static void Main(string[] args)
        {
            // Load configuration
            OPPFConfigXML.Configure();

            log = LogManager.GetLogger(@"OPPF.Integrations.ImageUploader");

            try
            {
                FileStream _lock = File.Open(LOCK_FILE_NAME, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);

                ImageUploader imageUploader = new ImageUploader();
                while (imageUploader.processImageInfos())
                {
                    // Nothing to do
                }
                ;

                _lock.Close();
                File.Delete(LOCK_FILE_NAME);
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
Example #2
0
        /// <summary>
        /// Connect to platedb and initialize the command that retrieves imaging tasks
        /// </summary>
        private void connectToDB()
        {
            // Get a new ODBC connection to platedb/pimsdb
            _dbConnection = new OdbcConnection(OPPFConfigXML.GetDbConnectionString());

            try
            {
                // Open the connection
                _dbConnection.Open();

                // Create a Command object
                _command             = _dbConnection.CreateCommand();
                _command.CommandText = OPPFConfigXML.GetDbQueryString();

                // Add barcode parameter
                _command.Parameters.Add("@p1", OdbcType.VarChar);

                int nparams = _command.CommandText.Length - _command.CommandText.Replace("?", "").Length;
                if (2 == nparams)
                {
                    // Add instrument parameter
                    _command.Parameters.Add("@p2", OdbcType.VarChar);
                }
            }
            catch (Exception e)
            {
                // Log it
                string msg = "connectToDB threw " + e.GetType() + ": " + e.Message;
                _log.Fatal(msg, e);

                // Really do want to rethrow - this is bad news
                throw;
            }
        }
Example #3
0
        public void GetDirectoryTest()
        {
            string expected = OPPFConfigXML_Accessor.DEFAULT_WEB_DIRECTORY;
            string actual;

            actual = OPPFConfigXML.GetWebDirectory();
            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void GetImageFormatTest()
        {
            string expected = OPPFConfigXML_Accessor.DEFAULT_IMAGE_FORMAT;
            string actual;

            actual = OPPFConfigXML.GetImageFormat();
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Zero-arg constructor. Initializes the logger and calls connectToDB().
        /// </summary>
        public DummyImagingTaskProvider()
        {
            // Load configuration
            OPPFConfigXML.Configure();

            // Get Logger.
            _log = LogManager.GetLogger(this.GetType());

            // Log the call to the constructor
            _log.Debug("Constructed a new " + this);
        }
Example #6
0
        /// <summary>
        /// Zero-arg constructor. Initializes the logger and calls connectToDB().
        /// </summary>
        public ImagingTaskProviderNew()
        {
            // Load configuration
            OPPFConfigXML.Configure();

            // Get Logger.
            _log = LogManager.GetLogger(this.GetType());
            //throw new Exception("Database name is " + OPPFConfigXML.GetDbConnectionString());
            // Log the call to the constructor
            _log.Debug("Constructed a new " + this);

            // Connect to DB
            //connectToDB();

            System.Net.ServicePointManager.Expect100Continue = false;
        }
Example #7
0
        /// <summary>
        /// Zero-arg constructor
        /// </summary>
        public PlateInfoProvider()
        {
            // Load configuration
            OPPFConfigXML.Configure();

            // Get Logger
            _log = LogManager.GetLogger(this.GetType());

            // PlateInfoCache
            // TODO: Allow configuration of initialSize and Capacity
            _plateInfoCache = new PlateInfoCache(1000, 1000);

            // Log the call to the constructor
            if (_log.IsDebugEnabled)
            {
                string msg = "Constructed a new " + this;
                _log.Debug(msg);
            }
        }
Example #8
0
 public DummyImageProcessor2Provider()
 {
     // Load configuration
     OPPFConfigXML.Configure();
     _pip = new DummyPlateInfoProvider();
 }
Example #9
0
 public ImageProcessor2ProviderNew()
 {
     // Load configuration
     OPPFConfigXML.Configure();
     _pip = new PlateInfoProviderNew();
 }
 /// <summary>
 /// Zero arg constructor. Reads the configuration file to obtain imageInfosDir.
 /// OPPFConfigXML.Configure() must already have been called.
 /// </summary>
 public ImageUploader()
 {
     // TODO Allow %robot% variable to be correctly interpreted
     this.imageInfosDir = OPPFConfigXML.GetXmlDirectory();
 }
 public ImageProcessorProvider()
 {
     // Load configuration
     OPPFConfigXML.Configure();
 }
Example #12
0
 public void ConfigureTest()
 {
     OPPFConfigXML.Configure();
 }