예제 #1
0
        public const int PRIORITY = 0x2010;   // after PARSE_WEB_MERGE_METADATA

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
            EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);

            // must be EE Module
            if (eeModuleDescription == null)
            {
                return;
            }

            // discover user-provided component
            ComponentDescription paComponent = detectExistingComponent(deploymentUnit);

            if (paComponent != null)
            {
                log.log(Level.INFO, "Detected user-provided @" + typeof(ProcessApplication).Name + " component with name '" + paComponent.ComponentName + "'.");

                // mark this to be a process application
                ProcessApplicationAttachments.attachProcessApplicationComponent(deploymentUnit, paComponent);
                ProcessApplicationAttachments.mark(deploymentUnit);
                ProcessApplicationAttachments.markPartOfProcessApplication(deploymentUnit);
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

            IList <ProcessesXmlWrapper> processesXmls = ProcessApplicationAttachments.getProcessesXmls(deploymentUnit);

            foreach (ProcessesXmlWrapper wrapper in processesXmls)
            {
                foreach (ProcessEngineXml processEngineXml in wrapper.ProcessesXml.ProcessEngines)
                {
                    startProcessEngine(processEngineXml, phaseContext);
                }
            }
        }
예제 #3
0
        public const int PRIORITY = 0x0000;   // this can happen ASAP in the POST_MODULE Phase

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.modules.Module module = deploymentUnit.getAttachment(MODULE);
            Module module = deploymentUnit.getAttachment(MODULE);

            // read @ProcessApplication annotation of PA-component
            string[] deploymentDescriptors = getDeploymentDescriptors(deploymentUnit);

            // load all processes.xml files
            IList <URL> deploymentDescriptorURLs = getDeploymentDescriptorUrls(module, deploymentDescriptors);

            foreach (URL processesXmlResource in deploymentDescriptorURLs)
            {
                VirtualFile processesXmlFile = getFile(processesXmlResource);

                // parse processes.xml metadata.
                ProcessesXml processesXml = null;
                if (isEmptyFile(processesXmlResource))
                {
                    processesXml = ProcessesXml.EMPTY_PROCESSES_XML;
                }
                else
                {
                    processesXml = parseProcessesXml(processesXmlResource);
                }

                // add the parsed metadata to the attachment list
                ProcessApplicationAttachments.addProcessesXml(deploymentUnit, new ProcessesXmlWrapper(processesXml, processesXmlFile));
            }
        }
예제 #4
0
        protected internal virtual void startProcessEngine(ProcessEngineXml processEngineXml, DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceTarget serviceTarget = phaseContext.getServiceTarget();
            ServiceTarget serviceTarget = phaseContext.ServiceTarget;

            // transform configuration
            ManagedProcessEngineMetadata configuration = transformConfiguration(processEngineXml);

            // validate the configuration
            configuration.validate();

            // create service instance
            MscManagedProcessEngineController service = new MscManagedProcessEngineController(configuration);

            // get the service name for the process engine
            ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngineXml.Name);

            // get service builder
            ServiceBuilder <ProcessEngine> serviceBuilder = serviceTarget.addService(serviceName, service);

            // make this service depend on the current phase -> makes sure it is removed with the phase service at undeployment
            serviceBuilder.addDependency(phaseContext.PhaseServiceName);

            // add Service dependencies
            MscManagedProcessEngineController.initializeServiceBuilder(configuration, service, serviceBuilder, processEngineXml.JobAcquisitionName);

            // install the service
            serviceBuilder.install();
        }
