Beispiel #1
0
 public virtual void deployProcessApplication(AbstractProcessApplication processApplication)
 {
     if (processApplication is ServletProcessApplication)
     {
         deployServletProcessApplication((ServletProcessApplication)processApplication);
     }
 }
Beispiel #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);
                }
            }
        }
Beispiel #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));
                        }
                    }
                }
            }
        }
Beispiel #4
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);
	  }
Beispiel #5
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);
        }
Beispiel #6
0
        public virtual void deployProcessApplication(AbstractProcessApplication processApplication)
        {
            ensureNotNull("Process application", processApplication);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String operationName = "Deployment of Process Application " + processApplication.getName();
            string operationName = "Deployment of Process Application " + processApplication.Name;

            serviceContainer.createDeploymentOperation(operationName).addAttachment(Attachments.PROCESS_APPLICATION, processApplication).addSteps(DeploymentSteps).execute();

            LOG.paDeployed(processApplication.Name);
        }
Beispiel #7
0
        protected internal virtual string[] getDeploymentDescriptorLocations(AbstractProcessApplication processApplication)
        {
            ProcessApplication annotation = processApplication.GetType().getAnnotation(typeof(ProcessApplication));

            if (annotation == null)
            {
                return(new string[] { ProcessApplication.DEFAULT_META_INF_PROCESSES_XML });
            }
            else
            {
                return(annotation.deploymentDescriptors());
            }
        }
Beispiel #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);
        }
Beispiel #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);
                }
            }
        }
Beispiel #10
0
        public static ELResolver lookupResolver(AbstractProcessApplication processApplication)
        {
            ServiceLoader <ProcessApplicationElResolver> providers       = ServiceLoader.load(typeof(ProcessApplicationElResolver));
            IList <ProcessApplicationElResolver>         sortedProviders = new List <ProcessApplicationElResolver>();

            foreach (ProcessApplicationElResolver provider in providers)
            {
                sortedProviders.Add(provider);
            }

            if (sortedProviders.Count == 0)
            {
                return(null);
            }
            else
            {
                // sort providers first
                sortedProviders.Sort(new org.camunda.bpm.application.ProcessApplicationElResolver_ProcessApplicationElResolverSorter());

                // add all providers to a composite resolver
                CompositeELResolver compositeResolver = new CompositeELResolver();
                StringBuilder       summary           = new StringBuilder();
                summary.Append(string.Format("ElResolvers found for Process Application {0}", processApplication.Name));

                foreach (ProcessApplicationElResolver processApplicationElResolver in sortedProviders)
                {
                    ELResolver elResolver = processApplicationElResolver.getElResolver(processApplication);

                    if (elResolver != null)
                    {
                        compositeResolver.add(elResolver);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                        summary.Append(string.Format("Class {0}", processApplicationElResolver.GetType().FullName));
                    }
                    else
                    {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                        LOG.noElResolverProvided(processApplication.Name, processApplicationElResolver.GetType().FullName);
                    }
                }

                LOG.paElResolversDiscovered(summary.ToString());

                return(compositeResolver);
            }
        }
Beispiel #11
0
        protected internal virtual void initializeVariableSerializers(AbstractProcessApplication abstractProcessApplication)
        {
            VariableSerializers paVariableSerializers = abstractProcessApplication.VariableSerializers;

            if (paVariableSerializers == null)
            {
                paVariableSerializers = new DefaultVariableSerializers();
                abstractProcessApplication.VariableSerializers = paVariableSerializers;
            }

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer<?> serializer : lookupSpinSerializers(abstractProcessApplication.getProcessApplicationClassloader()))
            foreach (TypedValueSerializer <object> serializer in lookupSpinSerializers(abstractProcessApplication.ProcessApplicationClassloader))
            {
                paVariableSerializers.addSerializer(serializer);
            }
        }
Beispiel #12
0
        protected internal virtual IDictionary <string, IList <ExecutableScript> > GetPaEnvScripts(IProcessApplicationReference pa)
        {
            try
            {
                IProcessApplicationInterface processApplication = pa.ProcessApplication;
                IProcessApplicationInterface rawObject          = processApplication.RawObject;

                if (rawObject is AbstractProcessApplication)
                {
                    AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication)rawObject;
                    return(abstractProcessApplication.EnvironmentScripts);
                }
                return(null);
            }
            catch (ProcessApplicationUnavailableException e)
            {
                throw new ProcessEngineException("Process Application is unavailable.", e);
            }
        }
Beispiel #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 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);
        }
Beispiel #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 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);
            }
        }
Beispiel #15
0
        public virtual void undeployProcessApplication(AbstractProcessApplication processApplication)
        {
            ensureNotNull("Process application", processApplication);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String processAppName = processApplication.getName();
            string processAppName = processApplication.Name;

            // if the process application is not deployed, ignore the request.
            if (serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processAppName) == null)
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String operationName = "Undeployment of Process Application " + processAppName;
            string operationName = "Undeployment of Process Application " + processAppName;

            // perform the undeployment
            serviceContainer.createUndeploymentOperation(operationName).addAttachment(Attachments.PROCESS_APPLICATION, processApplication).addSteps(UndeploymentSteps).execute();

            LOG.paUndeployed(processApplication.Name);
        }
