Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ STR_7022_SERVER_NAME=GlassFish Server 7.0.22
STR_7023_SERVER_NAME=GlassFish Server 7.0.23
STR_7024_SERVER_NAME=GlassFish Server 7.0.24
STR_7025_SERVER_NAME=GlassFish Server 7.0.25
STR_710_SERVER_NAME=GlassFish Server 7.1.0
STR_800_SERVER_NAME=GlassFish Server 8.0.0

# CommonServerSupport.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public enum ServerDetails {
),

/**
* details for an instance of GlassFish Server 7.0.24
* details for an instance of GlassFish Server 7.0.25
*/
GLASSFISH_SERVER_7_0_25(NbBundle.getMessage(ServerDetails.class, "STR_7025_SERVER_NAME", new Object[]{}), // NOI18N
GlassfishInstanceProvider.JAKARTAEE10_DEPLOYER_FRAGMENT,
Expand All @@ -566,15 +566,26 @@ public enum ServerDetails {
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/7.0.25/glassfish-7.0.25.zip", // NOI18N
"http://www.eclipse.org/legal/epl-2.0" //NOI18N
),

/**
* details for an instance of GlassFish Server 7.1.0
*/
GLASSFISH_SERVER_7_1_0(NbBundle.getMessage(ServerDetails.class, "STR_710_SERVER_NAME", new Object[]{}), // NOI18N
GlassfishInstanceProvider.JAKARTAEE10_DEPLOYER_FRAGMENT,
GlassFishVersion.GF_7_1_0,
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/7.1.0/glassfish-7.1.0.zip", // NOI18N
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/7.1.0/glassfish-7.1.0.zip", // NOI18N
"http://www.eclipse.org/legal/epl-2.0" //NOI18N
),

/**
* details for an instance of GlassFish Server 8.0.0
*/
GLASSFISH_SERVER_8_0_0(NbBundle.getMessage(ServerDetails.class, "STR_800_SERVER_NAME", new Object[]{}), // NOI18N
GlassfishInstanceProvider.JAKARTAEE11_DEPLOYER_FRAGMENT,
GlassFishVersion.GF_8_0_0,
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M12/glassfish-8.0.0-M12.zip", // NOI18N
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M12/glassfish-8.0.0-M12.zip", // NOI18N
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M15/glassfish-8.0.0-M15.zip", // NOI18N
"https://repo.maven.apache.org/maven2/org/glassfish/main/distributions/glassfish/8.0.0-M15/glassfish-8.0.0-M15.zip", // NOI18N
"http://www.eclipse.org/legal/epl-2.0" //NOI18N
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ STR_7022_SERVER_NAME=GlassFish Server 7.0.22
STR_7023_SERVER_NAME=GlassFish Server 7.0.23
STR_7024_SERVER_NAME=GlassFish Server 7.0.24
STR_7025_SERVER_NAME=GlassFish Server 7.0.25
STR_710_SERVER_NAME=GlassFish Server 7.1.0

STR_V8_FAMILY_NAME=GlassFish Server
STR_800_SERVER_NAME=GlassFish Server 8.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ public enum GlassFishVersion {
GF_7_0_24 ((short) 7, (short) 0, (short) 24, (short) 0, GlassFishVersion.GF_7_0_24_STR),
/** GlassFish 7.0.25 */
GF_7_0_25 ((short) 7, (short) 0, (short) 25, (short) 0, GlassFishVersion.GF_7_0_25_STR),
/** GlassFish 7.1.0 */
GF_7_1_0 ((short) 7, (short) 1, (short) 0, (short) 0, GlassFishVersion.GF_7_1_0_STR),
/** GlassFish 8.0.0 */
GF_8_0_0 ((short) 8, (short) 0, (short) 0, (short) 0, GlassFishVersion.GF_8_0_0_STR);
// Class attributes //
Expand Down Expand Up @@ -424,6 +426,11 @@ public enum GlassFishVersion {
static final String GF_7_0_25_STR = "7.0.25";
/** Additional {@code String} representations of GF_7_0_25 value. */
static final String GF_7_0_25_STR_NEXT[] = {"7.0.25", "7.0.25.0"};

/** A {@code String} representation of GF_7_1_0 value. */
static final String GF_7_1_0_STR = "7.1.0";
/** Additional {@code String} representations of GF_7_1_0 value. */
static final String GF_7_1_0_STR_NEXT[] = {"7.1.0", "7.1.0.0"};

/** A {@code String} representation of GF_8_0_0 value. */
static final String GF_8_0_0_STR = "8.0.0";
Expand Down Expand Up @@ -492,6 +499,7 @@ public enum GlassFishVersion {
initStringValuesMapFromArray(GF_7_0_23, GF_7_0_23_STR_NEXT);
initStringValuesMapFromArray(GF_7_0_24, GF_7_0_24_STR_NEXT);
initStringValuesMapFromArray(GF_7_0_25, GF_7_0_25_STR_NEXT);
initStringValuesMapFromArray(GF_7_1_0, GF_7_1_0_STR_NEXT);
initStringValuesMapFromArray(GF_8_0_0, GF_8_0_0_STR_NEXT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,37 @@ private static void addJavaAgent(GlassFishServer server,
}
}
}

/**
* Append module path and add modules to java options when there is at least
* one '--add-opens' without 'ALL-UNNAMED'.
* <p/>
* @param server GlassFish server entity.
* @param optList Returned list of java options.
*/
private static void appendModulePath(GlassFishServer server,
List<String> optList) {
boolean needed = optList
.stream()
.filter(
opt ->
opt.contains("--add-opens")
&&
!opt.contains("ALL-UNNAMED")
)
.findAny()
.isPresent();
if (needed) {
// appending module path and all modules in order to use
// '--add-opens' without 'ALL-UNNAMED'.
// See https://github.com/eclipse-ee4j/glassfish/pull/25537
String modulePath = server.getServerHome() + File.separator
+ ServerUtils.GF_LIB_DIR_NAME + File.separator
+ "bootstrap";
optList.add("--module-path=" + modulePath);
optList.add("--add-modules=ALL-MODULE-PATH");
}
}

/**
* Adds server variables from variables map into Java VM options
Expand Down Expand Up @@ -142,8 +173,9 @@ public static ResultProcess startServer(GlassFishServer server,
JvmConfigReader jvmConfigReader = new JvmConfigReader(DAS_NAME);
String domainAbsolutePath = server.getDomainsFolder() + File.separator
+ server.getDomainName();
String domainXmlPath = domainAbsolutePath + File.separator + "config"
+ File.separator + "domain.xml";
String domainXmlPath = domainAbsolutePath + File.separator
+ ServerUtils.GF_DOMAIN_CONFIG_DIR_NAME + File.separator
+ ServerUtils.GF_DOMAIN_CONFIG_FILE_NAME;
if (!TreeParser.readXml(new File(domainXmlPath), jvmConfigReader)) {
// retry with platform default
LOGGER.log(Level.INFO, "Retrying with {0} encoding", Charset.defaultCharset());
Expand All @@ -154,6 +186,7 @@ public static ResultProcess startServer(GlassFishServer server,
}
}
List<String> optList = jvmConfigReader.getOptList();
appendModulePath(server, optList);
Map<String, String> propMap = jvmConfigReader.getPropMap();
addJavaAgent(server, jvmConfigReader);
// try to find bootstraping jar - usually glassfish.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ public class ConfigBuilderProvider {
private static final Config.Next CONFIG_V7_0_25
= new Config.Next(GlassFishVersion.GF_7_0_25,
ConfigBuilderProvider.class.getResource("GlassFishV7_0_24.xml"));

/** Library builder configuration since GlassFish 7.1.0. */
private static final Config.Next CONFIG_V7_1_0
= new Config.Next(GlassFishVersion.GF_7_1_0,
ConfigBuilderProvider.class.getResource("GlassFishV7_1_0.xml"));

/** Library builder configuration since GlassFish 8.0.0. */
private static final Config.Next CONFIG_V8_0_0
Expand All @@ -260,7 +265,8 @@ public class ConfigBuilderProvider {
CONFIG_V7_0_15, CONFIG_V7_0_16, CONFIG_V7_0_17,
CONFIG_V7_0_18, CONFIG_V7_0_19, CONFIG_V7_0_20,
CONFIG_V7_0_21, CONFIG_V7_0_22, CONFIG_V7_0_23,
CONFIG_V7_0_24, CONFIG_V7_0_24, CONFIG_V8_0_0);
CONFIG_V7_0_24, CONFIG_V7_0_25, CONFIG_V7_1_0,
CONFIG_V8_0_0);

/** Builders array for each server instance. */
private static final ConcurrentMap<GlassFishServer, ConfigBuilder> builders
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->
<server>
<tools lib="lib">
<asadmin jar="client/appserver-cli.jar"/>
</tools>
<java version="21">
<platform version="17"/>
<platform version="18"/>
<platform version="19"/>
<platform version="20"/>
<platform version="21"/>
<platform version="22"/>
<platform version="23"/>
<platform version="24"/>
<platform version="25"/>
</java>
<javaee version="10.0.0">
<profile version="10.0.0" type="web"/>
<profile version="10.0.0" type="full" check="full"/>
<module type="war"/>
<module type="car" check="full"/>
<module type="ear" check="full"/>
<module type="ejb" check="full"/>
<module type="rar" check="full"/>
<check name="full">
<file path="appclient-server-core.jar"/>
</check>
</javaee>
<library id="Java EE">
<classpath>
<fileset dir="modules">
<include name="jakarta\..+\.jar"/>
<include name="jakarta.enterprise.cdi-api.jar"/>
<include name="jakarta.validation-api.jar"/>
<include name="jaxb-osgi.jar"/>
<include name="webservices-osgi.jar"/>
<include name="weld-osgi-bundle.jar"/>
</fileset>
<fileset dir="modules/endorsed">
<include name=".+\.jar"/>
</fileset>
</classpath>
<javadocs>
<lookup path="docs/jakartaee10-doc-api.jar"/>
</javadocs>
<sources>
</sources>
</library>
<library id="Jersey 3">
<classpath>
<fileset dir="modules">
<include name="jackson.+\.jar"/>
<include name="jersey.+\.jar"/>
<include name="jettison.*\.jar"/>
</fileset>
</classpath>
<javadocs>
<link url="https://repo.maven.apache.org/maven2/org/glassfish/jersey/jersey-documentation/3.1.11/jersey-documentation-3.1.11-docbook.zip"/>
</javadocs>
<sources>
</sources>
</library>
<library id="JAX-RS">
<classpath>
<fileset dir="modules">
<include name="jakarta.ws.rs-api.jar"/>
</fileset>
</classpath>
<javadocs>
</javadocs>
<sources>
</sources>
</library>
</server>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<platform version="22"/>
<platform version="23"/>
<platform version="24"/>
<platform version="25"/>
</java>
<javaee version="11.0.0">
<profile version="11.0.0" type="web"/>
Expand Down Expand Up @@ -70,7 +71,7 @@
</fileset>
</classpath>
<javadocs>
<link url="https://repo.maven.apache.org/maven2/org/glassfish/jersey/jersey-documentation/4.0.0-M3/jersey-documentation-4.0.0-M3-docbook.zip"/>
<link url="https://repo.maven.apache.org/maven2/org/glassfish/jersey/jersey-documentation/4.0.0-M4/jersey-documentation-4.0.0-M4-docbook.zip"/>
</javadocs>
<sources>
</sources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,37 +557,38 @@ public static GlassFishVersion getServerVersion(final String serverHome) {
ClassLoader cl = new URLClassLoader(new URL[] {commonUtilJar.
toURI().toURL()});
Class c = cl.loadClass(VERSION_CLASS);
// Try to get version from com.sun.appserv.server.util.Version.
try {
Method mGetFullVersion = c.getMethod(VERSION_METHOD);
System.getProperties().put(GF_HOME_PROPERTY, serverHome);
String fullVersionString
= (String)mGetFullVersion.invoke(c);
System.getProperties().remove(GF_HOME_PROPERTY);
String versionString
= getVersionString(fullVersionString);

// Use Manifest Bundle-Version.
try (JarFile jar = new JarFile(commonUtilJar)) {
Manifest manifest = jar.getManifest();
String versionString = getVersionString(manifest
.getMainAttributes().getValue(BUNDLE_VERSION));
if (versionString != null) {
version = GlassFishVersion.toValue(versionString);
}
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException
| SecurityException | NoClassDefFoundError ex) {
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from: "
+ commonUtilJar.getAbsolutePath() + ". "
+ "Using Manifest Bundle-Version as fallback option:", ex);
} catch (IOException ioe) {
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from Manifest: "
+ commonUtilJar.getAbsolutePath() + ": ", ioe);
}
// Use Manifest Bundle-Version as fallback option.

if (version == null) {
try (JarFile jar = new JarFile(commonUtilJar)) {
Manifest manifest = jar.getManifest();
String versionString = getVersionString(manifest
.getMainAttributes().getValue(BUNDLE_VERSION));
// Try to get version from com.sun.appserv.server.util.Version as fallback option.
try {
Method mGetFullVersion = c.getMethod(VERSION_METHOD);
System.getProperties().put(GF_HOME_PROPERTY, serverHome);
String fullVersionString = (String)mGetFullVersion.invoke(c);
System.getProperties().remove(GF_HOME_PROPERTY);
String versionString
= getVersionString(fullVersionString);
if (versionString != null) {
version = GlassFishVersion.toValue(versionString);
}
} catch (IOException ioe) {
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from Manifest: "
+ commonUtilJar.getAbsolutePath() + ": ", ioe);
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException
| SecurityException | NoClassDefFoundError ex) {
Logger.log(Level.WARNING, "Cannot retrieve Glassfish version from: "
+ commonUtilJar.getAbsolutePath() + ". "
+ "Using Manifest Bundle-Version as fallback option:", ex);
}
}
} catch (MalformedURLException | ClassNotFoundException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,32 @@ public void testGetInstanceforVersionGF7() {
assertTrue(cmd.equals(runner.getCommand()));
}

/**
* Test factory functionality for GlassFish v. 7.1.0
* <p/>
* Factory should initialize REST {@code Runner} and point it to
* provided {@code Command} instance.
*/
@Test
public void testGetInstanceforVersionGF71() {
GlassFishServerEntity srv = new GlassFishServerEntity();
srv.setVersion(GlassFishVersion.GF_7_1_0);
AdminFactory af = AdminFactory.getInstance(srv.getVersion());
assertTrue(af instanceof AdminFactoryRest);
Command cmd = new CommandVersion();
Runner runner;
try {
runner = af.getRunner(srv, cmd);
} catch (GlassFishIdeException gfie) {
runner = null;
fail("Exception in Runner initialization: " + gfie.getMessage());
}
// Returned runner should be REST interface.
assertTrue(runner instanceof RunnerRest);
// Stored command entity should be the one we supplied.
assertTrue(cmd.equals(runner.getCommand()));
}

/**
* Test factory functionality for GlassFish v. 8.0.0
* <p/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public void testToValue() {
GlassFishVersion.GF_7_0_24_STR_NEXT);
verifyToValueFromAdditionalArray(GlassFishVersion.GF_7_0_25,
GlassFishVersion.GF_7_0_25_STR_NEXT);
verifyToValueFromAdditionalArray(GlassFishVersion.GF_7_1_0,
GlassFishVersion.GF_7_1_0_STR_NEXT);
verifyToValueFromAdditionalArray(GlassFishVersion.GF_8_0_0,
GlassFishVersion.GF_8_0_0_STR_NEXT);
}
Expand Down Expand Up @@ -179,7 +181,7 @@ public void testToValueIncomplete() {
GlassFishVersion.GF_7_0_20, GlassFishVersion.GF_7_0_21,
GlassFishVersion.GF_7_0_22, GlassFishVersion.GF_7_0_23,
GlassFishVersion.GF_7_0_24, GlassFishVersion.GF_7_0_25,
GlassFishVersion.GF_8_0_0
GlassFishVersion.GF_7_1_0, GlassFishVersion.GF_8_0_0
};
String strings[] = {
"1.0.1.4", "2.0.1.5", "2.1.0.3", "2.1.1.7",
Expand All @@ -195,7 +197,7 @@ public void testToValueIncomplete() {
"7.0.14.0", "7.0.15.0", "7.0.16.0", "7.0.17.0",
"7.0.18.0", "7.0.19.0", "7.0.20.0", "7.0.21.0",
"7.0.22.0", "7.0.23.0", "7.0.24.0", "7.0.25.0",
"8.0.0.0"
"7.1.0.0", "8.0.0.0"
};
for (int i = 0; i < versions.length; i++) {
GlassFishVersion version = GlassFishVersion.toValue(strings[i]);
Expand Down
Loading