コード例 #1
0
        protected internal virtual ProcessEngine getProcessEngine(string name)
        {
            ServiceLoader <ProcessEngineProvider> serviceLoader = ServiceLoader.load(typeof(ProcessEngineProvider));
            IEnumerator <ProcessEngineProvider>   iterator      = serviceLoader.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (iterator.hasNext())
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                ProcessEngineProvider provider = iterator.next();
                return(provider.getProcessEngine(name));
            }
            else
            {
                throw new ProcessEngineException("No provider found");
            }
        }
コード例 #2
0
        /// <summary>
        /// Look up the process engine from the <seealso cref="ProcessEngineProvider"/>. If engineName is null, the default engine is returned. </summary>
        /// <param name="engineName">
        /// @return </param>
        public static ProcessEngine lookupProcessEngine(string engineName)
        {
            ServiceLoader <ProcessEngineProvider> serviceLoader = ServiceLoader.load(typeof(ProcessEngineProvider));
            IEnumerator <ProcessEngineProvider>   iterator      = serviceLoader.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (iterator.hasNext())
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                ProcessEngineProvider provider = iterator.next();
                if (string.ReferenceEquals(engineName, null))
                {
                    return(provider.DefaultProcessEngine);
                }
                else
                {
                    return(provider.getProcessEngine(engineName));
                }
            }
            else
            {
                throw new RestException(Status.INTERNAL_SERVER_ERROR, "Could not find an implementation of the " + typeof(ProcessEngineProvider) + "- SPI");
            }
        }