com.boozallen.aiops.mda.basic.cdi.CdiContainerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-data-delivery-spark-model-basic Show documentation
Show all versions of test-data-delivery-spark-model-basic Show documentation
Contains a barebones model with all features turned off to verify basic MDA generation and compilation
package com.boozallen.aiops.mda.basic.cdi;
/*-
* #%L
* aiSSEMBLE::Test::MDA::Data Delivery Spark Basic
* %%
* Copyright (C) 2021 Booz Allen
* %%
* This software package is licensed under the Booz Allen Public License. All Rights Reserved.
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.jboss.weld.environment.se.WeldContainer;
import com.boozallen.aissemble.core.cdi.CdiContainer;
import com.boozallen.aissemble.core.cdi.CdiContext;
/**
* Factory that creates the proper CDI Context for this series of pipelines.
*
* Please **DO** modify with your customizations, as appropriate.
*
* Originally generated from: templates/cdi.container.factory.java.vm
*/
public final class CdiContainerFactory {
private CdiContainerFactory() {
// private construct to prevent instantiation of all static class
}
/**
* Creates a new WeldContainer with the set of {@link CdiContext}
* implementations needed for these pipelines.
*
* @return Weld Container instance
*/
public static WeldContainer getCdiContainer() {
return getCdiContainer(null);
}
/**
* Creates a new WeldContainer with the set of {@link CdiContext}
* implementations needed for these pipelines with the ability to add in
* additional contexts in an ad-hoc fashion.
*
* @param additionalContexts
* @return Weld Container instance
*/
public static WeldContainer getCdiContainer(List additionalContexts) {
List contexts = getContexts();
if (CollectionUtils.isNotEmpty(additionalContexts)) {
contexts.addAll(additionalContexts);
}
return CdiContainer.create(contexts);
}
protected static List getContexts() {
List contexts = new ArrayList<>();
contexts.add(new PipelinesCdiContext());
return contexts;
}
}