Exemple #1
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();
        }
        protected void Init()
        {
            try
            {
                //--- Locate the message panel
                LocateMessagePanel();

                //--- Init the service manager and set the event handler
                ServiceManager = new ServiceManager();
                ServiceManager.StatusChanged += OnServiceStatusChanged;
                UpdateServiceControls();

                //--- Init the service target and the task progress manager and start the watching
                ServiceTarget = new ServiceTarget();
                ServiceTarget.ProgressManager.MessageCreated += OnMessageCreated;
                ServiceTarget.ProgressManager.StartMessageWatching();

                //--- Update the controls and enable the controls
                UpdateControls();
                UpdateConfigStatusLabel();
                EnableControls();
            }
            catch (Exception Exc)
            {
                ShowException(Exc);
                Close();
            }
        }
 protected void UpdateConfigStatusLabel()
 {
     //--- Set the version and the server parameters
     ConfigStatusLabel.Text = CtrlTxt_CfgSta
                              .Replace("%ver%", GetVersion().ToString())
                              .Replace("%usr%", ServiceTarget.GetServerUser())
                              .Replace("%svr%", ServiceTarget.GetServerName());
 }
Exemple #4
0
        // Lifecycle /////////////////////////////////////////////////

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException
        public virtual void start(StartContext context)
        {
            serviceContainer = context.Controller.ServiceContainer;
            childTarget      = context.ChildTarget;

            startTrackingServices();
            createJndiBindings();

            // set this implementation as Runtime Container
            org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.set(this);
        }
Exemple #5
0
 public BasicApp(
     IHaContext haContext
     )
 {
     haContext.StateChanges()
     .Where(n =>
            n.Entity.EntityId == "input_select.who_cooks"
            )
     .Subscribe(
         s => haContext.CallService("input_text", "set_value",
                                    ServiceTarget.FromEntities("input_text.test_result"), new { value = s.New?.State })
         );
 }
Exemple #6
0
    public LocalApp(
        IHaContext ha
        )
    {
        ha.StateChanges()
        .Where(n => n.Entity.EntityId == "binary_sensor.mypir" && n.New?.State == "on")
        .Subscribe(_ =>
        {
            ha.CallService("light", "turn_on", ServiceTarget.FromEntities("light.my_light"));
        });

        ha.StateChanges()
        .Where(n => n.Entity.EntityId == "binary_sensor.mypir_creates_fault" && n.New?.State == "on")
        .Subscribe(_ =>
        {
            throw new InvalidOperationException("Ohh nooo!");
        });
    }
Exemple #7
0
//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();
            }
        }
Exemple #8
0
    public async Task BasicTestApp_ShouldChangeStateOfInputTextToTheStateOfInputSelect_WhenChange()
    {
        var optionToSet = GetDifferentOptionThanCurrentlySelected();

        var waitTask = _haContext.StateChanges()
                       .Where(n => n.Entity.EntityId == "input_text.test_result")
                       .Timeout(TimeSpan.FromMilliseconds(5000))
                       .FirstAsync()
                       .ToTask();

        _haContext.CallService(
            "input_select",
            "select_option",
            ServiceTarget.FromEntities("input_select.who_cooks"),
            new { option = optionToSet });

        var result = await waitTask.ConfigureAwait(false);

        result.New !.State.Should().Be(optionToSet);
    }
        public void ServiceTargetShouldContainCorrectEntity()
        {
            var serviceTarget = ServiceTarget.FromEntity("light.kitchen");

            serviceTarget.EntityIds.Should().BeEquivalentTo("light.kitchen");
        }
        public void ServiceTargetShouldContainCorrectEntitiesUsingParams()
        {
            var serviceTarget = ServiceTarget.FromEntities("light.kitchen", "light.livingroom");

            serviceTarget.EntityIds.Should().BeEquivalentTo("light.kitchen", "light.livingroom");
        }