@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final List<MessageDestinationInjectionSource> injections = phaseContext.getDeploymentUnit().getAttachmentList(Attachments.MESSAGE_DESTINATIONS); for (final MessageDestinationInjectionSource injection : injections) { injection.resolve(phaseContext); } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final List<EEModuleDescription> descriptions = new ArrayList<EEModuleDescription>(); for (final DeploymentUnit visibleDeployment : deploymentUnit.getAttachmentList(org.jboss.as.server.deployment.Attachments.ACCESSIBLE_SUB_DEPLOYMENTS)) { final EEModuleDescription description = visibleDeployment.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if (description != null) { descriptions.add(description); } } final EEApplicationClasses classes = new EEApplicationClasses(descriptions); deploymentUnit.putAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION, classes); }
private ResourceRootHandler(DeploymentUnit deploymentUnit, Components components, Map<ResourceRoot, Index> indexes) { this.deploymentUnit = deploymentUnit; this.explicitBeanArchives = deploymentUnit.getAttachment(ExplicitBeanArchiveMetadataContainer.ATTACHMENT_KEY); this.module = deploymentUnit.getAttachment(Attachments.MODULE); this.indexes = indexes; this.components = components; this.reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); this.deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); this.classesResourceRoot = deploymentUnit.getAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT); HashSet<AnnotationType> annotationTypes = new HashSet<>(getRootDeploymentUnit(deploymentUnit).getAttachment(WeldAttachments.BEAN_DEFINING_ANNOTATIONS)); List<DotName> definingAnnotations = getRootDeploymentUnit(deploymentUnit).getAttachmentList(InjectionTargetDefiningAnnotations.INJECTION_TARGET_DEFINING_ANNOTATIONS); for(DotName annotation : definingAnnotations) { annotationTypes.add(new AnnotationType(annotation, false)); } this.beanDefiningAnnotations = annotationTypes; this.requireBeanDescriptor = getRootDeploymentUnit(deploymentUnit).getAttachment(WeldConfiguration.ATTACHMENT_KEY).isRequireBeanDescriptor(); }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final List<DeploymentUnit> subDeployments = deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS); final Set<String> moduleNames = new HashSet<String>(); final Set<String> moduleConflicts = new HashSet<String>(); //look for modules with the same name // for(DeploymentUnit deployment : subDeployments) { final EEModuleDescription module = deployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if(module != null) { if(moduleNames.contains(module.getModuleName())) { moduleConflicts.add(module.getModuleName()); } moduleNames.add(module.getModuleName()); } } for(DeploymentUnit deployment : subDeployments) { final EEModuleDescription module = deployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); if(module != null) { if(moduleConflicts.contains(module.getModuleName())) { module.setModuleName(deployment.getName()); } } } }
private void processModuleDescription(final EEModuleDescription moduleDescription, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext) { final ConcurrentContext concurrentContext = moduleDescription.getConcurrentContext(); // setup context setupConcurrentContext(concurrentContext, moduleDescription.getApplicationName(), moduleDescription.getModuleName(), null, deploymentUnit.getAttachment(MODULE).getClassLoader(), moduleDescription.getNamespaceContextSelector(), deploymentUnit, phaseContext.getServiceTarget()); // add setup action for web modules final ConcurrentContextSetupAction setupAction = new ConcurrentContextSetupAction(concurrentContext); deploymentUnit.getAttachmentList(Attachments.WEB_SETUP_ACTIONS).add(setupAction); }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { if (phaseContext.getAttachment(Attachments.DEPLOYMENT_TYPE) == DeploymentType.EAR) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // Make sure the next phase of this EAR depends on this phase of not just the EAR but also all subdeployments for (DeploymentUnit subdeployment : deploymentUnit.getAttachmentList(SUB_DEPLOYMENTS)) { phaseContext.addToAttachmentList(NEXT_PHASE_DEPS, Services.deploymentUnitName(deploymentUnit.getName(), subdeployment.getName(), phaseContext.getPhase())); } } }
/** * Process a deployment for jboss-beans.xml files. * Will parse the xml file and attach a configuration discovered during processing. * * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException * */ @Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit unit = phaseContext.getDeploymentUnit(); final VirtualFile deploymentRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); parseDescriptors(unit, deploymentRoot); final List<ResourceRoot> resourceRoots = unit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot root : resourceRoots) parseDescriptors(unit, root.getRoot()); }
return deploymentUnit.getAttachment(BatchAttachments.JOB_XML_RESOLVER); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final ClassLoader classLoader = module.getClassLoader(); WildFlyJobXmlResolver resolver; for (ResourceRoot r : deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)) { if (! SubDeploymentMarker.isSubDeployment(r)) { resources.add(r); resolver = create(classLoader, deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)); } else { resolver = create(classLoader, Collections.singletonList(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT))); final List<DeploymentUnit> accessibleDeployments = deploymentUnit.getAttachmentList(Attachments.ACCESSIBLE_SUB_DEPLOYMENTS); for (DeploymentUnit subDeployment : accessibleDeployments) {
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } List<ResourceRoot> potentialSubDeployments = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : potentialSubDeployments) { if (ModuleRootMarker.isModuleRoot(resourceRoot)) { // module roots cannot be managed bean jars continue; } final Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX); if (index != null) { if (!index.getAnnotations(MANAGED_BEAN).isEmpty()) { //this is a managed bean deployment SubDeploymentMarker.mark(resourceRoot); ModuleRootMarker.mark(resourceRoot); } } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // Only process EJB deployments if (!EjbDeploymentMarker.isEjbDeployment(deploymentUnit)) { return; } final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final Collection<ComponentDescription> componentDescriptions = eeModuleDescription.getComponentDescriptions(); if (componentDescriptions != null) { for (ComponentDescription componentDescription : componentDescriptions) { // process only EJB session beans if (componentDescription instanceof SessionBeanComponentDescription) { this.setupJNDIBindings((EJBComponentDescription) componentDescription, deploymentUnit); } } } if (appclient) { for (final ComponentDescription component : deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) { this.setupJNDIBindings((EJBComponentDescription) component, deploymentUnit); } } }
roots.add(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT)); roots.addAll(deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)); for (ResourceRoot root : roots) { VirtualFile c = root.getRoot().getChild(META_INF_FACES); CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX); for (DotName annotation : JSF_ANNOTATIONS) { List<AnnotationInstance> annotations = index.getAnnotations(annotation);
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { final VirtualFile rootFile = resourceRoot.getRoot(); if (!SubDeploymentMarker.isSubDeployment(resourceRoot)) { final VirtualFile sarDescriptor = rootFile .getChild(ServiceDeploymentParsingProcessor.SERVICE_DESCRIPTOR_PATH); if (sarDescriptor.exists()) { SubDeploymentMarker.mark(resourceRoot); ModuleRootMarker.mark(resourceRoot); } } } }
@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 DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX); final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION); for (ComponentDescription componentDescription : deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) { if (componentDescription instanceof SessionBeanComponentDescription) { try {
final List<ResourceRoot> roots = deploymentUnit.getAttachmentList(org.jboss.as.server.deployment.Attachments.RESOURCE_ROOTS); if(roots != null) for(ResourceRoot root : roots) { if(SubDeploymentMarker.isSubDeployment(root)) { final ResourceRoot parentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final String relativePath = root.getRoot().getPathNameRelativeTo(parentRoot.getRoot()); final ServiceName subDeploymentServiceName = Services.deploymentUnitName(deploymentUnit.getName(), relativePath);
@Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration viewConfiguration) throws DeploymentUnitProcessingException { viewConfiguration.addViewInterceptor(LoggingInterceptor.FACTORY, InterceptorOrder.View.EJB_EXCEPTION_LOGGING_INTERCEPTOR); final ClassLoader classLoader = componentConfiguration.getModuleClassLoader(); viewConfiguration.addViewInterceptor(AccessCheckingInterceptor.getFactory(), InterceptorOrder.View.CHECKING_INTERCEPTOR); viewConfiguration.addViewInterceptor(new ImmediateInterceptorFactory(new ContextClassLoaderInterceptor(classLoader)), InterceptorOrder.View.TCCL_INTERCEPTOR); //If this is the EJB 2.x local or home view add the exception transformer interceptor if (view.getMethodIntf() == MethodIntf.LOCAL && EJBLocalObject.class.isAssignableFrom(viewConfiguration.getViewClass())) { viewConfiguration.addViewInterceptor(EjbExceptionTransformingInterceptorFactories.LOCAL_INSTANCE, InterceptorOrder.View.REMOTE_EXCEPTION_TRANSFORMER); } else if (view.getMethodIntf() == MethodIntf.LOCAL_HOME) { viewConfiguration.addViewInterceptor(EjbExceptionTransformingInterceptorFactories.LOCAL_INSTANCE, InterceptorOrder.View.REMOTE_EXCEPTION_TRANSFORMER); } final List<SetupAction> ejbSetupActions = context.getDeploymentUnit().getAttachmentList(Attachments.OTHER_EE_SETUP_ACTIONS); if (!ejbSetupActions.isEmpty()) { viewConfiguration.addViewInterceptor(AdditionalSetupInterceptor.factory(ejbSetupActions), InterceptorOrder.View.EE_SETUP); } viewConfiguration.addViewInterceptor(WaitTimeInterceptor.FACTORY, InterceptorOrder.View.EJB_WAIT_TIME_INTERCEPTOR); viewConfiguration.addViewInterceptor(shutDownInterceptorFactory, InterceptorOrder.View.SHUTDOWN_INTERCEPTOR); } });
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); ServiceName namingStoreServiceName = support.getCapabilityServiceName(NamingService.CAPABILITY_NAME); //this will always be up but we need to make sure the naming service is //not shut down before the deployment is undeployed when the container is shut down phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, namingStoreServiceName); List<ServiceName> dependencies = deploymentUnit.getAttachmentList(Attachments.JNDI_DEPENDENCIES); final ServiceName serviceName = serviceName(deploymentUnit.getServiceName()); final ServiceBuilder<?> serviceBuilder = phaseContext.getServiceTarget().addService(serviceName, new RuntimeBindReleaseService()); for (final ServiceName dependency : dependencies) { serviceBuilder.requires(dependency); } if(deploymentUnit.getParent() != null) { for (final ServiceName jndiDependency : deploymentUnit.getParent().getAttachment(Attachments.JNDI_DEPENDENCIES)) { serviceBuilder.requires(jndiDependency); } } serviceBuilder.requires(namingStoreServiceName); serviceBuilder.install(); }
protected void processDeploymentDescriptor(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA); if (ejbJarMetaData == null) { return; final List<ComponentDescription> additionalComponents = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS); annotatedEJBs = new SimpleSet<String>() { @Override
private void addServices(final ServiceTarget target, final JBossServiceConfig mBeanConfig, final ClassLoader classLoader, final DeploymentReflectionIndex index, ServiceComponentInstantiator componentInstantiator, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final String mBeanClassName = mBeanConfig.getCode(); final List<ClassReflectionIndex> mBeanClassHierarchy = ReflectionUtils.getClassHierarchy(mBeanClassName, index, classLoader); final Object mBeanInstance = newInstance(mBeanConfig, mBeanClassHierarchy, classLoader); final String mBeanName = mBeanConfig.getName(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final MBeanServices mBeanServices = new MBeanServices(mBeanName, mBeanInstance, mBeanClassHierarchy, target, componentInstantiator, deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS), classLoader, mbeanServerServiceName); final JBossServiceDependencyConfig[] dependencyConfigs = mBeanConfig.getDependencyConfigs(); addDependencies(dependencyConfigs, mBeanClassHierarchy, mBeanServices, mBeanInstance); final JBossServiceDependencyListConfig[] dependencyListConfigs = mBeanConfig.getDependencyConfigLists(); addDependencyLists(dependencyListConfigs, mBeanClassHierarchy, mBeanServices, mBeanInstance); final JBossServiceAttributeConfig[] attributeConfigs = mBeanConfig.getAttributeConfigs(); addAttributes(attributeConfigs, mBeanClassHierarchy, mBeanServices, classLoader, mBeanInstance); // register all mBean related services mBeanServices.install(); }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(MODULE); final EEModuleConfiguration moduleConfiguration = deploymentUnit.getAttachment(EE_MODULE_CONFIGURATION); if (module == null || moduleConfiguration == null) { return; } ComponentRegistry componentRegistry = deploymentUnit.getAttachment(COMPONENT_REGISTRY); final List<ServiceName> dependencies = deploymentUnit.getAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES); final ServiceName bindingDependencyService = JndiNamingDependencyProcessor.serviceName(deploymentUnit.getServiceName()); // Iterate through each component, installing it into the container for (final ComponentConfiguration configuration : moduleConfiguration.getComponentConfigurations()) { try { ROOT_LOGGER.tracef("Installing component %s", configuration.getComponentClass().getName()); deployComponent(phaseContext, configuration, dependencies, bindingDependencyService); componentRegistry.addComponent(configuration); //we need to make sure that the web deployment has a dependency on all components it the app, so web components are started //when the web subsystem is starting //we only add a dependency on components in the same sub deployment, otherwise we get circular dependencies when initialize-in-order is used deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.WEB_DEPENDENCIES, configuration.getComponentDescription().getStartServiceName()); } catch (Exception e) { throw EeLogger.ROOT_LOGGER.failedToInstallComponent(e, configuration.getComponentName()); } } }
final List<SetupAction> setupActions = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS); CapabilityServiceSupport capabilitySupport = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final List<ServiceName> components = deploymentUnit.getAttachmentList(WebComponentDescription.WEB_COMPONENTS); .setAttributes(deploymentUnit.getAttachmentList(ServletContextAttribute.ATTACHMENT_KEY)) .setContextPath(pathName) .setSharedSessionManagerConfig(sharedSessionManagerConfig) .setOverlays(warMetaData.getOverlays()) .setExpressionFactoryWrappers(deploymentUnit.getAttachmentList(ExpressionFactoryWrapper.ATTACHMENT_KEY)) .setPredicatedHandlers(deploymentUnit.getAttachment(UndertowHandlersDeploymentProcessor.PREDICATED_HANDLERS)) .setInitialHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_INITIAL_HANDLER_CHAIN_WRAPPERS)) .setInnerHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_INNER_HANDLER_CHAIN_WRAPPERS)) .setOuterHandlerChainWrappers(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_OUTER_HANDLER_CHAIN_WRAPPERS)) .setThreadSetupActions(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_THREAD_SETUP_ACTIONS)) .setServletExtensions(deploymentUnit.getAttachmentList(UndertowAttachments.UNDERTOW_SERVLET_EXTENSIONS)) .setExternalResources(deploymentUnit.getAttachmentList(UndertowAttachments.EXTERNAL_RESOURCES)) .setAllowSuspendedRequests(deploymentUnit.getAttachmentList(UndertowAttachments.ALLOW_REQUEST_WHEN_SUSPENDED)) .createUndertowDeploymentInfoService(); .addDependency(hostServiceName, Host.class, service.getHost()) .addDependency(deploymentInfoServiceName, DeploymentInfo.class, service.getDeploymentInfoInjectedValue()); for (final ServiceName webDependency : deploymentUnit.getAttachmentList(Attachments.WEB_DEPENDENCIES)) { builder.requires(webDependency);