|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2015 Red Hat, Inc. |
| 2 | + * Copyright (c) 2024 Red Hat, Inc. |
3 | 3 | * Distributed under license by Red Hat, Inc. All rights reserved. |
4 | 4 | * This program is made available under the terms of the |
5 | 5 | * Eclipse Public License v2.0 which accompanies this distribution, |
|
15 | 15 | import java.util.Collections; |
16 | 16 |
|
17 | 17 | import org.jboss.tools.rsp.server.wildfly.impl.util.JBossManifestUtility; |
| 18 | +import org.jboss.tools.rsp.server.wildfly.impl.util.LayeredModulePathFactory; |
18 | 19 |
|
19 | 20 | public class ServerBeanTypeWildflyPlus extends JBossServerBeanType { |
20 | 21 | private boolean web; |
@@ -75,11 +76,31 @@ private static boolean canHandleVersion(int beanTypeVersion, int foundVersion) { |
75 | 76 |
|
76 | 77 | public static String getFullVersion(File location, |
77 | 78 | File systemFile, int majorVersion, String myPrefix) { |
| 79 | + File[] roots = new File[]{new File(location, MODULES)}; |
| 80 | + String moduleId = "org.jboss.as.product"; |
78 | 81 | String found = JBossManifestUtility.getManifestPropFromJBossModulesFolder( |
79 | | - new File[]{new File(location, MODULES)}, |
80 | | - "org.jboss.as.product", "main/dir/META-INF", |
| 82 | + roots, |
| 83 | + moduleId, "main/dir/META-INF", |
81 | 84 | MANIFEST_PROD_RELEASE_VERS); |
82 | | - return fullVersionIfResponsible(myPrefix, majorVersion, found); |
| 85 | + if( found != null ) |
| 86 | + return fullVersionIfResponsible(myPrefix, majorVersion, found); |
| 87 | + return getFullVersionWfly32PlusLayout(roots, moduleId, myPrefix, majorVersion); |
| 88 | + } |
| 89 | + |
| 90 | + public static String getFullVersionWfly32PlusLayout(File[] roots, String moduleId, String myPrefix, int majorVersion) { |
| 91 | + File[] layeredRoots = LayeredModulePathFactory.resolveLayeredModulePath(roots); |
| 92 | + for( int i = 0; i < layeredRoots.length; i++ ) { |
| 93 | + File[] jars = JBossManifestUtility.getFilesForModule(layeredRoots[i], moduleId, "main", ManifestUtility.jarFilter()); |
| 94 | + for( int j = 0; j < jars.length; j++ ) { |
| 95 | + File f = jars[j]; |
| 96 | + String found2 = ManifestUtility.getFullServerVersionFromZipLegacy(f, new String[]{ |
| 97 | + "Implementation-Version", "JBoss-Product-Release-Version", "JBossAS-Release-Version"}); |
| 98 | + if( found2 != null ) { |
| 99 | + return fullVersionIfResponsible(myPrefix, majorVersion, found2); |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + return null; |
83 | 104 | } |
84 | 105 |
|
85 | 106 | private static String fullVersionIfResponsible(String myPrefix, int majorVersion, String found) { |
|
0 commit comments