예제 #5
0
        public const int PRIORITY = 0x0000;   // this can happen at the beginning of the phase

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public override void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.ComponentDescription paComponent = getProcessApplicationComponent(deploymentUnit);
            ComponentDescription paComponent = getProcessApplicationComponent(deploymentUnit);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paViewServiceName = getProcessApplicationViewServiceName(paComponent);
            ServiceName paViewServiceName = getProcessApplicationViewServiceName(paComponent);

            Module module = deploymentUnit.getAttachment(Attachments.MODULE);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String moduleName = module.getIdentifier().toString();
            string moduleName = module.Identifier.ToString();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paStartServiceName = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forProcessApplicationStartService(moduleName);
            ServiceName paStartServiceName = ServiceNames.forProcessApplicationStartService(moduleName);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paStopServiceName = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forProcessApplicationStopService(moduleName);
            ServiceName paStopServiceName = ServiceNames.forProcessApplicationStopService(moduleName);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName noViewStartService = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forNoViewProcessApplicationStartService(moduleName);
            ServiceName noViewStartService = ServiceNames.forNoViewProcessApplicationStartService(moduleName);

            IList <ServiceName> deploymentServiceNames = new List <ServiceName>();

            ProcessApplicationStopService paStopService = new ProcessApplicationStopService();
            ServiceBuilder <ProcessApplicationStopService> stopServiceBuilder = phaseContext.ServiceTarget.addService(paStopServiceName, paStopService).addDependency(phaseContext.PhaseServiceName).addDependency(ServiceNames.forBpmPlatformPlugins(), typeof(BpmPlatformPlugins), paStopService.PlatformPluginsInjector).setInitialMode(ServiceController.Mode.ACTIVE);

            if (paViewServiceName != null)
            {
                stopServiceBuilder.addDependency(paViewServiceName, typeof(ComponentView), paStopService.PaComponentViewInjector);
            }
            else
            {
                stopServiceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), paStopService.NoViewProcessApplication);
            }

            stopServiceBuilder.install();

            // deploy all process archives
            IList <ProcessesXmlWrapper> processesXmlWrappers = ProcessApplicationAttachments.getProcessesXmls(deploymentUnit);

            foreach (ProcessesXmlWrapper processesXmlWrapper in processesXmlWrappers)
            {
                ProcessesXml processesXml = processesXmlWrapper.ProcessesXml;
                foreach (ProcessArchiveXml processArchive in processesXml.ProcessArchives)
                {
                    ServiceName processEngineServiceName = getProcessEngineServiceName(processArchive);
                    IDictionary <string, sbyte[]> deploymentResources = getDeploymentResources(processArchive, deploymentUnit, processesXmlWrapper.ProcessesXmlFile);

                    // add the deployment service for each process archive we deploy.
                    ProcessApplicationDeploymentService deploymentService = new ProcessApplicationDeploymentService(deploymentResources, processArchive, module);
                    string processArachiveName = processArchive.Name;
                    if (string.ReferenceEquals(processArachiveName, null))
                    {
                        // use random name for deployment service if name is null (we cannot ask the process application yet since the component might not be up.
                        processArachiveName = System.Guid.randomUUID().ToString();
                    }
                    ServiceName deploymentServiceName = ServiceNames.forProcessApplicationDeploymentService(deploymentUnit.Name, processArachiveName);
                    ServiceBuilder <ProcessApplicationDeploymentService> serviceBuilder = phaseContext.ServiceTarget.addService(deploymentServiceName, deploymentService).addDependency(phaseContext.PhaseServiceName).addDependency(paStopServiceName).addDependency(processEngineServiceName, typeof(ProcessEngine), deploymentService.ProcessEngineInjector).setInitialMode(ServiceController.Mode.ACTIVE);

                    if (paViewServiceName != null)
                    {
                        // add a dependency on the component start service to make sure we are started after the pa-component (Singleton EJB) has started
                        serviceBuilder.addDependency(paComponent.StartServiceName);
                        serviceBuilder.addDependency(paViewServiceName, typeof(ComponentView), deploymentService.PaComponentViewInjector);
                    }
                    else
                    {
                        serviceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), deploymentService.NoViewProcessApplication);
                    }

                    JBossCompatibilityExtension.addServerExecutorDependency(serviceBuilder, deploymentService.ExecutorInjector, false);

                    serviceBuilder.install();

                    deploymentServiceNames.Add(deploymentServiceName);
                }
            }

            AnnotationInstance postDeploy  = ProcessApplicationAttachments.getPostDeployDescription(deploymentUnit);
            AnnotationInstance preUndeploy = ProcessApplicationAttachments.getPreUndeployDescription(deploymentUnit);

            // register the managed process application start service
            ProcessApplicationStartService paStartService = new ProcessApplicationStartService(deploymentServiceNames, postDeploy, preUndeploy, module);
            ServiceBuilder <ProcessApplicationStartService> serviceBuilder = phaseContext.ServiceTarget.addService(paStartServiceName, paStartService).addDependency(phaseContext.PhaseServiceName).addDependency(ServiceNames.forDefaultProcessEngine(), typeof(ProcessEngine), paStartService.DefaultProcessEngineInjector).addDependency(ServiceNames.forBpmPlatformPlugins(), typeof(BpmPlatformPlugins), paStartService.PlatformPluginsInjector).addDependencies(deploymentServiceNames).setInitialMode(ServiceController.Mode.ACTIVE);

            if (paViewServiceName != null)
            {
                serviceBuilder.addDependency(paViewServiceName, typeof(ComponentView), paStartService.PaComponentViewInjector);
            }
            else
            {
                serviceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), paStartService.NoViewProcessApplication);
            }

            serviceBuilder.install();
        }