Example #1
0
        protected internal virtual ProcessApplicationReference getPaReference(ProcessApplicationIdentifier processApplicationIdentifier)
        {
            if (processApplicationIdentifier.Reference != null)
            {
                return(processApplicationIdentifier.Reference);
            }
            else if (processApplicationIdentifier.ProcessApplication != null)
            {
                return(processApplicationIdentifier.ProcessApplication.Reference);
            }
            else if (!string.ReferenceEquals(processApplicationIdentifier.Name, null))
            {
                RuntimeContainerDelegate    runtimeContainerDelegate = org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get();
                ProcessApplicationReference reference = runtimeContainerDelegate.getDeployedProcessApplication(processApplicationIdentifier.Name);

                if (reference == null)
                {
                    throw LOG.paWithNameNotRegistered(processApplicationIdentifier.Name);
                }
                else
                {
                    return(reference);
                }
            }
            else
            {
                throw LOG.cannotReolvePa(processApplicationIdentifier);
            }
        }
Example #2
0
        /// <summary>
        /// Loads the given script engine by language name. Will throw an exception if no script engine can be loaded for the given language name.
        /// </summary>
        /// <param name="language"> the name of the script language to lookup an implementation for </param>
        /// <returns> the script engine </returns>
        /// <exception cref="ProcessEngineException"> if no such engine can be found. </exception>
        public virtual ScriptEngine getScriptEngineForLanguage(string language)
        {
            if (!string.ReferenceEquals(language, null))
            {
                language = language.ToLower();
            }

            ProcessApplicationReference    pa     = Context.CurrentProcessApplication;
            ProcessEngineConfigurationImpl config = Context.ProcessEngineConfiguration;

            ScriptEngine engine = null;

            if (config.EnableFetchScriptEngineFromProcessApplication)
            {
                if (pa != null)
                {
                    engine = getPaScriptEngine(language, pa);
                }
            }

            if (engine == null)
            {
                engine = getGlobalScriptEngine(language);
            }

            return(engine);
        }
Example #3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public <T> T execute(final Command<T> command)
        public override T execute <T>(Command <T> command)
        {
            ProcessApplicationIdentifier processApplicationIdentifier = ProcessApplicationContextImpl.get();

            if (processApplicationIdentifier != null)
            {
                // clear the identifier so this interceptor does not apply to nested commands
                ProcessApplicationContextImpl.clear();

                try
                {
                    ProcessApplicationReference reference = getPaReference(processApplicationIdentifier);
                    return(Context.executeWithinProcessApplication(new CallableAnonymousInnerClass(this, command)
                                                                   , reference));
                }
                finally
                {
                    // restore the identifier for subsequent commands
                    ProcessApplicationContextImpl.set(processApplicationIdentifier);
                }
            }
            else
            {
                return(next.execute(command));
            }
        }
Example #4
0
        public virtual void execute(BpmnStackTrace stackTrace)
        {
            if (operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CANCEL_SCOPE && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_INTERRUPT_SCOPE && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CONCURRENT && operation != org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.DELETE_CASCADE)
            {
                // execution might be replaced in the meantime:
                ExecutionEntity replacedBy = execution.ReplacedBy;
                if (replacedBy != null)
                {
                    execution = replacedBy;
                }
            }

            //execution was canceled for example via terminate end event
            if (execution.Canceled && (operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.TRANSITION_NOTIFY_LISTENER_END || operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_NOTIFY_LISTENER_END))
            {
                return;
            }

            // execution might have ended in the meanwhile
            if (execution.Ended && (operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.TRANSITION_NOTIFY_LISTENER_TAKE || operation == org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_START_CREATE_SCOPE))
            {
                return;
            }

            ProcessApplicationReference currentPa = Context.CurrentProcessApplication;

            if (currentPa != null)
            {
                applicationContextName = currentPa.Name;
            }
            activityId   = execution.ActivityId;
            activityName = execution.CurrentActivityName;
            stackTrace.add(this);

            try
            {
                Context.ExecutionContext = execution;
                if (!performAsync)
                {
                    LOG.debugExecutingAtomicOperation(operation, execution);
                    operation.execute(execution);
                }
                else
                {
                    execution.scheduleAtomicOperationAsync(this);
                }
            }
            finally
            {
                Context.removeExecutionContext();
            }
        }
Example #5
0
        public virtual string execute(CommandContext commandContext)
        {
            commandContext.AuthorizationManager.checkCamundaAdmin();

            ProcessApplicationReference reference = Context.ProcessEngineConfiguration.ProcessApplicationManager.getProcessApplicationForDeployment(deploymentId);

            if (reference != null)
            {
                return(reference.Name);
            }
            else
            {
                return(null);
            }
        }
Example #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void handleInvocation(final DelegateInvocation invocation) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        public virtual void handleInvocation(DelegateInvocation invocation)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.ProcessApplicationReference processApplication = getProcessApplicationForInvocation(invocation);
            ProcessApplicationReference processApplication = getProcessApplicationForInvocation(invocation);

            if (processApplication != null && ProcessApplicationContextUtil.requiresContextSwitch(processApplication))
            {
                Context.executeWithinProcessApplication(new CallableAnonymousInnerClass(this, invocation)
                                                        , processApplication, new InvocationContext(invocation.ContextExecution));
            }
            else
            {
                handleInvocationInContext(invocation);
            }
        }
Example #7
0
        protected internal virtual ScriptEngine getPaScriptEngine(string language, ProcessApplicationReference pa)
        {
            try
            {
                ProcessApplicationInterface processApplication = pa.ProcessApplication;
                ProcessApplicationInterface rawObject          = processApplication.RawObject;

                if (rawObject is AbstractProcessApplication)
                {
                    AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication)rawObject;
                    return(abstractProcessApplication.getScriptEngineForName(language, enableScriptEngineCaching));
                }
                return(null);
            }
            catch (ProcessApplicationUnavailableException e)
            {
                throw new ProcessEngineException("Process Application is unavailable.", e);
            }
        }
Example #8
0
 public DeleteDeploymentFailListener(string deploymentId, ProcessApplicationReference processApplicationReference, CommandExecutor commandExecutor)
 {
     this.deploymentId = deploymentId;
     this.processApplicationReference = processApplicationReference;
     this.commandExecutor             = commandExecutor;
 }
Example #9
0
 public NoViewProcessApplicationStartService(ProcessApplicationReference reference)
 {
     this.reference = reference;
 }
Example #10
0
 public MscManagedProcessApplication(ProcessApplicationInfo processApplicationInfo, ProcessApplicationReference processApplicationReference)
 {
     this.processApplicationInfo      = processApplicationInfo;
     this.processApplicationReference = processApplicationReference;
 }