Пример #1
0
	  public override void performOperationStep(DeploymentOperation operationContext)
	  {

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
		AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<java.net.URL, org.camunda.bpm.application.impl.metadata.spi.ProcessesXml> processesXmls = operationContext.getAttachment(PROCESSES_XML_RESOURCES);
		IDictionary<URL, ProcessesXml> processesXmls = operationContext.getAttachment(PROCESSES_XML_RESOURCES);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<String, org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive> processArchiveDeploymentMap = operationContext.getAttachment(PROCESS_ARCHIVE_DEPLOYMENT_MAP);
		IDictionary<string, DeployedProcessArchive> processArchiveDeploymentMap = operationContext.getAttachment(PROCESS_ARCHIVE_DEPLOYMENT_MAP);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
		PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;

		ProcessApplicationInfoImpl processApplicationInfo = createProcessApplicationInfo(processApplication, processArchiveDeploymentMap);

		// create service
		JmxManagedProcessApplication mbean = new JmxManagedProcessApplication(processApplicationInfo, processApplication.Reference);
		mbean.ProcessesXmls = new List<ProcessesXml>(processesXmls.Values);
		mbean.DeploymentMap = processArchiveDeploymentMap;

		// start service
		serviceContainer.startService(ServiceTypes.PROCESS_APPLICATION, processApplication.Name, mbean);

		notifyBpmPlatformPlugins(serviceContainer, processApplication);
	  }
Пример #2
0
        public override void cancelOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);

            ProcessEngine processEngine = getProcessEngine(serviceContainer, processApplication.DefaultDeployToEngineName);

            // if a registration was performed, remove it.
            if (deployment != null && deployment.ProcessApplicationRegistration != null)
            {
                processEngine.ManagementService.unregisterProcessApplication(deployment.ProcessApplicationRegistration.DeploymentIds, true);
            }

            // delete deployment if we were able to create one AND if
            // isDeleteUponUndeploy is set.
            if (deployment != null && PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_DELETE_UPON_UNDEPLOY, false))
            {
                if (processEngine != null)
                {
                    processEngine.RepositoryService.deleteDeployment(deployment.Id, true);
                }
            }
        }
Пример #3
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(org.camunda.bpm.container.impl.spi.ServiceTypes.PROCESS_APPLICATION, processApplication.getName());
            JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.Name);

            ensureNotNull("Cannot find process application with name " + processApplication.Name, "deployedProcessApplication", deployedProcessApplication);

            IDictionary <string, DeployedProcessArchive> deploymentMap = deployedProcessApplication.ProcessArchiveDeploymentMap;

            if (deploymentMap != null)
            {
                IList <ProcessesXml> processesXmls = deployedProcessApplication.ProcessesXmls;
                foreach (ProcessesXml processesXml in processesXmls)
                {
                    foreach (ProcessArchiveXml parsedProcessArchive in processesXml.ProcessArchives)
                    {
                        DeployedProcessArchive deployedProcessArchive = deploymentMap[parsedProcessArchive.Name];
                        if (deployedProcessArchive != null)
                        {
                            operationContext.addStep(new UndeployProcessArchiveStep(deployedProcessApplication, parsedProcessArchive, deployedProcessArchive.ProcessEngineName));
                        }
                    }
                }
            }
        }
Пример #4
0
        private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext)
        {
            BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);
            JobExecutorXml jobExecutorXml = bpmPlatformXml.JobExecutor;

            return(jobExecutorXml);
        }
Пример #5
0
        protected internal override IList <ProcessEngineXml> getProcessEnginesXmls(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(BPM_PLATFORM_XML);
            BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(BPM_PLATFORM_XML);

            return(bpmPlatformXml.ProcessEngines);
        }
Пример #6
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);

            IDictionary <URL, ProcessesXml> parsedFiles = parseProcessesXmlFiles(processApplication);

            // attach parsed metadata
            operationContext.addAttachment(PROCESSES_XML_RESOURCES, parsedFiles);
        }
Пример #7
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
            BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);

            checkConfiguration(bpmPlatformXml.JobExecutor);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;

            serviceContainer.startService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_EXECUTOR, new JcaExecutorServiceDelegate(executorService));
        }
Пример #8
0
        public static ProcessApplicationInfo getProcessApplicationInfo(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(org.camunda.bpm.container.impl.deployment.Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);

            JmxManagedProcessApplication managedPa = serviceContainer.getServiceValue(ServiceTypes.PROCESS_APPLICATION, processApplication.Name);

            return(managedPa.ProcessApplicationInfo);
        }
