All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.factoryfx.copperbridge.WorkflowLauncherFactory Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.github.factoryfx.copperbridge;

import io.github.factoryfx.factory.attribute.dependency.FactoryAttribute;
import io.github.factoryfx.factory.validation.ValidationResult;
import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.SimpleFactoryBase;
import org.copperengine.core.util.Backchannel;

import io.github.factoryfx.factory.util.LanguageText;

public class WorkflowLauncherFactory> extends SimpleFactoryBase {

    public final FactoryAttribute> backchannel = new FactoryAttribute>().labelText("Backchannel");
    public final FactoryAttribute> copperEngineContext = new FactoryAttribute>().labelText("Copper engine context");

    public WorkflowLauncherFactory(){
        config().addValidation(a-> new ValidationResult(copperEngineContext.get() == null
                                                            || (copperEngineContext.get().transientScottyEngine.get() == null && copperEngineContext.get().persistentScottyEngine.get() == null),
                                                        new LanguageText().en("Transient and persistent engine must not both be null")), copperEngineContext);
    }

    @Override
    public WorkflowLauncher createImpl() {
        return new WorkflowLauncher(copperEngineContext.get().transientScottyEngine.instance(),
                                    copperEngineContext.get().persistentScottyEngine.instance()== null ? null : copperEngineContext.get().persistentScottyEngine.instance().persistentProcessingEngine,
                                    backchannel.instance());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy