use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class EjbManagementDeploymentUnitProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleConfiguration moduleDescription = deploymentUnit.getAttachment(EE_MODULE_CONFIGURATION);
if (moduleDescription == null) {
// Nothing to do
return;
}
if (deploymentUnit.getParent() != null && deploymentUnit.getParent().getParent() != null) {
// We only expose management resources 2 levels deep
return;
}
// Iterate through each component, installing it into the container
for (final ComponentConfiguration configuration : moduleDescription.getComponentConfigurations()) {
try {
final ComponentDescription componentDescription = configuration.getComponentDescription();
if (componentDescription instanceof EJBComponentDescription) {
installManagementResource(configuration, deploymentUnit);
}
} catch (RuntimeException e) {
throw EjbLogger.ROOT_LOGGER.failedToInstallManagementResource(e, configuration.getComponentName());
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class AbstractDeploymentUnitProcessor method processDeploymentDescriptor.
protected void processDeploymentDescriptor(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
// find the EJB jar metadata and start processing it
final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (ejbJarMetaData == null) {
return;
}
final SimpleSet<String> annotatedEJBs;
if (appclient) {
final List<ComponentDescription> additionalComponents = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS);
annotatedEJBs = new SimpleSet<String>() {
@Override
public boolean contains(Object o) {
for (final ComponentDescription component : additionalComponents) {
if (component.getComponentName().equals(o)) {
return true;
}
}
return false;
}
};
} else {
final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit);
annotatedEJBs = new SimpleSet<String>() {
@Override
public boolean contains(Object o) {
return ejbJarDescription.hasComponent((String) o);
}
};
}
// process EJBs
final EnterpriseBeansMetaData ejbs = ejbJarMetaData.getEnterpriseBeans();
if (ejbs != null && !ejbs.isEmpty()) {
for (final EnterpriseBeanMetaData ejb : ejbs) {
final String beanName = ejb.getName();
// the important bit is to skip already processed EJBs via annotations
if (annotatedEJBs.contains(beanName)) {
continue;
}
processBeanMetaData(deploymentUnit, ejb);
}
}
EjbDeploymentMarker.mark(deploymentUnit);
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class BusinessViewAnnotationProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
return;
}
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION);
final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions();
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
if (module == null) {
return;
}
final ClassLoader moduleClassLoader = module.getClassLoader();
if (componentDescriptions != null) {
for (ComponentDescription componentDescription : componentDescriptions) {
if (componentDescription instanceof SessionBeanComponentDescription == false) {
continue;
}
final Class<?> ejbClass = this.getEjbClass(componentDescription.getComponentClassName(), moduleClassLoader);
try {
this.processViewAnnotations(deploymentUnit, ejbClass, (SessionBeanComponentDescription) componentDescription);
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.failedToProcessBusinessInterfaces(ejbClass, e);
}
}
}
if (appclient) {
for (ComponentDescription componentDescription : deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
if (componentDescription instanceof SessionBeanComponentDescription == false) {
continue;
}
final Class<?> ejbClass = this.getEjbClass(componentDescription.getComponentClassName(), moduleClassLoader);
try {
this.processViewAnnotations(deploymentUnit, ejbClass, (SessionBeanComponentDescription) componentDescription);
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.failedToProcessBusinessInterfaces(ejbClass, e);
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class AbstractMergingProcessor 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 Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
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 (componentConfigurations == null || componentConfigurations.isEmpty()) {
return;
}
for (ComponentDescription componentConfiguration : componentConfigurations) {
if (typeParam.isAssignableFrom(componentConfiguration.getClass())) {
try {
processComponentConfig(deploymentUnit, applicationClasses, module, deploymentReflectionIndex, (T) componentConfiguration);
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.failToMergeData(componentConfiguration.getComponentName(), e);
}
}
}
}
use of org.jboss.as.ee.component.ComponentDescription in project wildfly by wildfly.
the class BeanValidationFactoryDeployer method bindFactoryToJndi.
private void bindFactoryToJndi(LazyValidatorFactory factory, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, EEModuleDescription moduleDescription) {
if (moduleDescription == null) {
return;
}
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
//if this is a war we need to bind to the modules comp namespace
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName());
bindServices(factory, serviceTarget, moduleDescription, moduleDescription.getModuleName(), moduleContextServiceName);
}
for (ComponentDescription component : moduleDescription.getComponentDescriptions()) {
if (component.getNamingMode() == ComponentNamingMode.CREATE) {
final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName());
bindServices(factory, serviceTarget, moduleDescription, component.getComponentName(), compContextServiceName);
}
}
}
Aggregations