From 9ce312fb70521ed90975ec53c1d8c8ac43844e6a Mon Sep 17 00:00:00 2001 From: Erin Harris Date: Tue, 25 Feb 2020 17:20:16 -0500 Subject: [PATCH] Issue #228: Support all server.env files --- .../ibm/ws/st/core/internal/Constants.java | 3 +- .../internal/WebSphereServerBehaviour.java | 14 ++-- .../st/core/internal/WebSphereServerInfo.java | 72 +++++++++++++------ .../validation/ConfigurationValidator.java | 8 ++- .../validation/VariableValidationTest.java | 13 +++- .../serverEnv/files/config/server.env | 3 +- .../validation/serverEnv/files/etc/server.env | 3 +- .../serverEnv/files/shared/server.env | 8 +++ .../resources/validation/serverEnv/server.xml | 3 + .../RuntimeExplorerViewActionProvider.java | 29 +++++--- .../actions/UtilityActionProvider.java | 24 ++++--- 11 files changed, 128 insertions(+), 52 deletions(-) create mode 100644 dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/shared/server.env diff --git a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/Constants.java b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/Constants.java index 5b6886cf..d947f7f4 100644 --- a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/Constants.java +++ b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/Constants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2019 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -196,6 +196,7 @@ public class Constants { // configuration variables public static final String SERVER_CONFIG_VAR = "${server.config.dir}"; public static final String SERVER_OUTPUT_VAR = "${server.output.dir}"; + public static final String WLP_USER_DIR_VAR = "${wlp.user.dir}"; public static final String WLP_INSTALL_VAR = "${wlp.install.dir}"; public static final String LOGGING_DIR_VAR = "${com.ibm.ws.logging.log.directory}"; public static final String MESSAGES_FILENAME_VAR = "${com.ibm.ws.logging.message.file.name}"; diff --git a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerBehaviour.java b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerBehaviour.java index 1f952d73..57fcac8a 100644 --- a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerBehaviour.java +++ b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerBehaviour.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -693,9 +693,9 @@ public WebSphereServerInfo getWebSphereServerInfo() { /** * Setup for starting the server. * - * @param launch ILaunch + * @param launch ILaunch * @param launchMode String - * @param monitor IProgressMonitor + * @param monitor IProgressMonitor * @throws CoreException if anything goes wrong */ public void preLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException { @@ -1337,7 +1337,7 @@ public boolean isCleanOnStartup() { * reset to false during every launch. * * @param clean true if the server should be cleaned on next startup, - * and false otherwise. + * and false otherwise. */ public void setCleanOnStartup(boolean clean) { cleanOnStartup = clean; @@ -1711,6 +1711,12 @@ else if (userDir != null && userDir.getRemoteUserPath() != null) { if (fileLocation != null) fileLocations.add(new File(fileLocation).toString().replace("\\", "/")); } + + if (serverInfo.getSharedServerEnv() != null) { + URI fileLocation = serverInfo.getSharedServerEnv().getURI(); + if (fileLocation != null) + fileLocations.add(new File(fileLocation).toString().replace("\\", "/")); + } } return fileLocations.toArray(new String[fileLocations.size()]); } diff --git a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java index 69e59c4e..108e7843 100644 --- a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java +++ b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/WebSphereServerInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2018 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -63,6 +63,7 @@ public class WebSphereServerInfo implements IMetadataGenerator { private Bootstrap bootstrap; private final Map jvmOptionsFiles; private ServerEnv serverEnv; + private ServerEnv sharedServerEnv; private ServerEnv etcServerEnv; private final UserDirectory userDir; @@ -114,12 +115,11 @@ public IPath getServerAppsPath() { public IPath getServerOutputPath() { if (serverName == null) return null; - ServerEnv env = null; - if ((env = (ServerEnv) getServerEnv()) != null) { - String wlpOutputDir = env.getValue(Constants.WLP_OUTPUT_DIR); - if (wlpOutputDir != null) { - return new Path(wlpOutputDir).append(serverName); - } + ConfigVars v = new ConfigVars(); + addServerEnvVars(v); + String wlpOutputDir = v.getValue(Constants.ENV_VAR_PREFIX + Constants.WLP_OUTPUT_DIR); + if (wlpOutputDir != null && !wlpOutputDir.isEmpty()) { + return new Path(wlpOutputDir).append(serverName); } return userDir.getOutputPath().append(serverName); } @@ -161,6 +161,14 @@ public ExtendedConfigFile getServerEnv() { return serverEnv; } + public ExtendedConfigFile getSharedServerEnv() { + return sharedServerEnv; + } + + public ExtendedConfigFile getEtcServerEnv() { + return etcServerEnv; + } + public ConfigurationFile getConfigRoot() { synchronized (infoLock) { updateConfigurationCache(); @@ -345,6 +353,17 @@ private boolean updateServerEnv() { serverEnv = null; } + File sharedServerEnvFile = getUserDirectory().getSharedPath().append(ExtendedConfigFile.SERVER_ENV_FILE).toFile(); + if (sharedServerEnvFile.exists()) { + if (sharedServerEnv == null || sharedServerEnv.hasChanged()) { + changed = true; + sharedServerEnv = new ServerEnv(sharedServerEnvFile, null); + } + } else if (sharedServerEnv != null) { + changed = true; + sharedServerEnv = null; + } + File etcServerEnvFile = runtime.getRuntimeLocation().append(ExtendedConfigFile.ETC_DIR).append(ExtendedConfigFile.SERVER_ENV_FILE).toFile(); if (etcServerEnvFile.exists()) { if (etcServerEnv == null || etcServerEnv.hasChanged()) { @@ -437,12 +456,22 @@ private void addServerVars(ConfigVars vars) { } } + addServerEnvVars(vars); + } + + private void addServerEnvVars(ConfigVars vars) { // Do the env vars from the /etc directory first - // since those from the server directory should override. + // since it is the lowest priority server.env file if (etcServerEnv != null) { etcServerEnv.getVariables(vars); } + // Followed by env vars from the /shared directory + if (sharedServerEnv != null) { + sharedServerEnv.getVariables(vars); + } + + // And finally the env vars from the config dir if (serverEnv != null) { serverEnv.getVariables(vars); } @@ -1032,26 +1061,23 @@ public IPath getLogDirectory() { return new Path(messageloc); } String logDir = null; - ServerEnv env = (ServerEnv) getServerEnv(); - if (env != null) { - ConfigVars v = new ConfigVars(); - env.getVariables(v); - //When both LOG_DIR and WLP_OUTPUT_DIR are specified . Logs will be created under LOG_DIR. - logDir = v.getValue(Constants.ENV_VAR_PREFIX + Constants.ENV_LOG_DIR); - if (logDir != null) { - return new Path(logDir); - } - logDir = v.getValue(Constants.ENV_VAR_PREFIX + Constants.WLP_OUTPUT_DIR); - if (logDir != null) { - return new Path(logDir).append(getServerName()).append("logs"); - } + ConfigVars v = new ConfigVars(); + addServerEnvVars(v); + //When both LOG_DIR and WLP_OUTPUT_DIR are specified . Logs will be created under LOG_DIR. + logDir = v.getValue(Constants.ENV_VAR_PREFIX + Constants.ENV_LOG_DIR); + if (logDir != null && !logDir.isEmpty()) { + return new Path(logDir); + } + logDir = v.getValue(Constants.ENV_VAR_PREFIX + Constants.WLP_OUTPUT_DIR); + if (logDir != null && !logDir.isEmpty()) { + return new Path(logDir).append(getServerName()).append("logs"); } logDir = System.getenv(Constants.ENV_LOG_DIR); - if (logDir != null) { + if (logDir != null && !logDir.isEmpty()) { return new Path(logDir); } logDir = System.getenv(Constants.WLP_OUTPUT_DIR); - if (logDir != null) { + if (logDir != null && !logDir.isEmpty()) { return new Path(logDir).append(getServerName()).append("logs"); } return null; diff --git a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/config/validation/ConfigurationValidator.java b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/config/validation/ConfigurationValidator.java index 837280af..5ad2760b 100644 --- a/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/config/validation/ConfigurationValidator.java +++ b/dev/com.ibm.ws.st.core/src/com/ibm/ws/st/core/internal/config/validation/ConfigurationValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -176,6 +176,12 @@ private void updateResultDependencies(ConfigurationFile configFile, ExtendedConfigFile serverEnv = serverInfo.getServerEnv(); if (serverEnv != null && serverEnv.getIFile() != null) resourceList.add(serverEnv.getIFile()); + serverEnv = serverInfo.getSharedServerEnv(); + if (serverEnv != null && serverEnv.getIFile() != null) + resourceList.add(serverEnv.getIFile()); + serverEnv = serverInfo.getEtcServerEnv(); + if (serverEnv != null && serverEnv.getIFile() != null) + resourceList.add(serverEnv.getIFile()); } // Add a dependency on unresolved includes diff --git a/dev/com.ibm.ws.st.core_tests/bvt/src/com/ibm/ws/st/core/tests/validation/VariableValidationTest.java b/dev/com.ibm.ws.st.core_tests/bvt/src/com/ibm/ws/st/core/tests/validation/VariableValidationTest.java index 125ba174..37fde282 100644 --- a/dev/com.ibm.ws.st.core_tests/bvt/src/com/ibm/ws/st/core/tests/validation/VariableValidationTest.java +++ b/dev/com.ibm.ws.st.core_tests/bvt/src/com/ibm/ws/st/core/tests/validation/VariableValidationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2018 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -229,17 +229,24 @@ public void testServerEnv() throws Exception { assertTrue("Creating runtime etc directory: " + runtimeEtcPath.toOSString(), etcDir.mkdirs()); FileUtil.copyFile(etcServerEnv.toOSString(), runtimeEtcPath.append("server.env").toOSString()); + // Copy the shared server.env file over to the /shared directory + IPath sharedServerEnv = serverEnvFiles.append("shared/server.env"); + IPath sharedPath = project.getLocation().append("shared"); + FileUtil.copyFile(sharedServerEnv.toOSString(), sharedPath.append("server.env").toOSString()); + // Validate the server.xml file - there should be two messages for invalid type of // variable reference String serverName = "serverEnv"; setupRuntimeServer(RESOURCE_PATH, serverName); IFile file = getServerFile(serverName, "server.xml"); ValidatorMessage[] messages = TestUtil.validate(file); - checkMessageCount(messages, 2); + checkMessageCount(messages, 3); checkMessage(messages[0], NLS.bind(Messages.incorrectVariableReferenceType, new String[] { "${env.PORT}", "httpPort", "httpEndpoint", "int" }), serverName + "/" + file.getName(), 20); checkMessage(messages[1], NLS.bind(Messages.incorrectVariableReferenceType, new String[] { "${env.SECURE_PORT}", "httpsPort", "httpEndpoint", "int" }), serverName + "/" + file.getName(), 21); + checkMessage(messages[2], NLS.bind(Messages.incorrectVariableReferenceType, new String[] { "${env.AUTO_EXPAND}", "autoExpand", "applicationManager", "boolean" }), + serverName + "/" + file.getName(), 24); // Copy the config server.env file over to the server config directory IPath configServerEnv = serverEnvFiles.append("config/server.env"); @@ -247,7 +254,7 @@ public void testServerEnv() throws Exception { IPath serverPath = serverFolder.getLocation(); FileUtil.copyFile(configServerEnv.toOSString(), serverPath.append("server.env").toOSString()); - // Validate the server.xml file - the config server.env overrides one of the variables + // Validate the server.xml file - the config server.env overrides two of the variables // with a correct value so there should only be one message now messages = TestUtil.validate(file); checkMessageCount(messages, 1); diff --git a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/config/server.env b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/config/server.env index 9d63ee6b..f57919c5 100644 --- a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/config/server.env +++ b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/config/server.env @@ -5,4 +5,5 @@ # Uncomment one the following lines to use a specific JRE #JAVA_HOME=C:\Program Files\Java\jdk1.7.0 #JAVA_HOME=/opt/ibm/java/jre -PORT=5067 \ No newline at end of file +PORT=5067 +AUTO_EXPAND=true \ No newline at end of file diff --git a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/etc/server.env b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/etc/server.env index f65a137c..4b93f6a7 100644 --- a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/etc/server.env +++ b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/etc/server.env @@ -6,4 +6,5 @@ #JAVA_HOME=C:\Program Files\Java\jdk1.7.0 #JAVA_HOME=/opt/ibm/java/jre PORT=abcd -SECURE_PORT=123$ \ No newline at end of file +SECURE_PORT=123$ +AUTO_EXPAND=true \ No newline at end of file diff --git a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/shared/server.env b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/shared/server.env new file mode 100644 index 00000000..c4b90153 --- /dev/null +++ b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/files/shared/server.env @@ -0,0 +1,8 @@ +# Liberty Server +# This file contains environment variables that are set on the process prior to startup +# See the InfoCenter for full documentation + +# Uncomment one the following lines to use a specific JRE +#JAVA_HOME=C:\Program Files\Java\jdk1.7.0 +#JAVA_HOME=/opt/ibm/java/jre +AUTO_EXPAND=abc \ No newline at end of file diff --git a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/server.xml b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/server.xml index 04d543a0..eeea20a1 100644 --- a/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/server.xml +++ b/dev/com.ibm.ws.st.core_tests/resources/validation/serverEnv/server.xml @@ -20,4 +20,7 @@ httpPort="${env.PORT}" httpsPort="${env.SECURE_PORT}" /> + + + \ No newline at end of file diff --git a/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/RuntimeExplorerViewActionProvider.java b/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/RuntimeExplorerViewActionProvider.java index 1329cc11..477e85d2 100644 --- a/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/RuntimeExplorerViewActionProvider.java +++ b/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/RuntimeExplorerViewActionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 IBM Corporation and others. + * Copyright (c) 2011, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,9 +47,10 @@ public class RuntimeExplorerViewActionProvider extends CommonActionProvider { protected NewQuickServerAction newQuickServerAction; protected ShowInServersAction showInServersAction; protected PropertiesAction propertiesAction; - protected NewExtendedConfigAction[] createConfigActions = new NewExtendedConfigAction[2]; - protected NewConfigDropinAction[] newConfigDropinActions = new NewConfigDropinAction[2]; + protected NewExtendedConfigAction[] createConfigActions = new NewExtendedConfigAction[1]; + protected NewExtendedConfigAction[] newServerEnvActions = new NewExtendedConfigAction[2]; protected NewExtendedConfigAction[] newJVMOptionsActions = new NewExtendedConfigAction[4]; + protected NewConfigDropinAction[] newConfigDropinActions = new NewConfigDropinAction[2]; protected AddOnRuntimeAction addOnRuntimeAction; @Override @@ -74,16 +75,15 @@ public void init(ICommonActionExtensionSite aSite) { showInServersAction = new ShowInServersAction(selProvider); propertiesAction = new PropertiesAction(selProvider, shell); - //propertiesAction.runtime. + createConfigActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE, selProvider, viewer); - createConfigActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selProvider, viewer); - newConfigDropinActions[0] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.DEFAULTS, selProvider, viewer); - newConfigDropinActions[1] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.OVERRIDES, selProvider, viewer); + newServerEnvActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selProvider, viewer, Constants.SERVER_CONFIG_VAR); + newServerEnvActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selProvider, viewer, Constants.WLP_USER_DIR_VAR + "/" + + Constants.SHARED_FOLDER); newJVMOptionsActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selProvider, viewer, Constants.SERVER_CONFIG_VAR); - newJVMOptionsActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selProvider, viewer, Constants.WLP_INSTALL_VAR + "/" - + Constants.USER_FOLDER + "/" + newJVMOptionsActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selProvider, viewer, Constants.WLP_USER_DIR_VAR + "/" + Constants.SHARED_FOLDER); newJVMOptionsActions[2] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selProvider, viewer, Constants.SERVER_CONFIG_VAR + "/" + Constants.CONFIG_DROPINS_FOLDER + "/" @@ -91,6 +91,10 @@ public void init(ICommonActionExtensionSite aSite) { newJVMOptionsActions[3] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selProvider, viewer, Constants.SERVER_CONFIG_VAR + "/" + Constants.CONFIG_DROPINS_FOLDER + "/" + Constants.CONFIG_OVERRIDE_DROPINS_FOLDER); + + newConfigDropinActions[0] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.DEFAULTS, selProvider, viewer); + newConfigDropinActions[1] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.OVERRIDES, selProvider, viewer); + addOnRuntimeAction = new AddOnRuntimeAction(shell, selProvider); } @@ -108,8 +112,13 @@ public void fillContextMenu(IMenuManager menu) { MenuManager configMenu = new MenuManager(Messages.menuNewExtendedConfig, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), "extendedConfig"); for (int i = 0; i < createConfigActions.length; i++) configMenu.add(createConfigActions[i]); + // Add the submenu for server.env + MenuManager subConfigMenu = new MenuManager(ExtendedConfigFile.SERVER_ENV_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.SERVER_ENV_FILE); + for (int i = 0; i < newServerEnvActions.length; i++) + subConfigMenu.add(newServerEnvActions[i]); + configMenu.add(subConfigMenu); // Add the submenu for jvm.options - MenuManager subConfigMenu = new MenuManager(ExtendedConfigFile.JVM_OPTIONS_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.JVM_OPTIONS_FILE); + subConfigMenu = new MenuManager(ExtendedConfigFile.JVM_OPTIONS_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.JVM_OPTIONS_FILE); for (int i = 0; i < newJVMOptionsActions.length; i++) subConfigMenu.add(newJVMOptionsActions[i]); configMenu.add(subConfigMenu); diff --git a/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/UtilityActionProvider.java b/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/UtilityActionProvider.java index d4d87973..d6a0adcf 100644 --- a/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/UtilityActionProvider.java +++ b/dev/com.ibm.ws.st.ui/src/com/ibm/ws/st/ui/internal/actions/UtilityActionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2017 IBM Corporation and others. + * Copyright (c) 2012, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,8 @@ public class UtilityActionProvider extends CommonActionProvider { public static final String UTILITY_MENU_PATH = "utility"; - protected NewExtendedConfigAction[] createConfigActions = new NewExtendedConfigAction[2]; + protected NewExtendedConfigAction[] createConfigActions = new NewExtendedConfigAction[1]; + protected NewExtendedConfigAction[] newServerEnvActions = new NewExtendedConfigAction[2]; protected NewExtendedConfigAction[] newJVMOptionsActions = new NewExtendedConfigAction[4]; protected PackageAction packageAction; protected PluginConfigAction pluginConfigAction; @@ -47,14 +48,13 @@ public void init(ICommonActionExtensionSite aSite) { ISelectionProvider selectionProvider = aSite.getStructuredViewer(); createConfigActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE, selectionProvider, viewer); - createConfigActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selectionProvider, viewer); - newConfigDropinActions[0] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.DEFAULTS, selectionProvider, viewer); - newConfigDropinActions[1] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.OVERRIDES, selectionProvider, viewer); + newServerEnvActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selectionProvider, viewer, Constants.SERVER_CONFIG_VAR); + newServerEnvActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.SERVER_ENV_FILE, selectionProvider, viewer, Constants.WLP_USER_DIR_VAR + "/" + + Constants.SHARED_FOLDER); newJVMOptionsActions[0] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selectionProvider, viewer, Constants.SERVER_CONFIG_VAR); - newJVMOptionsActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selectionProvider, viewer, Constants.WLP_INSTALL_VAR + "/" - + Constants.USER_FOLDER + "/" + newJVMOptionsActions[1] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selectionProvider, viewer, Constants.WLP_USER_DIR_VAR + "/" + Constants.SHARED_FOLDER); newJVMOptionsActions[2] = new NewExtendedConfigAction(ExtendedConfigFile.JVM_OPTIONS_FILE, selectionProvider, viewer, Constants.SERVER_CONFIG_VAR + "/" + Constants.CONFIG_DROPINS_FOLDER + "/" @@ -63,6 +63,9 @@ public void init(ICommonActionExtensionSite aSite) { + Constants.CONFIG_DROPINS_FOLDER + "/" + Constants.CONFIG_OVERRIDE_DROPINS_FOLDER); + newConfigDropinActions[0] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.DEFAULTS, selectionProvider, viewer); + newConfigDropinActions[1] = new NewConfigDropinAction(NewConfigDropinAction.DropinType.OVERRIDES, selectionProvider, viewer); + packageAction = new PackageAction(shell, selectionProvider); pluginConfigAction = new PluginConfigAction(shell, selectionProvider); dumpAction = new DumpAction(shell, selectionProvider); @@ -77,8 +80,13 @@ public void fillContextMenu(IMenuManager menu) { MenuManager configMenu = new MenuManager(Messages.menuNewExtendedConfig, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), "extendedConfig"); for (int i = 0; i < createConfigActions.length; i++) configMenu.add(createConfigActions[i]); + // Add the submenu for server.env + MenuManager subConfigMenu = new MenuManager(ExtendedConfigFile.SERVER_ENV_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.SERVER_ENV_FILE); + for (int i = 0; i < newServerEnvActions.length; i++) + subConfigMenu.add(newServerEnvActions[i]); + configMenu.add(subConfigMenu); // Add the submenu for jvm.options - MenuManager subConfigMenu = new MenuManager(ExtendedConfigFile.JVM_OPTIONS_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.JVM_OPTIONS_FILE); + subConfigMenu = new MenuManager(ExtendedConfigFile.JVM_OPTIONS_FILE, Activator.getImageDescriptor(ExtendedConfigFile.BOOTSTRAP_PROPS_FILE), ExtendedConfigFile.JVM_OPTIONS_FILE); for (int i = 0; i < newJVMOptionsActions.length; i++) subConfigMenu.add(newJVMOptionsActions[i]); configMenu.add(subConfigMenu);