use of org.jboss.as.server.deployment.module.ModuleSpecification in project teiid by teiid.
the class VDBDependencyDeployer method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
return;
}
final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
ArrayList<ModuleDependency> localDependencies = new ArrayList<ModuleDependency>();
ArrayList<ModuleDependency> userDependencies = new ArrayList<ModuleDependency>();
// $NON-NLS-1$
String moduleNames = deployment.getPropertyValue("lib");
if (moduleNames != null) {
StringTokenizer modules = new StringTokenizer(moduleNames);
while (modules.hasMoreTokens()) {
String moduleName = modules.nextToken().trim();
ModuleIdentifier lib = ModuleIdentifier.create(moduleName);
ModuleLoader moduleLoader = Module.getCallerModuleLoader();
try {
moduleLoader.loadModule(lib);
localDependencies.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(moduleName), false, false, false, false));
} catch (ModuleLoadException e) {
// this is to handle JAR based deployments which take on name like "deployment.<jar-name>"
moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
try {
moduleLoader.loadModule(lib);
userDependencies.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(moduleName), false, false, false, true));
} catch (ModuleLoadException e1) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50088, moduleName, deployment.getName(), deployment.getVersion(), e1));
}
}
}
}
if (!TeiidAttachments.isVDBXMLDeployment(deploymentUnit)) {
try {
final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
if (deploymentRoot == null) {
return;
}
final VirtualFile libDir = deploymentRoot.getChild(LIB);
if (libDir.exists()) {
final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
for (final VirtualFile archive : archives) {
try {
final Closeable closable = VFS.mountZip(archive, archive, TempFileProviderService.provider());
final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
ModuleRootMarker.mark(jarArchiveRoot);
deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
} catch (IOException e) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50018, archive), e);
}
}
}
} catch (IOException e) {
throw new DeploymentUnitProcessingException(e);
}
}
// add translators as dependent modules to this VDB.
try {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
// $NON-NLS-1$
final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader();
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false, false));
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false, false));
// $NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false, false));
if (!localDependencies.isEmpty()) {
moduleSpecification.addLocalDependencies(localDependencies);
}
if (!userDependencies.isEmpty()) {
moduleSpecification.addUserDependencies(userDependencies);
}
} catch (ModuleLoadException e) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name(), e);
}
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project camunda-bpm-platform by camunda.
the class ModuleDependencyProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getParent() == null) {
// The deployment unit has no parent so it is a simple war or an ear.
ModuleLoader moduleLoader = Module.getBootModuleLoader();
// If it is a simpleWar and marked with process application we have to add the dependency
boolean isProcessApplicationWarOrEar = ProcessApplicationAttachments.isProcessApplication(deploymentUnit);
AttachmentList<DeploymentUnit> subdeployments = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
// In cases of war files we have nothing todo.
if (subdeployments != null) {
// The deployment unit contains sub deployments which means the deployment unit is an ear.
// We have to check whether sub deployments are process applications or not.
boolean subDeploymentIsProcessApplication = false;
for (DeploymentUnit subDeploymentUnit : subdeployments) {
if (ProcessApplicationAttachments.isProcessApplication(subDeploymentUnit)) {
subDeploymentIsProcessApplication = true;
break;
}
}
// Also we have to add the dependency to the current deployment unit which is an ear
if (subDeploymentIsProcessApplication) {
for (DeploymentUnit subDeploymentUnit : subdeployments) {
final ModuleSpecification moduleSpecification = subDeploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
addSystemDependencies(moduleLoader, moduleSpecification);
}
// An ear is not marked as process application but also needs the dependency
isProcessApplicationWarOrEar = true;
}
}
if (isProcessApplicationWarOrEar) {
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
addSystemDependencies(moduleLoader, moduleSpecification);
}
}
// install the pa-module service
ModuleIdentifier identifyer = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER);
String moduleName = identifyer.toString();
ProcessApplicationModuleService processApplicationModuleService = new ProcessApplicationModuleService();
ServiceName serviceName = ServiceNames.forProcessApplicationModuleService(moduleName);
phaseContext.getServiceTarget().addService(serviceName, processApplicationModuleService).addDependency(phaseContext.getPhaseServiceName()).setInitialMode(Mode.ACTIVE).install();
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class EESecurityDependencyProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent();
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("javax.security.enterprise.api"), false, false, true, false));
Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT);
if (securityPresent != null && securityPresent) {
moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false));
}
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class GlobalModuleDependencyProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final List<GlobalModule> globalMods = this.globalModules;
for (final GlobalModule module : globalMods) {
final ModuleDependency dependency = new ModuleDependency(Module.getBootModuleLoader(), module.getModuleIdentifier(), false, false, module.isServices(), false);
if (module.isMetaInf()) {
dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true);
dependency.addImportFilter(PathFilters.getMetaInfFilter(), true);
}
if (module.isAnnotations()) {
deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, module.getModuleIdentifier());
}
moduleSpecification.addSystemDependency(dependency);
}
}
use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.
the class StaticInterceptorsDependenciesDeploymentUnitProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
final ModuleSpecification deploymentModuleSpec = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
for (final String interceptorModule : interceptorModules) {
final ModuleIdentifier interceptorModuleId = ModuleIdentifier.create(interceptorModule);
deploymentModuleSpec.addSystemDependency(new ModuleDependency(moduleLoader, interceptorModuleId, false, false, true, false));
}
}
Aggregations