Пример #9
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String paName = processApplication.getName();
            string paName = processApplication.Name;

            Type paClass = processApplication.GetType();

            System.Reflection.MethodInfo preUndeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, typeof(PreUndeploy));

            if (preUndeployMethod == null)
            {
                LOG.debugPaLifecycleMethodNotFound(CALLBACK_NAME, paName);
                return;
            }

            LOG.debugFoundPaLifecycleCallbackMethod(CALLBACK_NAME, paName);

            // resolve injections
            object[] injections = InjectionUtil.resolveInjections(operationContext, preUndeployMethod);

            try
            {
                // perform the actual invocation
                preUndeployMethod.invoke(processApplication, injections);
            }
            catch (System.ArgumentException e)
            {
                throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
            }
            catch (IllegalAccessException e)
            {
                throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
            }
            catch (InvocationTargetException e)
            {
                Exception cause = e.InnerException;
                if (cause is Exception)
                {
                    throw (Exception)cause;
                }
                else
                {
                    throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
                }
            }
        }
Пример #10
0
        protected internal override IList <ProcessEngineXml> getProcessEnginesXmls(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<java.net.URL, org.camunda.bpm.application.impl.metadata.spi.ProcessesXml> processesXmls = operationContext.getAttachment(PROCESSES_XML_RESOURCES);
            IDictionary <URL, ProcessesXml> processesXmls = operationContext.getAttachment(PROCESSES_XML_RESOURCES);

            IList <ProcessEngineXml> processEngines = new List <ProcessEngineXml>();

            foreach (ProcessesXml processesXml in processesXmls.Values)
            {
                ((IList <ProcessEngineXml>)processEngines).AddRange(processesXml.ProcessEngines);
            }

            return(processEngines);
        }
Пример #11
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);

            ClassLoader configurationClassloader = null;

            if (processApplication != null)
            {
                configurationClassloader = processApplication.ProcessApplicationClassloader;
            }
            else
            {
                configurationClassloader = typeof(ProcessEngineConfiguration).ClassLoader;
            }

            string configurationClassName = jobAcquisitionXml.JobExecutorClassName;

            if (string.ReferenceEquals(configurationClassName, null) || configurationClassName.Length == 0)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                configurationClassName = typeof(RuntimeContainerJobExecutor).FullName;
            }

            // create & instantiate the job executor class
            Type        jobExecutorClass = loadJobExecutorClass(configurationClassloader, configurationClassName);
            JobExecutor jobExecutor      = instantiateJobExecutor(jobExecutorClass);

            // apply properties
            IDictionary <string, string> properties = jobAcquisitionXml.Properties;

            PropertyHelper.applyProperties(jobExecutor, properties);

            // construct service for job executor
            JmxManagedJobExecutor jmxManagedJobExecutor = new JmxManagedJobExecutor(jobExecutor);

            // deploy the job executor service into the container
            serviceContainer.startService(ServiceTypes.JOB_EXECUTOR, jobAcquisitionXml.Name, jmxManagedJobExecutor);
        }
Пример #12
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(org.camunda.bpm.container.impl.spi.ServiceTypes.PROCESS_APPLICATION, processApplication.getName());
            JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.Name);

            ensureNotNull("Cannot find process application with name " + processApplication.Name, "deployedProcessApplication", deployedProcessApplication);

            IList <ProcessesXml> processesXmls = deployedProcessApplication.ProcessesXmls;

            foreach (ProcessesXml processesXml in processesXmls)
            {
                stopProcessEngines(processesXml.ProcessEngines, operationContext);
            }
        }
