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); } }
//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); } } }
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)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected String[] getDeploymentDescriptors(org.jboss.as.server.deployment.DeploymentUnit deploymentUnit) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException protected internal virtual string[] getDeploymentDescriptors(DeploymentUnit deploymentUnit) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.jboss.as.ee.component.ComponentDescription processApplicationComponent = org.camunda.bpm.container.impl.jboss.deployment.marker.ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit); ComponentDescription processApplicationComponent = ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String paClassName = processApplicationComponent.getComponentClassName(); string paClassName = processApplicationComponent.ComponentClassName; string[] deploymentDescriptorResourceNames = null; Module module = deploymentUnit.getAttachment(MODULE); Type paClass = null; try { paClass = (Type)module.ClassLoader.loadClass(paClassName); } catch (ClassNotFoundException) { throw new DeploymentUnitProcessingException("Unable to load process application class '" + paClassName + "'."); } ProcessApplication annotation = paClass.getAnnotation(typeof(ProcessApplication)); if (annotation == null) { deploymentDescriptorResourceNames = new string[] { PROCESSES_XML }; } else { deploymentDescriptorResourceNames = annotation.deploymentDescriptors(); } return(deploymentDescriptorResourceNames); }
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(); }
protected internal virtual ComponentDescription getProcessApplicationComponent(DeploymentUnit deploymentUnit) { ComponentDescription paComponentDescription = ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit); return(paComponentDescription); }
/// <summary> /// Detect an existing <seealso cref="ProcessApplication"/> component. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.jboss.as.ee.component.ComponentDescription detectExistingComponent(org.jboss.as.server.deployment.DeploymentUnit deploymentUnit) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException protected internal virtual ComponentDescription detectExistingComponent(DeploymentUnit 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); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.jboss.as.ee.component.EEApplicationClasses eeApplicationClasses = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); EEApplicationClasses eeApplicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.jboss.as.server.deployment.annotation.CompositeIndex compositeIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX); CompositeIndex compositeIndex = deploymentUnit.getAttachment([email protected]_ANNOTATION_INDEX); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.jboss.as.web.common.WarMetaData warMetaData = deploymentUnit.getAttachment(org.jboss.as.web.common.WarMetaData.ATTACHMENT_KEY); WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); // extract deployment metadata IList <AnnotationInstance> processApplicationAnnotations = null; IList <AnnotationInstance> postDeployAnnnotations = null; IList <AnnotationInstance> preUndeployAnnnotations = null; ISet <ClassInfo> servletProcessApplications = null; if (compositeIndex != null) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: processApplicationAnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(ProcessApplication).FullName)); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: postDeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(PostDeploy).FullName)); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: preUndeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(PreUndeploy).FullName)); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: servletProcessApplications = compositeIndex.getAllKnownSubclasses(DotName.createSimple(typeof(ServletProcessApplication).FullName)); } else { return(null); } if (processApplicationAnnotations.Count == 0) { // no pa found, this is not a process application deployment. return(null); } else if (processApplicationAnnotations.Count > 1) { // found multiple PAs -> unsupported. throw new DeploymentUnitProcessingException("Detected multiple classes annotated with @" + typeof(ProcessApplication).Name + ". A deployment must only provide a single @" + typeof(ProcessApplication).Name + " class."); } else { // found single PA AnnotationInstance annotationInstance = processApplicationAnnotations[0]; ClassInfo paClassInfo = (ClassInfo)annotationInstance.target(); string paClassName = paClassInfo.name().ToString(); ComponentDescription paComponent = null; // it can either be a Servlet Process Application or a Singleton Session Bean Component or if (servletProcessApplications.Contains(paClassInfo)) { // Servlet Process Applications can only be deployed inside Web Applications if (warMetaData == null) { throw new DeploymentUnitProcessingException("@ProcessApplication class is a ServletProcessApplication but deployment is not a Web Application."); } // check whether it's already a servlet context listener: JBossWebMetaData mergedJBossWebMetaData = warMetaData.MergedJBossWebMetaData; IList <ListenerMetaData> listeners = mergedJBossWebMetaData.Listeners; if (listeners == null) { listeners = new List <ListenerMetaData>(); mergedJBossWebMetaData.Listeners = listeners; } bool isListener = false; foreach (ListenerMetaData listenerMetaData in listeners) { if (listenerMetaData.ListenerClass.Equals(paClassInfo.name().ToString())) { isListener = true; } } if (!isListener) { // register as Servlet Context Listener ListenerMetaData listener = new ListenerMetaData(); listener.ListenerClass = paClassName; listeners.Add(listener); // synthesize WebComponent WebComponentDescription paWebComponent = new WebComponentDescription(paClassName, paClassName, eeModuleDescription, deploymentUnit.ServiceName, eeApplicationClasses); eeModuleDescription.addComponent(paWebComponent); deploymentUnit.addToAttachmentList(WebComponentDescription.WEB_COMPONENTS, paWebComponent.StartServiceName); paComponent = paWebComponent; } else { // lookup the existing component paComponent = eeModuleDescription.getComponentsByClassName(paClassName).get(0); } // deactivate sci } else { // if its not a ServletProcessApplication it must be a session bean component IList <ComponentDescription> componentsByClassName = eeModuleDescription.getComponentsByClassName(paClassName); if (componentsByClassName.Count > 0 && (componentsByClassName[0] is SessionBeanComponentDescription)) { paComponent = componentsByClassName[0]; } else { throw new DeploymentUnitProcessingException("Class " + paClassName + " is annotated with @" + typeof(ProcessApplication).Name + " but is neither a ServletProcessApplication nor an EJB Session Bean Component."); } } // attach additional metadata to the deployment unit if (postDeployAnnnotations.Count > 0) { if (postDeployAnnnotations.Count == 1) { ProcessApplicationAttachments.attachPostDeployDescription(deploymentUnit, postDeployAnnnotations[0]); } else { throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PostDeploy. Found [" + postDeployAnnnotations + "]"); } } if (preUndeployAnnnotations.Count > 0) { if (preUndeployAnnnotations.Count == 1) { ProcessApplicationAttachments.attachPreUndeployDescription(deploymentUnit, preUndeployAnnnotations[0]); } else { throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PreUndeploy. Found [" + preUndeployAnnnotations + "]"); } } return(paComponent); } }