@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); // for (final ModuleIdentifier moduleIdentifier : DEPENDENCIES) { moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, true, false, true, false)); } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); 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(deploymentUnit, serviceTarget, moduleContextServiceName); } for(ComponentDescription component : moduleDescription.getComponentDescriptions()) { if(component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(),moduleDescription.getModuleName(),component.getComponentName()); bindServices(deploymentUnit, serviceTarget, compContextServiceName); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); Module module = deploymentUnit.getAttachment(Attachments.MODULE); SmallRyeConfigBuilder builder = new SmallRyeConfigBuilder(); builder.forClassLoader(module.getClassLoader()) .addDefaultSources() .addDiscoveredSources() .addDiscoveredConverters(); addConfigSourcesFromServices(builder, phaseContext.getServiceRegistry(), module.getClassLoader()); Config config = builder.build(); deploymentUnit.putAttachment(CONFIG, config); ConfigProviderResolver configProviderResolver = deploymentUnit.getAttachment(CONFIG_PROVIDER_RESOLVER); configProviderResolver.registerConfig(config, module.getClassLoader()); }
@Override public void deploy(DeploymentPhaseContext phaseContext) { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); addDependencies(deploymentUnit); phaseContext.addDeploymentDependency(ServiceNames.CONFIG_PROVIDER, SubsystemDeploymentProcessor.CONFIG_PROVIDER_RESOLVER); }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ServiceName serviceName = deploymentUnit.getServiceName().append(SERVICE_NAME); final CachedConnectionManagerSetupAction action = new CachedConnectionManagerSetupAction(serviceName); phaseContext.getServiceTarget().addService(serviceName, action) .addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, action.cachedConnectionManager) .addDependency(ConnectorServices.NON_TX_CCM_SERVICE, CachedConnectionManager.class, action.noTxCcmValue) .install(); deploymentUnit.addToAttachmentList(Attachments.WEB_SETUP_ACTIONS, action); deploymentUnit.addToAttachmentList(Attachments.OTHER_EE_SETUP_ACTIONS, action); }
@Override public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException { DeploymentUnit unit = context.getDeploymentUnit(); if (unit.getParent() == null) { SingletonDeploymentConfiguration config = unit.getAttachment(CONFIGURATION_KEY); if (config != null) { CapabilityServiceSupport support = unit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); context.addDependency(SingletonServiceNameFactory.SINGLETON_POLICY.getServiceName(support, config.getPolicy()), SingletonDeploymentProcessor.POLICY_KEY); } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { return; // Skip non web deployments WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); assert warMetaData != null; Map<String, WebFragmentMetaData> webFragments = warMetaData.getWebFragmentsMetaData(); warMetaData.setWebFragmentsMetaData(webFragments); List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (resourceRoot.getRoot().getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { VirtualFile webFragment = resourceRoot.getRoot().getChild(WEB_FRAGMENT_XML); if (webFragment.exists() && webFragment.isFile()) { InputStream is = null; try { webFragments.put(resourceRoot.getRootName(), webFragmentMetaData); UndertowLogger.ROOT_LOGGER.distributableDisabledInFragmentXml(deploymentUnit.getName(),resourceRoot.getRootName()); } catch (XMLStreamException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(webFragment.toString(), e.getLocation().getLineNumber(), e.getLocation().getColumnNumber()));
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot resourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if(resourceRoot == null) { return; final VirtualFile deploymentRoot = resourceRoot.getRoot(); if (deploymentRoot == null || !deploymentRoot.exists()) { return; final String deploymentRootName = deploymentRoot.getName().toLowerCase(Locale.ENGLISH); if (!deploymentRootName.endsWith(RAR_EXTENSION)) { return; final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); moduleSpecification.setPublicModule(true); Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS); final List<VirtualFile> childArchives = deploymentRoot.getChildren(CHILD_ARCHIVE_FILTER); final ResourceRoot childResource = new ResourceRoot(child, mountHandle); ModuleRootMarker.mark(childResource); deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource); resourceRoot.addToAttachmentList(Attachments.INDEX_IGNORE_PATHS, child.getPathNameRelativeTo(deploymentRoot));
/** * Process a deployment for standard ra deployment 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 { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final boolean resolveProperties = Util.shouldResolveSpec(deploymentUnit); final VirtualFile file = deploymentRoot.getRoot(); if (file == null || !file.exists()) return; final String deploymentRootName = file.getName().toLowerCase(Locale.ENGLISH); if (!deploymentRootName.endsWith(".rar")) { return; } final VirtualFile alternateDescriptor = deploymentRoot.getAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_CONNECTOR_DEPLOYMENT_DESCRIPTOR); String prefix = ""; if (deploymentUnit.getParent() != null) { prefix = deploymentUnit.getParent().getName() + "#"; } String deploymentName = prefix + file.getName(); ConnectorXmlDescriptor xmlDescriptor = process(resolveProperties, file, alternateDescriptor, deploymentName); phaseContext.getDeploymentUnit().putAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY, xmlDescriptor); }
final VirtualFile deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); if(deploymentRoot == null || !deploymentRoot.exists()) return; if(deploymentRoot.isDirectory()) { serviceXmlFile = deploymentRoot.getChild(SERVICE_DESCRIPTOR_PATH); } else if(deploymentRoot.getName().toLowerCase(Locale.ENGLISH).endsWith(SERVICE_DESCRIPTOR_SUFFIX)) { serviceXmlFile = deploymentRoot; final JBossServiceXmlDescriptorParser jBossServiceXmlDescriptorParser = new JBossServiceXmlDescriptorParser(JBossDescriptorPropertyReplacement.propertyReplacer(phaseContext.getDeploymentUnit())); xmlMapper.registerRootElement(new QName("urn:jboss:service:7.0", "server"), jBossServiceXmlDescriptorParser); xmlMapper.registerRootElement(new QName(null, "server"), jBossServiceXmlDescriptorParser); final JBossServiceXmlDescriptor xmlDescriptor = result.getResult(); if(xmlDescriptor != null) phaseContext.getDeploymentUnit().putAttachment(JBossServiceXmlDescriptor.ATTACHMENT_KEY, xmlDescriptor); else throw SarLogger.ROOT_LOGGER.failedXmlParsing(serviceXmlFile);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DeploymentUnit topLevelDeployment = Utils.getRootDeploymentUnit(deploymentUnit); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); if (!WeldDeploymentMarker.isPartOfWeldDeployment(topLevelDeployment)) { return; final Collection<ServiceName> dependencies = deploymentUnit.getAttachment(Attachments.JNDI_DEPENDENCIES); .getAttachment(WeldAttachments.DEPLOYMENT_ROOT_BEAN_DEPLOYMENT_ARCHIVE); if (rootBda == null) { rootBda = topLevelDeployment.getAttachment(WeldAttachments.DEPLOYMENT_ROOT_BEAN_DEPLOYMENT_ARCHIVE); if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) || deploymentUnit.getName().endsWith(".jar")) { final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName()); bindBeanManager(serviceTarget, beanManagerServiceName, moduleContextServiceName, dependencies, phaseContext.getServiceRegistry()); for (ComponentDescription component : moduleDescription.getComponentDescriptions()) { if (component.getNamingMode() == ComponentNamingMode.CREATE) { final ServiceName compContextServiceName = ContextNames.contextServiceNameOfComponent(moduleDescription.getApplicationName(), moduleDescription.getModuleName(), component.getComponentName()); bindBeanManager(serviceTarget, beanManagerServiceName, compContextServiceName, dependencies, phaseContext.getServiceRegistry());
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_PROPERTIES)) { return; } final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentFile = deploymentRoot.getRoot(); final VirtualFile propertiesFile = deploymentFile.getChild(DEPLOYMENT_PROPERTIES); if (!propertiesFile.exists()) { return; } Properties properties = new Properties(); InputStream propertyFileStream = null; try { propertyFileStream = propertiesFile.openStream(); properties.load(propertyFileStream); } catch (IOException e) { throw EeLogger.ROOT_LOGGER.failedToLoadJbossProperties(e); } finally { VFSUtils.safeClose(propertyFileStream); } deploymentUnit.putAttachment(Attachments.DEPLOYMENT_PROPERTIES, properties); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); if (module == null) { return; final List<EJBClientInterceptor> ejbClientInterceptors = getClassPathInterceptors(module.getClassLoader()); final boolean interceptorsDefined = ejbClientInterceptors != null && ! ejbClientInterceptors.isEmpty(); .getAttachment(Attachments.EJB_CLIENT_METADATA); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); CallbackHandler callbackHandler = getCallbackHandler(phaseContext.getServiceRegistry(), clusterUserName, clusterSecurityRealm); if (callbackHandler != null) { defaultAuthenticationConfiguration = defaultAuthenticationConfiguration.useCallbackHandler(callbackHandler); CallbackHandler nodeCallbackHandler = getCallbackHandler(phaseContext.getServiceRegistry(), userName, securityRealm); if (nodeCallbackHandler != null) { nodeAuthenticationConfiguration = nodeAuthenticationConfiguration.useCallbackHandler(nodeCallbackHandler); phaseContext.addDeploymentDependency(ejbClientContextServiceName, EjbDeploymentAttachmentKeys.EJB_CLIENT_CONTEXT_SERVICE);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); .getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final ServiceModuleLoader moduleLoader = deploymentUnit .getAttachment(org.jboss.as.server.deployment.Attachments.SERVICE_MODULE_LOADER); final VirtualFile file = resourceRoot.getRoot().getChild(loc); if (file.exists()) { descriptorFile = file; break; return; if (deploymentUnit.getParent() != null) { EeLogger.ROOT_LOGGER.subdeploymentIgnored(descriptorFile.getPathName()); return;
@Override public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException { DeploymentUnit unit = context.getDeploymentUnit(); if (!unit.hasAttachment(SingletonDeploymentDependencyProcessor.CONFIGURATION_KEY)) { VirtualFile file = unit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot().getChild(SINGLETON_DEPLOYMENT_DESCRIPTOR); if (file.exists()) { try { unit.putAttachment(SingletonDeploymentDependencyProcessor.CONFIGURATION_KEY, this.parse(unit, file.getPhysicalFile())); } catch (IOException e) { throw new DeploymentUnitProcessingException(e); } } } }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { return; // Skip non web deployments final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); final VirtualFile jbossWebXml = deploymentRoot.getChild(JBOSS_WEB_XML); WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); assert warMetaData != null; if (jbossWebXml.exists()) { InputStream is = null; try { is = jbossWebXml.openStream(); final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setXMLResolver(NoopXMLResolver.create()); deploymentUnit.putAttachment(org.jboss.as.ee.structure.Attachments.DISTINCT_NAME, jBossWebMetaData.getDistinctName());
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ComponentRegistry componentRegistry = new ComponentRegistry(phaseContext.getServiceRegistry()); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION); if(moduleDescription == null) { return; phaseContext.getServiceTarget().addService(ComponentRegistry.serviceName(deploymentUnit), new ValueService<>(new ImmediateValue<Object>(componentRegistry))) .addDependency(moduleDescription.getDefaultClassIntrospectorServiceName(), EEClassIntrospector.class, componentRegistry.getClassIntrospectorInjectedValue()) .install(); deploymentUnit.putAttachment(COMPONENT_REGISTRY, componentRegistry); if (deploymentUnit.getAttachment(Attachments.DEPLOYMENT_TYPE) == DeploymentType.EAR) { deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); for (final Map.Entry<String, String> messageDestination : moduleDescription.getMessageDestinations().entrySet()) { applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot()); for (final ComponentDescription componentDescription : subDeploymentModuleDescription.getComponentDescriptions()) { applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); for (final Map.Entry<String, String> messageDestination : subDeploymentModuleDescription.getMessageDestinations().entrySet()) { applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); for (final ComponentDescription componentDescription : subdeployment.getAttachmentList(org.jboss.as.ee.component.Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS)) {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; EEModuleDescription moduleDescription = deploymentUnit.getAttachment(EE_MODULE_DESCRIPTION); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final ServiceName appContextServiceName = ContextNames.contextServiceNameOfApplication(moduleDescription.getApplicationName()); final ServiceName moduleContextServiceName = ContextNames.contextServiceNameOfModule(moduleDescription.getApplicationName(), moduleDescription.getModuleName()); final NamingStoreService contextService = new NamingStoreService(true); serviceTarget.addService(moduleContextServiceName, contextService).install(); .addDependency(moduleContextServiceName, ServiceBasedNamingStore.class, moduleNameBinder.getNamingStoreInjector()) .install(); deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES, moduleNameServiceName); deploymentUnit.putAttachment(MODULE_CONTEXT_CONFIG, moduleContextServiceName); phaseContext.addDependency(appContextServiceName, NamingStore.class, selector.getAppContextInjector()); phaseContext.addDependency(moduleContextServiceName, NamingStore.class, selector.getModuleContextInjector()); phaseContext.addDependency(moduleContextServiceName, NamingStore.class, selector.getCompContextInjector()); phaseContext.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, selector.getJbossContextInjector()); phaseContext.addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, selector.getExportedContextInjector()); phaseContext.addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, selector.getGlobalContextInjector()); moduleDescription.setNamespaceContextSelector(selector);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; if(deploymentRoot.getRoot().getChild("META-INF/application.xml").exists()) { List<ResourceRoot> potentialSubDeployments = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : potentialSubDeployments) { if (ModuleRootMarker.isModuleRoot(resourceRoot)) { VirtualFile ejbJarFile = resourceRoot.getRoot().getChild("META-INF/ejb-jar.xml"); if (ejbJarFile.exists()) { SubDeploymentMarker.mark(resourceRoot); ModuleRootMarker.mark(resourceRoot); } else { final Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX); if (index != null) { if (!index.getAnnotations(STATEFUL).isEmpty() ||
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ManagementResourceRegistration baseRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT); final ManagementResourceRegistration registration; final Resource deploymentResource = phaseContext.getDeploymentUnit().getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE); final ConnectorXmlDescriptor connectorXmlDescriptor = deploymentUnit.getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY); if (connectorXmlDescriptor == null) { return; // Skip non ra deployments final ServiceController<?> raService = phaseContext.getServiceRegistry().getService( ConnectorServices.RESOURCEADAPTERS_SERVICE); if (raService != null) final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); String deploymentUnitPrefix = ""; RaServicesFactory.createDeploymentService(registration, connectorXmlDescriptor, module, serviceTarget, deploymentUnitName, deploymentUnit.getServiceName(), deploymentUnitName, raxml, deploymentResource, phaseContext.getServiceRegistry());