/// <summary> /// Establishes a TCP connection with the endpoint at the specified address/port pair. /// </summary> /// <param name="address">The address of the endpoint to connect to.</param> /// <param name="service">The service name of the endpoint to connect to.</param> /// <param name="secure">True to enable TLS on the socket.</param> /// <param name="cancellationToken">The cancellation token to cancel the operation.</param> public Task ConnectAsync(string address, string service, bool secure = false, CancellationToken cancellationToken = default(CancellationToken)) { var port = ServiceNames.PortForTcpServiceName(service); return(ConnectAsync(address, port, secure, cancellationToken)); }
public ServiceBase Get(ServiceNames serviceName) { if (_cache.Contains(serviceName.ToString())) { var item = (CacheItem)_cache[serviceName.ToString()]; var service = (ServiceBase)item.Value; var policy = new CacheItemPolicy { AbsoluteExpiration = DateTime.UtcNow.AddSeconds(service.Timeout) }; _cache.Set(serviceName.ToString(), item, policy); Console.WriteLine("From Cache"); return(service); } else { ServiceBase service = ServiceFactory.Get(serviceName); var policy = new CacheItemPolicy { AbsoluteExpiration = DateTime.UtcNow.AddSeconds(service.Timeout) }; var cacheItem = new CacheItem(serviceName.ToString(), service); _cache.Set(serviceName.ToString(), cacheItem, policy); Console.WriteLine("New"); return(service); } }
public static ServerInfo AddServer(string servername, ServiceNames servicename, string forestname, int isactive) { var serverinfo = new ServerInfo(servername, servicename, forestname, isactive); serverinfos.Add(serverinfo); return(serverinfo); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemWithEnginesAndPropertiesXml() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemWithEnginesAndPropertiesXml() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_AND_PROPERTIES); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName)); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> defaultEngineService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forManagedProcessEngine("__default")); ServiceController <object> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default")); assertNotNull("process engine controller for engine __default is installed ", defaultEngineService); ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController)defaultEngineService.Service).ProcessEngineMetadata; IDictionary <string, string> configurationProperties = metadata.ConfigurationProperties; assertEquals("default", configurationProperties["job-name"]); assertEquals("default", configurationProperties["job-acquisition"]); assertEquals("default", configurationProperties["job-acquisition-name"]); IDictionary <string, string> foxLegacyProperties = metadata.FoxLegacyProperties; assertTrue(foxLegacyProperties.Count == 0); assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test"))); assertNotNull("process engine controller for engine __emptyPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__emptyPropertiesTag"))); assertNotNull("process engine controller for engine __noPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__noPropertiesTag"))); }
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(); }
/// <summary> /// Processes the Push-CloudServices commandlet synchronously. /// </summary> protected override void ProcessRecord() { var azureSubscription = new AzureSubscription(SettingsPath, SubscriptionId); var azureCert = new X509Certificate2(Convert.FromBase64String(azureSubscription.ManagementCertificate)); var credentials = new CertificateCloudCredentials(SubscriptionId, azureCert); FlexStreams.UseThreadQueue(ThreadAdapter); using (EventStream.Subscribe(e => WriteObject(e.Message))) using (var computeClient = new ComputeManagementClient(credentials)) using (var storageClient = new StorageManagementClient(credentials)) { var targetSlot = VipSwap ? DeploymentSlot.Staging : DeploymentSlot.Production; var storageAccount = storageClient.CreateContainerIfNotExistsAsync( StorageAccountName, StorageContainer, BlobContainerPublicAccessType.Off, SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.List).Result; var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference(StorageContainer); ProcessAsyncWork(ServiceNames.Select((t, i) => DeployCloudServiceAsync(computeClient, container, t, PackagePaths[i], ConfigurationPaths[i], DiagnosticsConfigurationPaths?[i], targetSlot)) .ToArray()); } WriteObject("Push-CloudServices completed!"); base.ProcessRecord(); }
public ServiceNameTests() { _serviceNames = new ServiceNames(new Dictionary <string, string> { { "sql-server", "custom-db" }, { "http-client", "some-service" }, { "mongodb", "my-mongo" }, }); }
public void DoesNotRequireAnyMappings(string serviceName) { var serviceNames = new ServiceNames(new Dictionary <string, string>()); var expected = $"{ApplicationName}-{serviceName}"; var actual = serviceNames.GetServiceName(ApplicationName, serviceName); Assert.Equal(expected, actual); }
public void CanPassNullToConstructor() { var serviceName = "elasticsearch"; var expected = $"{ApplicationName}-{serviceName}"; var serviceNames = new ServiceNames(null); var actual = serviceNames.GetServiceName(ApplicationName, serviceName); Assert.Equal(expected, actual); }
protected internal virtual ServiceController <ProcessEngine> installService(OperationContext context, ManagedProcessEngineMetadata processEngineConfiguration) { MscManagedProcessEngineController service = new MscManagedProcessEngineController(processEngineConfiguration); ServiceName name = ServiceNames.forManagedProcessEngine(processEngineConfiguration.EngineName); ServiceBuilder <ProcessEngine> serviceBuilder = context.ServiceTarget.addService(name, service); MscManagedProcessEngineController.initializeServiceBuilder(processEngineConfiguration, service, serviceBuilder, processEngineConfiguration.JobExecutorAcquisitionName); return(serviceBuilder.install()); }
public static ServiceBase Get(ServiceNames serviceName) { if (serviceName == ServiceNames.UserService) { return(new UserService()); } else { return(new ServiceBase()); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void performRuntime(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, org.jboss.as.controller.ServiceVerificationHandler verificationHandler, java.util.List<org.jboss.msc.service.ServiceController<?>> newControllers) throws org.jboss.as.controller.OperationFailedException protected internal override void performRuntime <T1>(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, IList <T1> newControllers) { string jobExecutorThreadPoolName = SubsystemAttributeDefinitons.THREAD_POOL_NAME.resolveModelAttribute(context, model).asString(); ServiceName jobExecutorThreadPoolServiceName = ServiceNames.forManagedThreadPool(jobExecutorThreadPoolName); performRuntimeThreadPool(context, model, jobExecutorThreadPoolName, jobExecutorThreadPoolServiceName, verificationHandler, newControllers); MscExecutorService service = new MscExecutorService(); ServiceController <MscExecutorService> serviceController = context.ServiceTarget.addService(ServiceNames.forMscExecutorService(), service).addDependency(jobExecutorThreadPoolServiceName, typeof(ManagedQueueExecutorService), service.ManagedQueueInjector).addListener(verificationHandler).setInitialMode(ServiceController.Mode.ACTIVE).install(); newControllers.Add(serviceController); }
public void CanAddMappingsLater() { var serviceName = "elasticsearch"; var expected = "custom-name"; var serviceNames = new ServiceNames(new Dictionary <string, string>()); serviceNames.SetServiceNameMappings(new Dictionary <string, string> { { serviceName, expected } }); var actual = serviceNames.GetServiceName(ApplicationName, serviceName); Assert.Equal(expected, actual); }
protected internal virtual ServiceName getProcessEngineServiceName(ProcessArchiveXml processArchive) { ServiceName serviceName = null; if (string.ReferenceEquals(processArchive.ProcessEngineName, null) || processArchive.ProcessEngineName.Length == 0) { serviceName = ServiceNames.forDefaultProcessEngine(); } else { serviceName = ServiceNames.forManagedProcessEngine(processArchive.ProcessEngineName); } return(serviceName); }
internal static ServiceNames ServiceSwitch(List <ServiceNames> services) { var specificService = new ServiceNames(); foreach (var service in services) { switch (service) { case ServiceNames.Ideal: specificService = ServiceNames.Ideal; break; } } return(specificService); }
public async Task ConnectAsync( string address, string service, bool secure = false, CancellationToken cancellationToken = default(CancellationToken), bool ignoreServerCertificateErrors = false, TlsProtocolVersion tlsProtocolVersion = TlsProtocolVersion.Tls12) { var port = ServiceNames.PortForTcpServiceName(service); await ConnectAsync( address, port, secure, cancellationToken, ignoreServerCertificateErrors).ConfigureAwait(false); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void performRuntimeThreadPool(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode model, String name, org.jboss.msc.service.ServiceName jobExecutorThreadPoolServiceName, org.jboss.as.controller.ServiceVerificationHandler verificationHandler, java.util.List<org.jboss.msc.service.ServiceController<?>> newControllers) throws org.jboss.as.controller.OperationFailedException protected internal virtual void performRuntimeThreadPool <T1>(OperationContext context, ModelNode model, string name, ServiceName jobExecutorThreadPoolServiceName, ServiceVerificationHandler verificationHandler, IList <T1> newControllers) { ServiceTarget serviceTarget = context.ServiceTarget; ThreadFactoryService threadFactory = new ThreadFactoryService(); threadFactory.ThreadGroupName = THREAD_POOL_GRP_NAME + name; ServiceName threadFactoryServiceName = ServiceNames.forThreadFactoryService(name); ServiceBuilder <ThreadFactory> factoryBuilder = serviceTarget.addService(threadFactoryServiceName, threadFactory); if (verificationHandler != null) { factoryBuilder.addListener(verificationHandler); } if (newControllers != null) { newControllers.Add(factoryBuilder.install()); } else { factoryBuilder.install(); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.jboss.as.threads.BoundedQueueThreadPoolService threadPoolService = new org.jboss.as.threads.BoundedQueueThreadPoolService(org.camunda.bpm.container.impl.jboss.extension.SubsystemAttributeDefinitons.CORE_THREADS.resolveModelAttribute(context, model).asInt(), org.camunda.bpm.container.impl.jboss.extension.SubsystemAttributeDefinitons.MAX_THREADS.resolveModelAttribute(context, model).asInt(), org.camunda.bpm.container.impl.jboss.extension.SubsystemAttributeDefinitons.QUEUE_LENGTH.resolveModelAttribute(context, model).asInt(), false, new org.jboss.as.threads.TimeSpec(java.util.concurrent.TimeUnit.SECONDS, org.camunda.bpm.container.impl.jboss.extension.SubsystemAttributeDefinitons.KEEPALIVE_TIME.resolveModelAttribute(context,model).asInt()), org.camunda.bpm.container.impl.jboss.extension.SubsystemAttributeDefinitons.ALLOW_CORE_TIMEOUT.resolveModelAttribute(context, model).asBoolean()); BoundedQueueThreadPoolService threadPoolService = new BoundedQueueThreadPoolService(SubsystemAttributeDefinitons.CORE_THREADS.resolveModelAttribute(context, model).asInt(), SubsystemAttributeDefinitons.MAX_THREADS.resolveModelAttribute(context, model).asInt(), SubsystemAttributeDefinitons.QUEUE_LENGTH.resolveModelAttribute(context, model).asInt(), false, new TimeSpec(TimeUnit.SECONDS, SubsystemAttributeDefinitons.KEEPALIVE_TIME.resolveModelAttribute(context, model).asInt()), SubsystemAttributeDefinitons.ALLOW_CORE_TIMEOUT.resolveModelAttribute(context, model).asBoolean()); ServiceBuilder <ManagedQueueExecutorService> builder = serviceTarget.addService(jobExecutorThreadPoolServiceName, threadPoolService).addDependency(threadFactoryServiceName, typeof(ThreadFactory), threadPoolService.ThreadFactoryInjector).setInitialMode(ServiceController.Mode.ACTIVE); if (verificationHandler != null) { builder.addListener(verificationHandler); } if (newControllers != null) { newControllers.Add(builder.install()); } else { builder.install(); } }
public void ReplacesExistingMappings() { var serviceNames = new ServiceNames(new Dictionary <string, string> { { "sql-server", "custom-db" }, { "elasticsearch", "original-service" }, }); serviceNames.SetServiceNameMappings(new Dictionary <string, string> { { "elasticsearch", "custom-name" } }); var mongodbActual = serviceNames.GetServiceName(ApplicationName, "mongodb"); var elasticActual = serviceNames.GetServiceName(ApplicationName, "elasticsearch"); var sqlActual = serviceNames.GetServiceName(ApplicationName, "sql-server"); Assert.Equal($"{ApplicationName}-mongodb", mongodbActual); Assert.Equal("custom-name", elasticActual); Assert.Equal($"{ApplicationName}-sql-server", sqlActual); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemXmlPlatformPlugins() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemXmlPlatformPlugins() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> serviceController = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forBpmPlatformPlugins()); ServiceController <object> serviceController = container.getService(ServiceNames.forBpmPlatformPlugins()); assertNotNull(serviceController); object platformPlugins = serviceController.Value; assertTrue(platformPlugins is BpmPlatformPlugins); assertNotNull(platformPlugins); IList <BpmPlatformPlugin> plugins = ((BpmPlatformPlugins)platformPlugins).Plugins; assertEquals(1, plugins.Count); assertTrue(plugins[0] is ExampleBpmPlatformPlugin); }
public override int GetHashCode() { unchecked { var hashCode = (AgentType != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(AgentType) : 0); hashCode = (hashCode * 397) ^ (ExecutablePath != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(ExecutablePath) : 0); hashCode = (hashCode * 397) ^ (CommandLineArguments != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(CommandLineArguments) : 0); hashCode = (hashCode * 397) ^ (HostName != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(HostName) : 0); hashCode = (hashCode * 397) ^ Port; hashCode = (hashCode * 397) ^ (ServiceNames != null ? ServiceNames.GetHashCode() : 0); return(hashCode); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, ServiceVerificationHandler verificationHandler, java.util.List<org.jboss.msc.service.ServiceController<?>> newControllers) throws OperationFailedException protected internal override void performRuntime <T1>(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, IList <T1> newControllers) { string acquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).LastElement.Value; MscRuntimeContainerJobExecutor mscRuntimeContainerJobExecutor = new MscRuntimeContainerJobExecutor(); if (model.hasDefined(SubsystemAttributeDefinitons.PROPERTIES.Name)) { IList <Property> properties = SubsystemAttributeDefinitons.PROPERTIES.resolveModelAttribute(context, model).asPropertyList(); foreach (Property property in properties) { PropertyHelper.applyProperty(mscRuntimeContainerJobExecutor, property.Name, property.Value.asString()); } } // start new service for job executor ServiceController <RuntimeContainerJobExecutor> serviceController = context.ServiceTarget.addService(ServiceNames.forMscRuntimeContainerJobExecutorService(acquisitionName), mscRuntimeContainerJobExecutor).addDependency(ServiceNames.forMscRuntimeContainerDelegate()).addDependency(ServiceNames.forMscExecutorService()).addListener(verificationHandler).setInitialMode(ServiceController.Mode.ACTIVE).install(); newControllers.Add(serviceController); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemWithEnginesPropertiesPlugins() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemWithEnginesPropertiesPlugins() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_PROPERTIES_PLUGINS); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; assertNotNull("platform service should be installed", container.getRequiredService(PLATFORM_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getRequiredService(processEngineServiceBindingServiceName)); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> defaultEngineService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forManagedProcessEngine("__default")); ServiceController <object> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default")); assertNotNull("process engine controller for engine __default is installed ", defaultEngineService); ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController)defaultEngineService.Service).ProcessEngineMetadata; IDictionary <string, string> configurationProperties = metadata.ConfigurationProperties; assertEquals("default", configurationProperties["job-name"]); assertEquals("default", configurationProperties["job-acquisition"]); assertEquals("default", configurationProperties["job-acquisition-name"]); IDictionary <string, string> foxLegacyProperties = metadata.FoxLegacyProperties; assertTrue(foxLegacyProperties.Count == 0); assertNotNull("process engine controller for engine __default is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__default"))); assertNotNull("process engine controller for engine __test is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__test"))); // check we have parsed the plugin configurations metadata = ((MscManagedProcessEngineController)container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")).Service).ProcessEngineMetadata; IList <ProcessEnginePluginXml> pluginConfigurations = metadata.PluginConfigurations; ProcessEnginePluginXml processEnginePluginXml = pluginConfigurations[0]; assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.PluginClass); IDictionary <string, string> processEnginePluginXmlProperties = processEnginePluginXml.Properties; assertEquals("abc", processEnginePluginXmlProperties["test"]); assertEquals("123", processEnginePluginXmlProperties["number"]); assertEquals("true", processEnginePluginXmlProperties["bool"]); processEnginePluginXml = pluginConfigurations[1]; assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.PluginClass); processEnginePluginXmlProperties = processEnginePluginXml.Properties; assertEquals("cba", processEnginePluginXmlProperties["test"]); assertEquals("321", processEnginePluginXmlProperties["number"]); assertEquals("false", processEnginePluginXmlProperties["bool"]); // test correct subsystem removal assertRemoveSubsystemResources(services); try { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> service = container.getRequiredService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forManagedProcessEngine("__default")); ServiceController <object> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__default")); fail("Service '" + service.Name + "' should have been removed."); } catch (Exception) { // nop } try { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> service = container.getRequiredService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forManagedProcessEngine("__test")); ServiceController <object> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")); fail("Service '" + service.Name + "' should have been removed."); } catch (Exception) { // nop } }
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(); }
public HomeController(ServiceNames _sName) { sName = _sName; }
public async Task ConnectAsync( string address, string service, bool secure = false, CancellationToken cancellationToken = new CancellationToken(), bool ignoreServerCertificateErrors = false, TlsProtocolVersion tlsProtocolVersion = TlsProtocolVersion.Tls12) { _ignoreCertificateErrors = ignoreServerCertificateErrors; var port = ServiceNames.PortForTcpServiceName(service); var connectTask = _tcpClient.ConnectAsync(address, port); var ret = new TaskCompletionSource <bool>(); var canceller = cancellationToken.Register(() => ret.SetCanceled()); var okOrCancelled = await Task.WhenAny(connectTask, ret.Task); if (okOrCancelled == ret.Task) { #pragma warning disable CS4014 // ensure we observe the connectTask's exception in case downstream consumers throw on unobserved tasks connectTask.ContinueWith(t => $"{t.Exception}", TaskContinuationOptions.OnlyOnFaulted); #pragma warning restore CS4014 // reset the backing field. // depending on the state of the socket this may throw ODE which it is appropriate to ignore try { Disconnect(); } catch (ObjectDisposedException) { } return; } canceller.Dispose(); if (secure) { SslProtocols tlsProtocol; switch (tlsProtocolVersion) { case TlsProtocolVersion.Tls10: tlsProtocol = SslProtocols.Tls; break; case TlsProtocolVersion.Tls11: tlsProtocol = SslProtocols.Tls11; break; case TlsProtocolVersion.Tls12: tlsProtocol = SslProtocols.Tls12; break; case TlsProtocolVersion.None: throw new InvalidOperationException("Tls Protocol Version cannot be 'None' when establishing a secure connection. Use unencrypted WebSocket (i.e. ws://) with 'None' or set TLS Protocolversion to Tls10, Tls11 or Tls12. Default when using encrypted WebSocket is Tls12"); default: throw new ArgumentOutOfRangeException(nameof(tlsProtocolVersion), tlsProtocolVersion, null); } var secureStream = new SslStream(_tcpClient.GetStream(), true, ValidateServerCertificate); try { await secureStream.AuthenticateAsClientAsync(address, null, tlsProtocol, false); _secureStream = secureStream; } catch (Exception ex) { throw ex; } } IsConnected = true; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemWithSingleEngineXml() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemWithSingleEngineXml() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_SINGLE_ENGINE); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName)); assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default"))); string persistedSubsystemXml = services.PersistedSubsystemXml; compareXml(null, subsystemXml, persistedSubsystemXml); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemWithJobExecutorAndPropertiesXml() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemWithJobExecutorAndPropertiesXml() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR_AND_PROPERTIES); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName)); assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME)); // "default" job acquisition /////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> defaultJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("default")); ServiceController <object> defaultJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("default")); assertNotNull("platform job acquisition service 'default' should be installed", defaultJobAcquisitionService); object value = defaultJobAcquisitionService.Value; assertNotNull(value); assertTrue(value is JobExecutor); JobExecutor defaultJobExecutor = (JobExecutor)value; assertEquals(300000, defaultJobExecutor.LockTimeInMillis); assertEquals(5000, defaultJobExecutor.WaitTimeInMillis); assertEquals(3, defaultJobExecutor.MaxJobsPerAcquisition); // "anders" job acquisition ///////////////////////////////////////////////////////// //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> andersJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("anders")); ServiceController <object> andersJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("anders")); assertNotNull("platform job acquisition service 'anders' should be installed", andersJobAcquisitionService); value = andersJobAcquisitionService.Value; assertNotNull(value); assertTrue(value is JobExecutor); JobExecutor andersJobExecutor = (JobExecutor)value; assertEquals(600000, andersJobExecutor.LockTimeInMillis); assertEquals(10000, andersJobExecutor.WaitTimeInMillis); assertEquals(5, andersJobExecutor.MaxJobsPerAcquisition); // "mixed" job acquisition ///////////////////////////////////////////////////////// //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> mixedJobAcquisitionService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forMscRuntimeContainerJobExecutorService("mixed")); ServiceController <object> mixedJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("mixed")); assertNotNull("platform job acquisition service 'mixed' should be installed", mixedJobAcquisitionService); value = mixedJobAcquisitionService.Value; assertNotNull(value); assertTrue(value is JobExecutor); JobExecutor mixedJobExecutor = (JobExecutor)value; assertEquals(500000, mixedJobExecutor.LockTimeInMillis); // default values assertEquals(5000, mixedJobExecutor.WaitTimeInMillis); assertEquals(3, mixedJobExecutor.MaxJobsPerAcquisition); }
public FamilyController(ServiceNames _sName) { sName = _sName; //sUri = string.Format("http://{0}/api/family", sName._sfWebApiServiceName); sUri = string.Format("http://{0}:{1}/api/family", sName._sfWebApiServiceName, sName._portno); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemXmlWithEnginePropertiesPluginsAndJobExecutorWithExpressions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemXmlWithEnginePropertiesPluginsAndJobExecutorWithExpressions() { System.Properties.putAll(EXPRESSION_PROPERTIES); try { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_PROPERTIES_PLUGINS_AND_JOB_EXECUTOR_WITH_EXPRESSIONS); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; assertNotNull("platform service should be installed", container.getRequiredService(PLATFORM_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getRequiredService(processEngineServiceBindingServiceName)); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.jboss.msc.service.ServiceController<?> defaultEngineService = container.getService(org.camunda.bpm.container.impl.jboss.service.ServiceNames.forManagedProcessEngine("__test")); ServiceController <object> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__test")); assertNotNull("process engine controller for engine __test is installed ", defaultEngineService); ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController)defaultEngineService.Service).ProcessEngineMetadata; IDictionary <string, string> configurationProperties = metadata.ConfigurationProperties; assertEquals("default", configurationProperties["job-acquisition-name"]); IDictionary <string, string> foxLegacyProperties = metadata.FoxLegacyProperties; assertTrue(foxLegacyProperties.Count == 0); assertNotNull("process engine controller for engine __test is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__test"))); // check we have parsed the plugin configurations IList <ProcessEnginePluginXml> pluginConfigurations = metadata.PluginConfigurations; assertEquals(1, pluginConfigurations.Count); ProcessEnginePluginXml processEnginePluginXml = pluginConfigurations[0]; assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.PluginClass); IDictionary <string, string> processEnginePluginXmlProperties = processEnginePluginXml.Properties; assertEquals("abc", processEnginePluginXmlProperties["test"]); assertEquals("123", processEnginePluginXmlProperties["number"]); assertEquals("true", processEnginePluginXmlProperties["bool"]); string persistedSubsystemXml = services.PersistedSubsystemXml; compareXml(null, subsystemXml, persistedSubsystemXml); } finally { foreach (string key in EXPRESSION_PROPERTIES.Keys) { System.clearProperty(key); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testInstallSubsystemXmlWithEnginesAndJobExecutor() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testInstallSubsystemXmlWithEnginesAndJobExecutor() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_AND_JOB_EXECUTOR); // System.out.println(normalizeXML(subsystemXml)); KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build(); ServiceContainer container = services.Container; // container.dumpServices(); assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME)); assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME)); assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName)); assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default"))); assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test"))); string persistedSubsystemXml = services.PersistedSubsystemXml; // System.out.println(persistedSubsystemXml); compareXml(null, subsystemXml, persistedSubsystemXml); }