use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class EjbDependsOnMergingProcessor method setupDependencies.
private void setupDependencies(final EJBComponentDescription description, final EEApplicationDescription applicationDescription, final ResourceRoot deploymentRoot, final String[] annotationValues) throws DeploymentUnitProcessingException {
for (final String annotationValue : annotationValues) {
final Set<ComponentDescription> components = applicationDescription.getComponents(annotationValue, deploymentRoot.getRoot());
if (components.isEmpty()) {
throw EjbLogger.ROOT_LOGGER.failToFindEjbRefByDependsOn(annotationValue, description.getComponentClassName());
} else if (components.size() != 1) {
throw EjbLogger.ROOT_LOGGER.failToCallEjbRefByDependsOn(annotationValue, description.getComponentClassName(), components);
}
final ComponentDescription component = components.iterator().next();
description.addDependency(component.getStartServiceName(), DependencyType.REQUIRED);
if (description instanceof SingletonComponentDescription) {
((SingletonComponentDescription) description).getDependsOn().add(component.getStartServiceName());
if (ROOT_LOGGER.isDebugEnabled()) {
ROOT_LOGGER.debugf(description.getEJBName() + " bean is dependent on " + component.getComponentName());
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class InterceptorAnnotationProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
return;
}
if (componentConfigurations == null || componentConfigurations.isEmpty()) {
return;
}
for (final ComponentDescription description : componentConfigurations) {
processComponentConfig(applicationClasses, deploymentReflectionIndex, description, deploymentUnit);
}
}
use of org.jboss.as.ee.component.ComponentDescription 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.ComponentDescription 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.ComponentDescription 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);
}
}
Aggregations