Пример #1
0
        public override void stop(StopContext context)
        {
            ManagedReference reference = null;

            try
            {
                // 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;
                }

                invokePreUndeploy(processApplication);
            }
            catch (Exception e)
            {
                LOGGER.log(Level.SEVERE, "Exception while stopping process application", e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }
Пример #2
0
        public override void stop(StopContext arg0)
        {
            ManagedReference reference = null;

            try
            {
                // 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;
                }

                BpmPlatformPlugins        bpmPlatformPlugins = platformPluginsInjector.Value;
                IList <BpmPlatformPlugin> plugins            = bpmPlatformPlugins.Plugins;

                foreach (BpmPlatformPlugin bpmPlatformPlugin in plugins)
                {
                    bpmPlatformPlugin.postProcessApplicationUndeploy(processApplication);
                }
            }
            catch (Exception e)
            {
                LOGGER.log(Level.WARNING, "Exception while invoking BpmPlatformPlugin.postProcessApplicationUndeploy", e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException
        public override void start(StartContext context)
        {
            ManagedReference reference = null;

            try
            {
                // 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;
                }

                // create & populate the process application info object
                processApplicationInfo            = new ProcessApplicationInfoImpl();
                processApplicationInfo.Name       = processApplication.Name;
                processApplicationInfo.Properties = processApplication.Properties;

                referencedProcessEngines = new HashSet <ProcessEngine>();
                IList <ProcessApplicationDeploymentInfo> deploymentInfos = new List <ProcessApplicationDeploymentInfo>();

                foreach (ServiceName deploymentServiceName in deploymentServiceNames)
                {
                    ProcessApplicationDeploymentService value = getDeploymentService(context, deploymentServiceName);
                    referencedProcessEngines.Add(value.ProcessEngineInjector.Value);

                    ProcessApplicationDeployment deployment = value.Deployment;
                    if (deployment != null)
                    {
                        foreach (string deploymentId in deployment.ProcessApplicationRegistration.DeploymentIds)
                        {
                            ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
                            deploymentInfo.DeploymentId      = deploymentId;
                            deploymentInfo.ProcessEngineName = value.ProcessEngineName;
                            deploymentInfos.Add(deploymentInfo);
                        }
                    }
                }
                processApplicationInfo.DeploymentInfo = deploymentInfos;

                notifyBpmPlatformPlugins(platformPluginsInjector.Value, processApplication);

                if (postDeployDescription != null)
                {
                    invokePostDeploy(processApplication);
                }

                // install the ManagedProcessApplication Service as a child to this service
                // if this service stops (at undeployment) the ManagedProcessApplication service is removed as well.
                ServiceName serviceName = ServiceNames.forManagedProcessApplication(processApplicationInfo.Name);
                MscManagedProcessApplication managedProcessApplication = new MscManagedProcessApplication(processApplicationInfo, processApplication.Reference);
                context.ChildTarget.addService(serviceName, managedProcessApplication).install();
            }
            catch (StartException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new StartException(e);
            }
            finally
            {
                if (reference != null)
                {
                    reference.release();
                }
            }
        }
Пример #4
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();
                }
            }
        }