diff --git a/appserver/admingui/commandrecorder/pom.xml b/appserver/admingui/commandrecorder/pom.xml new file mode 100644 index 00000000000..f7966c72eb4 --- /dev/null +++ b/appserver/admingui/commandrecorder/pom.xml @@ -0,0 +1,66 @@ + + + + + 4.0.0 + + + org.glassfish.main.admingui + admingui + 7.0.16-SNAPSHOT + ../pom.xml + + + console-commandrecorder-plugin + glassfish-jar + + Admin Console Command Recorder Plugin + Command Recorder plugin bundle for GlassFish Admin Console + + + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + + + jakarta.security.enterprise + jakarta.security.enterprise-api + provided + + + org.glassfish.main.admingui + console-common + ${project.version} + provided + + + org.glassfish.main.extras + command-logger + ${project.version} + provided + + + org.glassfish.main.admin + rest-service + ${project.version} + provided + + + diff --git a/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/CommandRecorder.java b/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/CommandRecorder.java new file mode 100644 index 00000000000..980fa349476 --- /dev/null +++ b/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/CommandRecorder.java @@ -0,0 +1,75 @@ +/* + * 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 + */ +package org.glassfish.commandrecorder.admingui; + +import static org.glassfish.extras.commandlogger.AdminCommandLogger.LogMode.NO_COMMAND; +import static org.glassfish.extras.commandlogger.AdminCommandLogger.LogMode.WRITE_COMMANDS; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import javax.security.auth.Subject; +import org.glassfish.api.ActionReport; +import org.glassfish.api.admin.CommandRunner; +import org.glassfish.api.admin.ParameterMap; +import org.glassfish.extras.commandlogger.AdminCommandLogger; + +@Named +@RequestScoped +public class CommandRecorder { + + @Inject + Instance commandRunnerProvider; + + @Inject + Instance actionReportProvider; + + @Inject + Instance subjectProvider; + + public boolean isEnabled() { + return !NO_COMMAND.equals(AdminCommandLogger.LogMode.get()); + } + + public void setEnabled(boolean enabled) { + if (enabled) { + setSystemProperty(WRITE_COMMANDS); + } else { + setSystemProperty(NO_COMMAND); + } + } + + private void setSystemProperty(AdminCommandLogger.LogMode propertyValue) { + final CommandRunner.CommandInvocation commandInvocation = commandRunnerProvider.get().getCommandInvocation("create-system-properties", actionReportProvider.get(), subjectProvider.get()); + commandInvocation.parameters(parameters(propertyValue)).execute(); + } + + public void toggle() { + setEnabled(!isEnabled()); + } + + public String getToggleButtonTitle() { + return (isEnabled() ? "Disable" : "Enable") + " logging commands"; + } + + private ParameterMap parameters(AdminCommandLogger.LogMode propertyValue) { + ParameterMap data = new ParameterMap(); + data.add("target", "server"); + data.add("DEFAULT", AdminCommandLogger.LogMode.PROPERTY_NAME + "=" + propertyValue.name()); + return data; + } +} diff --git a/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/plugin/CommandRecorderConsolePlugin.java b/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/plugin/CommandRecorderConsolePlugin.java new file mode 100644 index 00000000000..e2f302f7f8f --- /dev/null +++ b/appserver/admingui/commandrecorder/src/main/java/org/glassfish/commandrecorder/admingui/plugin/CommandRecorderConsolePlugin.java @@ -0,0 +1,29 @@ +/* + * 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 + */ +package org.glassfish.commandrecorder.admingui.plugin; + +import java.net.URL; +import org.glassfish.api.admingui.ConsoleProvider; +import org.jvnet.hk2.annotations.Service; + +@Service +public class CommandRecorderConsolePlugin implements ConsoleProvider { + + @Override + public URL getConfiguration() { + return null; + } +} diff --git a/appserver/admingui/commandrecorder/src/main/resources/META-INF/admingui/console-config.xml b/appserver/admingui/commandrecorder/src/main/resources/META-INF/admingui/console-config.xml new file mode 100644 index 00000000000..2af6aebcb14 --- /dev/null +++ b/appserver/admingui/commandrecorder/src/main/resources/META-INF/admingui/console-config.xml @@ -0,0 +1,29 @@ + + + + + + + + diff --git a/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/menu.xhtml b/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/menu.xhtml new file mode 100644 index 00000000000..972e0a3db32 --- /dev/null +++ b/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/menu.xhtml @@ -0,0 +1,38 @@ + + + + + + Command Recorder + + + + + + + + +
+
+ #{commandRecorder.toggleButtonTitle}
+
+
+
+ diff --git a/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/plugin/mastheadStatusArea.jsf b/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/plugin/mastheadStatusArea.jsf new file mode 100644 index 00000000000..5bab8a98e55 --- /dev/null +++ b/appserver/admingui/commandrecorder/src/main/resources/META-INF/resources/commandrecorder/plugin/mastheadStatusArea.jsf @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/appserver/admingui/core/pom.xml b/appserver/admingui/core/pom.xml index 96e70a75fab..49132d107f6 100644 --- a/appserver/admingui/core/pom.xml +++ b/appserver/admingui/core/pom.xml @@ -34,6 +34,16 @@ Admin Console Core Jar + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + + + jakarta.security.enterprise + jakarta.security.enterprise-api + provided + org.glassfish.woodstock woodstock-webui-jsf diff --git a/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/Hk2ServicesProducer.java b/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/Hk2ServicesProducer.java new file mode 100644 index 00000000000..eb1d05ac2d5 --- /dev/null +++ b/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/Hk2ServicesProducer.java @@ -0,0 +1,40 @@ +/* + * 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 + */ +package org.glassfish.admingui.cdi; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import org.glassfish.api.ActionReport; +import org.glassfish.api.admin.CommandRunner; +import org.glassfish.internal.api.Globals; + +@ApplicationScoped +public class Hk2ServicesProducer { + + @Produces + CommandRunner getCommandRunner() { + return getGlobalService(CommandRunner.class); + } + + @Produces + ActionReport getActionReport() { + return getGlobalService(ActionReport.class); + } + + private static T getGlobalService(Class aClass) { + return Globals.getDefaultHabitat().getService(aClass); + } +} diff --git a/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/SecurityProducer.java b/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/SecurityProducer.java new file mode 100644 index 00000000000..f093b9e9373 --- /dev/null +++ b/appserver/admingui/core/src/main/java/org/glassfish/admingui/cdi/SecurityProducer.java @@ -0,0 +1,33 @@ +/* + * 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 + */ +package org.glassfish.admingui.cdi; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.security.enterprise.SecurityContext; +import java.security.Principal; +import java.util.Set; +import javax.security.auth.Subject; + +@ApplicationScoped +public class SecurityProducer { + + @Produces + Subject getSubject(SecurityContext securityContext) { + return new Subject(true, securityContext.getPrincipalsByType(Principal.class), Set.of(), Set.of()); + } + +} diff --git a/appserver/admingui/plugin-service/src/main/java/org/glassfish/admingui/plugin/ConsolePluginService.java b/appserver/admingui/plugin-service/src/main/java/org/glassfish/admingui/plugin/ConsolePluginService.java index bc417a968ed..23c6996c85d 100644 --- a/appserver/admingui/plugin-service/src/main/java/org/glassfish/admingui/plugin/ConsolePluginService.java +++ b/appserver/admingui/plugin-service/src/main/java/org/glassfish/admingui/plugin/ConsolePluginService.java @@ -44,6 +44,7 @@ import org.glassfish.admingui.connector.ConsoleConfig; import jakarta.inject.Inject; +import java.util.Iterator; /** *

@@ -80,24 +81,39 @@ protected synchronized void init() { if ((providers != null) && (providers.iterator().hasNext())) { // Get our parser... ConfigParser parser = new ConfigParser(habitat); - URL url = null; String id = null; + Map configUrls = new HashMap<>(); + // Loop through the configs and add them all for (ConsoleProvider provider : providers) { // Read the contents from the URL - url = provider.getConfiguration(); - if (url == null) { - url = provider.getClass().getClassLoader().getResource( - ConsoleProvider.DEFAULT_CONFIG_FILENAME); + URL url = provider.getConfiguration(); + Iterator urlsIterator; + if (url != null) { + urlsIterator = List.of(url).iterator(); + } else { + try { + urlsIterator = provider.getClass().getClassLoader().getResources( + ConsoleProvider.DEFAULT_CONFIG_FILENAME).asIterator(); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + if (!urlsIterator.hasNext()) { + logger.log(Level.INFO, "Unable to find " + + ConsoleProvider.DEFAULT_CONFIG_FILENAME + + " file for provider '" + + provider.getClass().getName() + "'"); + continue; + } } - if (url == null) { - logger.log(Level.INFO, "Unable to find " - + ConsoleProvider.DEFAULT_CONFIG_FILENAME - + " file for provider '" - + provider.getClass().getName() + "'"); - continue; + while (urlsIterator.hasNext()) { + configUrls.put(urlsIterator.next(), provider.getClass().getClassLoader()); } + } + for (Map.Entry entry : configUrls.entrySet()) { + URL url = entry.getKey(); + ClassLoader classLoader = entry.getValue(); //System.out.println("Provider *"+provider+"* : url=*"+url+"*"); DomDocument doc = parser.parse(url); @@ -107,8 +123,8 @@ protected synchronized void init() { // Save the ClassLoader for later //System.out.println("Storing: " + config.getId() + " : " + provider.getClass().getClassLoader()); id = config.getId(); - moduleClassLoaderMap.put(id, provider.getClass().getClassLoader()); - classLoaderModuleMap.put(provider.getClass().getClassLoader(), id); + moduleClassLoaderMap.put(id, classLoader); + classLoaderModuleMap.put(classLoader, id); // Add the new IntegrationPoints addIntegrationPoints(config.getIntegrationPoints(), id); diff --git a/appserver/admingui/pom.xml b/appserver/admingui/pom.xml index 9187551c8a5..c88a61c33ec 100644 --- a/appserver/admingui/pom.xml +++ b/appserver/admingui/pom.xml @@ -86,6 +86,7 @@ core concurrent cluster + commandrecorder community-theme web gf-admingui-connector diff --git a/appserver/admingui/war/pom.xml b/appserver/admingui/war/pom.xml index 50c949a030b..46cdf00521e 100644 --- a/appserver/admingui/war/pom.xml +++ b/appserver/admingui/war/pom.xml @@ -54,6 +54,17 @@ + + ${project.groupId} + console-commandrecorder-plugin + ${project.version} + + + * + * + + + @@ -86,6 +97,21 @@ woodstock-webui-jsf-suntheme provided + + jakarta.faces + jakarta.faces-api + provided + + + jakarta.el + jakarta.el-api + provided + + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + diff --git a/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplication.java b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplication.java new file mode 100644 index 00000000000..67c27978bcf --- /dev/null +++ b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplication.java @@ -0,0 +1,46 @@ +/* + * 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 + */ +package org.glassfish.admingui.common; + +import jakarta.faces.application.Application; +import jakarta.faces.application.ApplicationWrapper; +import jakarta.faces.application.ViewHandler; + +/** + * + * @author Ondro Mihalyi + */ +public class AdminGuiApplication extends ApplicationWrapper { + + ViewHandler defaultViewHandler; + + public AdminGuiApplication(Application wrapped) { + super(wrapped); + } + + @Override + public void setViewHandler(ViewHandler handler) { + if (defaultViewHandler == null) { + defaultViewHandler = handler; + } + super.setViewHandler(handler); + } + + public ViewHandler getDefaultViewHandler() { + return defaultViewHandler; + } + +} diff --git a/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplicationFactory.java b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplicationFactory.java new file mode 100644 index 00000000000..4e7920a3092 --- /dev/null +++ b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiApplicationFactory.java @@ -0,0 +1,44 @@ +/* + * 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 + */ +package org.glassfish.admingui.common; + +import jakarta.faces.application.Application; +import jakarta.faces.application.ApplicationFactory; + +/** + * + * @author Ondro Mihalyi + */ +public class AdminGuiApplicationFactory extends ApplicationFactory { + + Application app; + + public AdminGuiApplicationFactory(ApplicationFactory wrapped) { + super(wrapped); + app = new AdminGuiApplication(wrapped.getApplication()); + } + + @Override + public Application getApplication() { + return app; + } + + @Override + public void setApplication(Application application) { + app = application; + } + +} diff --git a/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiViewHandler.java b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiViewHandler.java new file mode 100644 index 00000000000..0254f3ab965 --- /dev/null +++ b/appserver/admingui/war/src/main/java/org/glassfish/admingui/common/AdminGuiViewHandler.java @@ -0,0 +1,55 @@ +/* + * 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 + */ +package org.glassfish.admingui.common; + +import jakarta.faces.application.Application; +import jakarta.faces.application.ViewHandler; +import jakarta.faces.application.ViewHandlerWrapper; +import jakarta.faces.context.FacesContext; + +/** + * + * @author Ondro Mihalyi + */ +public class AdminGuiViewHandler extends ViewHandlerWrapper { + + private ViewHandler defaultViewHandler; + + public AdminGuiViewHandler(ViewHandler wrapped) { + super(wrapped); + Application app = FacesContext.getCurrentInstance().getApplication(); + if (app instanceof AdminGuiApplication) { + defaultViewHandler = ((AdminGuiApplication) app).getDefaultViewHandler(); + } else { + defaultViewHandler = wrapped; + } + } + + @Override + public ViewHandler getWrapped() { + String requestServletPath = null; + if (FacesContext.getCurrentInstance() != null) { + requestServletPath = FacesContext.getCurrentInstance().getExternalContext().getRequestServletPath(); + } + if (defaultViewHandler != null && requestServletPath != null && requestServletPath.endsWith(".xhtml")) { + return defaultViewHandler; + } + return super.getWrapped(); + } + + + +} diff --git a/appserver/admingui/war/src/main/webapp/WEB-INF/faces-config.xml b/appserver/admingui/war/src/main/webapp/WEB-INF/faces-config.xml index 477607cf533..b53ed6e77f6 100644 --- a/appserver/admingui/war/src/main/webapp/WEB-INF/faces-config.xml +++ b/appserver/admingui/war/src/main/webapp/WEB-INF/faces-config.xml @@ -22,8 +22,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd" version="4.0"> - + admingui + org.glassfish.admingui.common.AdminGuiViewHandler en de @@ -40,82 +41,7 @@ com.sun.webui.jsf.faces.UIComponentELResolver - - - - - - - - - + + org.glassfish.admingui.common.AdminGuiApplicationFactory + diff --git a/appserver/admingui/war/src/main/webapp/WEB-INF/web.xml b/appserver/admingui/war/src/main/webapp/WEB-INF/web.xml index 953b1eaf4c7..f5c5c9993d9 100644 --- a/appserver/admingui/war/src/main/webapp/WEB-INF/web.xml +++ b/appserver/admingui/war/src/main/webapp/WEB-INF/web.xml @@ -115,6 +115,10 @@ FacesServlet /faces/* + + FacesServlet + *.xhtml + FacesServlet *.jsf diff --git a/appserver/web/web-glue/pom.xml b/appserver/web/web-glue/pom.xml index 839aa3a6e02..5bbc45fc697 100755 --- a/appserver/web/web-glue/pom.xml +++ b/appserver/web/web-glue/pom.xml @@ -89,6 +89,10 @@ org.glassfish.hk2 hk2-core + + org.glassfish.hk2 + hk2-utils + org.glassfish.main.common stats77 diff --git a/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModuleListener.java b/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModuleListener.java index cef81d82a05..9c7be5d49e5 100644 --- a/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModuleListener.java +++ b/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModuleListener.java @@ -14,7 +14,6 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ - package com.sun.enterprise.web; import com.sun.appserv.web.cache.CacheManager; @@ -62,10 +61,16 @@ import static java.util.logging.Level.WARNING; import static org.glassfish.web.LogFacade.CLASS_CAST_EXCEPTION; +import java.io.IOException; +import org.glassfish.hk2.api.DynamicConfigurationService; +import org.glassfish.hk2.api.MultiException; +import org.glassfish.hk2.api.Populator; +import org.glassfish.hk2.api.ServiceLocatorFactory; +import org.glassfish.hk2.utilities.ClasspathDescriptorFileFinder; + /** * Startup event listener for a Context that configures the properties of that Jsp Servlet from sun-web.xml */ - final class WebModuleListener implements LifecycleListener { /** @@ -126,10 +131,9 @@ public void lifecycleEvent(LifecycleEvent event) { } // ------------------------------------------------------- Private Methods - /** - * Configure all JSP related aspects of the web module, including any relevant TLDs as well as the jsp config settings - * of the JspServlet (using the values from sun-web.xml's jsp-config). + * Configure all JSP related aspects of the web module, including any relevant TLDs as well as the jsp config + * settings of the JspServlet (using the values from sun-web.xml's jsp-config). */ private void configureJsp(WebModule webModule) { @@ -183,9 +187,12 @@ private void configureJsp(WebModule webModule) { servletContext.setAttribute("com.sun.appserv.tldlistener.map", tldListenerMap); ServiceLocator defaultServices = webContainer.getServerContext().getDefaultServices(); + final String servicesName = webModule.getComponentId(); + ServiceLocator webAppServices = ServiceLocatorFactory.getInstance().create(servicesName, defaultServices); + initializeServicesFromClassLoader(webAppServices, Thread.currentThread().getContextClassLoader()); // set services for jsf injection - servletContext.setAttribute(Constants.HABITAT_ATTRIBUTE, defaultServices); + servletContext.setAttribute(Constants.HABITAT_ATTRIBUTE, webAppServices); SunWebAppImpl bean = webModule.getIasWebAppConfigBean(); @@ -265,6 +272,17 @@ private void configureJsp(WebModule webModule) { } + private static void initializeServicesFromClassLoader(ServiceLocator serviceLocator, ClassLoader classLoader) { + DynamicConfigurationService dcs = + serviceLocator.getService(DynamicConfigurationService.class); + Populator populator = dcs.getPopulator(); + try { + populator.populate(new ClasspathDescriptorFileFinder(classLoader)); + } catch (IOException | MultiException ex) { + _logger.log(Level.SEVERE, ex, ex::getMessage); + } + } + private boolean includeInitialized; private List includeJars; diff --git a/nucleus/extras/command-logger/src/main/java/org/glassfish/extras/commandlogger/AdminCommandLogger.java b/nucleus/extras/command-logger/src/main/java/org/glassfish/extras/commandlogger/AdminCommandLogger.java index 9e02c4f3c55..5e2ca20b100 100644 --- a/nucleus/extras/command-logger/src/main/java/org/glassfish/extras/commandlogger/AdminCommandLogger.java +++ b/nucleus/extras/command-logger/src/main/java/org/glassfish/extras/commandlogger/AdminCommandLogger.java @@ -74,7 +74,7 @@ private String constructCommandLine(String commandName, ParameterMap parameters) .collect(joining(" ")); } - private static enum LogMode { + public static enum LogMode { ALL_COMMANDS, INTERNAL_COMMANDS, WRITE_COMMANDS, READ_WRITE_COMMANDS, NO_COMMAND; public static final LogMode DEFAULT = LogMode.NO_COMMAND;