use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class SarModuleDependencyProcessor method deploy.
/**
* Add dependencies for modules required for manged bean deployments, if managed bean configurations are attached
* to the deployment.
*
* @param phaseContext the deployment unit context
* @throws DeploymentUnitProcessingException
*/
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit.getAttachment(JBossServiceXmlDescriptor.ATTACHMENT_KEY);
if (serviceXmlDescriptor == null) {
// Skip deployments with out a service xml descriptor
return;
}
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_MODULES_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_AS_SYSTEM_JMX_ID, true, false, false, false));
// depend on Properties editor module which uses ServiceLoader approach to load the appropriate org.jboss.common.beans.property.finder.PropertyEditorFinder
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), PROPERTIES_EDITOR_MODULE_ID, false, false, true, false));
// All SARs require the ability to register MBeans.
moduleSpecification.addPermissionFactory(REGISTER_PERMISSION_FACTORY);
}
use of org.jboss.as.server.deployment.module.ModuleSpecification 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();
final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
final WeldCapability weldCapability;
try {
weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class);
} catch (CapabilityServiceSupport.NoSuchCapabilityException ignored) {
return;
}
if (!weldCapability.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.module.ModuleSpecification in project wildfly by wildfly.
the class CompensationsDependenciesDeploymentProcessor method addCompensationsModuleDependency.
private void addCompensationsModuleDependency(final DeploymentUnit unit) {
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, COMPENSATIONS_MODULE, false, false, true, false));
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class JPADependencyProcessor method addHibernate3AdaptorToDeployment.
private void addHibernate3AdaptorToDeployment(final ModuleLoader moduleLoader, final DeploymentUnit deploymentUnit) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
try {
final Module module = moduleLoader.loadModule(HIBERNATE_3_PROVIDER);
//use a trick to get to the root of the class loader
final URL url = module.getClassLoader().getResource(HIBERNATE3_PROVIDER_ADAPTOR.replace('.', '/') + ".class");
final URLConnection connection = url.openConnection();
if (!(connection instanceof JarURLConnection)) {
throw JpaLogger.ROOT_LOGGER.invalidUrlConnection("hibernate 3", connection);
}
final JarFile jarFile = ((JarURLConnection) connection).getJarFile();
moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(ResourceLoaders.createJarResourceLoader("hibernate3integration", jarFile)));
// hack in the dependencies which are part of hibernate3integration
// TODO: do this automatically (adding dependencies found in HIBERNATE_3_PROVIDER).
addDependency(moduleSpecification, moduleLoader, deploymentUnit, JBOSS_AS_NAMING_ID, JBOSS_JANDEX_ID);
} catch (ModuleLoadException e) {
throw JpaLogger.ROOT_LOGGER.cannotLoadModule(e, HIBERNATE_3_PROVIDER, "hibernate 3");
} catch (MalformedURLException e) {
throw JpaLogger.ROOT_LOGGER.cannotAddIntegration(e, "hibernate 3");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class FederationDependencyProcessor method addDependency.
private void addDependency(DeploymentPhaseContext phaseContext, ServiceName federationServiceName) {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, MODULE_ORG_PICKETLINK, false, false, true, false));
phaseContext.addDeploymentDependency(federationServiceName, DEPLOYMENT_ATTACHMENT_KEY);
}
Aggregations