use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class UndertowServletContainerDependencyProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (warMetaData != null) {
String servletContainerName = defaultServletContainer;
final JBossWebMetaData metaData = warMetaData.getMergedJBossWebMetaData();
if (metaData != null && metaData.getServletContainerName() != null) {
servletContainerName = metaData.getServletContainerName();
}
phaseContext.addDeploymentDependency(UndertowService.SERVLET_CONTAINER.append(servletContainerName), UndertowAttachments.SERVLET_CONTAINER_SERVICE);
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class WarAnnotationDeploymentProcessor method deploy.
/**
* Process web annotations.
*/
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// Skip non web deployments
return;
}
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
assert warMetaData != null;
Map<String, WebMetaData> annotationsMetaData = warMetaData.getAnnotationsMetaData();
if (annotationsMetaData == null) {
annotationsMetaData = new HashMap<String, WebMetaData>();
warMetaData.setAnnotationsMetaData(annotationsMetaData);
}
Map<ResourceRoot, Index> indexes = AnnotationIndexUtils.getAnnotationIndexes(deploymentUnit);
// Process lib/*.jar
for (final Entry<ResourceRoot, Index> entry : indexes.entrySet()) {
final Index jarIndex = entry.getValue();
annotationsMetaData.put(entry.getKey().getRootName(), processAnnotations(jarIndex));
}
Map<ModuleIdentifier, CompositeIndex> additionalModelAnnotations = deploymentUnit.getAttachment(Attachments.ADDITIONAL_ANNOTATION_INDEXES_BY_MODULE);
if (additionalModelAnnotations != null) {
final List<WebMetaData> additional = new ArrayList<WebMetaData>();
for (Entry<ModuleIdentifier, CompositeIndex> entry : additionalModelAnnotations.entrySet()) {
for (Index index : entry.getValue().getIndexes()) {
additional.add(processAnnotations(index));
}
}
warMetaData.setAdditionalModuleAnnotationsMetadata(additional);
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method create.
/**
* Builds universal JSE meta data model that is AS agnostic.
*
* @param dep webservice deployment
* @return universal JSE meta data model
*/
JSEArchiveMetaData create(final Deployment dep) {
if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
WSLogger.ROOT_LOGGER.tracef("Creating JBoss agnostic meta data for POJO webservice deployment: %s", dep.getSimpleName());
}
final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep, JBossWebMetaData.class);
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
final List<POJOEndpoint> pojoEndpoints = getPojoEndpoints(unit);
final JSEArchiveMetaData.Builder builder = new JSEArchiveMetaData.Builder();
// set context root
final String contextRoot = getContextRoot(dep, jbossWebMD);
builder.setContextRoot(contextRoot);
WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
// set servlet url patterns mappings
final Map<String, String> servletMappings = getServletUrlPatternsMappings(jbossWebMD, pojoEndpoints);
builder.setServletMappings(servletMappings);
// set servlet class names mappings
final Map<String, String> servletClassNamesMappings = getServletClassMappings(jbossWebMD, pojoEndpoints);
builder.setServletClassNames(servletClassNamesMappings);
// set security domain
final String securityDomain = jbossWebMD.getSecurityDomain();
builder.setSecurityDomain(securityDomain);
// set wsdl location resolver
final JBossWebservicesMetaData jbossWebservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
if (jbossWebservicesMD != null) {
final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(jbossWebservicesMD.getWebserviceDescriptions());
builder.setPublishLocationAdapter(resolver);
}
// set security meta data
final List<JSESecurityMetaData> jseSecurityMDs = getSecurityMetaData(jbossWebMD.getSecurityConstraints());
builder.setSecurityMetaData(jseSecurityMDs);
// set config name and file
setConfigNameAndFile(builder, jbossWebMD, jbossWebservicesMD);
return builder.build();
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class JBossWebservicesDescriptorDeploymentProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final URL jbossWebservicesDescriptorURL = getJBossWebServicesDescriptorURL(deploymentRoot);
if (jbossWebservicesDescriptorURL != null) {
final JBossWebservicesPropertyReplaceFactory webservicesFactory = new JBossWebservicesPropertyReplaceFactory(jbossWebservicesDescriptorURL, JBossDescriptorPropertyReplacement.propertyReplacer(unit));
final JBossWebservicesMetaData jbossWebservicesMD = webservicesFactory.load(jbossWebservicesDescriptorURL);
unit.putAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY, jbossWebservicesMD);
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class WSClassVerificationProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final JAXWSDeployment wsDeployment = unit.getAttachment(JAXWS_ENDPOINTS_KEY);
if (wsDeployment != null) {
final Module module = unit.getAttachment(Attachments.MODULE);
final DeploymentReflectionIndex deploymentReflectionIndex = unit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final ClassLoader moduleClassLoader = module.getClassLoader();
for (AbstractEndpoint pojoEndpoint : wsDeployment.getPojoEndpoints()) {
verifyEndpoint(pojoEndpoint, moduleClassLoader, deploymentReflectionIndex);
}
for (AbstractEndpoint ejbEndpoint : wsDeployment.getEjbEndpoints()) {
verifyEndpoint(ejbEndpoint, moduleClassLoader, deploymentReflectionIndex);
}
verifyApacheCXFModuleDependencyRequirement(unit);
}
}
Aggregations