use of org.jboss.metadata.ear.jboss.JBossAppMetaData in project wildfly by wildfly.
the class ASHelper method getContextRoot.
/**
* Returns context root associated with webservice deployment.
*
* If there's application.xml descriptor provided defining nested web module, then context root defined there will be
* returned. Otherwise context root defined in jboss-web.xml will be returned.
*
* @param dep webservice deployment
* @param jbossWebMD jboss web meta data
* @return context root
*/
public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null : ASHelper.getOptionalAttachment(unit.getParent(), WSAttachmentKeys.JBOSS_APP_METADATA_KEY);
String contextRoot = null;
// prefer context root defined in application.xml over one defined in jboss-web.xml
if (jbossAppMD != null) {
final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
if (moduleMD != null) {
final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
contextRoot = webModuleMD.getContextRoot();
}
}
if (contextRoot == null) {
contextRoot = jbossWebMD != null ? jbossWebMD.getContextRoot() : null;
}
return contextRoot;
}
use of org.jboss.metadata.ear.jboss.JBossAppMetaData in project wildfly by wildfly.
the class SecurityDomainMergingProcessor method getJBossAppSecurityDomain.
/**
* Try to obtain the security domain configured in jboss-app.xml at the ear level if available
*
* @param deploymentUnit
* @return
*/
private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) {
String securityDomain = null;
DeploymentUnit parent = deploymentUnit.getParent();
if (parent != null) {
final EarMetaData jbossAppMetaData = parent.getAttachment(Attachments.EAR_METADATA);
if (jbossAppMetaData instanceof JBossAppMetaData) {
securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain();
}
}
return securityDomain;
}
use of org.jboss.metadata.ear.jboss.JBossAppMetaData in project wildfly by wildfly.
the class UndertowDeploymentProcessor method getJBossAppSecurityDomain.
/**
* Try to obtain the security domain configured in jboss-app.xml at the ear level if available
*/
private String getJBossAppSecurityDomain(final DeploymentUnit deploymentUnit) {
String securityDomain = null;
DeploymentUnit parent = deploymentUnit.getParent();
if (parent != null) {
final EarMetaData jbossAppMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
if (jbossAppMetaData instanceof JBossAppMetaData) {
securityDomain = ((JBossAppMetaData) jbossAppMetaData).getSecurityDomain();
}
}
return securityDomain;
}
use of org.jboss.metadata.ear.jboss.JBossAppMetaData in project wildfly by wildfly.
the class AbstractSecurityMetaDataAccessorEJB method getSecurityDomain.
/**
* @see org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityDomain(Deployment)
*
* @param dep webservice deployment
* @return security domain associated with EJB 3 deployment
*/
public String getSecurityDomain(final Deployment dep) {
String securityDomain = null;
for (final EJBEndpoint ejbEndpoint : getEjbEndpoints(dep)) {
String nextSecurityDomain = ejbEndpoint.getSecurityDomain();
if (nextSecurityDomain == null || nextSecurityDomain.isEmpty()) {
nextSecurityDomain = null;
}
securityDomain = getDomain(securityDomain, nextSecurityDomain);
}
if (securityDomain == null) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
if (unit.getParent() != null) {
final EarMetaData jbossAppMD = unit.getParent().getAttachment(Attachments.EAR_METADATA);
return jbossAppMD instanceof JBossAppMetaData ? ((JBossAppMetaData) jbossAppMD).getSecurityDomain() : null;
}
}
return securityDomain;
}
use of org.jboss.metadata.ear.jboss.JBossAppMetaData in project wildfly by wildfly.
the class EarMetaDataParsingProcessor method deploy.
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);
}
}
Aggregations