Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void startInternal(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException
        public virtual void startInternal(StartContext context)
        {
            // setting the TCCL to the Classloader of this module.
            // this exploits a hack in MyBatis allowing it to use the TCCL to load the
            // mapping files from the process engine module
            Tccl.runUnderClassloader(new OperationAnonymousInnerClass(this)
                                     , typeof(ProcessEngine).ClassLoader);

            // invoke super start behavior.
            base.start(context);
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void performDeployment() throws org.jboss.msc.service.StartException
        protected internal virtual void performDeployment()
        {
            ManagedReference reference = null;

            try
            {
                // get process engine
                ProcessEngine processEngine = processEngineInjector.Value;

                // get the process application component
                ProcessApplicationInterface processApplication = null;
                ComponentView componentView = paComponentViewInjector.OptionalValue;
                if (componentView != null)
                {
                    reference          = componentView.createInstance();
                    processApplication = (ProcessApplicationInterface)reference.Instance;
                }
                else
                {
                    processApplication = noViewProcessApplication.Value;
                }

                // get the application name
                string processApplicationName = processApplication.Name;

                // build the deployment
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.RepositoryService repositoryService = processEngine.getRepositoryService();
                RepositoryService repositoryService = processEngine.RepositoryService;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.repository.ProcessApplicationDeploymentBuilder deploymentBuilder = repositoryService.createDeployment(processApplication.getReference());
                ProcessApplicationDeploymentBuilder deploymentBuilder = repositoryService.createDeployment(processApplication.Reference);

                // enable duplicate filtering
                deploymentBuilder.enableDuplicateFiltering(PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_DEPLOY_CHANGED_ONLY, false));

                // enable resuming of previous versions:
                if (PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_RESUME_PREVIOUS_VERSIONS, true))
                {
                    enableResumingOfPreviousVersions(deploymentBuilder);
                }

                // set the name for the deployment
                string deploymentName = processArchive.Name;
                if (string.ReferenceEquals(deploymentName, null) || deploymentName.Length == 0)
                {
                    deploymentName = processApplicationName;
                }
                deploymentBuilder.name(deploymentName);

                // set the tenant id for the deployment
                string tenantId = processArchive.TenantId;
                if (!string.ReferenceEquals(tenantId, null) && tenantId.Length > 0)
                {
                    deploymentBuilder.tenantId(tenantId);
                }

                // add deployment resources
                foreach (KeyValuePair <string, sbyte[]> resource in deploymentMap.SetOfKeyValuePairs())
                {
                    deploymentBuilder.addInputStream(resource.Key, new MemoryStream(resource.Value));
                }

                // let the process application component add resources to the deployment.
                processApplication.createDeployment(processArchive.Name, deploymentBuilder);

                ICollection <string> resourceNames = deploymentBuilder.ResourceNames;
                if (resourceNames.Count > 0)
                {
                    logDeploymentSummary(resourceNames, deploymentName, processApplicationName);
                    // perform the actual deployment
                    deployment = Tccl.runUnderClassloader(new OperationAnonymousInnerClass(this, deploymentBuilder)
                                                          , module.ClassLoader);
                }
                else
                {
                    LOGGER.info("Not creating a deployment for process archive '" + processArchive.Name + "': no resources provided.");
                }
            }
            catch (Exception e)
            {
                throw new StartException("Could not register process application with shared process engine ", e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }