use of org.jboss.as.ee.component.EEApplicationClasses in project wildfly by wildfly.
the class PassivationAnnotationParsingProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
for (DotName annotationName : PASSIVATION_ANNOTATIONS) {
final List<AnnotationInstance> lifecycles = index.getAnnotations(annotationName);
for (AnnotationInstance annotation : lifecycles) {
processPassivation(eeModuleDescription, annotation.target(), annotationName, applicationClasses);
}
}
}
use of org.jboss.as.ee.component.EEApplicationClasses in project wildfly by wildfly.
the class HomeViewMergingProcessor 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);
if (eeModuleDescription == null) {
return;
}
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);
for (ComponentDescription componentConfiguration : componentConfigurations) {
if (componentConfiguration instanceof SessionBeanComponentDescription) {
try {
processComponentConfig(deploymentUnit, applicationClasses, module, deploymentReflectionIndex, (SessionBeanComponentDescription) componentConfiguration);
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.failToMergeData(componentConfiguration.getComponentName(), e);
}
}
}
if (appclient) {
for (ComponentDescription componentDescription : deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
if (componentDescription instanceof SessionBeanComponentDescription) {
try {
processComponentConfig(deploymentUnit, applicationClasses, module, deploymentReflectionIndex, (SessionBeanComponentDescription) componentDescription);
} catch (Exception e) {
throw EjbLogger.ROOT_LOGGER.failToMergeData(componentDescription.getComponentName(), e);
}
}
}
}
}
use of org.jboss.as.ee.component.EEApplicationClasses in project wildfly by wildfly.
the class JSFManagedBeanProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClassesDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (index == null) {
return;
}
if (module == null) {
return;
}
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
return;
}
final Set<String> managedBeanClasses = new HashSet<String>();
handleAnnotations(index, managedBeanClasses);
processXmlManagedBeans(deploymentUnit, managedBeanClasses);
for (String managedBean : managedBeanClasses) {
//fail due to missing managed beans
try {
final Class<?> componentClass = module.getClassLoader().loadClass(managedBean);
componentClass.getConstructor();
} catch (ClassNotFoundException e) {
JSFLogger.ROOT_LOGGER.managedBeanLoadFail(managedBean);
continue;
} catch (NoSuchMethodException e) {
JSFLogger.ROOT_LOGGER.managedBeanNoDefaultConstructor(managedBean);
continue;
}
installManagedBeanComponent(managedBean, moduleDescription, deploymentUnit, applicationClassesDescription);
}
}
use of org.jboss.as.ee.component.EEApplicationClasses in project wildfly by wildfly.
the class EjbJarParsingDeploymentUnitProcessor method deploy.
/**
* Finds an ejb-jar.xml (at WEB-INF of a .war or META-INF of a .jar) parses the file and creates
* metadata out of it. The metadata is then attached to the deployment unit.
*
* @param deploymentPhase
* @throws DeploymentUnitProcessingException
*
*/
@Override
public void deploy(DeploymentPhaseContext deploymentPhase) throws DeploymentUnitProcessingException {
// get hold of the deployment unit.
final DeploymentUnit deploymentUnit = deploymentPhase.getDeploymentUnit();
// get the root of the deployment unit
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClassesDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final EjbJarMetaData ejbJarMetaData;
final EjbJarMetaData specMetaData = parseEjbJarXml(deploymentUnit);
final EjbJarMetaData jbossMetaData = parseJBossEjb3Xml(deploymentUnit);
if (specMetaData == null) {
if (jbossMetaData == null)
return;
ejbJarMetaData = jbossMetaData;
} else if (jbossMetaData == null) {
ejbJarMetaData = specMetaData;
} else {
ejbJarMetaData = jbossMetaData.createMerged(specMetaData);
}
// Mark it as an EJB deployment
EjbDeploymentMarker.mark(deploymentUnit);
if (!deploymentUnit.hasAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION)) {
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EjbJarDescription ejbModuleDescription = new EjbJarDescription(moduleDescription, applicationClassesDescription, deploymentUnit.getName().endsWith(".war"));
deploymentUnit.putAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION, ejbModuleDescription);
}
// attach the EjbJarMetaData to the deployment unit
deploymentUnit.putAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA, ejbJarMetaData);
// if the jboss-ejb3.xml has a distinct-name configured then attach it to the deployment unit
if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) {
deploymentUnit.putAttachment(org.jboss.as.ee.structure.Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName());
}
if (ejbJarMetaData.getModuleName() != null) {
eeModuleDescription.setModuleName(ejbJarMetaData.getModuleName());
}
if (ejbJarMetaData.isMetadataComplete()) {
MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true);
}
if (!ejbJarMetaData.isEJB3x()) {
//EJB spec 20.5.1, we do not process annotations for older deployments
MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true);
}
if (ejbJarMetaData.getEnterpriseBeans() != null) {
//check for entity beans
StringBuilder beans = new StringBuilder();
boolean error = false;
for (AbstractEnterpriseBeanMetaData bean : ejbJarMetaData.getEnterpriseBeans()) {
if (bean.getEjbType() == EjbType.ENTITY) {
if (!error) {
error = true;
} else {
beans.append(", ");
}
beans.append(bean.getEjbName());
}
}
if (error) {
throw EjbLogger.ROOT_LOGGER.entityBeansAreNotSupported(beans.toString());
}
}
}
use of org.jboss.as.ee.component.EEApplicationClasses in project wildfly by wildfly.
the class MessageDrivenComponentDescription method createConfiguration.
@Override
public ComponentConfiguration createConfiguration(final ClassReflectionIndex classIndex, final ClassLoader moduleClassLoader, final ModuleLoader moduleLoader) {
final ComponentConfiguration mdbComponentConfiguration = new ComponentConfiguration(this, classIndex, moduleClassLoader, moduleLoader);
// setup the component create service
final Class<?> messageListenerInterface;
try {
messageListenerInterface = Class.forName(getMessageListenerInterfaceName(), true, moduleClassLoader);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
mdbComponentConfiguration.setComponentCreateServiceFactory(new MessageDrivenComponentCreateServiceFactory(messageListenerInterface));
// setup the configurator to inject the PoolConfig in the MessageDrivenComponentCreateService
final MessageDrivenComponentDescription mdbComponentDescription = (MessageDrivenComponentDescription) mdbComponentConfiguration.getComponentDescription();
mdbComponentConfiguration.getCreateDependencies().add(new PoolInjectingConfigurator(mdbComponentDescription));
// setup the configurator to inject the resource adapter
mdbComponentConfiguration.getCreateDependencies().add(new ResourceAdapterInjectingConfiguration());
mdbComponentConfiguration.getCreateDependencies().add(new DependencyConfigurator<MessageDrivenComponentCreateService>() {
@Override
public void configureDependency(final ServiceBuilder<?> serviceBuilder, final MessageDrivenComponentCreateService mdbComponentCreateService) throws DeploymentUnitProcessingException {
serviceBuilder.addDependency(EJBUtilities.SERVICE_NAME, EJBUtilities.class, mdbComponentCreateService.getEJBUtilitiesInjector());
serviceBuilder.addDependency(SuspendController.SERVICE_NAME, SuspendController.class, mdbComponentCreateService.getSuspendControllerInjectedValue());
}
});
// add the bmt interceptor
if (TransactionManagementType.BEAN.equals(this.getTransactionManagementType())) {
getConfigurators().add(new ComponentConfigurator() {
@Override
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
// add the bmt interceptor factory
configuration.addComponentInterceptor(EjbBMTInterceptor.FACTORY, InterceptorOrder.Component.BMT_TRANSACTION_INTERCEPTOR, false);
}
});
} else {
getConfigurators().add(new ComponentConfigurator() {
@Override
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
final EEApplicationClasses applicationClasses = context.getDeploymentUnit().getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
InterceptorClassDescription interceptorConfig = ComponentDescription.mergeInterceptorConfig(configuration.getComponentClass(), applicationClasses.getClassByName(description.getComponentClassName()), description, MetadataCompleteMarker.isMetadataComplete(context.getDeploymentUnit()));
configuration.addPostConstructInterceptor(new LifecycleCMTTxInterceptor.Factory(interceptorConfig.getPostConstruct(), true), InterceptorOrder.ComponentPostConstruct.TRANSACTION_INTERCEPTOR);
configuration.addPreDestroyInterceptor(new LifecycleCMTTxInterceptor.Factory(interceptorConfig.getPreDestroy(), true), InterceptorOrder.ComponentPreDestroy.TRANSACTION_INTERCEPTOR);
configuration.addTimeoutViewInterceptor(TimerCMTTxInterceptor.FACTORY, InterceptorOrder.View.CMT_TRANSACTION_INTERCEPTOR);
}
});
}
return mdbComponentConfiguration;
}
Aggregations