diff --git a/appserver/extras/embedded/common/bootstrap/pom.xml b/appserver/extras/embedded/common/bootstrap/pom.xml
index 13c50353de8..c074f33bebd 100644
--- a/appserver/extras/embedded/common/bootstrap/pom.xml
+++ b/appserver/extras/embedded/common/bootstrap/pom.xml
@@ -78,7 +78,7 @@
jar
false
${project.build.directory}/classes
- META-INF/**
+ META-INF/**,module-info.class
org.glassfish.main.core
diff --git a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/AsadminLoggingITest.java b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/AsadminLoggingITest.java
index f9141903b42..d5cb64c8fd9 100644
--- a/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/AsadminLoggingITest.java
+++ b/appserver/tests/admin/tests/src/test/java/org/glassfish/main/admin/test/AsadminLoggingITest.java
@@ -117,7 +117,7 @@ public void listLoggers() {
assertThat(result, asadminOK());
String[] lines = substringBefore(result.getStdOut(), "Command list-loggers executed successfully.").split("\n");
assertAll(
- () -> assertThat(lines, arrayWithSize(equalTo(61))),
+ () -> assertThat(lines, arrayWithSize(equalTo(62))),
() -> assertThat(lines[0], matchesPattern("Logger Name[ ]+Subsystem[ ]+Logger Description[ ]+"))
);
Map loggers = Arrays.stream(lines).skip(1).map(line -> line.split("\\s{2,}"))
diff --git a/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/FelixPrettyPrinter.java b/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/FelixPrettyPrinter.java
index e388941891a..3619b998136 100644
--- a/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/FelixPrettyPrinter.java
+++ b/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/FelixPrettyPrinter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
+ * Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 2008, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
@@ -25,10 +25,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.osgi.framework.BundleException;
-
/**
- * Tools for obtaining readable information from the {@link BundleException}
+ * Tools for obtaining readable information from the {@link org.osgi.framework.BundleException}
*/
public class FelixPrettyPrinter {
diff --git a/nucleus/common/glassfish-jdk-extensions/src/main/java/module-info.java b/nucleus/common/glassfish-jdk-extensions/src/main/java/module-info.java
new file mode 100644
index 00000000000..5b202253adf
--- /dev/null
+++ b/nucleus/common/glassfish-jdk-extensions/src/main/java/module-info.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/**
+ * @author David Matejcek
+ */
+module org.glassfish.main.jdke {
+
+ requires java.base;
+
+ exports org.glassfish.main.jdke.cl;
+ exports org.glassfish.main.jdke.i18n;
+}
diff --git a/nucleus/common/simple-glassfish-api/src/main/java/module-info.java b/nucleus/common/simple-glassfish-api/src/main/java/module-info.java
new file mode 100644
index 00000000000..2892a81a8c6
--- /dev/null
+++ b/nucleus/common/simple-glassfish-api/src/main/java/module-info.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/**
+ * @author David Matejcek
+ */
+module org.glassfish.main.api.simple {
+
+ requires java.base;
+ requires java.logging;
+
+ exports org.glassfish.embeddable;
+ exports org.glassfish.embeddable.spi;
+}
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntime.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntime.java
index cbfdc7565c6..a01cb482a09 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntime.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntime.java
@@ -18,7 +18,6 @@
package org.glassfish.main.boot.embedded;
import com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
import com.sun.enterprise.module.ModulesRegistry;
import com.sun.enterprise.module.bootstrap.Main;
import com.sun.enterprise.module.bootstrap.ModuleStartup;
@@ -46,6 +45,7 @@
import org.glassfish.embeddable.GlassFishRuntime;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.utilities.DuplicatePostProcessor;
+import org.glassfish.main.boot.log.LogFacade;
import static com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys.AUTO_DELETE;
import static java.util.logging.Level.FINER;
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntimeBuilder.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntimeBuilder.java
index c86c6ae4d81..17f42159f07 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntimeBuilder.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedGlassFishRuntimeBuilder.java
@@ -20,7 +20,6 @@
import com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys;
import com.sun.enterprise.glassfish.bootstrap.cfg.OsgiPlatform;
import com.sun.enterprise.glassfish.bootstrap.cfg.ServerFiles;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
import com.sun.enterprise.module.ModulesRegistry;
import com.sun.enterprise.module.common_impl.AbstractFactory;
@@ -37,6 +36,7 @@
import org.glassfish.embeddable.GlassFishException;
import org.glassfish.embeddable.GlassFishRuntime;
import org.glassfish.embeddable.spi.RuntimeBuilder;
+import org.glassfish.main.boot.log.LogFacade;
import org.glassfish.main.jdke.cl.GlassfishUrlClassLoader;
/**
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedInhabitantsParser.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedInhabitantsParser.java
index 357a9a45014..405da792bc8 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedInhabitantsParser.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/EmbeddedInhabitantsParser.java
@@ -17,8 +17,6 @@
package org.glassfish.main.boot.embedded;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -26,6 +24,7 @@
import org.glassfish.hk2.api.PopulatorPostProcessor;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.utilities.DescriptorImpl;
+import org.glassfish.main.boot.log.LogFacade;
/**
* Kernel's decoration for embedded environment.
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/JarUtil.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/JarUtil.java
index 08959c3e13a..0952aa639ba 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/JarUtil.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/JarUtil.java
@@ -17,8 +17,6 @@
package org.glassfish.main.boot.embedded;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -29,6 +27,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.glassfish.main.boot.log.LogFacade;
+
/**
* Most part is copied from com.sun.appserv.connectors.internal.api.ConnectorsUtil
*
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/SingleHK2Factory.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/SingleHK2Factory.java
index ec56fc1061b..11467f95490 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/SingleHK2Factory.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/embedded/SingleHK2Factory.java
@@ -17,13 +17,14 @@
package org.glassfish.main.boot.embedded;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
import com.sun.enterprise.module.ModuleDefinition;
import com.sun.enterprise.module.ModulesRegistry;
import com.sun.enterprise.module.common_impl.AbstractFactory;
import com.sun.enterprise.module.common_impl.ModuleId;
import com.sun.enterprise.module.single.SingleModulesRegistry;
+import org.glassfish.main.boot.log.LogFacade;
+
/**
* Factory which provides SingleModulesRegistry
* This should actually be in HK2 workspace.
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/log/LogFacade.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/log/LogFacade.java
new file mode 100644
index 00000000000..c462735f160
--- /dev/null
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/log/LogFacade.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
+ * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.main.boot.log;
+
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.glassfish.logging.annotation.LogMessageInfo;
+import org.glassfish.logging.annotation.LogMessagesResourceBundle;
+import org.glassfish.logging.annotation.LoggerInfo;
+
+public class LogFacade {
+
+ @LoggerInfo(subsystem = "BOOTSTRAP", description="Main bootstrap logger.")
+ public static final String BOOTSTRAP_LOGGER_NAME = "jakarta.enterprise.bootstrap";
+
+ @LogMessagesResourceBundle
+ public static final String RB_NAME = "org.glassfish.main.boot.log.LogMessages";
+
+ public static final Logger BOOTSTRAP_LOGGER = Logger.getLogger(BOOTSTRAP_LOGGER_NAME, RB_NAME);
+
+ @LogMessageInfo(
+ message = "Can not start bundle {0} because it is not contained in the list of installed bundles.",
+ level = "WARNING")
+ public static final String CANT_START_BUNDLE = "NCLS-BOOTSTRAP-00005";
+
+ @LogMessageInfo(
+ message = "Failed to start {0}.",
+ level = "WARNING")
+ public static final String BUNDLE_START_FAILED = "NCLS-BOOTSTRAP-00006";
+
+ @LogMessageInfo(
+ message = "Can't uninstall bundle = {0} as it's already uninstalled.",
+ level = "WARNING")
+ public static final String BUNDLE_ALREADY_UNINSTALED = "NCLS-BOOTSTRAP-00007";
+
+ @LogMessageInfo(
+ message = "Uninstalled bundle {0} installed from {1}.",
+ level = "INFO")
+ public static final String UNINSTALLED_BUNDLE = "NCLS-BOOTSTRAP-00008";
+
+ @LogMessageInfo(
+ message = "Can't update bundle = {0} as it's already uninstalled.",
+ level = "WARNING")
+ public static final String CANT_UPDATE_ALREADY_INSTALLED = "NCLS-BOOTSTRAP-00009";
+
+ @LogMessageInfo(
+ message = "Updated bundle {0} from {1}.",
+ level = "INFO")
+ public static final String BUNDLE_UPDATED = "NCLS-BOOTSTRAP-00010";
+
+ @LogMessageInfo(
+ message = "Failed to uninstall bundle {0}.",
+ level = "WARNING")
+ public static final String BUNDLE_UNINSTALL_FAILED = "NCLS-BOOTSTRAP-00011";
+
+ @LogMessageInfo(
+ message = "Failed to update {0}.",
+ level = "WARNING")
+ public static final String UPDATE_FAILED = "NCLS-BOOTSTRAP-00012";
+
+ @LogMessageInfo(
+ message = "Failed to install {0}.",
+ level = "WARNING")
+ public static final String INSTALL_FAILED = "NCLS-BOOTSTRAP-00013";
+
+ @LogMessageInfo(
+ message = "Can not set the start level for {0} to {2} as it is already set to {1}.",
+ level = "WARNING")
+ public static final String CANT_SET_START_LEVEL = "NCLS-BOOTSTRAP-00014";
+
+ @LogMessageInfo(
+ message = "Skipping entry {0} because it is not an absolute URI.",
+ level = "WARNING")
+ public static final String ENTRY_SKIPPED = "NCLS-BOOTSTRAP-00015";
+
+ @LogMessageInfo(
+ message = "Skipping entry {0} due to exception: ",
+ level = "WARNING")
+ public static final String ENTRY_SKIPPED_DUE_TO = "NCLS-BOOTSTRAP-00016";
+
+ @LogMessageInfo(
+ message = "Create bundle provisioner {0}.",
+ level = "CONFIG")
+ public static final String CREATE_BUNDLE_PROVISIONER = "NCLS-BOOTSTRAP-00026";
+
+ @LogMessageInfo(
+ message = "Registered {0} as OSGi service registration: {1}.",
+ level = "CONFIG")
+ public static final String SERVICE_REGISTERED = "NCLS-BOOTSTRAP-00027";
+
+ @LogMessageInfo(
+ message = "Unregistered {0} from service registry.",
+ level = "CONFIG")
+ public static final String SERVICE_UNREGISTERED = "NCLS-BOOTSTRAP-00028";
+
+ @LogMessageInfo(
+ message = "Exception while unregistering: ",
+ level = "WARNING")
+ public static final String SERVICE_UNREGISTRATION_EXCEPTION = "NCLS-BOOTSTRAP-00029";
+
+ @LogMessageInfo(
+ message = "installLocations = {0}.",
+ level = "INFO")
+ public static final String SHOW_INSTALL_LOCATIONS = "NCLS-BOOTSTRAP-00030";
+
+ @LogMessageInfo(
+ message = "Unable to determine if {0} is a fragment or not due to ",
+ level = "INFO")
+ public static final String CANT_TELL_IF_FRAGMENT = "NCLS-BOOTSTRAP-00031";
+
+ @LogMessageInfo(
+ message = "Skipping starting of bundles bundles have been provisioned already.",
+ level = "INFO")
+ public static final String SKIP_STARTING_ALREADY_PROVISIONED_BUNDLES = "NCLS-BOOTSTRAP-00032";
+
+ @LogMessageInfo(
+ message = "{0} : latest file in installation location = {1} and latest installed bundle = {2} ",
+ level = "INFO")
+ public static final String LATEST_FILE_IN_INSTALL_LOCATION = "NCLS-BOOTSTRAP-00033";
+
+ @LogMessageInfo(
+ message = "Updating system bundle.",
+ level = "INFO")
+ public static final String UPDATING_SYSTEM_BUNDLE = "NCLS-BOOTSTRAP-00034";
+
+ @LogMessageInfo(
+ message = "Provisioning options have changed, recreating the framework with a clean OSGi storage(aka cache).",
+ level = "INFO")
+ public static final String PROVISIONING_OPTIONS_CHANGED = "NCLS-BOOTSTRAP-00035";
+
+ @LogMessageInfo(
+ message = "Storage support not available in framework bundle, so can't store bundle ids. This may lead to slower start up time.",
+ level = "WARNING")
+ public static final String CANT_STORE_BUNDLEIDS = "NCLS-BOOTSTRAP-00037";
+
+ @LogMessageInfo(
+ message = "Storage support not available in framework bundle, so can't store provisioning options. This may lead to slower start up time.",
+ level = "WARNING")
+ public static final String CANT_STORE_PROVISIONING_OPTIONS = "NCLS-BOOTSTRAP-00038";
+
+ @LogMessageInfo(
+ message = "Got an unexpected exception.",
+ level = "WARNING")
+ public static final String CAUGHT_EXCEPTION = "NCLS-BOOTSTRAP-00039";
+
+ /**
+ * This helper method is duplicated from org.glassfish.api.logging.LogHelper to avoid adding
+ * dependency on the glassfish-api bundle.
+ * Logs a message with the given level, message, parameters and Throwable
.
+ *
+ * @param logger the Logger
object to be used for logging the message.
+ * @param level the Level
of the message to be logged.
+ * @param messageId the key in the resource bundle of the Logger
containing the localized text.
+ * @param thrown the Throwable
associated with the message to be logged.
+ * @param params the parameters to the localized text.
+ */
+ public static void log(Logger logger, Level level, String messageId, Throwable thrown, Object... params) {
+ LogRecord rec = new LogRecord(level, messageId);
+ rec.setLoggerName(logger.getName());
+ rec.setResourceBundleName(logger.getResourceBundleName());
+ rec.setResourceBundle(logger.getResourceBundle());
+ rec.setParameters(params);
+ rec.setThrown(thrown);
+ logger.log(rec);
+ }
+}
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/BundleProvisioner.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/BundleProvisioner.java
index e8355f0bc07..2100bd22149 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/BundleProvisioner.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/BundleProvisioner.java
@@ -17,8 +17,6 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
@@ -31,6 +29,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/DefaultBundleProvisionerCustomizer.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/DefaultBundleProvisionerCustomizer.java
index d7f809e7a75..dd013789f71 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/DefaultBundleProvisionerCustomizer.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/DefaultBundleProvisionerCustomizer.java
@@ -16,8 +16,6 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.io.File;
import java.io.FileFilter;
import java.net.URI;
@@ -33,6 +31,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.Bundle;
import static com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys.AUTO_INSTALL_PROP;
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishImpl.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishImpl.java
index 29d7785d9e0..02fcc67eb13 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishImpl.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishImpl.java
@@ -17,13 +17,12 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.embeddable.GlassFish;
import org.glassfish.embeddable.GlassFishException;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisioner.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisioner.java
index c3be576dd86..79c6fc9d139 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisioner.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisioner.java
@@ -17,14 +17,13 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisionerCustomizer.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisionerCustomizer.java
index 24311e45cef..cb6eb114a76 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisionerCustomizer.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/MinimalBundleProvisionerCustomizer.java
@@ -16,8 +16,6 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -30,6 +28,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.Constants;
class MinimalBundleProvisionerCustomizer extends DefaultBundleProvisionerCustomizer {
diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/OSGiGlassFishRuntimeBuilder.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/OSGiGlassFishRuntimeBuilder.java
index eacc8f90286..4f109b60a07 100644
--- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/OSGiGlassFishRuntimeBuilder.java
+++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/OSGiGlassFishRuntimeBuilder.java
@@ -19,7 +19,6 @@
import com.sun.enterprise.glassfish.bootstrap.cfg.BootstrapKeys;
import com.sun.enterprise.glassfish.bootstrap.cfg.OsgiPlatform;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
import java.io.File;
import java.io.FileInputStream;
@@ -35,6 +34,7 @@
import org.glassfish.embeddable.GlassFishException;
import org.glassfish.embeddable.GlassFishRuntime;
import org.glassfish.embeddable.spi.RuntimeBuilder;
+import org.glassfish.main.boot.log.LogFacade;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.launch.Framework;
diff --git a/nucleus/core/bootstrap-osgi/src/test/java/org/glassfish/main/boot/osgi/BundleProvisionerTest.java b/nucleus/core/bootstrap-osgi/src/test/java/org/glassfish/main/boot/osgi/BundleProvisionerTest.java
index 3923b7f6891..a22f85c2815 100644
--- a/nucleus/core/bootstrap-osgi/src/test/java/org/glassfish/main/boot/osgi/BundleProvisionerTest.java
+++ b/nucleus/core/bootstrap-osgi/src/test/java/org/glassfish/main/boot/osgi/BundleProvisionerTest.java
@@ -16,8 +16,6 @@
package org.glassfish.main.boot.osgi;
-import com.sun.enterprise.glassfish.bootstrap.log.LogFacade;
-
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.nio.file.Files;
@@ -44,7 +42,7 @@ class BundleProvisionerTest {
@Test
void noBundles() throws Exception {
- LOG.log(Level.INFO, LogFacade.STARTING_BUNDLEPROVISIONER);
+ LOG.log(Level.INFO, "Starting BundleProvisioner");
// TODO: add some properties, create more tests
Properties props = new Properties();
Path cacheDir = Files.createTempDirectory("FelixCache");
@@ -60,14 +58,14 @@ void noBundles() throws Exception {
}
assertNotNull(osgiFramework, "No OSGi framwework found!");
long t1 = System.currentTimeMillis();
- LOG.log(Level.INFO, LogFacade.OSGI_LOCATE_TIME, (t1-t0));
+ LOG.log(Level.INFO, "Time taken to locate OSGi framework = {0} ms.", t1 - t0);
osgiFramework.init();
long t2 = System.currentTimeMillis();
- LOG.log(Level.INFO, LogFacade.OSGI_INIT_TIME, (t2-t1));
+ LOG.log(Level.INFO, "Time taken to initialize OSGi framework = {0} ms.", t2 - t1);
BundleProvisioner bundleProvisioner = new BundleProvisioner(osgiFramework.getBundleContext(), props);
bundleProvisioner.installBundles();
long t3 = System.currentTimeMillis();
- LOG.log(Level.INFO, LogFacade.BUNDLE_INSTALLATION_TIME, (t3-t2));
+ LOG.log(Level.INFO, "Time taken to finish installation of bundles = {0} ms.", t3 - t2);
assertEquals(0, bundleProvisioner.getNoOfInstalledBundles());
assertEquals(0, bundleProvisioner.getNoOfUpdatedBundles());
assertEquals(0, bundleProvisioner.getNoOfUninstalledBundles());
@@ -77,13 +75,13 @@ void noBundles() throws Exception {
assertEquals(Bundle.ACTIVE, osgiFramework.getState());
long t4 = System.currentTimeMillis();
- LOG.log(Level.INFO, LogFacade.BUNDLE_STARTING_TIME, (t4-t3));
- LOG.log(Level.INFO, LogFacade.TOTAL_START_TIME, (t4-t0));
+ LOG.log(Level.INFO, "Time taken to finish starting bundles = {0} ms.", t4 - t3);
+ LOG.log(Level.INFO, "Total time taken to start = {0} ms.", t4 - t0);
osgiFramework.stop();
osgiFramework.waitForStop(0);
long t5 = System.currentTimeMillis();
- LOG.log(Level.INFO, LogFacade.BUNDLE_STOP_TIME, (t5 - t4));
- LOG.log(Level.INFO, LogFacade.TOTAL_TIME, (t5-t0));
+ LOG.log(Level.INFO, "Time taken to stop = {0} ms.", t5 - t4);
+ LOG.log(Level.INFO, "Total time taken = {0}.", t5 - t0);
assertEquals(Bundle.RESOLVED, osgiFramework.getState());
}
}
diff --git a/nucleus/core/bootstrap/src/main/java/com/sun/enterprise/glassfish/bootstrap/log/LogFacade.java b/nucleus/core/bootstrap/src/main/java/com/sun/enterprise/glassfish/bootstrap/log/LogFacade.java
index 29c8475eecd..356dfbd4fbf 100644
--- a/nucleus/core/bootstrap/src/main/java/com/sun/enterprise/glassfish/bootstrap/log/LogFacade.java
+++ b/nucleus/core/bootstrap/src/main/java/com/sun/enterprise/glassfish/bootstrap/log/LogFacade.java
@@ -17,8 +17,6 @@
package com.sun.enterprise.glassfish.bootstrap.log;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.glassfish.logging.annotation.LogMessageInfo;
@@ -30,8 +28,8 @@ public class LogFacade {
@LoggerInfo(subsystem = "BOOTSTRAP", description="Main bootstrap logger.")
public static final String BOOTSTRAP_LOGGER_NAME = "jakarta.enterprise.bootstrap";
- @LogMessagesResourceBundle()
- public static final String RB_NAME = "com.sun.enterprise.glassfish.bootstrap.LogMessages";
+ @LogMessagesResourceBundle
+ public static final String RB_NAME = "com.sun.enterprise.glassfish.bootstrap.log.LogMessages";
public static final Logger BOOTSTRAP_LOGGER = Logger.getLogger(BOOTSTRAP_LOGGER_NAME, RB_NAME);
@@ -47,189 +45,4 @@ public class LogFacade {
level = "INFO")
public static final String BOOTSTRAP_FMWCONF = "NCLS-BOOTSTRAP-00002";
- @LogMessageInfo(
- message = "Can not start bundle {0} because it is not contained in the list of installed bundles.",
- level = "WARNING")
- public static final String CANT_START_BUNDLE = "NCLS-BOOTSTRAP-00005";
-
- @LogMessageInfo(
- message = "Failed to start {0}.",
- level = "WARNING")
- public static final String BUNDLE_START_FAILED = "NCLS-BOOTSTRAP-00006";
-
- @LogMessageInfo(
- message = "Can't uninstall bundle = {0} as it's already uninstalled.",
- level = "WARNING")
- public static final String BUNDLE_ALREADY_UNINSTALED = "NCLS-BOOTSTRAP-00007";
-
- @LogMessageInfo(
- message = "Uninstalled bundle {0} installed from {1}.",
- level = "INFO")
- public static final String UNINSTALLED_BUNDLE = "NCLS-BOOTSTRAP-00008";
-
- @LogMessageInfo(
- message = "Can't update bundle = {0} as it's already uninstalled.",
- level = "WARNING")
- public static final String CANT_UPDATE_ALREADY_INSTALLED = "NCLS-BOOTSTRAP-00009";
-
- @LogMessageInfo(
- message = "Updated bundle {0} from {1}.",
- level = "INFO")
- public static final String BUNDLE_UPDATED = "NCLS-BOOTSTRAP-00010";
-
- @LogMessageInfo(
- message = "Failed to uninstall bundle {0}.",
- level = "WARNING")
- public static final String BUNDLE_UNINSTALL_FAILED = "NCLS-BOOTSTRAP-00011";
-
- @LogMessageInfo(
- message = "Failed to update {0}.",
- level = "WARNING")
- public static final String UPDATE_FAILED = "NCLS-BOOTSTRAP-00012";
-
- @LogMessageInfo(
- message = "Failed to install {0}.",
- level = "WARNING")
- public static final String INSTALL_FAILED = "NCLS-BOOTSTRAP-00013";
-
- @LogMessageInfo(
- message = "Can not set the start level for {0} to {2} as it is already set to {1}.",
- level = "WARNING")
- public static final String CANT_SET_START_LEVEL = "NCLS-BOOTSTRAP-00014";
-
- @LogMessageInfo(
- message = "Skipping entry {0} because it is not an absolute URI.",
- level = "WARNING")
- public static final String ENTRY_SKIPPED = "NCLS-BOOTSTRAP-00015";
-
- @LogMessageInfo(
- message = "Skipping entry {0} due to exception: ",
- level = "WARNING")
- public static final String ENTRY_SKIPPED_DUE_TO = "NCLS-BOOTSTRAP-00016";
-
- @LogMessageInfo(
- message = "Starting BundleProvisioner.",
- level = "INFO")
- public static final String STARTING_BUNDLEPROVISIONER = "NCLS-BOOTSTRAP-00017";
-
- @LogMessageInfo(
- message = "Time taken to locate OSGi framework = {0} ms.",
- level = "INFO")
- public static final String OSGI_LOCATE_TIME = "NCLS-BOOTSTRAP-00018";
-
- @LogMessageInfo(
- message = "Time taken to initialize OSGi framework = {0} ms.",
- level = "INFO")
- public static final String OSGI_INIT_TIME = "NCLS-BOOTSTRAP-00020";
-
- @LogMessageInfo(
- message = "Time taken to finish installation of bundles = {0} ms.",
- level = "INFO")
- public static final String BUNDLE_INSTALLATION_TIME = "NCLS-BOOTSTRAP-00021";
-
- @LogMessageInfo(
- message = "Time taken to finish starting bundles = {0} ms.",
- level = "INFO")
- public static final String BUNDLE_STARTING_TIME = "NCLS-BOOTSTRAP-00022";
-
- @LogMessageInfo(
- message = "Total time taken to start = {0} ms.",
- level = "INFO")
- public static final String TOTAL_START_TIME = "NCLS-BOOTSTRAP-00023";
-
- @LogMessageInfo(
- message = "Time taken to stop = {0} ms.",
- level = "INFO")
- public static final String BUNDLE_STOP_TIME = "NCLS-BOOTSTRAP-00024";
-
- @LogMessageInfo(
- message = "Total time taken = {0}.",
- level = "INFO")
- public static final String TOTAL_TIME = "NCLS-BOOTSTRAP-00025";
-
- @LogMessageInfo(
- message = "Create bundle provisioner {0}.",
- level = "CONFIG")
- public static final String CREATE_BUNDLE_PROVISIONER = "NCLS-BOOTSTRAP-00026";
-
- @LogMessageInfo(
- message = "Registered {0} as OSGi service registration: {1}.",
- level = "CONFIG")
- public static final String SERVICE_REGISTERED = "NCLS-BOOTSTRAP-00027";
-
- @LogMessageInfo(
- message = "Unregistered {0} from service registry.",
- level = "CONFIG")
- public static final String SERVICE_UNREGISTERED = "NCLS-BOOTSTRAP-00028";
-
- @LogMessageInfo(
- message = "Exception while unregistering: ",
- level = "WARNING")
- public static final String SERVICE_UNREGISTRATION_EXCEPTION = "NCLS-BOOTSTRAP-00029";
-
- @LogMessageInfo(
- message = "installLocations = {0}.",
- level = "INFO")
- public static final String SHOW_INSTALL_LOCATIONS = "NCLS-BOOTSTRAP-00030";
-
- @LogMessageInfo(
- message = "Unable to determine if {0} is a fragment or not due to ",
- level = "INFO")
- public static final String CANT_TELL_IF_FRAGMENT = "NCLS-BOOTSTRAP-00031";
-
- @LogMessageInfo(
- message = "Skipping starting of bundles bundles have been provisioned already.",
- level = "INFO")
- public static final String SKIP_STARTING_ALREADY_PROVISIONED_BUNDLES = "NCLS-BOOTSTRAP-00032";
-
- @LogMessageInfo(
- message = "{0} : latest file in installation location = {1} and latest installed bundle = {2} ",
- level = "INFO")
- public static final String LATEST_FILE_IN_INSTALL_LOCATION = "NCLS-BOOTSTRAP-00033";
-
- @LogMessageInfo(
- message = "Updating system bundle.",
- level = "INFO")
- public static final String UPDATING_SYSTEM_BUNDLE = "NCLS-BOOTSTRAP-00034";
-
- @LogMessageInfo(
- message = "Provisioning options have changed, recreating the framework with a clean OSGi storage(aka cache).",
- level = "INFO")
- public static final String PROVISIONING_OPTIONS_CHANGED = "NCLS-BOOTSTRAP-00035";
-
- @LogMessageInfo(
- message = "Storage support not available in framework bundle, so can't store bundle ids. This may lead to slower start up time.",
- level = "WARNING")
- public static final String CANT_STORE_BUNDLEIDS = "NCLS-BOOTSTRAP-00037";
-
- @LogMessageInfo(
- message = "Storage support not available in framework bundle, so can't store provisioning options. This may lead to slower start up time.",
- level = "WARNING")
- public static final String CANT_STORE_PROVISIONING_OPTIONS = "NCLS-BOOTSTRAP-00038";
-
- @LogMessageInfo(
- message = "Got an unexpected exception.",
- level = "WARNING")
- public static final String CAUGHT_EXCEPTION = "NCLS-BOOTSTRAP-00039";
-
- /**
- * This helper method is duplicated from org.glassfish.api.logging.LogHelper to avoid adding
- * dependency on the glassfish-api bundle.
- * Logs a message with the given level, message, parameters and Throwable
.
- *
- * @param logger the Logger
object to be used for logging the message.
- * @param level the Level
of the message to be logged.
- * @param messageId the key in the resource bundle of the Logger
containing the localized text.
- * @param thrown the Throwable
associated with the message to be logged.
- * @param params the parameters to the localized text.
- */
- public static void log(Logger logger, Level level, String messageId, Throwable thrown, Object... params) {
- LogRecord rec = new LogRecord(level, messageId);
- rec.setLoggerName(logger.getName());
- rec.setResourceBundleName(logger.getResourceBundleName());
- rec.setResourceBundle(logger.getResourceBundle());
- rec.setParameters(params);
- rec.setThrown(thrown);
- logger.log(rec);
- }
}
diff --git a/nucleus/core/bootstrap/src/main/java/module-info.java b/nucleus/core/bootstrap/src/main/java/module-info.java
new file mode 100644
index 00000000000..8b5b5fc74f2
--- /dev/null
+++ b/nucleus/core/bootstrap/src/main/java/module-info.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+/**
+ * @author David Matejcek
+ */
+module org.glassfish.main.bootstrap {
+
+ requires java.base;
+ requires java.logging;
+
+ requires org.apache.felix.framework;
+ requires org.glassfish.annotation.processing.logging;
+ requires org.glassfish.main.jdke;
+
+ exports com.sun.enterprise.glassfish.bootstrap.cfg;
+ exports com.sun.enterprise.glassfish.bootstrap.launch;
+}
diff --git a/nucleus/glassfish-jul-extension/src/main/java/module-info.java b/nucleus/glassfish-jul-extension/src/main/java/module-info.java
index 3be019be94d..47055a1c3b4 100644
--- a/nucleus/glassfish-jul-extension/src/main/java/module-info.java
+++ b/nucleus/glassfish-jul-extension/src/main/java/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at