use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class InjectionDeploymentAspect method setInjectionAwareInstanceProvider.
private void setInjectionAwareInstanceProvider(final Endpoint ep) {
final InstanceProvider stackInstanceProvider = ep.getInstanceProvider();
final DeploymentUnit unit = ep.getService().getDeployment().getAttachment(DeploymentUnit.class);
final InstanceProvider injectionAwareInstanceProvider = new InjectionAwareInstanceProvider(stackInstanceProvider, ep, unit);
ep.setInstanceProvider(injectionAwareInstanceProvider);
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class WebMetaDataCreator method create.
/**
* Creates web meta data for EJB deployments.
*
* @param dep webservice deployment
*/
void create(final Deployment dep) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
WarMetaData warMD = ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
JBossWebMetaData jbossWebMD = warMD != null ? warMD.getMergedJBossWebMetaData() : null;
if (warMD == null) {
warMD = new WarMetaData();
}
if (jbossWebMD == null) {
jbossWebMD = new JBossWebMetaData();
warMD.setMergedJBossWebMetaData(jbossWebMD);
unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD);
}
createWebAppDescriptor(dep, jbossWebMD);
createJBossWebAppDescriptor(dep, jbossWebMD);
dep.addAttachment(JBossWebMetaData.class, jbossWebMD);
}
use of org.jboss.as.server.deployment.DeploymentUnit 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.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class WeldBeanValidationDependencyProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
// Skip if there are no beans.xml files in the deployment
return;
}
ModuleDependency cdiBeanValidationDep = new ModuleDependency(moduleLoader, CDI_BEAN_VALIDATION_ID, false, false, true, false);
moduleSpecification.addSystemDependency(cdiBeanValidationDep);
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class EndpointDeployService method install.
public static DeploymentUnit install(final ServiceTarget serviceTarget, final String context, final ClassLoader loader, final String hostName, final Map<String, String> urlPatternToClassName, JBossWebMetaData jbwmd, WebservicesMetaData wsmd, JBossWebservicesMetaData jbwsmd, Map<Class<?>, Object> deploymentAttachments) {
final DeploymentUnit unit = EndpointPublisherHelper.doPrepareStep(context, loader, urlPatternToClassName, jbwmd, wsmd, jbwsmd);
if (deploymentAttachments != null) {
Deployment dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
for (Entry<Class<?>, Object> e : deploymentAttachments.entrySet()) {
dep.addAttachment(e.getKey(), e.getValue());
}
}
final EndpointDeployService service = new EndpointDeployService(context, unit);
final ServiceBuilder<DeploymentUnit> builder = serviceTarget.addService(service.getName(), service);
builder.addDependency(DependencyType.REQUIRED, WSServices.CONFIG_SERVICE);
builder.setInitialMode(Mode.ACTIVE);
builder.install();
return unit;
}
Aggregations