Search in sources :

Example 1 with CamelDeploymentSettings

use of org.wildfly.extension.camel.deployment.CamelDeploymentSettings in project wildfly-camel by wildfly-extras.

the class CamelIntegrationParser method parser.

public static CamelDeploymentSettings parser(XMLExtendedStreamReader reader, PropertyReplacer replacer) throws XMLStreamException {
    CamelDeploymentSettings result = new CamelDeploymentSettings();
    parseCamelIntegrationElement(reader, result, replacer);
    return result;
}
Also used : CamelDeploymentSettings(org.wildfly.extension.camel.deployment.CamelDeploymentSettings)

Example 2 with CamelDeploymentSettings

use of org.wildfly.extension.camel.deployment.CamelDeploymentSettings in project wildfly-camel by wildfly-extras.

the class CDIBeanArchiveProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
    CamelDeploymentSettings depSettings = depUnit.getAttachment(CamelDeploymentSettings.ATTACHMENT_KEY);
    List<DeploymentUnit> subDeployments = depUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
    // Return if camel disabled or not a CDI deployment
    if (!depSettings.isEnabled() || !WeldDeploymentMarker.isPartOfWeldDeployment(depUnit)) {
        return;
    }
    // Return if we're not an EAR deployment with 1 or more sub-deployments
    if (depUnit.getName().endsWith(".ear") && subDeployments.isEmpty()) {
        return;
    }
    // Make sure external bean archives from the camel-cdi module are visible to sub deployments
    List<BeanDeploymentArchiveImpl> deploymentArchives = depUnit.getAttachmentList(WeldAttachments.ADDITIONAL_BEAN_DEPLOYMENT_MODULES);
    BeanDeploymentArchiveImpl rootArchive = depUnit.getAttachment(WeldAttachments.DEPLOYMENT_ROOT_BEAN_DEPLOYMENT_ARCHIVE);
    for (BeanDeploymentArchiveImpl bda : deploymentArchives) {
        if (bda.getBeanArchiveType().equals(BeanDeploymentArchiveImpl.BeanArchiveType.EXTERNAL)) {
            for (BeanDeploymentArchive topLevelBda : rootArchive.getBeanDeploymentArchives()) {
                bda.addBeanDeploymentArchive(topLevelBda);
            }
        }
        for (DeploymentUnit subDepUnit : subDeployments) {
            BeanDeploymentArchive subBda = subDepUnit.getAttachment(WeldAttachments.DEPLOYMENT_ROOT_BEAN_DEPLOYMENT_ARCHIVE);
            bda.addBeanDeploymentArchive(subBda);
        }
    }
}
Also used : CamelDeploymentSettings(org.wildfly.extension.camel.deployment.CamelDeploymentSettings) BeanDeploymentArchiveImpl(org.jboss.as.weld.deployment.BeanDeploymentArchiveImpl) BeanDeploymentArchive(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

CamelDeploymentSettings (org.wildfly.extension.camel.deployment.CamelDeploymentSettings)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 BeanDeploymentArchiveImpl (org.jboss.as.weld.deployment.BeanDeploymentArchiveImpl)1 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)1