Example #1
0
        private void Execute(RhinoEtlCommandLineOptions options)
        {
            RhinoEtlRunner.SetupLogging(options.Verbose);

            log.DebugFormat("Starting with {0}", options.File);
            try
            {
                string ext = Path.GetExtension(options.File).ToLower();
                Type   processType;
                if (ext == ".exe" || ext == ".dll")
                {
                    processType = GetFromAssembly(options);
                }
                else
                {
                    processType = GetFromDslFile(options.File);
                }

                ExecuteProcessInSeparateAppDomain(processType, options);
            }
            catch (Exception e)
            {
                log.Debug(e);
                log.Error(e.Message);
            }
        }
Example #2
0
        private void Execute(RhinoEtlCommandLineOptions options)
        {
            RhinoEtlRunner.SetupLogging(options.Verbose);

            log.DebugFormat("Starting with {0}", options.File);
            try
            {
                string ext = Path.GetExtension(options.File).ToLower();
                Type processType;
                if(ext==".exe" || ext==".dll")
                {
                    processType = GetFromAssembly(options);
                }
                else
                {
                    processType = GetFromDslFile(options.File);
                }

                ExecuteProcessInSeparateAppDomain(processType, options);
            }
            catch (Exception e)
            {
                log.Debug(e);
                log.Error(e.Message);
            }
        }
Example #3
0
 private static Type GetFromAssembly(RhinoEtlCommandLineOptions options)
 {
     FileInfo _assemblyInfo = new FileInfo(options.File);
     Assembly asm = Assembly.LoadFile(_assemblyInfo.FullName);
     //Assembly asm = Assembly.Load(options.File);
     foreach (Type type in asm.GetTypes())
     {
         if(typeof(EtlProcess).IsAssignableFrom(type) && type.Name.Equals(options.Process, StringComparison.InvariantCultureIgnoreCase))
             return type;
     }
     throw new InvalidOperationException("Could not find type nameed '" + options.Process + "' on: " +
                                         options.File);
 }
Example #4
0
        private static Type GetFromAssembly(RhinoEtlCommandLineOptions options)
        {
            FileInfo _assemblyInfo = new FileInfo(options.File);
            Assembly asm           = Assembly.LoadFile(_assemblyInfo.FullName);

            //Assembly asm = Assembly.Load(options.File);
            foreach (Type type in asm.GetTypes())
            {
                if (typeof(EtlProcess).IsAssignableFrom(type) && type.Name.Equals(options.Process, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(type);
                }
            }
            throw new InvalidOperationException("Could not find type nameed '" + options.Process + "' on: " +
                                                options.File);
        }
Example #5
0
 private static void Main(string[] args)
 {
     try
     {
         RhinoEtlCommandLineOptions options = new RhinoEtlCommandLineOptions();
         try
         {
             options.Parse(args);
         }
         catch (CommandLineException e)
         {
             Console.WriteLine(e.Message);
             options.PrintOptions();
             return;
         }
         new RhinoEtlSetup().Execute(options);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Example #6
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         appDomainSetup.ApplicationBase   = _assemblyInfo.DirectoryName;
         appDomainSetup.ConfigurationFile = options.File + ".config";
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof(RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof(RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }
Example #7
0
 private static void Main(string[] args)
 {
     try
     {
         RhinoEtlCommandLineOptions options = new RhinoEtlCommandLineOptions();
         try
         {
             options.Parse(args);
         }
         catch (CommandLineException e)
         {
             Console.WriteLine(e.Message);
             options.PrintOptions();
             return;
         }
         new RhinoEtlSetup().Execute(options);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Example #8
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         //setting this to the current executing directory because that's where the dsl's dll gets created.
         appDomainSetup.ApplicationBase   = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
         appDomainSetup.ConfigurationFile = string.IsNullOrEmpty(options.Configuration) ? options.File + ".config" : options.Configuration;
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof(RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof(RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }
Example #9
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         //setting this to the current executing directory because that's where the dsl's dll gets created.
         appDomainSetup.ApplicationBase = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
         appDomainSetup.ConfigurationFile = string.IsNullOrEmpty(options.Configuration) ? options.File + ".config" : options.Configuration;
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof (RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof (RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }
Example #10
0
 private void ExecuteProcessInSeparateAppDomain(Type processType, RhinoEtlCommandLineOptions options)
 {
     try
     {
         FileInfo _assemblyInfo = new FileInfo(options.File);
         //we have to run the code in another appdomain, because we want to
         //setup our own app.config for it
         AppDomainSetup appDomainSetup = new AppDomainSetup();
         appDomainSetup.ApplicationBase = _assemblyInfo.DirectoryName;
         appDomainSetup.ConfigurationFile = options.File + ".config";
         AppDomain appDomain = AppDomain.CreateDomain("etl.domain", null, appDomainSetup);
         appDomain.Load(processType.Assembly.GetName());
         RhinoEtlRunner runner = (RhinoEtlRunner)appDomain.CreateInstanceAndUnwrap(typeof (RhinoEtlRunner).Assembly.GetName().FullName,
                                                                                   typeof (RhinoEtlRunner).FullName);
         runner.Start(processType, options.Verbose);
     }
     catch (Exception e)
     {
         log.Debug(e);
         log.Error(e.Message);
     }
 }