io.github.factoryfx.copperbridge.WorkflowLauncherFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of copperBridge Show documentation
Show all versions of copperBridge Show documentation
factoryfx dependency injection framework
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());
}
}