@Override 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(SAR_EXTENSION)) { return; ModuleRootMarker.mark(resourceRoot, true); Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS); try { 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));
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); VirtualFile appclientClientXml = resourceRoot.getRoot().getChild(META_INF_APPLICATION_CLIENT_XML); if (appclientClientXml.exists()) { SubDeploymentMarker.mark(resourceRoot); ModuleRootMarker.mark(resourceRoot); } else { final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST); if (manifest != null) { Attributes main = manifest.getMainAttributes(); } else if (deploymentUnit.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleMetaData md = root.getAttachment(org.jboss.as.ee.structure.Attachments.MODULE_META_DATA); if (md != null) { if (md.getType() == ModuleMetaData.ModuleType.Client) { DeploymentTypeMarker.setType(DeploymentType.APPLICATION_CLIENT, deploymentUnit); VirtualFile appclientClientXml = root.getRoot().getChild(META_INF_APPLICATION_CLIENT_XML); if (appclientClientXml.exists()) { DeploymentTypeMarker.setType(DeploymentType.APPLICATION_CLIENT, deploymentUnit); } else { final Manifest manifest = root.getAttachment(Attachments.MANIFEST); if (manifest != null) { Attributes main = manifest.getMainAttributes();
@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)); ModuleRootMarker.mark(deploymentResourceRoot, true); final MountHandle mountHandle = deploymentResourceRoot.getMountHandle(); try { deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, root);
/** * 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 ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final VirtualFile virtualFile = deploymentRoot.getRoot(); deploymentRoot.putAttachment(Attachments.INDEX_RESOURCE_ROOT, false); ModuleRootMarker.mark(deploymentRoot, false); final boolean appXmlPresent = deploymentRoot.getRoot().getChild("META-INF/application.xml").exists(); final EarMetaData earMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA); if (earMetaData != null) { final String xmlLibDirName = earMetaData.getLibraryDirectory(); for (final VirtualFile child : libArchives) { String relativeName = child.getPathNameRelativeTo(deploymentRoot.getRoot()); MountedDeploymentOverlay overlay = overlays.get(relativeName); final MountHandle mountHandle; final ResourceRoot childResource = new ResourceRoot(child, mountHandle); if (child.getName().toLowerCase(Locale.ENGLISH).endsWith(JAR_EXTENSION)) { ModuleRootMarker.mark(childResource); childResource.putAttachment(org.jboss.as.ee.structure.Attachments.MODULE_META_DATA, module); final VirtualFile alternateDeploymentDescriptor = deploymentRoot.getRoot().getChild(alternativeDD); childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_CLIENT_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor); break; case Connector: childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_CONNECTOR_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor); break;
@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()));
@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());
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null || warMetaData.getMergedJBossWebMetaData() == null) { return; TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY); if (tldsMetaData == null) { tldsMetaData = new TldsMetaData(); deploymentUnit.putAttachment(TldsMetaData.ATTACHMENT_KEY, tldsMetaData); final List<TldMetaData> uniqueTlds = new ArrayList<>(); final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); final List<VirtualFile> testRoots = new ArrayList<VirtualFile>(); testRoots.add(deploymentRoot); testRoots.add(deploymentRoot.getChild(WEB_INF)); testRoots.add(deploymentRoot.getChild(META_INF)); for (ResourceRoot root : deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)) { testRoots.add(root.getRoot()); testRoots.add(root.getRoot().getChild(META_INF)); testRoots.add(root.getRoot().getChild(META_INF).getChild(RESOURCES)); 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(META_INF); if (webFragment.exists() && webFragment.isDirectory()) { processTlds(deploymentRoot, webFragment.getChildren(), tlds, uniqueTlds);
List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : structure) { if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) { if (resourceRoot.getRootName().equals("classes")) { deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot); } else { VirtualFile beansXml = resourceRoot.getRoot().getChild(META_INF_BEANS_XML); if (beansXml.exists() && beansXml.isFile()) { WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", beansXml.toString()); beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false)); if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild(WEB_INF_BEANS_XML); final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile(); beansXml = classesRoot.getRoot().getChild(META_INF_BEANS_XML); final boolean beansXmlPresent = beansXml != null && beansXml.exists() && beansXml.isFile(); beanArchiveMetadata.put(deploymentRoot, new ExplicitBeanArchiveMetadata(beansXml, classesRoot, parseBeansXml(beansXml, parser, deploymentUnit), true)); } else if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild(META_INF_BEANS_XML); if (rootBeansXml.exists() && rootBeansXml.isFile()) { WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", rootBeansXml.toString());
@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; boolean fragmentFound = false; Map<String, WebFragmentMetaData> webFragments = warMetaData.getWebFragmentsMetaData(); List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (resourceRoot.getRoot().getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { jarsSet.add(resourceRoot.getRootName()); VirtualFile overlay = resourceRoot.getRoot().getChild("META-INF/resources"); if (overlay.exists()) { overlays.add(overlay); VirtualFile sci = resourceRoot.getRoot().getChild("META-INF/services/javax.servlet.ServletContainerInitializer"); if (sci.exists()) { scis.put(resourceRoot.getRootName(), sci); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings);
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(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final ServiceVerificationHandler serviceVerificationHandler = deploymentUnit.getAttachment(Attachments.SERVICE_VERIFICATION_HANDLER); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (final ResourceRoot childRoot : childRoots) { if (childRoot == deploymentResourceRoot || !SubDeploymentMarker.isSubDeployment(childRoot)) { continue; } final Resource resource = DeploymentModelUtils.createSubDeployment(childRoot.getRootName(), deploymentUnit); final ImmutableManagementResourceRegistration registration = deploymentUnit.getAttachment(DeploymentModelUtils.REGISTRATION_ATTACHMENT); final ManagementResourceRegistration mutableRegistration = deploymentUnit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT); final AbstractVaultReader vaultReader = deploymentUnit.getAttachment(Attachments.VAULT_READER_ATTACHMENT_KEY); final SubDeploymentUnitService service = new SubDeploymentUnitService(childRoot, deploymentUnit, registration, mutableRegistration, resource, serviceVerificationHandler, vaultReader); final ResourceRoot parentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final String relativePath = childRoot.getRoot().getPathNameRelativeTo(parentRoot.getRoot()); final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), relativePath); serviceTarget.addService(serviceName, service) .addDependency(Services.JBOSS_DEPLOYMENT_CHAINS, DeployerChains.class, service.getDeployerChainsInjector()) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); phaseContext.addDeploymentDependency(serviceName, Attachments.SUB_DEPLOYMENTS); //we also need a dep on the first phase of the sub deployments phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, serviceName.append(ServiceName.of(Phase.STRUCTURE.name()))); } }
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (deploymentUnit.getName().toLowerCase(Locale.ENGLISH).endsWith(".ear")) { final Map<VirtualFile, ResourceRoot> existing = new HashMap<VirtualFile, ResourceRoot>(); for (final ResourceRoot additional : deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)) { existing.put(additional.getRoot(), additional); final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final VirtualFile appClientRoot = root.getRoot().getChild(deployment); if (appClientRoot.exists()) { if (existing.containsKey(appClientRoot)) { final ResourceRoot existingRoot = existing.get(appClientRoot); SubDeploymentMarker.mark(existingRoot); ModuleRootMarker.mark(existingRoot); } else { final Closeable closable = appClientRoot.isFile() ? mount(appClientRoot, false) : null; final MountHandle mountHandle = new MountHandle(closable); final ResourceRoot childResource = new ResourceRoot(appClientRoot, mountHandle); ModuleRootMarker.mark(childResource); SubDeploymentMarker.mark(childResource); deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource); } else if (deploymentUnit.getParent() != null && deploymentUnit.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { final ResourceRoot parentRoot = deploymentUnit.getParent().getAttachment(Attachments.DEPLOYMENT_ROOT); final VirtualFile appClientRoot = parentRoot.getRoot().getChild(deployment); final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (appClientRoot.equals(root.getRoot())) { DeploymentTypeMarker.setType(DeploymentType.APPLICATION_CLIENT, deploymentUnit);
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(); .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); } } } }
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) {
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); } } } }
private void handleJarDeployment(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!isEarDeployment(deploymentUnit) && !isWarDeployment(deploymentUnit) && (!appClientContainerMode || DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) ) { // handle META-INF/persistence.xml // ordered list of PUs List<PersistenceUnitMetadataHolder> listPUHolders = new ArrayList<PersistenceUnitMetadataHolder>(1); // handle META-INF/persistence.xml final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); VirtualFile persistence_xml = deploymentRoot.getRoot().getChild(META_INF_PERSISTENCE_XML); parse(persistence_xml, listPUHolders, deploymentUnit); PersistenceUnitMetadataHolder holder = normalize(listPUHolders); // save the persistent unit definitions // deploymentUnit.putAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS, holder); deploymentRoot.putAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS, holder); markDU(holder, deploymentUnit); ROOT_LOGGER.tracef("parsed persistence unit definitions for jar %s", deploymentRoot.getRootName()); incrementPersistenceUnitCount(deploymentUnit, holder.getPersistenceUnits().size()); addApplicationDependenciesOnProvider( deploymentUnit, holder); } }
private Set<VirtualFile> dataSources(final DeploymentUnit deploymentUnit) { final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); if (deploymentRoot == null || !deploymentRoot.exists()) { return Collections.emptySet(); } final String deploymentRootName = deploymentRoot.getName().toLowerCase(Locale.ENGLISH); if (deploymentRootName.endsWith("-ds.xml")) { return Collections.singleton(deploymentRoot); } final Set<VirtualFile> ret = new HashSet<VirtualFile>(); for (String location : LOCATIONS) { final VirtualFile loc = deploymentRoot.getChild(location); if (loc.exists()) { for (final VirtualFile file : loc.getChildren()) { if (file.getName().endsWith("-ds.xml")) { ret.add(file); } } } } return ret; }