Пример #13
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);

            ClassLoader classLoader = null;

            if (processApplication != null)
            {
                classLoader = processApplication.ProcessApplicationClassloader;
            }

            string configurationClassName = processEngineXml.ConfigurationClass;

            if (string.ReferenceEquals(configurationClassName, null) || configurationClassName.Length == 0)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                configurationClassName = typeof(StandaloneProcessEngineConfiguration).FullName;
            }

            // create & instantiate configuration class
            Type configurationClass = loadClass(configurationClassName, classLoader, typeof(ProcessEngineConfigurationImpl));
            ProcessEngineConfigurationImpl configuration = createInstance(configurationClass);

            // set UUid generator
            // TODO: move this to configuration and use as default?
            ProcessEngineConfigurationImpl configurationImpl = configuration;

            configurationImpl.IdGenerator = new StrongUuidGenerator();

            // set configuration values
            string name = processEngineXml.Name;

            configuration.ProcessEngineName = name;

            string datasourceJndiName = processEngineXml.Datasource;

            configuration.DataSourceJndiName = datasourceJndiName;

            // apply properties
            IDictionary <string, string> properties = processEngineXml.Properties;

            setJobExecutorActivate(configuration, properties);
            PropertyHelper.applyProperties(configuration, properties);

            // instantiate plugins:
            configurePlugins(configuration, processEngineXml, classLoader);

            if (!string.ReferenceEquals(processEngineXml.JobAcquisitionName, null) && processEngineXml.JobAcquisitionName.Length > 0)
            {
                JobExecutor jobExecutor = getJobExecutorService(serviceContainer);
                ensureNotNull("Cannot find referenced job executor with name '" + processEngineXml.JobAcquisitionName + "'", "jobExecutor", jobExecutor);

                // set JobExecutor on process engine
                configurationImpl.JobExecutor = jobExecutor;
            }

            // start the process engine inside the container.
            JmxManagedProcessEngine managedProcessEngineService = createProcessEngineControllerInstance(configuration);

            serviceContainer.startService(ServiceTypes.PROCESS_ENGINE, configuration.ProcessEngineName, managedProcessEngineService);
        }
Пример #14
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
            AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ClassLoader processApplicationClassloader = processApplication.getProcessApplicationClassloader();
            ClassLoader processApplicationClassloader = processApplication.ProcessApplicationClassloader;

            ProcessEngine processEngine = getProcessEngine(serviceContainer, processApplication.DefaultDeployToEngineName);

            // start building deployment map
            IDictionary <string, sbyte[]> deploymentMap = new Dictionary <string, sbyte[]>();

            // add all processes listed in the processes.xml
            IList <string> listedProcessResources = processArchive.ProcessResourceNames;

            foreach (string processResource in listedProcessResources)
            {
                Stream resourceAsStream = null;
                try
                {
                    resourceAsStream = processApplicationClassloader.getResourceAsStream(processResource);
                    sbyte[] bytes = IoUtil.readInputStream(resourceAsStream, processResource);
                    deploymentMap[processResource] = bytes;
                }
                finally
                {
                    IoUtil.closeSilently(resourceAsStream);
                }
            }

            // scan for additional process definitions if not turned off
            if (PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, true))
            {
                string   paResourceRoot             = processArchive.Properties[org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_RESOURCE_ROOT_PATH];
                string[] additionalResourceSuffixes = StringUtil.Split(processArchive.Properties[org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_ADDITIONAL_RESOURCE_SUFFIXES], org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR);
//JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method:
                deploymentMap.putAll(findResources(processApplicationClassloader, paResourceRoot, additionalResourceSuffixes));
            }

            // perform process engine deployment
            RepositoryService repositoryService = processEngine.RepositoryService;
            ProcessApplicationDeploymentBuilder deploymentBuilder = repositoryService.createDeployment(processApplication.Reference);

            // set the name for the deployment
            string deploymentName = processArchive.Name;

            if (string.ReferenceEquals(deploymentName, null) || deploymentName.Length == 0)
            {
                deploymentName = processApplication.Name;
            }
            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);
            }

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

            if (PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_RESUME_PREVIOUS_VERSIONS, true))
            {
                enableResumingOfPreviousVersions(deploymentBuilder);
            }

            // add all resources obtained through the processes.xml and through scanning
            foreach (KeyValuePair <string, sbyte[]> deploymentResource in deploymentMap.SetOfKeyValuePairs())
            {
                deploymentBuilder.addInputStream(deploymentResource.Key, new MemoryStream(deploymentResource.Value));
            }

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

            ICollection <string> deploymentResourceNames = deploymentBuilder.ResourceNames;

            if (deploymentResourceNames.Count > 0)
            {
                LOG.deploymentSummary(deploymentResourceNames, deploymentName);

                // perform the process engine deployment
                deployment = deploymentBuilder.deploy();

                // add attachment
                IDictionary <string, DeployedProcessArchive> processArchiveDeploymentMap = operationContext.getAttachment(Attachments.PROCESS_ARCHIVE_DEPLOYMENT_MAP);
                if (processArchiveDeploymentMap == null)
                {
                    processArchiveDeploymentMap = new Dictionary <string, DeployedProcessArchive>();
                    operationContext.addAttachment(Attachments.PROCESS_ARCHIVE_DEPLOYMENT_MAP, processArchiveDeploymentMap);
                }
                processArchiveDeploymentMap[processArchive.Name] = new DeployedProcessArchive(deployment);
            }
            else
            {
                LOG.notCreatingPaDeployment(processApplication.Name);
            }
        }