Example #1
0
        private double GetPollingIntervalMilliseconds(double pollingInterval, PollingType pollType)
        {
            //Polling interval
            switch (pollType)
            {
            case PollingType.Milliseconds:
                return((double)TimeSpan.FromSeconds(pollingInterval).TotalMilliseconds);

            case PollingType.Seconds:
                return((double)TimeSpan.FromSeconds(pollingInterval).TotalMilliseconds);

            case PollingType.Minutes:
                return((double)TimeSpan.FromMinutes(pollingInterval).TotalMilliseconds);

            case PollingType.Hours:
                return((double)TimeSpan.FromHours(pollingInterval).TotalMilliseconds);

            case PollingType.Days:
                return((double)TimeSpan.FromDays(pollingInterval).TotalMilliseconds);

            case PollingType.Weeks:
                return((double)TimeSpan.FromDays(pollingInterval * 7).TotalMilliseconds);

            case PollingType.ExtendedFormat:
                //  set wait to MaxValue
                return((double)int.MaxValue);

            default:
                return(-1);
            }
        }
Example #2
0
 public Pooling(Shape kernel = null, Shape stride = null, PollingType type = PollingType.Max) : this(type)
 {
     if (kernel != null)
     {
         this.SetParam("kernel", kernel);
     }
     if (stride != null)
     {
         this.SetParam("stride", stride);
     }
 }
Example #3
0
        public Pooling(PollingType type = PollingType.Max) : base("Pooling")
        {
            _type = type;
            String typeStr = null;

            switch (_type)
            {
            case PollingType.Max:
            default:
                typeStr = "max";
                break;
            }
            this.SetParam("pool_type", typeStr);
        }
        /// <summary>
        /// Initializes a new instance of the FtpAdapterInboundHandler class
        /// </summary>
        public FtpAdapterInboundHandler(FtpAdapterConnection connection
            , MetadataLookup metadataLookup)
            : base(connection, metadataLookup)
        {
            connectionUri = connection.ConnectionFactory.ConnectionUri;
            filter = new Wildcard(connectionUri.FileName);

            pollingType = connection.ConnectionFactory.Adapter.PollingType;

            if (pollingType == PollingType.Simple)
            {
                pollingInterval = connection.ConnectionFactory.Adapter.PollingInterval;
                pollingTimer = new Timer(new TimerCallback(t => GetFiles()));
            }
            else
                scheduleName = connection.ConnectionFactory.Adapter.ScheduleName;
        }
        /// <summary>
        /// Initializes a new instance of the FileAdapterInboundHandler class
        /// </summary>
        public FileAdapterInboundHandler(FileAdapterConnection connection
            , MetadataLookup metadataLookup)
            : base(connection, metadataLookup)
        {
            connectionUri = connection.ConnectionFactory.ConnectionUri;

            pollingType = connection.ConnectionFactory.Adapter.PollingType;

            if (pollingType == PollingType.Event || pollingType == PollingType.Simple)
            {
                if (pollingType == PollingType.Event)
                {
                    watcher = new FileSystemWatcher(connectionUri.Path, connectionUri.FileName);
                    watcher.Changed += FileEvent;
                }

                pollingInterval = connection.ConnectionFactory.Adapter.PollingInterval;
                pollingTimer = new Timer(new TimerCallback(t => GetFiles()));
            }
            else
                scheduleName = connection.ConnectionFactory.Adapter.ScheduleName;
        }
        /// <summary>
        /// Initializes a new instance of the AdoNetAdapterInboundHandler class
        /// </summary>
        public AdoNetAdapterInboundHandler(AdoNetAdapterConnection connection
            , MetadataLookup metadataLookup)
            : base(connection, metadataLookup)
        {
            pollingType = connection.ConnectionFactory.Adapter.PollingType;

            if (pollingType == PollingType.Simple)
            {
                pollingInterval = connection.ConnectionFactory.Adapter.PollingInterval * 1000;

                pollingTimer = new Timer(new TimerCallback(t => ExecutePolling()));
            }
            else
            {
                scheduleName = connection.ConnectionFactory.Adapter.ScheduleName;
            }

            UriBuilder actionBuilder = new UriBuilder(AdoNetAdapter.SERVICENAMESPACE);
            actionBuilder.Path = System.IO.Path.Combine(actionBuilder.Path, connection.ConnectionFactory.ConnectionUri.ConnectionName);
            actionBuilder.Path = System.IO.Path.Combine(actionBuilder.Path, connection.ConnectionFactory.ConnectionUri.InboundID);

            action = actionBuilder.ToString() + "#Receive";
        }
        private double GetPollingIntervalMilliseconds( double pollingInterval, PollingType pollType )
        {
            //Polling interval
            switch( pollType )
            {
                case PollingType.Milliseconds:
                    return  (double)TimeSpan.FromSeconds( pollingInterval ).TotalMilliseconds;

                case PollingType.Seconds:
                    return  (double)TimeSpan.FromSeconds( pollingInterval ).TotalMilliseconds;

                case PollingType.Minutes:
                    return  (double)TimeSpan.FromMinutes( pollingInterval ).TotalMilliseconds;

                case PollingType.Hours:
                    return  (double)TimeSpan.FromHours( pollingInterval ).TotalMilliseconds;

                case PollingType.Days:
                    return  (double)TimeSpan.FromDays( pollingInterval ).TotalMilliseconds;

                case PollingType.Weeks:
                    return  (double)TimeSpan.FromDays( pollingInterval * 7 ).TotalMilliseconds;

                case PollingType.ExtendedFormat:
                    //  set wait to MaxValue
                    return  (double)int.MaxValue;
                default:
                    return -1;
            }
        }