@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())); } catch (IOException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(webFragment.toString()), e); } finally { try {
@Override public final DeploymentUnitProcessingException cannotLoad(final String injectionTarget) { final DeploymentUnitProcessingException result = new DeploymentUnitProcessingException(String.format(getLoggingLocale(), cannotLoad$str(), injectionTarget)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS)); final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (mainRoot == null) continue; VirtualFile root = mainRoot.getRoot(); for (String path : SEAM_FILES) { if (root.getChild(path).exists()) { final ModuleSpecification moduleSpecification = deploymentUnit .getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false, false)); // for VFS scanner getSeamIntResourceRoot().getRoot().getPathName())); moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader)); } catch (Exception 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()); throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString(), e.getLocation().getLineNumber(), e.getLocation().getColumnNumber()), e); } catch (IOException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(jbossWebXml.toString()), e); } finally { try {
private Field getField(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final String name = getName(); final String className = getClassName(); final Module module = deploymentUnit.getAttachment(MODULE); final ModuleClassLoader classLoader = module.getClassLoader(); final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(REFLECTION_INDEX); final ClassReflectionIndex classIndex; try { classIndex = reflectionIndex.getClassIndex(Class.forName(className, false, classLoader)); } catch (ClassNotFoundException e) { throw new DeploymentUnitProcessingException(e); } final Field field = classIndex.getField(name); if (field == null) { throw EeLogger.ROOT_LOGGER.fieldNotFound(name); } return field; } }
@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); } } } }
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); assert warMetaData != null; VirtualFile overlay = resourceRoot.getRoot().getChild("META-INF/resources"); if (overlay.exists()) { overlays.add(overlay); if (orderingElementMetaData.isOthers()) { if (otherPos >= 0) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.invalidMultipleOthers()); resolveOrder(orderings, order); } catch (IllegalStateException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.invalidRelativeOrdering(), e); WebCommonMetaDataMerger.augment(mergedFragmentMetaData, webFragmentMetaData, specMetaData, false); } catch (Exception e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.invalidWebFragment(jar), e); WebCommonMetaDataMerger.augment(mergedFragmentMetaData, webFragmentMetaData, specMetaData, false); } catch (Exception e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.invalidWebFragment(jar), e); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); LOG.debug("Ignoring deployment unit '" + deploymentUnit.getName() + "' as it is not recognized as being a SwitchYard Application."); return; SwitchYardMetaData switchYardMetaData = deploymentUnit.getAttachment(SwitchYardMetaData.ATTACHMENT_KEY); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); Thread.currentThread().setContextClassLoader(module.getClassLoader()); is = switchYardMetaData.getSwitchYardFile().openStream(); SwitchYardModel switchyardModel = new ModelPuller<SwitchYardModel>().pull(is); JBossPropertyResolver.set(deploymentUnit, switchyardModel); LOG.debug("Successfully parsed SwitchYard configuration for deployment unit '" + deploymentUnit.getName() + "'."); } catch (IOException ioe) { throw new DeploymentUnitProcessingException(ioe); } finally { Thread.currentThread().setContextClassLoader(origCL);
final List<ResourceRoot> entries = new ArrayList<ResourceRoot>(); final VirtualFile webinfClasses = deploymentRoot.getChild(WEB_INF_CLASSES); if (webinfClasses.exists()) { final ResourceRoot webInfClassesRoot = new ResourceRoot(webinfClasses.getName(), webinfClasses, null); ModuleRootMarker.mark(webInfClassesRoot); entries.add(webInfClassesRoot); Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS); final VirtualFile webinfLib = deploymentRoot.getChild(WEB_INF_LIB); if (webinfLib.exists()) { closable = null; final ResourceRoot webInfArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable)); ModuleRootMarker.mark(webInfArchiveRoot); entries.add(webInfArchiveRoot); } catch (IOException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToProcessWebInfLib(archive), e);
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Boolean computeCompositeIndex = deploymentUnit.getAttachment(Attachments.COMPUTE_COMPOSITE_ANNOTATION_INDEX); if (computeCompositeIndex != null && !computeCompositeIndex) { return; final List<ModuleIdentifier> additionalModuleIndexes = deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES); final List<Index> indexes = new ArrayList<Index>(); for (final ModuleIdentifier moduleIdentifier : additionalModuleIndexes) { try { Module module = Module.getBootModuleLoader().loadModule(moduleIdentifier); final CompositeIndex additionalIndex = ModuleIndexBuilder.buildCompositeIndex(module); if (additionalIndex != null) { additionalAnnotationIndexes.put(moduleIdentifier, additionalIndex); } else { ServerLogger.DEPLOYMENT_LOGGER.noCompositeIndex(module.getIdentifier(), ModuleIndexBuilder.INDEX_LOCATION); throw new DeploymentUnitProcessingException(e); deploymentUnit.putAttachment(Attachments.ADDITIONAL_ANNOTATION_INDEXES_BY_MODULE, additionalAnnotationIndexes); Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX); if (index != null) { indexes.add(index);
private void processDeployment(final WarMetaData warMetaData, final DeploymentUnit deploymentUnit, final ServiceTarget serviceTarget, final String deploymentName, final String hostName, final String serverInstanceName) throws DeploymentUnitProcessingException { ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failedToResolveModule(deploymentUnit)); final List<SetupAction> setupActions = deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS); CapabilityServiceSupport capabilitySupport = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WebInjectionContainer injectionContainer = new WebInjectionContainer(module.getClassLoader(), componentRegistry); SharedSessionManagerConfig sharedSessionManagerConfig = deploymentUnit.getParent() != null ? deploymentUnit.getParent().getAttachment(UndertowAttachments.SHARED_SESSION_MANAGER_CONFIG) : null; if(!deploymentResourceRoot.isUsePhysicalCodeSource()) { try { deploymentUnit.addToAttachmentList(ServletContextAttribute.ATTACHMENT_KEY, new ServletContextAttribute(Constants.CODE_SOURCE_ATTRIBUTE_NAME, deploymentRoot.toURL())); } catch (MalformedURLException e) { throw new DeploymentUnitProcessingException(e);
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ModuleSpecification attachment = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); if (attachment == null) { return; } final List<PermissionFactory> permissions = attachment.getPermissionFactories(); final Enumeration<Permission> e = DEFAULT_PERMISSIONS.elements(); while (e.hasMoreElements()) { permissions.add(new ImmediatePermissionFactory(e.nextElement())); } //make sure they can read the contents of the deployment ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); try { File file = root.getRoot().getPhysicalFile(); if(file != null && file.isDirectory()) { FilePermission permission = new FilePermission(file.getAbsolutePath() + File.separatorChar + "-", "read"); permissions.add(new ImmediatePermissionFactory(permission)); } } catch (IOException ex) { throw new DeploymentUnitProcessingException(ex); } }
@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 ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot(); if (deploymentRoot == null) { return; final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); if (moduleSpecification == null) { return; deploymentResourceRoot.putAttachment(Attachments.INDEX_RESOURCE_ROOT, false); deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.getMetaInfFilter(), true)); deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.getMetaInfSubdirectoriesFilter(), true)); deploymentResourceRoot.getExportFilters().add(new FilterSpecification(PathFilters.acceptAll(), false)); deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, root); throw new DeploymentUnitProcessingException(e);
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); } }
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) throw new DeploymentUnitProcessingException(t);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); KeycloakAdapterConfigService config = KeycloakAdapterConfigService.INSTANCE; String deploymentName = deploymentUnit.getName(); if (!config.isKeycloakServerDeployment(deploymentName)) { return; } final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); String webContext = config.getWebContext(); if (webContext == null) { throw new DeploymentUnitProcessingException("Can't determine web context/module for Keycloak Server"); } description.setModuleName(webContext); }
private void loadAttachments(Module module, DeploymentUnit deploymentUnit, WeldPortableExtensions extensions) throws DeploymentUnitProcessingException { Enumeration<URL> resources = module.getClassLoader().getResources("META-INF/services/" + Extension.class.getName()); final List<String> services = new ArrayList<>(); while (resources.hasMoreElements()) { final Class<Extension> extensionClass = loadExtension(service, module.getClassLoader()); if (extensionClass == null) { continue; throw new DeploymentUnitProcessingException(e);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getParent() != null) { return; WildFlySecurityManager.getClassLoaderPrivileged(ExternalBeanArchiveProcessor.class)); final String beanArchiveIdPrefix = deploymentUnit.getName() + ".external."; final Set<AnnotationType> beanDefiningAnnotations = new HashSet<>(deploymentUnit.getAttachment(WeldAttachments.BEAN_DEFINING_ANNOTATIONS)); if (weldDeploymentMetadata != null) { for (ExplicitBeanArchiveMetadata md : weldDeploymentMetadata.getBeanArchiveMetadata().values()) { existing.add(md.getBeansXmlFile().toURL()); if (md.getAdditionalBeansXmlFile() != null) { existing.add(md.getAdditionalBeansXmlFile().toURL()); throw new DeploymentUnitProcessingException(e); return; for (DependencySpec dep : module.getDependencies()) { final Module dependency = loadModuleDependency(dep); if (dependency == null) {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); boolean resolveProperties = Util.shouldResolveJBoss(deploymentUnit); final PropertyResolver propertyResolver = deploymentUnit.getAttachment(org.jboss.as.ee.metadata.property.Attachments.FINAL_PROPERTY_RESOLVER); final PropertyReplacer propertyReplacer = deploymentUnit.getAttachment(org.jboss.as.ee.metadata.property.Attachments.FINAL_PROPERTY_REPLACER); InputStream xmlStream = null; try { xmlStream = new FileInputStream(f.getPhysicalFile()); DsXmlParser parser = new DsXmlParser(propertyResolver, propertyReplacer); parser.setSystemPropertiesResolved(resolveProperties); deploymentUnit.addToAttachmentList(DATA_SOURCES_ATTACHMENT_KEY, dataSources); throw new DeploymentUnitProcessingException(e.getMessage(), e); } finally { VFSUtils.safeClose(xmlStream);
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(JsfVersionMarker.isJsfDisabled(deploymentUnit)) { return; final CompositeIndex compositeIndex = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX); if (compositeIndex == null) { return; // Can not continue without index final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { return; // Can not continue without module final ClassLoader classLoader = module.getClassLoader(); annotatedClass = classLoader.loadClass(className.toString()); } catch (ClassNotFoundException e) { throw new DeploymentUnitProcessingException(JSFLogger.ROOT_LOGGER.classLoadingFailed(className)); throw new DeploymentUnitProcessingException(JSFLogger.ROOT_LOGGER.invalidAnnotationLocation(annotation, target)); deploymentUnit.addToAttachmentList(ServletContextAttribute.ATTACHMENT_KEY, new ServletContextAttribute(FACES_ANNOTATIONS_SC_ATTR, instances));