Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void invokePostDeploy(final org.camunda.bpm.application.ProcessApplicationInterface processApplication) throws ClassNotFoundException, org.jboss.msc.service.StartException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        protected internal virtual void invokePostDeploy(ProcessApplicationInterface processApplication)
        {
            Type paClass = getPaClass(postDeployDescription);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Method postDeployMethod = org.camunda.bpm.container.impl.deployment.util.InjectionUtil.detectAnnotatedMethod(paClass, org.camunda.bpm.application.PostDeploy.class);
            System.Reflection.MethodInfo postDeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, typeof(PostDeploy));

            if (postDeployMethod != null)
            {
                try
                {
                    processApplication.execute(new CallableAnonymousInnerClass(this, processApplication, postDeployMethod));
                }
                catch (Exception e)
                {
                    throw new StartException("Exception while invoking the @PostDeploy method ", e);
                }
            }
        }
Ejemplo n.º 2
0
        public static T executeWithinProcessApplication <T>(Callable <T> callback, ProcessApplicationReference processApplicationReference, InvocationContext invocationContext)
        {
            string paName = processApplicationReference.Name;

            try
            {
                ProcessApplicationInterface processApplication = processApplicationReference.ProcessApplication;
                CurrentProcessApplication = processApplicationReference;

                try
                {
                    // wrap callback
                    ProcessApplicationClassloaderInterceptor <T> wrappedCallback = new ProcessApplicationClassloaderInterceptor <T>(callback);
                    // execute wrapped callback
                    return(processApplication.execute(wrappedCallback, invocationContext));
                }
                catch (Exception e)
                {
                    // unwrap exception
                    if (e.InnerException != null && e.InnerException is Exception)
                    {
                        throw (Exception)e.InnerException;
                    }
                    else
                    {
                        throw new ProcessEngineException("Unexpected exeption while executing within process application ", e);
                    }
                }
                finally
                {
                    removeCurrentProcessApplication();
                }
            }
            catch (ProcessApplicationUnavailableException e)
            {
                throw new ProcessEngineException("Cannot switch to process application '" + paName + "' for execution: " + e.Message, e);
            }
        }