Beispiel #16
0
        protected internal virtual IScriptEngine GetPaScriptEngine(string language, IProcessApplicationReference pa)
        {
            try
            {
                IProcessApplicationInterface processApplication = pa.ProcessApplication;
                IProcessApplicationInterface 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);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #17
0
	  protected internal virtual void notifyBpmPlatformPlugins(PlatformServiceContainer serviceContainer, AbstractProcessApplication processApplication)
	  {
		JmxManagedBpmPlatformPlugins plugins = serviceContainer.getService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_PLATFORM_PLUGINS);

		if (plugins != null)
		{
		  foreach (BpmPlatformPlugin plugin in plugins.Value.Plugins)
		  {
			plugin.postProcessApplicationDeploy(processApplication);
		  }
		}
	  }
Beispiel #18
0
 public virtual void undeployProcessApplication(AbstractProcessApplication processApplication)
 {
     // nothing to do
 }
Beispiel #19
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected java.util.Map<java.net.URL, org.camunda.bpm.application.impl.metadata.spi.ProcessesXml> parseProcessesXmlFiles(final org.camunda.bpm.application.AbstractProcessApplication processApplication)
        protected internal virtual IDictionary <URL, ProcessesXml> parseProcessesXmlFiles(AbstractProcessApplication processApplication)
        {
            string[]    deploymentDescriptors = getDeploymentDescriptorLocations(processApplication);
            IList <URL> processesXmlUrls      = getProcessesXmlUrls(deploymentDescriptors, processApplication);

            IDictionary <URL, ProcessesXml> parsedFiles = new Dictionary <URL, ProcessesXml>();

            // perform parsing
            foreach (URL url in processesXmlUrls)
            {
                LOG.foundProcessesXmlFile(url.ToString());

                if (isEmptyFile(url))
                {
                    parsedFiles[url] = ProcessesXml.EMPTY_PROCESSES_XML;
                    LOG.emptyProcessesXml();
                }
                else
                {
                    parsedFiles[url] = parseProcessesXml(url);
                }
            }

            if (parsedFiles.Count == 0)
            {
                LOG.noProcessesXmlForPa(processApplication.Name);
            }

            return(parsedFiles);
        }
Beispiel #20
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected org.camunda.bpm.application.impl.ProcessApplicationInfoImpl createProcessApplicationInfo(final org.camunda.bpm.application.AbstractProcessApplication processApplication, final java.util.Map<String, org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive> processArchiveDeploymentMap)
	  protected internal virtual ProcessApplicationInfoImpl createProcessApplicationInfo(AbstractProcessApplication processApplication, IDictionary<string, DeployedProcessArchive> processArchiveDeploymentMap)
	  {
		// populate process application info
		ProcessApplicationInfoImpl processApplicationInfo = new ProcessApplicationInfoImpl();

		processApplicationInfo.Name = processApplication.Name;
		processApplicationInfo.Properties = processApplication.Properties;

		// create deployment infos
		IList<ProcessApplicationDeploymentInfo> deploymentInfoList = new List<ProcessApplicationDeploymentInfo>();
		if (processArchiveDeploymentMap != null)
		{
		  foreach (KeyValuePair<string, DeployedProcessArchive> deployment in processArchiveDeploymentMap.SetOfKeyValuePairs())
		  {

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive deployedProcessArchive = deployment.getValue();
			DeployedProcessArchive deployedProcessArchive = deployment.Value;
			foreach (string deploymentId in deployedProcessArchive.AllDeploymentIds)
			{
			  ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
			  deploymentInfo.DeploymentId = deploymentId;
			  deploymentInfo.ProcessEngineName = deployedProcessArchive.ProcessEngineName;
			  deploymentInfoList.Add(deploymentInfo);
			}

		  }
		}

		processApplicationInfo.DeploymentInfo = deploymentInfoList;

		return processApplicationInfo;
	  }
Beispiel #21
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);
            }
        }
Beispiel #22
0
 public ProcessApplicationReferenceImpl(AbstractProcessApplication processApplication)
 {
     this.processApplication = new WeakReference <AbstractProcessApplication>(processApplication);
     name = processApplication.Name;
 }
Beispiel #23
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);
        }
Beispiel #24
0
        protected internal virtual IList <URL> getProcessesXmlUrls(string[] deploymentDescriptors, AbstractProcessApplication processApplication)
        {
            ClassLoader processApplicationClassloader = processApplication.ProcessApplicationClassloader;

            IList <URL> result = new List <URL>();

            // load all deployment descriptor files using the classloader of the process application
            foreach (string deploymentDescriptor in deploymentDescriptors)
            {
                IEnumerator <URL> processesXmlFileLocations = null;
                try
                {
                    processesXmlFileLocations = processApplicationClassloader.getResources(deploymentDescriptor);
                }
                catch (IOException e)
                {
                    throw LOG.exceptionWhileReadingProcessesXml(deploymentDescriptor, e);
                }

                while (processesXmlFileLocations.MoveNext())
                {
                    result.Add(processesXmlFileLocations.Current);
                }
            }

            return(result);
        }