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); }
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)); } } } } }
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; JobExecutorXml jobExecutorXml = getJobExecutorXml(operationContext); int queueSize = getQueueSize(jobExecutorXml); int corePoolSize = getCorePoolSize(jobExecutorXml); int maxPoolSize = getMaxPoolSize(jobExecutorXml); long keepAliveTime = getKeepAliveTime(jobExecutorXml); // initialize Queue & Executor services BlockingQueue <ThreadStart> threadPoolQueue = new ArrayBlockingQueue <ThreadStart>(queueSize); ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue); threadPoolExecutor.RejectedExecutionHandler = new ThreadPoolExecutor.AbortPolicy(); // construct the service for the thread pool JmxManagedThreadPool managedThreadPool = new JmxManagedThreadPool(threadPoolQueue, threadPoolExecutor); // install the service into the container serviceContainer.startService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_EXECUTOR, managedThreadPool); }
protected override void ProcessRecord() { try { TraceConfig.SetDefaultLevel(TraceSinkType.Console, EventLevel.Error); var newClusterManifest = this.ReadXml <ClusterManifestType>(this.GetAbsolutePath(this.ClusterManifestPath), this.GetFabricFilePath(Constants.ServiceModelSchemaFileName)); if (newClusterManifest.Infrastructure.Item is ClusterManifestTypeInfrastructureWindowsServer) { if (string.IsNullOrEmpty(this.OldClusterManifestPath)) { var parameters = new Dictionary <string, dynamic> { { DeploymentParameters.ClusterManifestString, this.GetAbsolutePath(this.ClusterManifestPath) } }; var deploymentParameters = new DeploymentParameters(); deploymentParameters.SetParameters(parameters, DeploymentOperations.ValidateClusterManifest); DeploymentOperation.ExecuteOperation(deploymentParameters); this.WriteObject(true); } else { var upgradeValidationParameters = new Dictionary <string, dynamic> { { DeploymentParameters.OldClusterManifestString, this.GetAbsolutePath(this.OldClusterManifestPath) }, { DeploymentParameters.ClusterManifestString, this.GetAbsolutePath(this.ClusterManifestPath) } }; var upgradeDeploymentParameters = new DeploymentParameters(); upgradeDeploymentParameters.SetParameters(upgradeValidationParameters, DeploymentOperations.Validate); try { DeploymentOperation.ExecuteOperation(upgradeDeploymentParameters); } catch (Exception exception) { if (exception is FabricHostRestartRequiredException || exception is FabricHostRestartNotRequiredException) { this.WriteObject(true); return; } throw; } } } else { throw new InvalidOperationException(StringResources.Error_NonServerClusterManifestValidationNotSupport); } } catch (Exception exception) { this.WriteObject(false); this.ThrowTerminatingError( exception, Constants.TestClusterManifestErrorId, null); } }
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 java.util.Map<String, org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive> processArchiveDeploymentMap = deployedProcessApplication.getProcessArchiveDeploymentMap(); IDictionary <string, DeployedProcessArchive> processArchiveDeploymentMap = deployedProcessApplication.ProcessArchiveDeploymentMap; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive deployedProcessArchive = processArchiveDeploymentMap.get(processArchive.getName()); DeployedProcessArchive deployedProcessArchive = processArchiveDeploymentMap[processArchive.Name]; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.ProcessEngine processEngine = serviceContainer.getServiceValue(org.camunda.bpm.container.impl.spi.ServiceTypes.PROCESS_ENGINE, processEngineName); ProcessEngine processEngine = serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName); // unregrister with the process engine. processEngine.ManagementService.unregisterProcessApplication(deployedProcessArchive.AllDeploymentIds, true); // delete the deployment if not disabled if (PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { if (processEngine != null) { // always cascade & skip custom listeners deleteDeployment(deployedProcessArchive.PrimaryDeploymentId, processEngine.RepositoryService); } } }
private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext) { BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML); JobExecutorXml jobExecutorXml = bpmPlatformXml.JobExecutor; return(jobExecutorXml); }
public async Task <Response <DeploymentOperation> > GetAsync(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (deploymentName == null) { throw new ArgumentNullException(nameof(deploymentName)); } if (operationId == null) { throw new ArgumentNullException(nameof(operationId)); } using var message = CreateGetRequest(resourceGroupName, deploymentName, operationId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { DeploymentOperation value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = DeploymentOperation.DeserializeDeploymentOperation(document.RootElement); } return(Response.FromValue(value, message.Response)); }
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); } } }
public virtual void executeDeploymentOperation(DeploymentOperation operation) { Stack <DeploymentOperation> currentOperationContext = activeDeploymentOperations.get(); if (currentOperationContext == null) { currentOperationContext = new Stack <DeploymentOperation>(); activeDeploymentOperations.set(currentOperationContext); } try { currentOperationContext.Push(operation); // execute the operation operation.execute(); } finally { currentOperationContext.Pop(); if (currentOperationContext.Count == 0) { activeDeploymentOperations.remove(); } } }
private List <DeploymentOperation> GetNewOperations(List <DeploymentOperation> old, IList <DeploymentOperation> current) { List <DeploymentOperation> newOperations = new List <DeploymentOperation>(); foreach (DeploymentOperation operation in current) { DeploymentOperation operationWithSameIdAndProvisioningState = old.Find(o => o.OperationId.Equals(operation.OperationId) && o.Properties.ProvisioningState.Equals(operation.Properties.ProvisioningState)); if (operationWithSameIdAndProvisioningState == null) { newOperations.Add(operation); } //If nested deployment, get the operations under those deployments as well if (operation.Properties.TargetResource != null && operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase)) { HttpStatusCode statusCode; Enum.TryParse <HttpStatusCode>(operation.Properties.StatusCode, out statusCode); if (!statusCode.IsClientFailureRequest()) { List <DeploymentOperation> newNestedOperations = new List <DeploymentOperation>(); DeploymentOperationsListResult result; result = ResourceManagementClient.DeploymentOperations.List( resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id), deploymentName: operation.Properties.TargetResource.ResourceName, parameters: null); newNestedOperations = GetNewOperations(operations, result.Operations); newOperations.AddRange(newNestedOperations); } } } return(newOperations); }
protected override async Task <TaskResult> ExecuteAsync(TaskContext context, WaitDependsOnActivityInput input) { DeploymentOperation deploymentOperation = new DeploymentOperation(input.DeploymentContext, this.infrastructure, input.Resource) { InstanceId = context.OrchestrationInstance.InstanceId, ExecutionId = context.OrchestrationInstance.ExecutionId, Stage = input.ProvisioningStage, Input = DataConverter.Serialize(input) }; templateHelper.SaveDeploymentOperation(deploymentOperation); using (var db = new DbAccess(this.options.Database.ConnectionString)) { foreach (var item in input.DependsOn) { db.AddStatement(this.commandText, new { input.DeploymentContext.RootId, input.DeploymentContext.DeploymentId, context.OrchestrationInstance.InstanceId, context.OrchestrationInstance.ExecutionId, EventName = input.ProvisioningStage.ToString(), DependsOnName = item }); } await db.ExecuteNonQueryAsync(); } return(new TaskResult() { Code = 200 }); }
protected override TaskResult Execute(TaskContext context, DeploymentOrchestrationInput input) { TaskResult tr; try { var Deployment = DeploymentOrchestrationInput.Validate(input, templateHelper.ARMfunctions, infrastructure); tr = new TaskResult(200, DataConverter.Serialize(Deployment)); } catch (Exception ex) { tr = new TaskResult() { Code = 400, Content = ex.Message }; } DeploymentOperation deploymentOperation = new DeploymentOperation(input, this.infrastructure) { InstanceId = context.OrchestrationInstance.InstanceId, ExecutionId = context.OrchestrationInstance.ExecutionId, Stage = tr.Code == 200 ? ProvisioningStage.ValidateTemplate : ProvisioningStage.ValidateTemplateFailed, Input = DataConverter.Serialize(input), Result = DataConverter.Serialize(tr) }; templateHelper.SaveDeploymentOperation(deploymentOperation); return(tr); }
public static ProcessEngine getDefaultProcessEngine(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; return(serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, "default")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void setUp() { step = new StartManagedThreadPoolStep(); deploymentOperation = new DeploymentOperation("name", container, System.Linq.Enumerable.Empty <DeploymentOperationStep> ()); jobExecutorXml = new JobExecutorXmlImpl(); bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutorXml, System.Linq.Enumerable.Empty <ProcessEngineXml>()); deploymentOperation.addAttachment(Attachments.BPM_PLATFORM_XML, bpmPlatformXml); }
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); }
public void ProcessError(DeploymentOperation operation) { ErrorResponse error = DeserializeDeploymentOperationError(operation.Properties?.StatusMessage?.ToString()); if (error != null) { ErrorMessages.Add(error); } }
public void ProcessError(DeploymentOperation operation) { ErrorResponse error = operation.Properties?.StatusMessage?.Error; if (error != null) { ErrorMessages.Add(error); } }
public override void performOperationStep(DeploymentOperation operationContext) { IList <ProcessEngineXml> processEngines = getProcessEnginesXmls(operationContext); foreach (ProcessEngineXml parsedProcessEngine in processEngines) { // for each process engine add a new deployment step operationContext.addStep(createStartProcessEngineStep(parsedProcessEngine)); } }
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); }
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; ISet <string> serviceNames = serviceContainer.getServiceNames(ServiceTypes.PROCESS_ENGINE); foreach (string serviceName in serviceNames) { stopProcessEngine(serviceName, serviceContainer); } }
public override void performOperationStep(DeploymentOperation operationContext) { URL bpmPlatformXmlSource = getBpmPlatformXmlStream(operationContext); ensureNotNull("Unable to find bpm-platform.xml. This file is necessary for deploying the camunda BPM platform", "bpmPlatformXmlSource", bpmPlatformXmlSource); // parse the bpm platform xml BpmPlatformXml bpmPlatformXml = (new BpmPlatformXmlParser()).createParse().sourceUrl(bpmPlatformXmlSource).execute().BpmPlatformXml; // attach to operation context operationContext.addAttachment(Attachments.BPM_PLATFORM_XML, bpmPlatformXml); }
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)); }
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; IList <JmxManagedProcessApplication> processApplicationsReferences = serviceContainer.getServiceValuesByType(ServiceTypes.PROCESS_APPLICATION); foreach (JmxManagedProcessApplication processApplication in processApplicationsReferences) { stopProcessApplication(processApplication.ProcessApplicationReference); } }
public static object[] resolveInjections(DeploymentOperation operationContext, System.Reflection.MethodInfo lifecycleMethod) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Type[] parameterTypes = lifecycleMethod.getGenericParameterTypes(); Type[] parameterTypes = lifecycleMethod.GenericParameterTypes; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<Object> parameters = new java.util.ArrayList<Object>(); IList <object> parameters = new List <object>(); foreach (Type parameterType in parameterTypes) { bool injectionResolved = false; if (parameterType is Type) { Type parameterClass = (Type)parameterType; // support injection of the default process engine if (parameterClass.IsAssignableFrom(typeof(ProcessEngine))) { parameters.Add(getDefaultProcessEngine(operationContext)); injectionResolved = true; } // support injection of the ProcessApplicationInfo else if (parameterClass.IsAssignableFrom(typeof(ProcessApplicationInfo))) { parameters.Add(getProcessApplicationInfo(operationContext)); injectionResolved = true; } } else if (parameterType is ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType)parameterType; Type[] actualTypeArguments = parameterizedType.ActualTypeArguments; // support injection of List<ProcessEngine> if (actualTypeArguments.Length == 1 && (Type)actualTypeArguments[0].IsAssignableFrom(typeof(ProcessEngine))) { parameters.Add(getProcessEngines(operationContext)); injectionResolved = true; } } if (!injectionResolved) { throw LOG.unsuppoertedParameterType(parameterType); } } return(parameters.ToArray()); }
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); }
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); } } }
private List <DeploymentOperation> GetNewOperations(List <DeploymentOperation> old, IList <DeploymentOperation> current) { List <DeploymentOperation> newOperations = new List <DeploymentOperation>(); foreach (DeploymentOperation operation in current) { DeploymentOperation operationWithSameIdAndProvisioningState = old.Find(o => o.OperationId.Equals(operation.OperationId) && o.Properties.ProvisioningState.Equals(operation.Properties.ProvisioningState)); if (operationWithSameIdAndProvisioningState == null) { newOperations.Add(operation); } } return(newOperations); }
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); }
protected internal virtual void stopProcessEngine(string processEngineName, 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; try { serviceContainer.stopService(ServiceTypes.PROCESS_ENGINE, processEngineName); } catch (Exception e) { LOG.exceptionWhileStopping("Process Engine", processEngineName, e); } }
private List <DeploymentOperation> GetNewOperations(List <DeploymentOperation> old, Rest.Azure.IPage <DeploymentOperation> current) { List <DeploymentOperation> newOperations = new List <DeploymentOperation>(); foreach (DeploymentOperation operation in current) { DeploymentOperation operationWithSameIdAndProvisioningState = old.Find(o => o.OperationId.Equals(operation.OperationId) && o.Properties.ProvisioningState.Equals(operation.Properties.ProvisioningState)); if (operationWithSameIdAndProvisioningState == null) { newOperations.Add(operation); } //If nested deployment, get the operations under those deployments as well. Check if the deployment exists before calling list operations on it if (operation.Properties.TargetResource != null && operation.Properties.TargetResource.ResourceType.Equals("Microsoft.Resources/deployments", StringComparison.OrdinalIgnoreCase) && ResourceManagementClient.Deployments.CheckExistence( resourceGroupName: GetResourceGroupName(operation.Properties.TargetResource.Id), deploymentName: operation.Properties.TargetResource.ResourceName)) { HttpStatusCode statusCode; Enum.TryParse <HttpStatusCode>(operation.Properties.StatusCode, out statusCode); if (!IsClientFailureRequest((int)statusCode)) { List <DeploymentOperation> newNestedOperations = new List <DeploymentOperation>(); Rest.Azure.IPage <DeploymentOperation> result; result = ResourceManagementClient.DeploymentOperations.List( resourceGroupName: GetResourceGroupName(operation.Properties.TargetResource.Id), deploymentName: operation.Properties.TargetResource.ResourceName); newNestedOperations = GetNewOperations(operations, result); foreach (DeploymentOperation op in newNestedOperations) { DeploymentOperation nestedOperationWithSameIdAndProvisioningState = newOperations.Find(o => o.OperationId.Equals(op.OperationId) && o.Properties.ProvisioningState.Equals(op.Properties.ProvisioningState)); if (nestedOperationWithSameIdAndProvisioningState == null) { newOperations.Add(op); } } } } } return(newOperations); }