Exemplo n.º 1
0
        //allows adding or modifying a destination for a specific application server
        public void AddOrEditDestination(ConnectionInformations ci)
        {
            //in productive code the given parameters should be checked for validity, e.g. that name is not null
            //as this is not relevant for the example, we omit it here
            RfcConfigParameters par = new RfcConfigParameters();

            par.Add(RfcConfigParameters.Name, ci.Name);
            par.Add(RfcConfigParameters.AppServerHost, ci.AppServerHost);
            par.Add(RfcConfigParameters.SystemNumber, ci.SystemNumber);
            par.Add(RfcConfigParameters.SystemID, ci.SystemID);
            par.Add(RfcConfigParameters.User, ci.User);
            par.Add(RfcConfigParameters.Password, ci.Password);
            par.Add(RfcConfigParameters.Client, ci.Client);
            par.Add(RfcConfigParameters.Language, ci.Language);
            par.Add(RfcConfigParameters.PoolSize, ci.PoolSize);
            par.Add(RfcConfigParameters.MaxPoolSize, ci.MaxPoolSize);
            par.Add(RfcConfigParameters.IdleTimeout, ci.IdleTimeout);
            par.Add(RfcConfigParameters.SAPRouter, ci.SAPRouter);
            RfcConfigParameters existingConfiguration;

            //if a destination of that name existed before, we need to fire a change event
            if (availableDestinations.TryGetValue(ci.Name, out existingConfiguration))
            {
                availableDestinations[ci.Name] = par;
                RfcConfigurationEventArgs eventArgs = new RfcConfigurationEventArgs(RfcConfigParameters.EventType.CHANGED, par);
                if (changeHandler != null)
                {
                    changeHandler(ci.Name, eventArgs);
                }
            }
            else
            {
                availableDestinations[ci.Name] = par;
            }
        }
Exemplo n.º 2
0
        public static void Init(ConnectionInformations ci)
        {
            RfcDestination dest = null;

            try
            {
                dest = RfcDestinationManager.GetDestination(ci.Name);
            }
            catch { }
            if (dest == null)
            {
                connectionInfo.AddOrEditDestination(ci);
                dest = RfcDestinationManager.GetDestination(ci.Name);
            }
            dest.Ping();
        }
Exemplo n.º 3
0
        public static ConnectionInformations ReadFromAppConfig()
        {
            ConnectionInformations ci = new ConnectionInformations();

            ci.Name          = ConfigurationManager.AppSettings["Name"];
            ci.AppServerHost = ConfigurationManager.AppSettings["AppServerHost"];
            ci.SystemNumber  = ConfigurationManager.AppSettings["SystemNumber"];
            ci.SystemID      = ConfigurationManager.AppSettings["SystemID"];
            ci.User          = ConfigurationManager.AppSettings["User"];
            ci.Password      = ConfigurationManager.AppSettings["Password"];
            ci.Client        = ConfigurationManager.AppSettings["Client"];
            ci.Language      = ConfigurationManager.AppSettings["Language"];
            ci.PoolSize      = ConfigurationManager.AppSettings["PoolSize"];
            ci.MaxPoolSize   = ConfigurationManager.AppSettings["MaxPoolSize"];
            ci.IdleTimeout   = ConfigurationManager.AppSettings["IdleTimeout"];
            ci.SAPRouter     = ConfigurationManager.AppSettings["SAPRouter"];
            return(ci);
        }