public PropertyReplacingBeansXmlParser(DeploymentUnit deploymentUnit) { this.replacer = SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit); }
try { XMLStreamReader reader = getXMLStreamReader(stream, descriptor, dtdInfo); EjbJarMetaData ejbJarMetaData = EjbJarMetaDataParser.parse(reader, dtdInfo, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); return ejbJarMetaData; } catch (XMLStreamException xmlse) {
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebFragmentMetaData webFragmentMetaData = WebFragmentMetaDataParser.parse(xmlReader, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); webFragments.put(resourceRoot.getRootName(), webFragmentMetaData);
final XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebMetaData webMetaData = WebMetaDataParser.parse(xmlReader, dtdInfo, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentFile = deploymentRoot.getRoot(); EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit); if (earMetaData == null && jbossMetaData == null) { return; } // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) { deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName()); } JBossAppMetaData merged; if (earMetaData != null) { merged = new JBossAppMetaData(earMetaData.getEarVersion()); } else { merged = new JBossAppMetaData(); } JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData); deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged); if (merged.getEarEnvironmentRefsGroup() != null) { final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup()); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings); } }
private BeansXml parseBeansXml(URL beansXmlFile, BeansXmlParser parser, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { return parser.parse(beansXmlFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); } }
private BeansXml parseBeansXml(VirtualFile beansXmlFile, BeansXmlParser parser, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { try { return parser.parse(beansXmlFile.asFileURL(), SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); } catch (MalformedURLException e) { throw WeldMessages.MESSAGES.couldNotGetBeansXmlAsURL(beansXmlFile.toString(), e); } }
private void parse( final VirtualFile persistence_xml, final List<PersistenceUnitMetadataHolder> listPUHolders, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { ROOT_LOGGER.tracef("parse checking if %s exists, result = %b",persistence_xml.toString(), persistence_xml.exists()); if (persistence_xml.exists() && persistence_xml.isFile()) { InputStream is = null; try { is = persistence_xml.openStream(); final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setXMLResolver(NoopXMLResolver.create()); XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); PersistenceUnitMetadataHolder puHolder = PersistenceUnitXmlParser.parse(xmlReader, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); postParseSteps(persistence_xml, puHolder, deploymentUnit); listPUHolders.add(puHolder); } catch (Exception e) { throw new DeploymentUnitProcessingException(JpaLogger.ROOT_LOGGER.failedToParse(persistence_xml), e); } finally { try { if (is != null) { is.close(); } } catch (IOException e) { // Ignore } } } }
private void parse( final VirtualFile persistence_xml, final List<PersistenceUnitMetadataHolder> listPUHolders, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { ROOT_LOGGER.tracef("parse checking if %s exists, result = %b",persistence_xml.toString(), persistence_xml.exists()); if (persistence_xml.exists() && persistence_xml.isFile()) { InputStream is = null; try { is = persistence_xml.openStream(); final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setXMLResolver(NoopXMLResolver.create()); XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); PersistenceUnitMetadataHolder puHolder = PersistenceUnitXmlParser.parse(xmlReader, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); postParseSteps(persistence_xml, puHolder, deploymentUnit); listPUHolders.add(puHolder); } catch (Exception e) { throw new DeploymentUnitProcessingException(JpaLogger.ROOT_LOGGER.failedToParse(persistence_xml), e); } finally { try { if (is != null) { is.close(); } } catch (IOException e) { // Ignore } } } }
private PersistenceUnitMetadata getPersistenceUnit(final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, EEModuleClassDescription classDescription) throws DeploymentUnitProcessingException { final AnnotationValue puName = annotation.value("unitName"); String searchName = null; // note: a null searchName will match the first PU definition found if (puName != null && (searchName = puName.asString()) != null) { searchName = SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit).replaceProperties(searchName); } ROOT_LOGGER.debugf("persistence unit search for unitName=%s referenced from class=%s (annotation=%s)", searchName, classDescription.getClassName(), annotation.toString()); PersistenceUnitMetadata pu = PersistenceUnitSearch.resolvePersistenceUnitSupplier(deploymentUnit, searchName); if (null == pu) { classDescription.setInvalid(JpaLogger.ROOT_LOGGER.persistenceUnitNotFound(searchName, deploymentUnit)); return null; } return pu; }
private PersistenceUnitMetadata getPersistenceUnit(final DeploymentUnit deploymentUnit, final AnnotationInstance annotation, EEModuleClassDescription classDescription) throws DeploymentUnitProcessingException { final AnnotationValue puName = annotation.value("unitName"); String searchName = null; // note: a null searchName will match the first PU definition found if (puName != null && (searchName = puName.asString()) != null) { searchName = SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit).replaceProperties(searchName); } ROOT_LOGGER.debugf("persistence unit search for unitName=%s referenced from class=%s (annotation=%s)", searchName, classDescription.getClassName(), annotation.toString()); PersistenceUnitMetadata pu = PersistenceUnitSearch.resolvePersistenceUnitSupplier(deploymentUnit, searchName); if (null == pu) { classDescription.setInvalid(JpaLogger.ROOT_LOGGER.persistenceUnitNotFound(searchName, deploymentUnit)); return null; } return pu; }
try { XMLStreamReader reader = getXMLStreamReader(stream, descriptor, dtdInfo); EjbJarMetaData ejbJarMetaData = EjbJarMetaDataParser.parse(reader, dtdInfo, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); return ejbJarMetaData; } catch (XMLStreamException xmlse) {
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebFragmentMetaData webFragmentMetaData = WebFragmentMetaDataParser.parse(xmlReader, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); webFragments.put(resourceRoot.getRootName(), webFragmentMetaData);
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebFragmentMetaData webFragmentMetaData = WebFragmentMetaDataParser.parse(xmlReader, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); webFragments.put(resourceRoot.getRootName(), webFragmentMetaData);
final XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebMetaData webMetaData = WebMetaDataParser.parse(xmlReader, dtdInfo, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
final XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); WebMetaData webMetaData = WebMetaDataParser.parse(xmlReader, dtdInfo, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit));
@Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, deploymentUnit)) { return; } final ApplicationClientMetaData appClientMD = parseAppClient(deploymentUnit, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); final JBossClientMetaData jbossClientMD = parseJBossClient(deploymentUnit, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); final JBossClientMetaData merged; if (appClientMD == null && jbossClientMD == null) { return; } else if (appClientMD == null) { merged = jbossClientMD; } else { merged = new JBossClientMetaData(); merged.setEnvironmentRefsGroupMetaData(new AppClientEnvironmentRefsGroupMetaData()); merged.merge(jbossClientMD, appClientMD); } if(merged.isMetadataComplete()) { MetadataCompleteMarker.setMetadataComplete(deploymentUnit, true); } deploymentUnit.putAttachment(AppClientAttachments.APPLICATION_CLIENT_META_DATA, merged); final DeploymentDescriptorEnvironment environment = new DeploymentDescriptorEnvironment("java:module/env/", merged.getEnvironmentRefsGroupMetaData()); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, environment); //override module name if applicable if(merged.getModuleName() != null && !merged.getModuleName().isEmpty()) { final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); description.setModuleName(merged.getModuleName()); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentFile = deploymentRoot.getRoot(); EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit); if (earMetaData == null && jbossMetaData == null) { return; } // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) { deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName()); } JBossAppMetaData merged; if (earMetaData != null) { merged = new JBossAppMetaData(earMetaData.getEarVersion()); } else { merged = new JBossAppMetaData(); } JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData); deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged); if (merged.getEarEnvironmentRefsGroup() != null) { final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup()); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentFile = deploymentRoot.getRoot(); EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit); if (earMetaData == null && jbossMetaData == null) { return; } // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) { deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName()); } JBossAppMetaData merged; if (earMetaData != null) { merged = new JBossAppMetaData(earMetaData.getEarVersion()); } else { merged = new JBossAppMetaData(); } JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData); deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged); if (merged.getEarEnvironmentRefsGroup() != null) { final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup()); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final VirtualFile deploymentFile = deploymentRoot.getRoot(); EarMetaData earMetaData = handleSpecMetadata(deploymentFile, SpecDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); JBossAppMetaData jbossMetaData = handleJbossMetadata(deploymentFile, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit), deploymentUnit); if (earMetaData == null && jbossMetaData == null) { return; } // the jboss-app.xml has a distinct-name configured then attach it to the deployment unit if (jbossMetaData != null && jbossMetaData.getDistinctName() != null) { deploymentUnit.putAttachment(Attachments.DISTINCT_NAME, jbossMetaData.getDistinctName()); } JBossAppMetaData merged; if (earMetaData != null) { merged = new JBossAppMetaData(earMetaData.getEarVersion()); } else { merged = new JBossAppMetaData(); } JBossAppMetaDataMerger.merge(merged, jbossMetaData, earMetaData); deploymentUnit.putAttachment(Attachments.EAR_METADATA, merged); if (merged.getEarEnvironmentRefsGroup() != null) { final DeploymentDescriptorEnvironment bindings = new DeploymentDescriptorEnvironment("java:app/env/", merged.getEarEnvironmentRefsGroup()); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.MODULE_DEPLOYMENT_DESCRIPTOR_ENVIRONMENT, bindings); } }