Exemple #1
0
        protected override int Execute()
        {
            InitExecutorMap();

            logger = GetLogger();
            Hashtable args = GetArguments();

            bool isOk = ValidParams(args);

            if (!isOk)
            {
                return(1);
            }

            string oprName = args["opr"].ToString();

            foreach (string pattern in executorMap.Keys)
            {
                Match match = Regex.Match(oprName, pattern);
                if (!match.Success)
                {
                    continue;
                }

                string fqdn = (string)executorMap[pattern];
                string json = "";

                Assembly           asm = Assembly.GetExecutingAssembly();
                IOperationExecutor obj = (IOperationExecutor)asm.CreateInstance(fqdn);
                obj.SetLogger(logger);

                if (fqdn.EndsWith("GetListExecutor"))
                {
                    json = obj.ExecuteGetListOperation(oprName, args);
                }
                else
                {
                    json = obj.ExecuteOperation(oprName, args);
                }

                Console.WriteLine(json);
            }

            return(0);
        }