示例#1
0
        public void LoadData()
        {
            try
            {
                ReadOperation <string> operation = IOFactory.GetReadTextOperation(_pathToSaveFile);
                operation.DoOperationSync();
                string result = operation.GetResult();
                _data = JsonUtility.FromJson <DataContainer>(result);

                for (int i = _data.data.Count - 1; i >= 0; i--)
                {
                    DataElement element = _data.data[i];
                    if (string.IsNullOrEmpty(element.guid) == false)
                    {
                        _cacheData.Add(element.guid, i);
                    }
                    else
                    {
                        _data.data.RemoveAt(i);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log("Error at LoadData : " + e.Message);
                throw;
            }
        }
示例#2
0
 private Rule CreateRuleWithResponseFile(string urlPath, string responseFileText)
 {
     IOFactory.SetAllText("response.txt", responseFileText);
     return(new Rule {
         RequestUrlPath = urlPath, ResponsePath = "response.txt"
     });
 }
示例#3
0
        public PluginContainer(
            IInternalPluginHost pluginHost,
            IORegistry ioRegistry,
            CompositionContainer parentContainer,
            Type pluginType,
            INodeInfo nodeInfo
            )
        {
            FIOFactory = new IOFactory(pluginHost, ioRegistry);

            var catalog            = new TypeCatalog(pluginType);
            var ioExportProvider   = new IOExportProvider(FIOFactory);
            var hostExportProvider = new HostExportProvider()
            {
                PluginHost = pluginHost
            };
            var exportProviders = new ExportProvider[] { hostExportProvider, ioExportProvider, parentContainer };

            FContainer = new CompositionContainer(catalog, exportProviders);
            FContainer.ComposeParts(this);
            FPlugin = PluginBase as IPluginEvaluate;

            FAutoEvaluate = nodeInfo.AutoEvaluate;
            FIOFactory.OnCreated(EventArgs.Empty);
        }
示例#4
0
        public string GenerateResponse()
        {
            var user_name = "processAutomaticUser";


            var file_result = _responseRepository.FindFile();

            if (file_result == null)
            {
                return("Process didn't find files.");
            }


            var response = _responseRepository.SaveResponse(user_name);


            var _fileReader = new IOFactory(file_result.Format.IOClassName);

            var read_file_list = (List <ResponseData>)_fileReader.ReadFlatFile(file_result.FileName);

            _responseRepository.SaveResponseData(read_file_list);


            var _xmlGenerator = new Infrastructure.Service.IbsXmlGenerator();

            _xmlGenerator.CreateFile(response);

            _responseRepository.UpdateResponse(_xmlGenerator.xmlFile);


            return("Ok");
        }
示例#5
0
            protected override IIOContainer <ISpread <ISpread <T> > > CreatePin <T>(string name)
            {
                var attr = new InputAttribute(name);

                attr.BinVisibility = PinVisibility.Hidden;
                attr.BinSize       = 1;
                attr.Order         = Count;
                attr.BinOrder      = Count + 1;
                return(IOFactory.CreateIOContainer <IDiffSpread <ISpread <T> > >(attr));
            }
示例#6
0
        protected override IIOContainer <ISpread <ISpread <T> > > CreatePin <T>(string name)
        {
            var attr = new InputAttribute(name)
            {
                BinVisibility = PinVisibility.Hidden,
                BinSize       = 1,
                Order         = Count,
                BinOrder      = Count + 1,
                AutoValidate  = false
            };

            return(IOFactory.CreateIOContainer <ISpread <ISpread <T> > >(attr));
        }
示例#7
0
        public Engine(List <Input> inputs)
        {
            IOFactory ioFactory = new IOFactory();

            foreach (Input i in inputs)
            {
                IInputProvider provider = ioFactory.BuildInputProvider(i);
                Inputs.Add(provider, i);
                Providers.Add(provider, ioFactory.BuildOutputProviders(i));

                provider.OnProcessingRequired += Provider_OnProcessingRequired;
            }
        }
示例#8
0
 public void SaveMetadata()
 {
     try
     {
         string content = JsonUtility.ToJson(_metadata, true);
         WriteOperation <string> operation = IOFactory.GetWriteTextOperation(_pathToMetadata, content);
         operation.DoOperationSync();
     }
     catch (Exception e)
     {
         Debug.Log("Error at SaveMetadata :" + e.Message);
         throw;
     }
 }
示例#9
0
        public void Application_Start(object sender, EventArgs e)
        {
            // 在应用程序启动时运行的代码
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            ValidatorRegister.RegisterAdapter();
            CacheProvider.Register(new HttpCache());
            string rootPath = Server.MapPath("~/");

            IOFactory.Register(new LocalStoreFile(rootPath), new LocalFolder(rootPath));
            ConfigSerializer.Register(new ConfigSerializer(rootPath));
        }
示例#10
0
        protected override void OnStop()
        {
            try
            {
                ip = getIP();
                string            m_ServiceName = "JBAS50SVC";
                ServiceController service       = new ServiceController(m_ServiceName);

                GlobalProperty.Filename = System.AppDomain.CurrentDomain.BaseDirectory + "\\setting.ini";
                IOFactory factory        = new IOFactory();
                string    DBstr_LandBank = getEncodedProperty("DBstr", "LandBank");
                string    DBstr_IntraAP  = getEncodedProperty("DBstr", "IntraAP");

                AbstractEngine LandBank = factory.getEngine("SQL", DBstr_LandBank);
                AbstractEngine IntraAP  = factory.getEngine("SQL", DBstr_IntraAP);

                // 設定一個 Timeout 時間,若超過 60 秒啟動不成功就宣告失敗!
                TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 60);

                // 若該服務不是「停用」的狀態,才將其停止運作,否則會引發 Exception
                if (service.Status != ServiceControllerStatus.Stopped &&
                    service.Status != ServiceControllerStatus.StopPending)
                {
                    service.Stop();
                    service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                }

                //string msg = "";
                //if (checkNaNaWeb() == true)
                //{
                //    string subject = ip + "工作流程系統JBoss服務停止失敗";
                //    msg = ip + "<Font color=\"#FF0000\">工作流程系統JBoss服務停止失敗</Font>";
                //    processNotice(LandBank, IntraAP, "2", subject, msg);
                //}
                //else
                //{
                //    msg = ip + "工作流程系統JBoss服務已停止";
                //    processNotice(LandBank, IntraAP, "1", msg, msg);
                //}
            }
            catch (Exception ex)
            {
                // 如果無法停用服務會引發 Exception,也會讓反安裝自動中斷
                //throw new exception("服務無法停用,建議您可以先利用「工作管理員」將 INService.exe 程序結束,再進行解除安裝。");
                //com.dsc.kernal.utility.Utility.writeFileLog("C:\\", ex.TargetSite + "服務無法停用,建議您可以先利用「工作管理員」將 JBossService.exe 程序結束,再進行解除安裝。");
                log(ex.ToString());
                throw ex;
            }
        }
示例#11
0
        public void LoadMetadata()
        {
            try
            {
                ReadOperation <string> operation = IOFactory.GetReadTextOperation(_pathToMetadata);
                operation.DoOperationSync();
                string result = operation.GetResult();
                _metadata = JsonUtility.FromJson <MetadataContainer>(result);

                for (int i = 0; i < _metadata.metadata.Count; i++)
                {
                    MetadataElement element = _metadata.metadata[i];
                    _cacheMetadata.Add(element.key, i);
                }
            }
            catch (Exception e)
            {
                Debug.Log("Error at LoadMetadata : " + e.Message);
                throw;
            }
        }
示例#12
0
        protected override void OnStart(string[] args)
        {
            try
            {
                //System.Threading.Thread.Sleep(20000);
                ip = getIP();
                string            m_ServiceName = "JBossService";
                ServiceController service       = new ServiceController(m_ServiceName);

                GlobalProperty.Filename = System.AppDomain.CurrentDomain.BaseDirectory + "\\setting.ini";
                IOFactory factory        = new IOFactory();
                string    DBstr_LandBank = getEncodedProperty("DBstr", "LandBank");
                string    DBstr_IntraAP  = getEncodedProperty("DBstr", "IntraAP");

                AbstractEngine LandBank = factory.getEngine("SQL", DBstr_LandBank);
                //string sql = "update BatchLog set status = 1,starttime = getdate(),endtime = null where progname = 'JBossService'";
                //LandBank.executeSQL(sql);
                //com.dsc.kernal.utility.Utility.writeFileLog("C:\\", "finish SQL");

                TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 300);


                m_ServiceName = "JBAS50SVC";
                service       = new ServiceController(m_ServiceName);

                // 檢查相依性
                ServiceController www = new ServiceController("W3SVC");
                www.WaitForStatus(ServiceControllerStatus.Running, timeout);

                ServiceController[] depends = service.ServicesDependedOn;
                for (int i = 0; i < depends.Length; i++)
                {
                    //log(depends[i].ServiceName);
                    while (depends[i].Status.Equals(ServiceControllerStatus.Running) == false)
                    {
                        //log("wait");
                        System.Threading.Thread.Sleep(10000);
                    }
                }

                if (!service.Status.Equals(ServiceControllerStatus.Running))
                {
                    service.Start();
                    service.WaitForStatus(ServiceControllerStatus.Running, timeout);

                    // 可能前一次關閉時有問題,造成第一次啟動失敗,再一次關閉後再啟動
                    service.Stop();
                    service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                    service.Start();
                    service.WaitForStatus(ServiceControllerStatus.Running, timeout);
                }

                AbstractEngine IntraAP = factory.getEngine("SQL", DBstr_IntraAP);

                if (checkNaNaWeb() == false)
                {
                    string subject = ip + "工作流程系統流程引擎JBoss服務執行失敗";
                    string msg     = ip + "<Font color=\"#FF0000\">工作流程系統流程引擎JBoss服務執行失敗</Font>";
                    processNotice(LandBank, IntraAP, "1", subject, msg);
                }
                else
                {
                    string msg = ip + "工作流程系統流程引擎JBoss服務執行成功";
                    processNotice(LandBank, IntraAP, "2", msg, msg);
                }
                LandBank.close();
            }
            catch (Exception ex)
            {
                //com.dsc.kernal.utility.Utility.writeFileLog("C:\\", ex.TargetSite + "服務無法啟動,請檢查相關設定!");
                log(ex.ToString());
                throw ex;
            }
        }