diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java index bfa770126f9..f2d0dc7cfb1 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java @@ -282,8 +282,9 @@ private void installAliases(final ModuleSpecification moduleSpecification, final ModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER); for (final String aliasName : moduleSpecification.getModuleAliases()) { final ModuleIdentifier alias = ModuleIdentifier.fromString(aliasName); + final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(alias.toString()); - final ModuleSpec spec = ModuleSpec.buildAlias(aliasName, moduleIdentifier.getName()).create(); + final ModuleSpec spec = ModuleSpec.buildAlias(aliasName, moduleIdentifier.toString()).create(); HashSet dependencies = new HashSet<>(moduleSpecification.getAllDependencies()); //we need to add the module we are aliasing as a dependency, to make sure that it will be resolved diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecification.java b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecification.java index 6ae0f0782db..6be02f3c8e7 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecification.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecification.java @@ -129,12 +129,12 @@ public class ModuleSpecification extends SimpleAttachable { private final List permissionFactories = new ArrayList<>(); public void addSystemDependency(final ModuleDependency dependency) { - if (!exclusions.contains(dependency.getIdentifier().getName())) { + if (!exclusions.contains(dependency.getIdentifier().toString())) { if (systemDependenciesSet.add(dependency)) { resetDependencyLists(); } } else { - excludedDependencies.add(dependency.getIdentifier().getName()); + excludedDependencies.add(dependency.getIdentifier().toString()); } } @@ -173,12 +173,12 @@ public void removeUserDependencies(final Predicate predicate) } public void addLocalDependency(final ModuleDependency dependency) { - if (!exclusions.contains(dependency.getIdentifier().getName())) { + if (!exclusions.contains(dependency.getIdentifier().toString())) { if (this.localDependenciesSet.add(dependency)) { resetDependencyLists(); } } else { - excludedDependencies.add(dependency.getIdentifier().getName()); + excludedDependencies.add(dependency.getIdentifier().toString()); } } @@ -205,7 +205,7 @@ public Set getSystemDependenciesSet() { */ @Deprecated(forRemoval = true) public void addExclusion(final ModuleIdentifier exclusion) { - addModuleExclusion(exclusion.getName()); + addModuleExclusion(exclusion.toString()); } /** @@ -227,7 +227,7 @@ public void addModuleExclusion(final String exclusion) { Iterator it = systemDependenciesSet.iterator(); while (it.hasNext()) { final ModuleDependency dep = it.next(); - if (dep.getIdentifier().getName().equals(exclusion)) { + if (dep.getIdentifier().toString().equals(exclusion)) { it.remove(); resetDependencyLists(); } @@ -235,7 +235,7 @@ public void addModuleExclusion(final String exclusion) { it = localDependenciesSet.iterator(); while (it.hasNext()) { final ModuleDependency dep = it.next(); - if (dep.getIdentifier().getName().equals(exclusion)) { + if (dep.getIdentifier().toString().equals(exclusion)) { it.remove(); resetDependencyLists(); } @@ -370,7 +370,7 @@ public void setLocalLast(final boolean localLast) { @Deprecated(forRemoval = true) @SuppressWarnings("unused") public void addAlias(final ModuleIdentifier moduleIdentifier) { - addModuleAlias(moduleIdentifier.getName()); + addModuleAlias(moduleIdentifier.toString()); } /** @@ -390,7 +390,7 @@ public void addModuleAlias(final String moduleIdentifier) { @Deprecated(forRemoval = true) public void addAliases(final Collection moduleIdentifiers) { for (ModuleIdentifier id : moduleIdentifiers) { - addModuleAlias(id.getName()); + addModuleAlias(id.toString()); } } diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java b/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java index b636c6558c0..b2714794247 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java @@ -244,7 +244,7 @@ private void handleDeployment(final DeploymentPhaseContext phaseContext, final D } // No more nested loop for (ModuleDependency dependency : moduleDependencies) { - String identifier = dependency.getIdentifier().getName(); + String identifier = dependency.getIdentifier().toString(); if (index.containsKey(identifier)) { aliasDependencies.add(new ModuleDependency(dependency.getModuleLoader(), index.get(identifier).getModuleIdentifier(), dependency.isOptional(), dependency.isExport(), dependency.isImportServices(), dependency.isUserSpecified())); } @@ -253,7 +253,7 @@ private void handleDeployment(final DeploymentPhaseContext phaseContext, final D ModuleAliasChecker.checkModuleAliasesForDependencies(moduleDependencies, MessageContext.JBOSS_DEPLOYMENT_STRUCTURE_CONTEXT, deploymentUnit.getName()); moduleSpec.addUserDependencies(moduleDependencies); ModuleAliasChecker.checkModuleAliasesForExclusions(rootDeploymentSpecification.getExclusions(), MessageContext.JBOSS_DEPLOYMENT_STRUCTURE_CONTEXT, deploymentUnit.getName()); - rootDeploymentSpecification.getExclusions().stream().map(ModuleIdentifier::getName).forEach(moduleSpec::addModuleExclusion); + rootDeploymentSpecification.getExclusions().stream().map(ModuleIdentifier::toString).forEach(moduleSpec::addModuleExclusion); moduleSpec.addAliases(rootDeploymentSpecification.getAliases()); moduleSpec.addModuleSystemDependencies(rootDeploymentSpecification.getSystemDependencies()); for (final ResourceRoot additionalResourceRoot : rootDeploymentSpecification.getResourceRoots()) { @@ -279,7 +279,7 @@ private void handleDeployment(final DeploymentPhaseContext phaseContext, final D for (final ModuleIdentifier dependency : rootDeploymentSpecification.getAnnotationModules()) { ModuleIdentifier identifier = dependency; for (AdditionalModuleSpecification module : additionalModules.values()) { - if (module.getModuleAliases().contains(dependency.getName())) { + if (module.getModuleAliases().contains(dependency.toString())) { identifier = module.getModuleIdentifier(); break; } diff --git a/server/src/test/java/org/jboss/as/server/deployment/module/ModuleSpecificationTestCase.java b/server/src/test/java/org/jboss/as/server/deployment/module/ModuleSpecificationTestCase.java index 057dfdb8fba..a8356cf2a99 100644 --- a/server/src/test/java/org/jboss/as/server/deployment/module/ModuleSpecificationTestCase.java +++ b/server/src/test/java/org/jboss/as/server/deployment/module/ModuleSpecificationTestCase.java @@ -36,7 +36,7 @@ public class ModuleSpecificationTestCase { private static final Set ALL_DEPS = Set.of(DEP_A, DEP_B, DEP_C, DEP_A_FILTERED); - private static final ModuleDependency DEP_D = createModuleDependency("d"); + private static final ModuleDependency DEP_D = createModuleDependency("d:aslot"); private static final ModuleDependency DEP_E = createModuleDependency("e"); private static ModuleDependency createModuleDependency(String identifier) { @@ -61,11 +61,11 @@ public void testUserDependencyConsistency() { ); // Removal consistency - ms.removeUserDependencies(md -> md.getIdentifier().getName().equals("a")); + ms.removeUserDependencies(md -> md.getIdentifier().toString().equals("a")); Set userDepSet = ms.getUserDependenciesSet(); assertEquals(INITIAL_DEPS.size() /* the initials, minus 'a', plus 'd'*/, userDepSet.size()); for (ModuleDependency md : ALL_DEPS) { - boolean shouldFind = !md.getIdentifier().getName().equals("a"); + boolean shouldFind = !md.getIdentifier().toString().equals("a"); assertEquals(shouldFind, userDepSet.contains(md)); } assertTrue(userDepSet.contains(DEP_D)); @@ -95,12 +95,12 @@ public void testLocalDependencyConsistency() { public void testModuleAliases() { ModuleSpecification ms = new ModuleSpecification(); for (ModuleDependency dependency : ALL_DEPS) { - ms.addModuleAlias(dependency.getIdentifier().getName()); + ms.addModuleAlias(dependency.getIdentifier().toString()); } Set aliases = ms.getModuleAliases(); assertEquals(ALL_DEPS.size() - 1, aliases.size()); for (ModuleDependency dep : INITIAL_DEPS) { - assertTrue(dep + " missing", aliases.contains(dep.getIdentifier().getName())); + assertTrue(dep + " missing", aliases.contains(dep.getIdentifier().toString())); } } @@ -174,7 +174,7 @@ private ModuleSpecification dependencySetConsistencyTest(BiConsumer fictitious = ms.getFictitiousExcludedDependencies(); - Set expected = exclusionsSupported ? Set.of(DEP_E.getIdentifier().getName()) : Set.of(DEP_D.getIdentifier().getName(), DEP_E.getIdentifier().getName()); + Set expected = exclusionsSupported ? Set.of(DEP_E.getIdentifier().toString()) : Set.of(DEP_D.getIdentifier().toString(), DEP_E.getIdentifier().toString()); assertEquals(expected, fictitious); return ms;