use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class EjbContextJndiBindingProcessor method deploy.
/**
* {@inheritDoc} *
*/
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEResourceReferenceProcessorRegistry registry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY);
//setup ejb context jndi handlers
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EJBContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(SessionContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EntityContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(MessageDrivenContext.class));
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 EjbIIOPDeploymentUnitProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!IIOPDeploymentMarker.isIIOPDeployment(deploymentUnit)) {
return;
}
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit)) {
return;
}
// a bean-name -> IIOPMetaData map, reflecting the assembly descriptor IIOP configuration.
Map<String, IIOPMetaData> iiopMetaDataMap = new HashMap<String, IIOPMetaData>();
final EjbJarMetaData ejbMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (ejbMetaData != null && ejbMetaData.getAssemblyDescriptor() != null) {
List<IIOPMetaData> iiopMetaDatas = ejbMetaData.getAssemblyDescriptor().getAny(IIOPMetaData.class);
if (iiopMetaDatas != null && iiopMetaDatas.size() > 0) {
for (IIOPMetaData metaData : iiopMetaDatas) {
iiopMetaDataMap.put(metaData.getEjbName(), metaData);
}
}
}
final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
if (moduleDescription != null) {
for (final ComponentDescription componentDescription : moduleDescription.getComponentDescriptions()) {
if (componentDescription instanceof EJBComponentDescription) {
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentDescription;
if (ejbComponentDescription.getEjbRemoteView() != null && ejbComponentDescription.getEjbHomeView() != null) {
// check if there is IIOP metadata for the bean - first using the bean name, then the wildcard "*" if needed.
IIOPMetaData iiopMetaData = iiopMetaDataMap.get(ejbComponentDescription.getEJBName());
if (iiopMetaData == null) {
iiopMetaData = iiopMetaDataMap.get(IIOPMetaData.WILDCARD_BEAN_NAME);
}
// has been enabled by default in the EJB3 subsystem.
if (iiopMetaData != null || settingsService.isEnabledByDefault()) {
processEjb(ejbComponentDescription, deploymentReflectionIndex, module, phaseContext.getServiceTarget(), iiopMetaData);
}
}
}
}
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class AroundTimeoutAnnotationParsingProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
return;
}
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
final List<AnnotationInstance> aroundInvokes = index.getAnnotations(AROUND_TIMEOUT_ANNOTATION_NAME);
for (AnnotationInstance annotation : aroundInvokes) {
processAroundInvoke(annotation.target(), eeModuleDescription);
}
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class DeploymentRepositoryProcessor 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;
}
// Note, we do not use the EEModuleDescription.getApplicationName() because that API returns the
// module name if the top level unit isn't a .ear, which is not what we want. We really want a
// .ear name as application name (that's the semantic in EJB spec). So use EEModuleDescription.getEarApplicationName
String applicationName = eeModuleDescription.getEarApplicationName();
// if it's not a .ear deployment then set app name to empty string
applicationName = applicationName == null ? "" : applicationName;
final DeploymentModuleIdentifier identifier = new DeploymentModuleIdentifier(applicationName, eeModuleDescription.getModuleName(), eeModuleDescription.getDistinctName());
final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions();
final Map<String, EjbDeploymentInformation> deploymentInformationMap = new HashMap<String, EjbDeploymentInformation>();
final Set<ServiceName> componentStartServices = new HashSet<ServiceName>();
final Map<ServiceName, InjectedValue<?>> injectedValues = new HashMap<ServiceName, InjectedValue<?>>();
for (final ComponentDescription component : componentDescriptions) {
if (component instanceof EJBComponentDescription) {
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) component;
componentStartServices.add(component.getStartServiceName());
final InjectedValue<EJBComponent> componentInjectedValue = new InjectedValue<EJBComponent>();
injectedValues.put(component.getCreateServiceName(), componentInjectedValue);
final Map<String, InjectedValue<ComponentView>> remoteViews = new HashMap<String, InjectedValue<ComponentView>>();
final Map<String, InjectedValue<ComponentView>> localViews = new HashMap<String, InjectedValue<ComponentView>>();
for (final ViewDescription view : ejbComponentDescription.getViews()) {
boolean remoteView = false;
if (view instanceof EJBViewDescription) {
final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf();
if (viewType == MethodIntf.HOME || viewType == MethodIntf.REMOTE) {
remoteView = true;
}
}
final InjectedValue<ComponentView> componentViewInjectedValue = new InjectedValue<ComponentView>();
if (remoteView) {
remoteViews.put(view.getViewClassName(), componentViewInjectedValue);
} else {
localViews.put(view.getViewClassName(), componentViewInjectedValue);
}
injectedValues.put(view.getServiceName(), componentViewInjectedValue);
}
final InjectedValue<EjbIIOPService> iorFactory = new InjectedValue<EjbIIOPService>();
if (ejbComponentDescription.isExposedViaIiop()) {
injectedValues.put(ejbComponentDescription.getServiceName().append(EjbIIOPService.SERVICE_NAME), iorFactory);
}
final EjbDeploymentInformation info = new EjbDeploymentInformation(ejbComponentDescription.getEJBName(), componentInjectedValue, remoteViews, localViews, module.getClassLoader(), iorFactory);
deploymentInformationMap.put(ejbComponentDescription.getEJBName(), info);
}
}
final StartupCountdown countdown = deploymentUnit.getAttachment(Attachments.STARTUP_COUNTDOWN);
final ModuleDeployment deployment = new ModuleDeployment(identifier, deploymentInformationMap, countdown);
ServiceName moduleDeploymentService = deploymentUnit.getServiceName().append(ModuleDeployment.SERVICE_NAME);
final ServiceBuilder<ModuleDeployment> builder = phaseContext.getServiceTarget().addService(moduleDeploymentService, deployment);
for (Map.Entry<ServiceName, InjectedValue<?>> entry : injectedValues.entrySet()) {
builder.addDependency(entry.getKey(), (InjectedValue<Object>) entry.getValue());
}
builder.addDependency(DeploymentRepository.SERVICE_NAME, DeploymentRepository.class, deployment.getDeploymentRepository());
builder.install();
final ModuleDeployment.ModuleDeploymentStartService deploymentStart = new ModuleDeployment.ModuleDeploymentStartService(identifier, countdown);
final ServiceBuilder<Void> startBuilder = phaseContext.getServiceTarget().addService(deploymentUnit.getServiceName().append(ModuleDeployment.START_SERVICE_NAME), deploymentStart);
startBuilder.addDependencies(componentStartServices);
startBuilder.addDependency(moduleDeploymentService);
startBuilder.addDependency(DeploymentRepository.SERVICE_NAME, DeploymentRepository.class, deploymentStart.getDeploymentRepository());
startBuilder.install();
}
use of org.jboss.as.ee.component.EEModuleDescription in project wildfly by wildfly.
the class EJBViewDescription method createInjectionSource.
@Override
protected InjectionSource createInjectionSource(final ServiceName serviceName, Value<ClassLoader> viewClassLoader, boolean appclient) {
if (methodIntf != MethodIntf.REMOTE && methodIntf != MethodIntf.HOME) {
return super.createInjectionSource(serviceName, viewClassLoader, appclient);
} else {
final EJBComponentDescription componentDescription = getComponentDescription();
final EEModuleDescription desc = componentDescription.getModuleDescription();
final String earApplicationName = desc.getEarApplicationName();
return new RemoteViewInjectionSource(serviceName, earApplicationName, desc.getModuleName(), desc.getDistinctName(), componentDescription.getComponentName(), getViewClassName(), componentDescription.isStateful(), viewClassLoader, appclient);
}
}
Aggregations