use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class EEModuleConfigurationProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
if (module == null || moduleDescription == null) {
return;
}
final int startupBeansCount = moduleDescription.getStartupBeansCount();
if (deploymentUnit.getParent() == null) {
deploymentUnit.putAttachment(Attachments.STARTUP_COUNTDOWN, new StartupCountdown(startupBeansCount));
} else {
final StartupCountdown countdown = deploymentUnit.getParent().getAttachment(Attachments.STARTUP_COUNTDOWN);
// copy ref to child deployment
deploymentUnit.putAttachment(Attachments.STARTUP_COUNTDOWN, countdown);
countdown.countUp(startupBeansCount);
}
final Set<ServiceName> failed = new HashSet<ServiceName>();
final EEModuleConfiguration moduleConfiguration = new EEModuleConfiguration(moduleDescription);
deploymentUnit.putAttachment(Attachments.EE_MODULE_CONFIGURATION, moduleConfiguration);
final ClassLoader oldCl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
final Iterator<ComponentDescription> iterator = moduleDescription.getComponentDescriptions().iterator();
while (iterator.hasNext()) {
final ComponentDescription componentDescription = iterator.next();
ROOT_LOGGER.debugf("Configuring component class: %s named %s", componentDescription.getComponentClassName(), componentDescription.getComponentName());
final ComponentConfiguration componentConfiguration;
try {
componentConfiguration = componentDescription.createConfiguration(reflectionIndex.getClassIndex(ClassLoadingUtils.loadClass(componentDescription.getComponentClassName(), module)), module.getClassLoader(), module.getModuleLoader());
for (final ComponentConfigurator componentConfigurator : componentDescription.getConfigurators()) {
componentConfigurator.configure(phaseContext, componentDescription, componentConfiguration);
}
moduleConfiguration.addComponentConfiguration(componentConfiguration);
} catch (Exception e) {
if (componentDescription.isOptional()) {
// https://issues.jboss.org/browse/WFLY-924 Just log a WARN summary of which component failed and then log the cause at DEBUG level
ROOT_LOGGER.componentInstallationFailure(componentDescription.getComponentName());
ROOT_LOGGER.debugf(e, "Not installing optional component %s due to an exception", componentDescription.getComponentName());
// keep track of failed optional components
failed.add(componentDescription.getStartServiceName());
failed.add(componentDescription.getCreateServiceName());
failed.add(componentDescription.getServiceName());
iterator.remove();
} else {
throw EeLogger.ROOT_LOGGER.cannotConfigureComponent(e, componentDescription.getComponentName());
}
}
}
deploymentUnit.putAttachment(Attachments.FAILED_COMPONENTS, Collections.synchronizedSet(failed));
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldCl);
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class EEModuleInitialProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final String deploymentUnitName = deploymentUnit.getName();
final String moduleName;
if (deploymentUnitName.endsWith(".war") || deploymentUnitName.endsWith(".wab") || deploymentUnitName.endsWith(".jar") || deploymentUnitName.endsWith(".ear") || deploymentUnitName.endsWith(".rar")) {
moduleName = deploymentUnitName.substring(0, deploymentUnitName.length() - 4);
} else {
moduleName = deploymentUnitName;
}
final String appName;
final String earApplicationName = deploymentUnit.getAttachment(Attachments.EAR_APPLICATION_NAME);
//if this is non-null this is always the one we want to use
if (earApplicationName != null) {
appName = earApplicationName;
} else {
//an appname of null means use the module name
appName = null;
}
deploymentUnit.putAttachment(Attachments.EE_MODULE_DESCRIPTION, new EEModuleDescription(appName, moduleName, earApplicationName, appClient));
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class AbstractComponentConfigProcessor method deploy.
/**
* {@inheritDoc} *
*/
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
if (componentConfigurations == null || componentConfigurations.isEmpty()) {
return;
}
for (ComponentDescription componentConfiguration : componentConfigurations) {
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
if (index != null) {
processComponentConfig(deploymentUnit, phaseContext, index, componentConfiguration);
}
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class AbstractDeploymentDescriptorBindingsProcessor method deploy.
@Override
public final void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final DeploymentDescriptorEnvironment environment = deploymentUnit.getAttachment(Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final EEModuleDescription description = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (module == null || description == null) {
return;
}
if (environment != null) {
final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, environment, description, null, module.getClassLoader(), deploymentReflectionIndex, applicationClasses);
description.getBindingConfigurations().addAll(bindings);
}
for (final ComponentDescription componentDescription : description.getComponentDescriptions()) {
if (componentDescription.getDeploymentDescriptorEnvironment() != null) {
final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, componentDescription.getDeploymentDescriptorEnvironment(), componentDescription, componentDescription, module.getClassLoader(), deploymentReflectionIndex, applicationClasses);
componentDescription.getBindingConfigurations().addAll(bindings);
}
}
for (final InterceptorEnvironment interceptorEnv : description.getInterceptorEnvironment().values()) {
final List<BindingConfiguration> bindings = processDescriptorEntries(deploymentUnit, interceptorEnv.getDeploymentDescriptorEnvironment(), interceptorEnv, null, module.getClassLoader(), deploymentReflectionIndex, applicationClasses);
interceptorEnv.getBindingConfigurations().addAll(bindings);
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class ApplicationClassesAggregationProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final List<EEModuleDescription> descriptions = new ArrayList<EEModuleDescription>();
for (final DeploymentUnit visibleDeployment : deploymentUnit.getAttachmentList(org.jboss.as.server.deployment.Attachments.ACCESSIBLE_SUB_DEPLOYMENTS)) {
final EEModuleDescription description = visibleDeployment.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (description != null) {
descriptions.add(description);
}
}
final EEApplicationClasses classes = new EEApplicationClasses(descriptions);
deploymentUnit.putAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION, classes);
}
Aggregations