use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class ApplicationClientParsingDeploymentProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
return;
}
final ApplicationClientMetaData appClientMD = parseAppClient(deploymentUnit, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
final JBossClientMetaData jbossClientMD = parseJBossClient(deploymentUnit, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
final JBossClientMetaData merged;
if (appClientMD == null && jbossClientMD == null) {
return;
} else if (appClientMD == null) {
merged = jbossClientMD;
} else {
merged = new JBossClientMetaData();
merged.setEnvironmentRefsGroupMetaData(new AppClientEnvironmentRefsGroupMetaData());
merged.merge(jbossClientMD, appClientMD);
}
if (merged.isMetadataComplete()) {
MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true);
}
deploymentUnit.putAttachment(AppClientAttachments.APPLICATION_CLIENT_META_DATA, merged);
final DeploymentDescriptorEnvironment environment = new DeploymentDescriptorEnvironment("java:module/env/", merged.getEnvironmentRefsGroupMetaData());
deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, environment);
//override module name if applicable
if (merged.getModuleName() != null && !merged.getModuleName().isEmpty()) {
final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
description.setModuleName(merged.getModuleName());
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class ApplicationClientManifestProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) {
return;
}
final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final Manifest manifest = root.getAttachment(Attachments.MANIFEST);
if (manifest != null) {
Attributes main = manifest.getMainAttributes();
if (main != null) {
String mainClass = main.getValue("Main-Class");
if (mainClass != null && !mainClass.isEmpty()) {
try {
final Class<?> clazz = module.getClassLoader().loadClass(mainClass);
deploymentUnit.putAttachment(AppClientAttachments.MAIN_CLASS, clazz);
final ApplicationClientComponentDescription description = new ApplicationClientComponentDescription(clazz.getName(), moduleDescription, deploymentUnit.getServiceName(), applicationClasses);
moduleDescription.addComponent(description);
deploymentUnit.putAttachment(AppClientAttachments.APPLICATION_CLIENT_COMPONENT, description);
final DeploymentDescriptorEnvironment environment = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT);
if (environment != null) {
DescriptorEnvironmentLifecycleMethodProcessor.handleMethods(environment, moduleDescription, mainClass);
}
} catch (ClassNotFoundException e) {
throw AppClientLogger.ROOT_LOGGER.cannotLoadAppClientMainClass(e);
}
}
}
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class DataSourceDefinitionInjectionSource method getResourceValue.
public void getResourceValue(final ResolutionContext context, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final String poolName = uniqueName(context, jndiName);
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(context.getApplicationName(), context.getModuleName(), context.getComponentName(), !context.isCompUsesModule(), jndiName);
final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
try {
final Class<?> clazz = module.getClassLoader().loadClass(className);
clearUnknownProperties(reflectionIndex, clazz, properties);
populateProperties(reflectionIndex, clazz, properties);
DsSecurityImpl dsSecurity = new DsSecurityImpl(user, password, null, false, null, null);
if (XADataSource.class.isAssignableFrom(clazz) && transactional) {
final DsXaPoolImpl xaPool = new DsXaPoolImpl(minPoolSize < 0 ? Defaults.MIN_POOL_SIZE : Integer.valueOf(minPoolSize), initialPoolSize < 0 ? Defaults.INITIAL_POOL_SIZE : Integer.valueOf(initialPoolSize), maxPoolSize < 1 ? Defaults.MAX_POOL_SIZE : Integer.valueOf(maxPoolSize), Defaults.PREFILL, Defaults.USE_STRICT_MIN, Defaults.FLUSH_STRATEGY, Defaults.IS_SAME_RM_OVERRIDE, Defaults.INTERLEAVING, Defaults.PAD_XID, Defaults.WRAP_XA_RESOURCE, Defaults.NO_TX_SEPARATE_POOL, Boolean.FALSE, null, Defaults.FAIR, null);
final ModifiableXaDataSource dataSource = new ModifiableXaDataSource(transactionIsolation(), null, dsSecurity, null, null, null, null, null, null, poolName, true, jndiName, false, false, Defaults.CONNECTABLE, Defaults.TRACKING, Defaults.MCP, Defaults.ENLISTMENT_TRACE, properties, className, null, null, xaPool, null);
final XaDataSourceService xds = new XaDataSourceService(bindInfo.getBinderServiceName().getCanonicalName(), bindInfo, module.getClassLoader());
xds.getDataSourceConfigInjector().inject(dataSource);
startDataSource(xds, bindInfo, eeModuleDescription, context, phaseContext.getServiceTarget(), serviceBuilder, injector);
} else {
final DsPoolImpl commonPool = new DsPoolImpl(minPoolSize < 0 ? Defaults.MIN_POOL_SIZE : Integer.valueOf(minPoolSize), initialPoolSize < 0 ? Defaults.INITIAL_POOL_SIZE : Integer.valueOf(initialPoolSize), maxPoolSize < 1 ? Defaults.MAX_POOL_SIZE : Integer.valueOf(maxPoolSize), Defaults.PREFILL, Defaults.USE_STRICT_MIN, Defaults.FLUSH_STRATEGY, Boolean.FALSE, null, Defaults.FAIR, null);
final ModifiableDataSource dataSource = new ModifiableDataSource(url, null, className, null, transactionIsolation(), properties, null, dsSecurity, null, null, null, null, null, false, poolName, true, jndiName, Defaults.SPY, Defaults.USE_CCM, transactional, Defaults.CONNECTABLE, Defaults.TRACKING, Defaults.MCP, Defaults.ENLISTMENT_TRACE, commonPool);
final LocalDataSourceService ds = new LocalDataSourceService(bindInfo.getBinderServiceName().getCanonicalName(), bindInfo, module.getClassLoader());
ds.getDataSourceConfigInjector().inject(dataSource);
startDataSource(ds, bindInfo, eeModuleDescription, context, phaseContext.getServiceTarget(), serviceBuilder, injector);
}
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class JPAAnnotationProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
// @PersistenceContext
List<AnnotationInstance> persistenceContexts = index.getAnnotations(PERSISTENCE_CONTEXT_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceContext annotations
this.processPersistenceAnnotations(deploymentUnit, eeModuleDescription, persistenceContexts, applicationClasses);
// @PersistenceContexts
List<AnnotationInstance> collectionPersistenceContexts = index.getAnnotations(PERSISTENCE_CONTEXTS_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceContext annotations
processPersistenceAnnotations(deploymentUnit, eeModuleDescription, collectionPersistenceContexts, applicationClasses);
// @PersistenceUnits
List<AnnotationInstance> collectionPersistenceunits = index.getAnnotations(PERSISTENCE_UNITS_ANNOTATION_NAME);
processPersistenceAnnotations(deploymentUnit, eeModuleDescription, collectionPersistenceunits, applicationClasses);
// @PersistenceUnit
List<AnnotationInstance> persistenceUnits = index.getAnnotations(PERSISTENCE_UNIT_ANNOTATION_NAME);
// create binding and injection configurations out of the @PersistenceUnit annotations
this.processPersistenceAnnotations(deploymentUnit, eeModuleDescription, persistenceUnits, applicationClasses);
// if we found any @PersistenceContext or @PersistenceUnit annotations then mark this as a JPA deployment
if (!persistenceContexts.isEmpty() || !persistenceUnits.isEmpty() || !collectionPersistenceContexts.isEmpty() || !collectionPersistenceunits.isEmpty()) {
JPADeploymentMarker.mark(deploymentUnit);
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class MailSessionDefinitionInjectionSource method getResourceValue.
public void getResourceValue(final ResolutionContext context, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
try {
MailSessionService mailSessionService = new DirectMailSessionService(provider);
startMailSession(mailSessionService, jndiName, eeModuleDescription, context, phaseContext.getServiceTarget(), serviceBuilder, injector);
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
}
Aggregations