コード例 #1
0
        /// <summary>
        /// Returns the configuration read from the xml file: "Alchemi.Manager.config.xml"
        /// </summary>
        /// <param name="aRole">For what alchemi node is the EndPointConfiguration beeing used.</param>
        /// <param name="configFileName">What is the name of the config file.</param>
        /// <returns>Configuration object</returns>
        public static EndPointConfiguration GetConfiguration(AlchemiRole aRole, string configFileName)
        {
            string configFile          = Utils.GetFilePath(configFileName, aRole, true);
            EndPointConfiguration temp = DeSlz(configFile);

            temp.ConfigFileName = configFileName;
            temp.ConfigFile     = configFile;
            return(temp);
        }
コード例 #2
0
        /// <summary>
        /// Deserialises and reads the configuration from the given xml file
        ///
        /// Updates:
        /// Jan 18, 2006 - [email protected]
        ///		Saved the file used to load into ConfigFile so serializing puts the file back to the original location.
        /// </summary>
        /// <param name="file">Name of the config file</param>
        /// <returns>Configuration object</returns>
        private static EndPointConfiguration DeSlz(string file)
        {
            XmlSerializer         xs   = new XmlSerializer(typeof(EndPointConfiguration));
            FileStream            fs   = new FileStream(file, FileMode.Open);
            EndPointConfiguration temp = (EndPointConfiguration)xs.Deserialize(fs);

            fs.Close();

            temp.ConfigFile = file;

            return(temp);
        }
コード例 #3
0
 /// <summary>
 /// Write settings from this control to EndPointConfiguration instance.
 /// </summary>
 /// <param name="epConf">EndPointConfiguration instance to set.</param>
 public void WriteEndPointConfiguration(EndPointConfiguration epConf)
 {
     epConf.Host                     = this.Host;
     epConf.Port                     = this.Port;
     epConf.LocalAddressPart         = this.AddressPart;
     epConf.Protocol                 = this.Protocol;
     epConf.RemotingMechanism        = this.SelectedRemotingMechanism;
     epConf.Binding                  = this.WCFBinding;
     epConf.BindingSettingType       = this.BindingSettingType;
     epConf.BindingConfigurationName = this.BindingConfigurationName;
     epConf.ServiceConfigurationName = this.ServiceConfigurationName;
     epConf.HostNameForPublishing    = this.HostNameForPublishing;
 }
コード例 #4
0
 /// <summary>
 /// Set the values of this control acording to the EndPointConfiguration instance.
 /// </summary>
 /// <param name="epConf">EndPointConfiguration instance to read from.</param>
 public void ReadEndPointConfiguration(EndPointConfiguration epConf)
 {
     if (epConf == null)
     {
         epConf = new EndPointConfiguration();
     }
     this.Host        = epConf.Host;
     this.Port        = epConf.Port;
     this.AddressPart = epConf.LocalAddressPart;
     this.SelectedRemotingMechanism = epConf.RemotingMechanism;
     this.Protocol                 = epConf.Protocol;
     this.WCFBinding               = epConf.Binding;
     this.BindingSettingType       = epConf.BindingSettingType;
     this.BindingConfigurationName = epConf.BindingConfigurationName;
     this.ServiceConfigurationName = epConf.ServiceConfigurationName;
     this.HostNameForPublishing    = epConf.HostNameForPublishing;
 }
コード例 #5
0
        public void StartTcpBinary(EndPointConfiguration epc)
        {
            EndPoint ownEP = new EndPoint(epc.Port, RemotingMechanism.TcpBinary);

            logger.Debug("Configuring remoting...");

            RemotingConfiguration.Configure(
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RemotingConfigFile), false);

            //TODO: for hierarchical grids
            //				RemoteEndPoint managerEP = null;
            //				if (Config.Intermediate)
            //				{
            //					managerEP = new RemoteEndPoint(
            //						Config.ManagerHost,
            //						Config.ManagerPort,
            //						RemotingMechanism.TcpBinary
            //						);
            //				}

            logger.Debug("Registering tcp channel on port: " + ownEP.Port);

            _Chnl = new TcpChannel(epc.Port);
            ChannelServices.RegisterChannel(_Chnl, false);

            //since this is a single call thing, thread safety isnt an issue

            logger.Debug("Registering well known service type");

            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(GManager), "Alchemi_Node",
                WellKnownObjectMode.SingleCall);

            // TODO: hierarchical grids ignored until after v1.0.0
            /*
            _Dedicated = dedicated;
            _Id = id;

            if (Manager != null)
            {
                if (_Id == "")
                {
                    Log("Registering new executor ...");
                    _Id = Manager.Executor_RegisterNewExecutor(null, new ExecutorInfo);
                    Log("New ExecutorID = " + _Id);
                }

                try
                {
                    try
                    {
                        ConnectToManager();
                    }
                    catch (InvalidExecutorException)
                    {
                        Log("Invalid executor! Registering new executor ...");
                        _Id = Manager.Executor_RegisterNewExecutor(null, new ExecutorInfo);
                        Log("New ExecutorID = " + _Id);
                        ConnectToManager();
                    }
                }
                catch (ConnectBackException)
                {
                    Log("Couldn't connect as dedicated executor. Reverting to non-dedicated executor.");
                    _Dedicated = false;
                    ConnectToManager();
                }
            }
            */
        }