Esempio n. 1
0
        private IProcessEngineInfo InitProcessEngineFromResource()
        {
            IProcessEngineInfo processEngineInfo = null;
            string             processEngineName = null;

            try
            {
                log.LogInformation("initializing process engine");
                IProcessEngine processEngine = BuildProcessEngine();
                processEngineName = processEngine.Name;
                log.LogInformation($"initialised process engine {processEngineName}");
                processEngineInfo = new ProcessEngineInfoImpl(processEngineName, null);
                processEngines.AddOrUpdate(processEngineName, processEngine, (name, engine) => engine);
                processEngineInfosByName[processEngineName] = processEngineInfo;
            }
            catch (Exception e)
            {
                log.LogError(e, $"Exception while initializing process engine: {e.Message}");
                processEngineInfo = new ProcessEngineInfoImpl(null, GetExceptionString(e));
                throw e;
            }

            processEngineInfos.Add(processEngineInfo);

            return(processEngineInfo);
        }
        public override JToken ToJsonObject(IProcessEngineInfo processEngineInfo)
        {
            ProcessEngineInfoImpl processEngineInfoImpl = (ProcessEngineInfoImpl)processEngineInfo;
            JToken jsonObject = JToken.FromObject(new
            {
                name        = processEngineInfoImpl.Name,
                resourceUrl = processEngineInfoImpl.ResourceUrl,
                exception   = processEngineInfoImpl.Exception
            });

            return(jsonObject);
        }
Esempio n. 3
0
        protected internal static void initProcessEngineFromSpringResource(URL resource)
        {
            try
            {
                Type springConfigurationHelperClass = ReflectUtil.loadClass("org.camunda.bpm.engine.test.spring.SpringConfigurationHelper");
                System.Reflection.MethodInfo method = springConfigurationHelperClass.GetMethod("buildProcessEngine", new Type[] { typeof(URL) });
                ProcessEngine processEngine         = (ProcessEngine)method.invoke(null, new object[] { resource });

                string            processEngineName = processEngine.Name;
                ProcessEngineInfo processEngineInfo = new ProcessEngineInfoImpl(processEngineName, resource.ToString(), null);
                processEngineInfosByName[processEngineName]          = processEngineInfo;
                processEngineInfosByResourceUrl[resource.ToString()] = processEngineInfo;
            }
            catch (Exception e)
            {
                throw new ProcessEngineException("couldn't initialize process engine from spring configuration resource " + resource.ToString() + ": " + e.Message, e);
            }
        }
Esempio n. 4
0
        private static IProcessEngineInfo InitProcessEngineFromResource(Uri resourceUrl)
        {
            var processEngineInfo = ProcessEngineInfosByResourceUrl[resourceUrl.LocalPath];

            // if there is an existing process engine info
            if (processEngineInfo != null)
            {
                // remove that process engine from the member fields
                processEngineInfos.Remove(processEngineInfo);
                if (ReferenceEquals(processEngineInfo.Exception, null))
                {
                    var processEngineName = processEngineInfo.Name;
                    processEngines.Remove(processEngineName);
                    ProcessEngineInfosByName.Remove(processEngineName);
                }
                ProcessEngineInfosByResourceUrl.Remove(processEngineInfo.ResourceUrl);
            }

            var resourceUrlString = resourceUrl.ToString();

            try
            {
                Log.InitializingProcessEngineForResource(resourceUrl);
                var processEngine     = BuildProcessEngine(resourceUrl);
                var processEngineName = processEngine.Name;
                Log.InitializingProcessEngine(processEngine.Name);
                processEngineInfo = new ProcessEngineInfoImpl(processEngineName, resourceUrlString, null);
                processEngines[processEngineName]           = processEngine;
                ProcessEngineInfosByName[processEngineName] = processEngineInfo;
            }
            catch (System.Exception e)
            {
                Log.ExceptionWhileInitializingProcessengine(e);
                processEngineInfo = new ProcessEngineInfoImpl(null, resourceUrlString, GetExceptionString(e));
            }
            ProcessEngineInfosByResourceUrl[resourceUrlString] = processEngineInfo;
            processEngineInfos.Add(processEngineInfo);
            return(processEngineInfo);
        }
Esempio n. 5
0
        private static ProcessEngineInfo initProcessEngineFromResource(URL resourceUrl)
        {
            ProcessEngineInfo processEngineInfo = processEngineInfosByResourceUrl[resourceUrl];

            // if there is an existing process engine info
            if (processEngineInfo != null)
            {
                // remove that process engine from the member fields
                processEngineInfos.Remove(processEngineInfo);
                if (string.ReferenceEquals(processEngineInfo.Exception, null))
                {
                    string processEngineName = processEngineInfo.Name;
                    processEngines.Remove(processEngineName);
                    processEngineInfosByName.Remove(processEngineName);
                }
                processEngineInfosByResourceUrl.Remove(processEngineInfo.ResourceUrl);
            }

            string resourceUrlString = resourceUrl.ToString();

            try
            {
                LOG.initializingProcessEngineForResource(resourceUrl);
                ProcessEngine processEngine     = buildProcessEngine(resourceUrl);
                string        processEngineName = processEngine.Name;
                LOG.initializingProcessEngine(processEngine.Name);
                processEngineInfo = new ProcessEngineInfoImpl(processEngineName, resourceUrlString, null);
                processEngines[processEngineName]           = processEngine;
                processEngineInfosByName[processEngineName] = processEngineInfo;
            }
            catch (Exception e)
            {
                LOG.exceptionWhileInitializingProcessengine(e);
                processEngineInfo = new ProcessEngineInfoImpl(null, resourceUrlString, getExceptionString(e));
            }
            processEngineInfosByResourceUrl[resourceUrlString] = processEngineInfo;
            processEngineInfos.Add(processEngineInfo);
            return(processEngineInfo);
        }