From 6fbf83725cc1f4ca913fbd8ca925c52f421bf203 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 10 Jul 2024 10:42:45 +0530 Subject: [PATCH 01/10] FISH-7932 Payara Cloud integration --- build.gradle | 7 + .../java/fish/payara/PayaraConstants.java | 3 +- .../cloud/PayaraCloudConfigurationType.java | 57 +++ .../fish/payara/cloud/PayaraCloudProject.java | 188 ++++++++ .../payara/cloud/actions/CloudAction.java | 138 ++++++ .../cloud/actions/CloudDeployAction.java | 46 ++ .../payara/cloud/actions/CloudDevAction.java | 46 ++ .../actions/CloudListApplicationAction.java | 91 ++++ .../actions/CloudListNamespaceAction.java | 57 +++ .../actions/CloudListSubscriptionAction.java | 44 ++ .../cloud/actions/CloudLoginAction.java | 46 ++ .../cloud/actions/CloudStartAction.java | 46 ++ .../payara/cloud/actions/CloudStopAction.java | 44 ++ .../cloud/actions/CloudUndeployAction.java | 46 ++ .../cloud/maven/CloudMavenConfiguration.java | 114 +++++ .../maven/CloudMavenConfigurationFactory.java | 58 +++ .../payara/cloud/maven/CloudMavenOutput.java | 90 ++++ .../payara/cloud/maven/CloudMavenProject.java | 230 +++++++++ .../fish/payara/cloud/maven/CloudPanel.java | 439 ++++++++++++++++++ .../cloud/maven/CloudSettingsEditor.java | 107 +++++ .../fish/payara/cloud/maven/CloudUtil.java | 56 +++ .../payara/micro/actions/MicroAction.java | 6 +- .../actions/MigrateToJakartaEE10Action.java | 6 +- .../micro/maven/MicroMavenConfiguration.java | 22 +- ...venProject.java => MicroMavenProject.java} | 173 +------ .../MicroMavenRemoteConnectionCreator.java | 4 +- src/main/java/fish/payara/util/MavenUtil.java | 183 ++++++++ src/main/resources/META-INF/plugin.xml | 57 ++- .../fish/payara/PayaraBundle.properties | 5 + src/main/resources/icons/cloud.svg | 27 ++ 30 files changed, 2257 insertions(+), 179 deletions(-) create mode 100644 src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java create mode 100644 src/main/java/fish/payara/cloud/PayaraCloudProject.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudDeployAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudDevAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudListApplicationAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudListNamespaceAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudListSubscriptionAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudLoginAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudStartAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudStopAction.java create mode 100644 src/main/java/fish/payara/cloud/actions/CloudUndeployAction.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudMavenConfiguration.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudMavenConfigurationFactory.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudMavenOutput.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudMavenProject.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudPanel.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudSettingsEditor.java create mode 100644 src/main/java/fish/payara/cloud/maven/CloudUtil.java rename src/main/java/fish/payara/micro/maven/{MavenProject.java => MicroMavenProject.java} (57%) create mode 100644 src/main/java/fish/payara/util/MavenUtil.java create mode 100644 src/main/resources/icons/cloud.svg diff --git a/build.gradle b/build.gradle index 7b06223..a06d38f 100644 --- a/build.gradle +++ b/build.gradle @@ -14,10 +14,17 @@ sourceCompatibility = "17" targetCompatibility = "17" repositories { + mavenLocal() mavenCentral() + maven { + url "https://nexus.dev.payara.fish/repository/payara-artifacts/" + } } dependencies { + + implementation 'fish.payara.tools:payara-cloud:1.0-Alpha4' + implementation 'fish.payara.cloud:cloud-api:1.0.1' testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.9.1' } diff --git a/src/main/java/fish/payara/PayaraConstants.java b/src/main/java/fish/payara/PayaraConstants.java index dcc12a4..b6c9c19 100644 --- a/src/main/java/fish/payara/PayaraConstants.java +++ b/src/main/java/fish/payara/PayaraConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * Copyright (c) 2020-2024 Payara Foundation and/or its affiliates and others. * All rights reserved. * * This program and the accompanying materials are made available under the @@ -22,6 +22,7 @@ public interface PayaraConstants { Icon PAYARA_ICON = IconLoader.getIcon("/icons/payara.svg"); + Icon CLOUD_ICON = IconLoader.getIcon("/icons/cloud.svg"); int DEFAULT_DEBUG_PORT = 9007; } diff --git a/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java b/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java new file mode 100644 index 0000000..e309134 --- /dev/null +++ b/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud; + +import fish.payara.cloud.maven.CloudMavenConfigurationFactory; +import com.intellij.execution.configurations.ConfigurationFactory; +import com.intellij.execution.configurations.ConfigurationType; +import static fish.payara.PayaraConstants.CLOUD_ICON; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +public class PayaraCloudConfigurationType implements ConfigurationType { + + @NotNull + @Override + public String getDisplayName() { + return "Payara Cloud"; + } + + @Override + public String getConfigurationTypeDescription() { + return "Payara Cloud configuration type"; + } + + @Override + public Icon getIcon() { + return CLOUD_ICON; + } + + @NotNull + @Override + public String getId() { + return "PAYARA_CLOUD_CONFIGURATION"; + } + + @Override + public ConfigurationFactory[] getConfigurationFactories() { + return new ConfigurationFactory[]{ + new CloudMavenConfigurationFactory(this) + }; + } +} diff --git a/src/main/java/fish/payara/cloud/PayaraCloudProject.java b/src/main/java/fish/payara/cloud/PayaraCloudProject.java new file mode 100644 index 0000000..e0eb028 --- /dev/null +++ b/src/main/java/fish/payara/cloud/PayaraCloudProject.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2020-2022 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud; + +import com.intellij.openapi.extensions.ExtensionsArea; +import com.intellij.openapi.extensions.PluginDescriptor; +import com.intellij.openapi.extensions.PluginId; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; +import com.intellij.util.ReflectionUtil; +import com.intellij.util.messages.MessageBus; +import org.jetbrains.annotations.NotNull; +import kotlinx.coroutines.CoroutineScope; +import kotlinx.coroutines.GlobalScope; +/** + * + * @author gaurav.gupta@payara.fish + */ +public abstract class PayaraCloudProject implements Project { + + private final Project project; + + private final PsiFile buildFile; + + protected PayaraCloudProject(Project project, PsiFile buildFile) { + this.project = project; + this.buildFile = buildFile; + } + + public T instantiateClass(@NotNull Class aClass, @NotNull PluginId pluginId) { + return ReflectionUtil.newInstance(aClass, false); + } + + public Project getProject() { + return project; + } + + public PsiFile getBuildFile() { + return buildFile; + } + + public abstract String getProjectName(); + + public abstract String getLoginCommand(); + + public abstract String getDevCommand(); + + public abstract String getDeployCommand(); + + public abstract String getUndeployCommand(); + + public abstract String getStartCommand(); + + public abstract String getStopCommand(); + + public abstract String getApplicationCommand(); + + public abstract String getNamespaceCommand(); + + public abstract String getSubscriptionCommand(); + + @Override + public String getName() { + return project.getName(); + } + + @Override + public VirtualFile getBaseDir() { + return project.getBaseDir(); + } + + @Override + public String getBasePath() { + return project.getBasePath(); + } + + @Override + public VirtualFile getProjectFile() { + return project.getProjectFile(); + } + + @Override + public String getProjectFilePath() { + return project.getProjectFilePath(); + } + + @Override + public VirtualFile getWorkspaceFile() { + return project.getWorkspaceFile(); + } + + @Override + public String getLocationHash() { + return project.getLocationHash(); + } + + @Override + public void save() { + project.save(); + } + + @Override + public boolean isOpen() { + return project.isOpen(); + } + + @Override + public boolean isInitialized() { + return project.isInitialized(); + } + + @Override + public boolean isDefault() { + return project.isDefault(); + } + + @Override + public T getComponent(Class type) { + return project.getComponent(type); + } + + @Override + public MessageBus getMessageBus() { + return project.getMessageBus(); + } + + @Override + public boolean isDisposed() { + return project.isDisposed(); + } + + @Override + public Condition getDisposed() { + return project.getDisposed(); + } + + @Override + public T getUserData(Key key) { + return project.getUserData(key); + } + + @Override + public void putUserData(Key key, T t) { + project.putUserData(key, t); + } + + @Override + public void dispose() { + project.dispose(); + } + + public CoroutineScope getCoroutineScope() { + return GlobalScope.INSTANCE; + } + + @Override + public <@NotNull T> T instantiateClass(@NotNull String baseClass, PluginDescriptor pluginDescriptor) { + return getProject().instantiateClass(baseClass, pluginDescriptor); + } + + @Override + public ExtensionsArea getExtensionArea() { + return getProject().getExtensionArea(); + } + + @Override + public boolean hasComponent(@NotNull Class interfaceClass) { + return getProject().hasComponent(interfaceClass); + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudAction.java b/src/main/java/fish/payara/cloud/actions/CloudAction.java new file mode 100644 index 0000000..5309ff3 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudAction.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.notification.*; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.wm.ToolWindow; +import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.terminal.JBTerminalWidget; +import com.intellij.ui.content.Content; +import com.jediterm.terminal.TtyConnector; +import fish.payara.PayaraBundle; +import fish.payara.PayaraConstants; +import fish.payara.cloud.maven.CloudMavenProject; +import fish.payara.cloud.PayaraCloudProject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.plugins.terminal.LocalTerminalDirectRunner; +import org.jetbrains.plugins.terminal.ShellTerminalWidget; +import org.jetbrains.plugins.terminal.TerminalTabState; +import org.jetbrains.plugins.terminal.TerminalView; + +import java.awt.event.KeyEvent; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public abstract class CloudAction extends AnAction { + + private static final Logger LOG = Logger.getLogger(CloudAction.class.getName()); + + private static final String TOOL_WINDOW_ID = "Terminal"; + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + try { + final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); + if (project == null) { + LOG.warning("Unable to resolve project type."); + return; + } + + PayaraCloudProject cloudProject = CloudMavenProject.getInstance(project); + if (cloudProject == null) { + LOG.warning(PayaraBundle.message("CloudAction.notification.message")); + Notifications.Bus.notify( + new Notification( + PayaraBundle.message("CloudAction.notification.group"), + PayaraConstants.CLOUD_ICON, + e.getPresentation().getDescription(), + "", + PayaraBundle.message("CloudAction.notification.message"), + NotificationType.WARNING, + NotificationListener.URL_OPENING_LISTENER + ), project); + return; + } + if (cloudProject != null) { + onAction(cloudProject); + } + } catch (Exception ex) { + LOG.log(Level.SEVERE, null, ex); + } + } + + public abstract void onAction(PayaraCloudProject project); + + public JBTerminalWidget getTerminal(Project project, String tabName) { + ToolWindowManager windowManager = ToolWindowManager.getInstance(project); + ToolWindow terminalWindow = windowManager.getToolWindow(TOOL_WINDOW_ID); + if (terminalWindow != null) { + JBTerminalWidget widget = findTerminal(terminalWindow, tabName); + if (widget != null) { + return widget; + } + createTerminal(project, tabName); + return findTerminal(terminalWindow, tabName); + } + return null; + } + + private void createTerminal(Project project, String tabName) { + TerminalTabState tabState = new TerminalTabState(); + tabState.myTabName = tabName; + tabState.myWorkingDirectory = project.getBasePath(); + TerminalView.getInstance(project) + .createNewSession(new LocalTerminalDirectRunner(project), tabState); + } + + private JBTerminalWidget findTerminal(ToolWindow terminalWindow, String tabName) { + Content[] contents = terminalWindow.getContentManager().getContents(); + for (Content content : contents) { + if (content.getTabName().equals(tabName)) { + return TerminalView.getWidgetByContent(content); + } + } + return null; + } + + public void executeCommand(JBTerminalWidget widget, String command) { + try { + widget.setRequestFocusEnabled(true); + widget.requestFocusInWindow(); + widget.requestFocus(true); + widget.requestFocus(); + widget.grabFocus(); + TtyConnector connector = widget.getTtyConnector(); + if (connector != null) { + connector.write(command); + connector.write(widget.getTerminalStarter().getCode(KeyEvent.VK_ENTER, 0)); + } else if (widget instanceof ShellTerminalWidget) { + ((ShellTerminalWidget) widget).executeCommand(command); + } + } catch (IOException ex) { + LOG.log(Level.SEVERE, null, ex); + } + } +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudDeployAction.java b/src/main/java/fish/payara/cloud/actions/CloudDeployAction.java new file mode 100644 index 0000000..ac503c3 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudDeployAction.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; + +import java.util.logging.Logger; + +import static java.util.logging.Level.WARNING; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudDeployAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudDeployAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName + " instance"); + if (terminal != null) { + executeCommand(terminal, project.getDeployCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudDevAction.java b/src/main/java/fish/payara/cloud/actions/CloudDevAction.java new file mode 100644 index 0000000..117b705 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudDevAction.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; + +import java.util.logging.Logger; + +import static java.util.logging.Level.WARNING; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudDevAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudDevAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName + " instance"); + if (terminal != null) { + executeCommand(terminal, project.getDevCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudListApplicationAction.java b/src/main/java/fish/payara/cloud/actions/CloudListApplicationAction.java new file mode 100644 index 0000000..10135d3 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudListApplicationAction.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.openapi.ui.Messages; +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.PayaraConstants; +import fish.payara.cloud.PayaraCloudProject; +import fish.payara.cloud.maven.CloudMavenProject; +import javax.swing.*; +import java.awt.*; +import static java.util.logging.Level.WARNING; +import java.util.logging.Logger; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudListApplicationAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudListApplicationAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName); + if (terminal != null) { + JPanel panel = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.insets = new Insets(2, 2, 2, 2); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 0; + gbc.gridy = 0; + + JLabel subscriptionLabel = new JLabel("Subscription:"); + panel.add(subscriptionLabel, gbc); + + gbc.gridx = 1; + JTextField subscriptionField = new JTextField(20); + panel.add(subscriptionField, gbc); + + gbc.gridx = 0; + gbc.gridy = 1; + JLabel namespaceLabel = new JLabel("Namespace:"); + panel.add(namespaceLabel, gbc); + + gbc.gridx = 1; + JTextField namespaceField = new JTextField(20); + panel.add(namespaceField, gbc); + + int result = JOptionPane.showConfirmDialog( + null, + panel, + "List Cloud Applications", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE, + PayaraConstants.CLOUD_ICON + ); + + if (result == JOptionPane.OK_OPTION) { + String subscriptionValue = subscriptionField.getText().trim(); + String namespaceValue = namespaceField.getText().trim(); + + String cmd = project.getApplicationCommand(); + if (!subscriptionValue.isEmpty()) { + cmd += " -D" + CloudMavenProject.SUBSCRIPTION_ATTR + "='" + subscriptionValue + "'"; + } + if (!namespaceValue.isEmpty()) { + cmd += " -D" + CloudMavenProject.NAMESPACE_ATTR + "='" + namespaceValue + "'"; + } + executeCommand(terminal, cmd); + } + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudListNamespaceAction.java b/src/main/java/fish/payara/cloud/actions/CloudListNamespaceAction.java new file mode 100644 index 0000000..bf6c803 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudListNamespaceAction.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + + +import com.intellij.openapi.ui.Messages; +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; +import fish.payara.cloud.maven.CloudMavenProject; +import static java.util.logging.Level.WARNING; +import java.util.logging.Logger; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudListNamespaceAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudListNamespaceAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName); + if (terminal != null) { + String subscriptionValue = Messages.showInputDialog( + project.getProject(), + "Subscription:", + "List Cloud Namespaces", + Messages.getQuestionIcon() + ); + if (subscriptionValue != null && !subscriptionValue.trim().isEmpty()) { + executeCommand(terminal, project.getNamespaceCommand() + " -D" + CloudMavenProject.SUBSCRIPTION_ATTR + "='" + subscriptionValue + "'"); + } else { + executeCommand(terminal, project.getNamespaceCommand()); + } + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudListSubscriptionAction.java b/src/main/java/fish/payara/cloud/actions/CloudListSubscriptionAction.java new file mode 100644 index 0000000..ca5c63a --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudListSubscriptionAction.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; +import static java.util.logging.Level.WARNING; +import java.util.logging.Logger; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudListSubscriptionAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudListSubscriptionAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName); + if (terminal != null) { + executeCommand(terminal, project.getSubscriptionCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudLoginAction.java b/src/main/java/fish/payara/cloud/actions/CloudLoginAction.java new file mode 100644 index 0000000..aac5376 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudLoginAction.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; + +import java.util.logging.Logger; + +import static java.util.logging.Level.WARNING; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudLoginAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudLoginAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName + " instance"); + if (terminal != null) { + executeCommand(terminal, project.getLoginCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudStartAction.java b/src/main/java/fish/payara/cloud/actions/CloudStartAction.java new file mode 100644 index 0000000..a505038 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudStartAction.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; + +import java.util.logging.Logger; + +import static java.util.logging.Level.WARNING; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudStartAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudStartAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName + " instance"); + if (terminal != null) { + executeCommand(terminal, project.getStartCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudStopAction.java b/src/main/java/fish/payara/cloud/actions/CloudStopAction.java new file mode 100644 index 0000000..aae9f4b --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudStopAction.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; +import static java.util.logging.Level.WARNING; +import java.util.logging.Logger; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudStopAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudStopAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName); + if (terminal != null) { + executeCommand(terminal, project.getStopCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/actions/CloudUndeployAction.java b/src/main/java/fish/payara/cloud/actions/CloudUndeployAction.java new file mode 100644 index 0000000..bef14b8 --- /dev/null +++ b/src/main/java/fish/payara/cloud/actions/CloudUndeployAction.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.actions; + +import com.intellij.terminal.JBTerminalWidget; +import fish.payara.cloud.PayaraCloudProject; + +import java.util.logging.Logger; + +import static java.util.logging.Level.WARNING; + +/** + * + * @author gaurav.gupta@payara.fish + */ +public class CloudUndeployAction extends CloudAction { + + private static final Logger LOG = Logger.getLogger(CloudUndeployAction.class.getName()); + + @Override + public void onAction(PayaraCloudProject project) { + String projectName; + projectName = project.getProjectName(); + JBTerminalWidget terminal = getTerminal(project, projectName + " instance"); + if (terminal != null) { + executeCommand(terminal, project.getUndeployCommand()); + } else { + LOG.log(WARNING, "Shell window for {0} is not available.", projectName); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenConfiguration.java b/src/main/java/fish/payara/cloud/maven/CloudMavenConfiguration.java new file mode 100644 index 0000000..9ad986f --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenConfiguration.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import com.intellij.execution.configurations.ConfigurationFactory; +import com.intellij.execution.configurations.JavaParameters; +import com.intellij.execution.configurations.RemoteConnection; +import com.intellij.execution.configurations.RemoteConnectionCreator; +import com.intellij.execution.configurations.RunConfiguration; +import com.intellij.openapi.options.SettingsEditor; +import com.intellij.openapi.project.Project; +import org.jetbrains.idea.maven.execution.MavenRunConfiguration; +import org.jetbrains.idea.maven.execution.MavenRunnerParameters; +import com.intellij.execution.runners.ExecutionEnvironment; +import fish.payara.PayaraBundle; +import fish.payara.PayaraConstants; +import com.intellij.notification.*; +import com.intellij.openapi.util.JDOMExternalizerUtil; +import org.jetbrains.annotations.NotNull; +import org.jdom.Element; +import org.jetbrains.idea.maven.execution.MavenRunConfiguration; +import org.jetbrains.idea.maven.execution.MavenRunnerParameters; +import org.jetbrains.idea.maven.execution.run.configuration.MavenRunConfigurationSettingsEditor; + +public class CloudMavenConfiguration extends MavenRunConfiguration { + + private String goals = CloudMavenProject.DEV_GOAL; + + protected CloudMavenConfiguration(Project project, ConfigurationFactory factory, String name) { + super(project, factory, name); + } + + public String getGoals() { + return goals; + } + + public void setGoals(String goals) { + this.goals = goals; + } + + @Override + public SettingsEditor getConfigurationEditor() { + MavenRunnerParameters parameters = this.getRunnerParameters(); + + if (parameters != null) { + if (parameters.getWorkingDirPath().isEmpty() + && super.getProject().getBasePath() != null) { + parameters.setWorkingDirPath(super.getProject().getBasePath()); + } + if (parameters.getGoals().isEmpty()) { + CloudMavenProject mavenProject = CloudMavenProject.getInstance(super.getProject()); + if (mavenProject == null) { + parameters.getGoals().add(String.format( + "%s:%s:%s:%s", + CloudMavenProject.CLOUD_GROUP_ID, + CloudMavenProject.CLOUD_ARTIFACT_ID, + CloudMavenProject.CLOUD_VERSION, + getGoals() + )); + } else { + parameters.getGoals().add(String.format( + "%s:%s", + CloudMavenProject.CLOUD_PLUGIN, + getGoals() + )); + } + } + } + return LazyEditorFactory.create(this); + } + private static final class LazyEditorFactory { + static @NotNull SettingsEditor create(@NotNull CloudMavenConfiguration configuration) { + return new CloudSettingsEditor(configuration.getProject()); + } + } + + @Override + public RemoteConnectionCreator createRemoteConnectionCreator(JavaParameters javaParameters) { + return new RemoteConnectionCreator() { + public RemoteConnection createRemoteConnection(ExecutionEnvironment environment) { + Notifications.Bus.notify( + new Notification( + PayaraBundle.message("CloudDebug.notification.group"), + PayaraConstants.CLOUD_ICON, + PayaraBundle.message("CloudDebug.notification.group"), + "", + PayaraBundle.message("CloudDebug.notification.message"), + NotificationType.WARNING, + NotificationListener.URL_OPENING_LISTENER + ), null); + return null; + } + public boolean isPollConnection() { + return false; + } + }; + } + + +} diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenConfigurationFactory.java b/src/main/java/fish/payara/cloud/maven/CloudMavenConfigurationFactory.java new file mode 100644 index 0000000..669a951 --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenConfigurationFactory.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import com.intellij.execution.configurations.*; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.IconLoader; +import static fish.payara.PayaraConstants.CLOUD_ICON; +import javax.swing.Icon; +import org.jetbrains.annotations.NotNull; + +public class CloudMavenConfigurationFactory extends ConfigurationFactory { + + private static final String FACTORY_NAME = "Cloud Maven"; + + public CloudMavenConfigurationFactory(ConfigurationType type) { + super(type); + } + + @NotNull + @Override + public RunConfiguration createTemplateConfiguration(@NotNull Project project) { + return new CloudMavenConfiguration(project, this, FACTORY_NAME); + } + + @NotNull + @Override + public String getName() { + return FACTORY_NAME; + } + + @NotNull + @Override + public String getId() { + return FACTORY_NAME; + } + + @NotNull + @Override + public Icon getIcon() { + return CLOUD_ICON; + } + +} diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenOutput.java b/src/main/java/fish/payara/cloud/maven/CloudMavenOutput.java new file mode 100644 index 0000000..d7e91ce --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenOutput.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import fish.payara.cloud.client.ClientOutput; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Gaurav Gupta + */ +public class CloudMavenOutput implements ClientOutput { + + private static final Logger LOG = Logger.getLogger(CloudMavenOutput.class.getName()); + + private final boolean interactive; + + public CloudMavenOutput(boolean interactive) { + this.interactive = interactive; + } + + @Override + public void warning(String message) { + LOG.warning(message); + } + + @Override + public void info(String message) { + LOG.info(message); + } + + @Override + public void error(String message, Throwable cause) { + LOG.log(Level.SEVERE, message, cause); + } + + @Override + public void started(Object processId, Runnable cancellation) { + LOG.log(Level.FINE, "Started: {0}", processId); + } + + @Override + public void progress(Object processId, String message) { + LOG.log(Level.FINE, "Progress: {0} {1}", new Object[]{processId, message}); + } + + @Override + public void finished(Object processId) { + LOG.log(Level.FINE, "Finished: {0}", processId); + } + + @Override + public void openUrl(URI uri) { + LOG.info("Opening URL: " + uri); + if (interactive) { + try { + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + Desktop.getDesktop().browse(uri); + } else { + LOG.warning("Desktop browsing is not supported on this platform."); + } + } catch (IOException e) { + LOG.log(Level.SEVERE, "Failed to open URL: " + uri, e); + } + } + } + + @Override + public void failure(String message, Throwable cause) { + LOG.log(Level.SEVERE, "Failure: " + message, cause); + } +} \ No newline at end of file diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java new file mode 100644 index 0000000..a4bc8c5 --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import com.intellij.diagnostic.ActivityCategory; +import com.intellij.openapi.extensions.PluginDescriptor; +import com.intellij.openapi.extensions.PluginId; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiFile; +import com.intellij.psi.search.FilenameIndex; +import com.intellij.psi.search.GlobalSearchScope; +import fish.payara.cloud.PayaraCloudProject; +import fish.payara.util.MavenUtil; +import org.jetbrains.annotations.NotNull; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.util.Map; +import java.util.logging.Logger; +import static java.util.logging.Level.SEVERE; + +/** + * @author gaurav.gupta@payara.fish + */ +public class CloudMavenProject extends PayaraCloudProject { + + private static final Logger LOG = Logger.getLogger(CloudMavenProject.class.getName()); + + public static final String CLOUD_GROUP_ID = "fish.payara.maven.plugins"; + public static final String CLOUD_ARTIFACT_ID = "payara-cloud-maven-plugin"; + public static final String CLOUD_VERSION = "1.0-Alpha3"; + public static final String CLOUD_PLUGIN = "payara-cloud"; + public static final String START_GOAL = "start"; + public static final String LOGIN_GOAL = "login"; + public static final String DEV_GOAL = "dev"; + public static final String DEPLOY_GOAL = "deploy"; + public static final String UNDEPLOY_GOAL = "undeploy"; + private static final String STOP_GOAL = "stop"; + private static final String APPLICATION_GOAL = "application"; + private static final String NAMESPACE_GOAL = "namespace"; + private static final String SUBSCRIPTION_GOAL = "subscription"; + public static final String PACKAGE_GOAL = "package"; + private static final String BUILD_FILE = "pom.xml"; + public static final String NAMESPACE_ATTR = "namespaceName"; + public static final String SUBSCRIPTION_ATTR = "subscriptionName"; + + @Override + public String getLoginCommand() { + return String.format("mvn %s:%s:%s", + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, LOGIN_GOAL + ); + } + + @Override + public String getDevCommand() { + return String.format("mvn %s %s:%s:%s", + PACKAGE_GOAL, + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, DEV_GOAL + ); + } + + @Override + public String getDeployCommand() { + return String.format("mvn %s %s:%s:%s", + PACKAGE_GOAL, + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, DEPLOY_GOAL + ); + } + + @Override + public String getUndeployCommand() { + return String.format("mvn %s %s:%s:%s", + PACKAGE_GOAL, + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, UNDEPLOY_GOAL + ); + } + + @Override + public String getStartCommand() { + return String.format("mvn %s %s:%s:%s", + PACKAGE_GOAL, + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, START_GOAL + ); + } + + @Override + public String getStopCommand() { + return String.format("mvn %s:%s:%s", + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, STOP_GOAL + ); + } + + @Override + public String getApplicationCommand() { + return String.format("mvn %s:%s:%s", + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, APPLICATION_GOAL + ); + } + + @Override + public String getNamespaceCommand() { + return String.format("mvn %s:%s:%s", + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, NAMESPACE_GOAL + ); + } + + @Override + public String getSubscriptionCommand() { + return String.format("mvn %s:%s:%s", + CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID, SUBSCRIPTION_GOAL + ); + } + + public static CloudMavenProject getInstance(Project project) { + PsiFile pom = getPomFile(project); + if (pom != null) { + return new CloudMavenProject(project, pom); + } + return null; + } + + public CloudMavenProject(Project project, PsiFile pom) { + super(project, pom); + } + + /** + * Return the project name from pom.xml artifactId + * + * @return + */ + @Override + public String getProjectName() { + return MavenUtil.getProjectName(super.getBuildFile()); + } + + /** + * @param project + * @return the pom.xml file + */ + private static PsiFile getPomFile(Project project) { + PsiFile[] poms = FilenameIndex.getFilesByName(project, BUILD_FILE, GlobalSearchScope.projectScope(project)); + for (PsiFile pom : poms) { + if (isValidPom(pom)) { + return pom; + } + } + return null; + } + + /** + * @param pomFile the pom.xml file + * @return true if pom.xml file includes Payara Cloud Maven plugin + */ + private static boolean isValidPom(PsiFile pomFile) { + try { + Node pomRoot = MavenUtil.getPomRootNode(pomFile); + return MavenUtil.getBuildNodes(pomRoot) + .stream() + .anyMatch(CloudMavenProject::isCloudPlugin); + } catch (ParserConfigurationException | SAXException | IOException ex) { + LOG.log(SEVERE, null, ex); + } + return false; + } + + /** + * @param buildNode + * @return true if pom.xml file includes Payara Cloud Maven plugin + */ + private static boolean isCloudPlugin(Node buildNode) { + return MavenUtil.getPluginNode(buildNode, CLOUD_GROUP_ID, CLOUD_ARTIFACT_ID) != null; + } + + @Override + public RuntimeException createError(Throwable error, PluginId pluginId) { + return getProject().createError(error, pluginId); + } + + @Override + public RuntimeException createError(String message, PluginId pluginId) { + return getProject().createError(message, pluginId); + } + + @Override + public RuntimeException createError(String message, Throwable throwable, PluginId pluginId, Map attachments) { + return getProject().createError(message, throwable, pluginId, attachments); + } + + @Override + public @NotNull ActivityCategory getActivityCategory(boolean isExtension) { + return getProject().getActivityCategory(isExtension); + } + + @Override + public boolean isInjectionForExtensionSupported() { + return getProject().isInjectionForExtensionSupported(); + } + + @Override + public T getService(@NotNull Class serviceClass) { + return getProject().getService(serviceClass); + } + + @Override + public T instantiateClassWithConstructorInjection(@NotNull Class aClass, @NotNull Object key, @NotNull PluginId pluginId) { + return getProject().instantiateClassWithConstructorInjection(aClass, key, pluginId); + } + + @Override + public Class loadClass(String className, PluginDescriptor pluginDescriptor) throws ClassNotFoundException { + return getProject().loadClass(className, pluginDescriptor); + } +} diff --git a/src/main/java/fish/payara/cloud/maven/CloudPanel.java b/src/main/java/fish/payara/cloud/maven/CloudPanel.java new file mode 100644 index 0000000..dd8538e --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudPanel.java @@ -0,0 +1,439 @@ +/* + * Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import com.intellij.execution.configuration.EnvironmentVariablesComponent; +import com.intellij.execution.target.LanguageRuntimeConfiguration; +import com.intellij.execution.target.TargetEnvironmentConfiguration; +import com.intellij.execution.target.TargetEnvironmentsManager; +import com.intellij.execution.target.java.JavaLanguageRuntimeConfiguration; +import com.intellij.openapi.externalSystem.service.ui.ExternalSystemJdkComboBox; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.ComboBox; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.ComponentUtil; +import com.intellij.ui.IdeBorderFactory; +import com.intellij.ui.RawCommandLineEditor; +import com.intellij.ui.UserActivityWatcher; +import com.intellij.util.ui.JBFont; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.idea.maven.project.MavenConfigurableBundle; +import org.jetbrains.idea.maven.project.MavenProject; +import org.jetbrains.idea.maven.project.MavenProjectsManager; +import org.jetbrains.idea.maven.execution.MavenPropertiesPanel; +import org.jetbrains.idea.maven.execution.MavenRunnerSettings; + +import java.util.stream.Collectors; +import javax.ws.rs.core.Link; + +import javax.swing.*; +import java.awt.*; +import java.util.List; +import java.util.*; +import java.util.stream.IntStream; +import java.util.concurrent.ExecutionException; + +/** + * + * @author Gaurav Gupta + */ +public class CloudPanel { + + protected final Project myProject; + private final boolean myRunConfigurationMode; + + private JCheckBox myDelegateToMavenCheckbox; + private RawCommandLineEditor myVMParametersEditor; + private EnvironmentVariablesComponent myEnvVariablesComponent; + private JLabel myJdkLabel; + private ExternalSystemJdkComboBox myJdkCombo; + private ComboBox myTargetJdkCombo; + + private JCheckBox mySkipTestsCheckBox; + private MavenPropertiesPanel myPropertiesPanel; + + private Map myProperties; + private String myTargetName; + + private ComboBox goalsComboBox; + private ComboBox subscriptionComboBox; + private ComboBox namespaceComboBox; + private static List subscriptions; + private final static String LOADING = "Loading..."; + + public CloudPanel(@NotNull Project p, boolean isRunConfiguration) { + myProject = p; + myRunConfigurationMode = isRunConfiguration; + } + + public JComponent createComponent() { + JPanel panel = new JPanel(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.HORIZONTAL; + c.anchor = GridBagConstraints.WEST; + c.insets = new Insets(5, 5, 5, 5); + + myDelegateToMavenCheckbox = new JCheckBox(MavenConfigurableBundle.message("maven.settings.runner.delegate")); + + if (!myRunConfigurationMode) { + c.gridx = 0; + c.gridy++; + c.weightx = 1; + c.gridwidth = GridBagConstraints.REMAINDER; + panel.add(myDelegateToMavenCheckbox, c); + } + + c.gridwidth = 1; + + c.gridx = 0; + c.gridy++; + panel.add(new JLabel("Goals:"), c); + c.gridx = 1; + List goals = new ArrayList(); + goals.add(CloudMavenProject.DEV_GOAL); + goals.add(CloudMavenProject.DEPLOY_GOAL); + goalsComboBox = new ComboBox<>(goals.toArray(new String[0])); + goalsComboBox.setEditable(true); + panel.add(goalsComboBox, c); + +// List subscriptionTitles = new ArrayList<>(); +// try { +// if (subscriptions == null || subscriptions.isEmpty()) { +// subscriptions = CloudUtil.getSubscriptions(); // Fetch subscriptions if not already fetched +// } +// subscriptionTitles = subscriptions.stream() +// .map(link -> link.getTitle()) +// .collect(Collectors.toList()); +// } catch (Throwable e) { +// System.out.println("Exception " + e.getMessage()); +// e.printStackTrace(); +// } +// +// subscriptionTitles.add(0, ""); +// subscriptionComboBox = new ComboBox<>(subscriptionTitles.toArray(new String[0])); + subscriptionComboBox = new ComboBox<>(); + subscriptionComboBox.setEditable(true); + subscriptionComboBox.addActionListener(e -> { + updateMavenProperties(); + fetchNamespacesAsync((String) subscriptionComboBox.getSelectedItem()); + }); + + // Add Subscription Combo + c.gridx = 0; + c.gridy++; + panel.add(new JLabel("Subscription:"), c); + c.gridx = 1; + panel.add(subscriptionComboBox, c); + + // Add Namespace Combo + c.gridx = 0; + c.gridy++; + panel.add(new JLabel("Namespace:"), c); + c.gridx = 1; + namespaceComboBox = new ComboBox<>(); + namespaceComboBox.setEditable(true); + panel.add(namespaceComboBox, c); + namespaceComboBox.addActionListener(e -> { + updateMavenProperties(); + }); + + myJdkLabel = new JLabel(MavenConfigurableBundle.message("maven.settings.runner.jre")); + myJdkLabel.setLabelFor(myJdkCombo = new ExternalSystemJdkComboBox(myProject)); + c.gridx = 0; + c.gridy++; + c.weightx = 0; + panel.add(myJdkLabel, c); + c.gridx = 1; + c.weightx = 1; + c.insets.left = 10; + c.fill = GridBagConstraints.HORIZONTAL; + panel.add(myJdkCombo, c); + myTargetJdkCombo = new ComboBox<>(); + ComponentUtil.putClientProperty(myTargetJdkCombo, UserActivityWatcher.DO_NOT_WATCH, true); + myTargetJdkCombo.setVisible(false); + panel.add(myTargetJdkCombo, c); + c.insets.left = 0; + + JLabel labelVMParameters = new JLabel(MavenConfigurableBundle.message("maven.settings.runner.vm.options")); + labelVMParameters.setLabelFor(myVMParametersEditor = new RawCommandLineEditor()); + myVMParametersEditor.setDialogCaption(labelVMParameters.getText()); + + c.gridx = 0; + c.gridy++; + c.weightx = 0; + panel.add(labelVMParameters, c); + + c.gridx = 1; + c.weightx = 1; + c.insets.left = 10; + panel.add(myVMParametersEditor, c); + + JPanel propertiesPanel = new JPanel(new BorderLayout()); + propertiesPanel.setBorder(IdeBorderFactory.createTitledBorder(MavenConfigurableBundle.message("maven.settings.runner.properties"), false)); + + propertiesPanel.add(mySkipTestsCheckBox = new JCheckBox(MavenConfigurableBundle.message("maven.settings.runner.skip.tests")), BorderLayout.NORTH); + + collectProperties(); + propertiesPanel.add(myPropertiesPanel = new MavenPropertiesPanel(myProperties), BorderLayout.CENTER); + myPropertiesPanel.getTable().setShowGrid(false); + myPropertiesPanel.getEmptyText().setText(MavenConfigurableBundle.message("maven.settings.runner.properties.not.defined")); + + JLabel labelOverrideJvmConfig = new JLabel(MavenConfigurableBundle.message("maven.settings.vm.options.tooltip")); + labelOverrideJvmConfig.setFont(JBFont.small()); + c.gridx = 1; + c.gridy++; + c.weightx = 1; + c.insets.left = 20; + panel.add(labelOverrideJvmConfig, c); + c.insets.left = 0; + + myEnvVariablesComponent = new EnvironmentVariablesComponent(); + myEnvVariablesComponent.setPassParentEnvs(true); + myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST); + c.gridx = 0; + c.gridy++; + c.weightx = 1; + c.gridwidth = 2; + panel.add(myEnvVariablesComponent, c); + c.gridwidth = 1; + + c.gridx = 0; + c.gridy++; + c.weightx = c.weighty = 1; + c.gridwidth = c.gridheight = GridBagConstraints.REMAINDER; + c.fill = GridBagConstraints.BOTH; + panel.add(propertiesPanel, c); + + // Start fetching subscriptions + fetchSubscriptions(); + return panel; + } + + private void fetchSubscriptions() { + subscriptionComboBox.removeAllItems(); + subscriptionComboBox.addItem(LOADING); + subscriptionComboBox.setSelectedItem(LOADING); + + SwingWorker, Void> worker = new SwingWorker<>() { + @Override + protected List doInBackground() throws Exception { + // Fetch subscriptions in the background + return CloudUtil.getSubscriptions(); + } + + @Override + protected void done() { + try { + if (subscriptions == null || subscriptions.isEmpty()) { + subscriptions = get(); // Fetch subscriptions if not already fetched + } + List subscriptionTitles = subscriptions.stream() + .map(link -> link.getTitle()) + .collect(Collectors.toList()); + subscriptionComboBox.removeAllItems(); +// subscriptionTitles.add(0, ""); + subscriptionTitles.forEach(title -> subscriptionComboBox.addItem(title)); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, "Failed to load subscriptions.", "Error", JOptionPane.ERROR_MESSAGE); + } + } + }; + worker.execute(); + } + + private void fetchNamespacesAsync(String selectedSubscription) { + namespaceComboBox.removeAllItems(); + namespaceComboBox.addItem(LOADING); + namespaceComboBox.setSelectedItem(LOADING); + + SwingWorker, Void> worker = new SwingWorker<>() { + @Override + protected List doInBackground() throws Exception { + // Fetch namespaces in the background + return subscriptions != null ? CloudUtil.getNamespaces(selectedSubscription) : Collections.emptyList(); + } + + @Override + protected void done() { + try { + List namespaces = get(); + List namespaceTitles = namespaces.stream() + .map(Link::getTitle) + .collect(Collectors.toList()); + namespaceComboBox.removeAllItems(); +// namespaceTitles.add(0, ""); + namespaceTitles.forEach(namespaceComboBox::addItem); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, "Failed to load namespaces.", "Error", JOptionPane.ERROR_MESSAGE); + } + } + }; + worker.execute(); + } + + private void updateMavenProperties() { + Map mavenProperties = new HashMap<>(myPropertiesPanel.getDataAsMap()); + String subscription = (String) subscriptionComboBox.getSelectedItem(); + String namespace = (String) namespaceComboBox.getSelectedItem(); + + if (namespace != null && !namespace.isEmpty()) { + mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); + } else { + mavenProperties.remove(CloudMavenProject.NAMESPACE_ATTR); + } + + if (subscription != null && !subscription.isEmpty()) { + mavenProperties.put(CloudMavenProject.SUBSCRIPTION_ATTR, subscription); + } else { + mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); + } + + myPropertiesPanel.setDataFromMap(mavenProperties); + } + + private void collectProperties() { + MavenProjectsManager s = MavenProjectsManager.getInstance(myProject); + Map result = new LinkedHashMap<>(); + + for (MavenProject each : s.getProjects()) { + Properties properties = each.getProperties(); + result.putAll((Map) properties); + } + + myProperties = result; + } + + protected void getData(MavenRunnerSettings data, CloudMavenConfiguration config) { + myDelegateToMavenCheckbox.setSelected(data.isDelegateBuildToMaven()); + myVMParametersEditor.setText(data.getVmOptions()); + mySkipTestsCheckBox.setSelected(data.isSkipTests()); + + myJdkCombo.refreshData(data.getJreName()); + myTargetJdkCombo.setSelectedItem(data.getJreName()); + + Map mavenProperties = data.getMavenProperties(); + myPropertiesPanel.setDataFromMap(mavenProperties); + + myEnvVariablesComponent.setEnvs(data.getEnvironmentProperties()); + myEnvVariablesComponent.setPassParentEnvs(data.isPassParentEnv()); + + goalsComboBox.setSelectedItem(config.getGoals()); + + if (mavenProperties.containsKey(CloudMavenProject.SUBSCRIPTION_ATTR)) { + String subscriptionName = mavenProperties.get(CloudMavenProject.SUBSCRIPTION_ATTR); + subscriptionComboBox.setSelectedItem(subscriptionName); + } else { + subscriptionComboBox.setSelectedItem(null); + } + if (mavenProperties.containsKey(CloudMavenProject.NAMESPACE_ATTR)) { + String namespaceName = mavenProperties.get(CloudMavenProject.NAMESPACE_ATTR); + namespaceComboBox.setSelectedItem(namespaceName); + } else { + namespaceComboBox.setSelectedItem(null); + } + + } + + protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) { + data.setDelegateBuildToMaven(myDelegateToMavenCheckbox.isSelected()); + data.setVmOptions(myVMParametersEditor.getText().trim()); + data.setSkipTests(mySkipTestsCheckBox.isSelected()); + if (myJdkCombo.getSelectedValue() != null) { + data.setJreName(myJdkCombo.getSelectedValue()); + } else { + data.setJreName(StringUtil.notNullize(myTargetJdkCombo.getItem(), MavenRunnerSettings.USE_PROJECT_JDK)); + } + Map mavenProperties = new HashMap<>(myPropertiesPanel.getDataAsMap()); + + String subscription = (String) subscriptionComboBox.getSelectedItem(); + String namespace = (String) namespaceComboBox.getSelectedItem(); + + if (namespace != null && !namespace.isEmpty()) { + mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); + } else { + mavenProperties.remove(CloudMavenProject.NAMESPACE_ATTR); + } + + if (subscription != null && !subscription.isEmpty()) { + mavenProperties.put(CloudMavenProject.SUBSCRIPTION_ATTR, subscription); + } else { + mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); + } + + data.setMavenProperties(mavenProperties); + + data.setEnvironmentProperties(myEnvVariablesComponent.getEnvs()); + data.setPassParentEnv(myEnvVariablesComponent.isPassParentEnvs()); + + config.setGoals((String) goalsComboBox.getSelectedItem()); + } + + public Project getProject() { + return myProject; + } + + void applyTargetEnvironmentConfiguration(@Nullable String targetName) { + boolean localTarget = targetName == null; + boolean targetChanged = !Objects.equals(myTargetName, targetName); + if (targetChanged) { + myTargetName = targetName; + updateJdkComponents(targetName); + if (localTarget) { + myJdkCombo.refreshData(null); + } + } else if (!localTarget) { + updateJdkComponents(targetName); + } + } + + private void updateJdkComponents(@Nullable String targetName) { + boolean localTarget = targetName == null; + myTargetJdkCombo.setVisible(!localTarget); + myJdkCombo.setVisible(localTarget); + if (!localTarget) { + List items = IntStream.range(0, myTargetJdkCombo.getItemCount()) + .mapToObj(i -> myTargetJdkCombo.getItemAt(i)) + .toList(); + + List targetItems = new ArrayList<>(); + TargetEnvironmentConfiguration targetEnvironmentConfiguration = TargetEnvironmentsManager.getInstance(myProject) + .getTargets().findByName(targetName); + if (targetEnvironmentConfiguration != null) { + for (LanguageRuntimeConfiguration runtimeConfiguration : targetEnvironmentConfiguration.getRuntimes().resolvedConfigs()) { + if (runtimeConfiguration instanceof JavaLanguageRuntimeConfiguration) { + String homePath = ((JavaLanguageRuntimeConfiguration) runtimeConfiguration).getHomePath(); + targetItems.add(homePath); + } + } + } + + if (!items.equals(targetItems)) { + myTargetJdkCombo.removeAllItems(); + targetItems.forEach(myTargetJdkCombo::addItem); + } + myJdkLabel.setLabelFor(myTargetJdkCombo); + } else { + myJdkLabel.setLabelFor(myJdkCombo); + } + } + +} diff --git a/src/main/java/fish/payara/cloud/maven/CloudSettingsEditor.java b/src/main/java/fish/payara/cloud/maven/CloudSettingsEditor.java new file mode 100644 index 0000000..65e692d --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudSettingsEditor.java @@ -0,0 +1,107 @@ +/* + * Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.options.SettingsEditor; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.idea.maven.project.MavenConfigurableBundle; +import org.jetbrains.idea.maven.project.MavenDisablePanelCheckbox; +import org.jetbrains.idea.maven.project.MavenProjectBundle; +import org.jetbrains.idea.maven.execution.MavenRunnerSettings; +import org.jetbrains.idea.maven.execution.MavenRunner; +import javax.swing.*; + +/** + * + * @author Gaurav Gupta + */ + +public class CloudSettingsEditor extends SettingsEditor { + + private final CloudPanel myPanel; + + private JCheckBox myUseProjectSettings; + + public CloudSettingsEditor(@NotNull Project project) { + myPanel = new CloudPanel(project, true); + } + + @Override + protected void resetEditorFrom(@NotNull CloudMavenConfiguration runConfiguration) { + String targetName = com.intellij.ide.DataManager.getInstance().getDataContext(this.getComponent()) + .getData(com.intellij.execution.impl.SingleConfigurationConfigurable.RUN_ON_TARGET_NAME_KEY); + boolean localTarget = targetName == null; + if (localTarget) { + myUseProjectSettings.setSelected(runConfiguration.getRunnerSettings() == null); + } + else { + myUseProjectSettings.setSelected(false); + } + + if (runConfiguration.getRunnerSettings() == null) { + MavenRunnerSettings settings = MavenRunner.getInstance(myPanel.getProject()).getSettings(); + myPanel.getData(settings,runConfiguration); + } + else { + myPanel.getData(runConfiguration.getRunnerSettings(),runConfiguration); + } + } + + @Override + protected void applyEditorTo(@NotNull CloudMavenConfiguration runConfiguration) throws ConfigurationException { + String targetName = com.intellij.ide.DataManager.getInstance().getDataContext(this.getComponent()) + .getData(com.intellij.execution.impl.SingleConfigurationConfigurable.RUN_ON_TARGET_NAME_KEY); + boolean localTarget = targetName == null; + myUseProjectSettings.setEnabled(localTarget); + if (!localTarget) { + myUseProjectSettings.setSelected(false); + myUseProjectSettings.setToolTipText(MavenConfigurableBundle.message("maven.settings.on.targets.runner.use.project.settings.tooltip")); + } else { + myUseProjectSettings.setToolTipText(MavenConfigurableBundle.message("maven.settings.runner.use.project.settings.tooltip")); + } + + if (myUseProjectSettings.isSelected()) { + runConfiguration.setRunnerSettings(null); + } + else { + MavenRunnerSettings runnerSettings = runConfiguration.getRunnerSettings(); + myPanel.applyTargetEnvironmentConfiguration(targetName); + if (runnerSettings != null) { + myPanel.setData(runnerSettings, runConfiguration); + } + else { + MavenRunnerSettings settings = MavenRunner.getInstance(myPanel.getProject()).getSettings().clone(); + myPanel.setData(settings, runConfiguration); + runConfiguration.setRunnerSettings(settings); + } + } + } + + @NotNull + @Override + protected JComponent createEditor() { + Pair pair = MavenDisablePanelCheckbox.createPanel(myPanel.createComponent(), + MavenProjectBundle.message("label.use.project.settings")); + + myUseProjectSettings = pair.second; + return pair.first; + } +} \ No newline at end of file diff --git a/src/main/java/fish/payara/cloud/maven/CloudUtil.java b/src/main/java/fish/payara/cloud/maven/CloudUtil.java new file mode 100644 index 0000000..9f19c86 --- /dev/null +++ b/src/main/java/fish/payara/cloud/maven/CloudUtil.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.cloud.maven; + +import java.util.List; +import javax.ws.rs.core.Link; +import fish.payara.tools.cloud.ApplicationContext; +import fish.payara.tools.cloud.ListSubscriptions; +import fish.payara.tools.cloud.ListNamespaces; + +/** + * + * @author Gaurav Gupta + */ +public class CloudUtil { + + private static String CLIENT_ID = "qeqSpqVZtHGbr0YU75Z9p87HMle0RA5a"; + private static String CLIENT_NAME = "Payara Cloud Maven Plugin"; + + static List getSubscriptions() throws Exception { + ApplicationContext context = getApplicationContextBuilder(true).build(); + ListSubscriptions controller = new ListSubscriptions(context); + return controller.call(); + } + + static List getNamespaces(String selectedSubscription) throws Exception { + ApplicationContext.Builder builder = getApplicationContextBuilder(false); + if (selectedSubscription != null && !selectedSubscription.trim().isEmpty()) { + builder.subscriptionName(selectedSubscription); + } + ApplicationContext context = builder.build(); + ListNamespaces controller = new ListNamespaces(context); + return controller.call(); + } + + private static ApplicationContext.Builder getApplicationContextBuilder(boolean intractive) { + ApplicationContext.Builder builder = ApplicationContext.builder(CLIENT_ID, CLIENT_NAME) + .clientOutput(new CloudMavenOutput(intractive)) + .interactive(intractive); + return builder; + } +} diff --git a/src/main/java/fish/payara/micro/actions/MicroAction.java b/src/main/java/fish/payara/micro/actions/MicroAction.java index 6cbaf84..9f07c2e 100644 --- a/src/main/java/fish/payara/micro/actions/MicroAction.java +++ b/src/main/java/fish/payara/micro/actions/MicroAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * Copyright (c) 2020-2024 Payara Foundation and/or its affiliates and others. * All rights reserved. * * This program and the accompanying materials are made available under the @@ -30,7 +30,7 @@ import fish.payara.PayaraConstants; import fish.payara.micro.PayaraMicroProject; import fish.payara.micro.gradle.GradleProject; -import fish.payara.micro.maven.MavenProject; +import fish.payara.micro.maven.MicroMavenProject; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.terminal.LocalTerminalDirectRunner; import org.jetbrains.plugins.terminal.ShellTerminalWidget; @@ -61,7 +61,7 @@ public void actionPerformed(@NotNull AnActionEvent e) { return; } - PayaraMicroProject microProject = MavenProject.getInstance(project); + PayaraMicroProject microProject = MicroMavenProject.getInstance(project); PayaraMicroProject gradleProject = GradleProject.getInstance(project); if (microProject == null && gradleProject == null) { LOG.warning(PayaraBundle.message("MicroAction.notification.message")); diff --git a/src/main/java/fish/payara/micro/actions/MigrateToJakartaEE10Action.java b/src/main/java/fish/payara/micro/actions/MigrateToJakartaEE10Action.java index 9beebb0..25cfae8 100644 --- a/src/main/java/fish/payara/micro/actions/MigrateToJakartaEE10Action.java +++ b/src/main/java/fish/payara/micro/actions/MigrateToJakartaEE10Action.java @@ -15,7 +15,7 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.terminal.JBTerminalWidget; import fish.payara.micro.PayaraMicroProject; -import fish.payara.micro.maven.MavenProject; +import fish.payara.micro.maven.MicroMavenProject; import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -48,7 +48,7 @@ public void actionPerformed(@NotNull AnActionEvent actionEvent) { final Project project = CommonDataKeys.PROJECT.getData(actionEvent.getDataContext()); assert project != null; PsiFile[] poms = FilenameIndex.getFilesByName(project, "pom.xml", GlobalSearchScope.projectScope(project)); - PayaraMicroProject microProject = new MavenProject(project, poms[0]); + PayaraMicroProject microProject = new MicroMavenProject(project, poms[0]); String projectName = project.getName(); JBTerminalWidget terminal = getTerminal(project, projectName); if (terminal != null) { @@ -70,7 +70,7 @@ public void actionPerformed(@NotNull AnActionEvent actionEvent) { LOG.log(WARNING, e.getMessage(), projectName); } if (++count > TIME_OUT) { - String message = "Tranformation aborted after 5 minutes"; + String message = "Transformation aborted after 5 minutes"; LOG.log(WARNING, message, projectName); throw new RuntimeException(message); } diff --git a/src/main/java/fish/payara/micro/maven/MicroMavenConfiguration.java b/src/main/java/fish/payara/micro/maven/MicroMavenConfiguration.java index e31a8d3..320f97d 100644 --- a/src/main/java/fish/payara/micro/maven/MicroMavenConfiguration.java +++ b/src/main/java/fish/payara/micro/maven/MicroMavenConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * Copyright (c) 2020-2024 Payara Foundation and/or its affiliates and others. * All rights reserved. * * This program and the accompanying materials are made available under the @@ -41,23 +41,23 @@ public SettingsEditor getConfigurationEditor() { parameters.setWorkingDirPath(super.getProject().getBasePath()); } if (parameters.getGoals().isEmpty()) { - MavenProject mavenProject = MavenProject.getInstance(super.getProject()); + MicroMavenProject mavenProject = MicroMavenProject.getInstance(super.getProject()); if (mavenProject == null) { - parameters.getGoals().add(MavenProject.PACKAGE_GOAL); + parameters.getGoals().add(MicroMavenProject.PACKAGE_GOAL); parameters.getGoals().add(String.format( "%s:%s:%s:%s %s", - MavenProject.MICRO_GROUP_ID, - MavenProject.MICRO_ARTIFACT_ID, - MavenProject.MICRO_VERSION, - MavenProject.DEV_GOAL, - MavenProject.DEPLOY_WAR_PROPERTY + MicroMavenProject.MICRO_GROUP_ID, + MicroMavenProject.MICRO_ARTIFACT_ID, + MicroMavenProject.MICRO_VERSION, + MicroMavenProject.DEV_GOAL, + MicroMavenProject.DEPLOY_WAR_PROPERTY )); } else { - parameters.getGoals().add(MavenProject.PACKAGE_GOAL); + parameters.getGoals().add(MicroMavenProject.PACKAGE_GOAL); parameters.getGoals().add(String.format( "%s:%s", - MavenProject.MICRO_PLUGIN, - MavenProject.DEV_GOAL + MicroMavenProject.MICRO_PLUGIN, + MicroMavenProject.DEV_GOAL )); } } diff --git a/src/main/java/fish/payara/micro/maven/MavenProject.java b/src/main/java/fish/payara/micro/maven/MicroMavenProject.java similarity index 57% rename from src/main/java/fish/payara/micro/maven/MavenProject.java rename to src/main/java/fish/payara/micro/maven/MicroMavenProject.java index 30289e6..559b7cc 100644 --- a/src/main/java/fish/payara/micro/maven/MavenProject.java +++ b/src/main/java/fish/payara/micro/maven/MicroMavenProject.java @@ -23,44 +23,27 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.search.FilenameIndex; import com.intellij.psi.search.GlobalSearchScope; -import static fish.payara.PayaraConstants.DEFAULT_DEBUG_PORT; import fish.payara.micro.PayaraMicroProject; import org.jetbrains.annotations.NotNull; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.logging.Logger; - +import static fish.payara.PayaraConstants.DEFAULT_DEBUG_PORT; +import fish.payara.util.MavenUtil; import static java.util.logging.Level.SEVERE; -import static java.util.stream.Collectors.toList; /** - * * @author gaurav.gupta@payara.fish */ -public class MavenProject extends PayaraMicroProject { +public class MicroMavenProject extends PayaraMicroProject { - private static final Logger LOG = Logger.getLogger(MavenProject.class.getName()); + private static final Logger LOG = Logger.getLogger(MicroMavenProject.class.getName()); - private static final String PROFILES = "profiles"; - private static final String PROFILE = "profile"; - private static final String BUILD = "build"; - private static final String PLUGINS = "plugins"; - private static final String PLUGIN = "plugin"; - private static final String GROUP_ID = "groupId"; - private static final String ARTIFACT_ID = "artifactId"; - private static final String NAME = "name"; public static final String MICRO_GROUP_ID = "fish.payara.maven.plugins"; public static final String MICRO_ARTIFACT_ID = "payara-micro-maven-plugin"; public static final String MICRO_VERSION = "2.3"; @@ -152,15 +135,15 @@ public String getTransformCommand(String srcPath, String targetPath) { PAYARA_TRANSFORMER, PAYARA_TRANSFORMER_MAVEN, PAYARA_TRANSFORMER_VERSION, srcPath, targetPath); } - public static MavenProject getInstance(Project project) { + public static MicroMavenProject getInstance(Project project) { PsiFile pom = getPomFile(project); if (pom != null) { - return new MavenProject(project, pom); + return new MicroMavenProject(project, pom); } return null; } - public MavenProject(Project project, PsiFile pom) { + public MicroMavenProject(Project project, PsiFile pom) { super(project, pom); parsePom(); } @@ -172,33 +155,7 @@ public MavenProject(Project project, PsiFile pom) { */ @Override public String getProjectName() { - String artifactId = null; - String name = null; - try { - Node pomRoot = getPomRootNode(super.getBuildFile()); - if (pomRoot != null) { - NodeList childNodes = pomRoot.getChildNodes(); - for (int childNodeIndex = 0; childNodeIndex < childNodes.getLength(); childNodeIndex++) { - Node childNode = childNodes.item(childNodeIndex); - if (childNode.getNodeName().equals(NAME) - && childNode.getTextContent() != null) { - name = childNode.getTextContent(); - break; - } - if (childNode.getNodeName().equals(ARTIFACT_ID) - && childNode.getTextContent() != null) { - artifactId = childNode.getTextContent(); - } - } - } - } catch (ParserConfigurationException | SAXException | IOException ex) { - LOG.log(SEVERE, super.getBuildFile().getVirtualFile().getPath(), ex); - } - if (name != null) { - return name; - } else { - return artifactId; - } + return MavenUtil.getProjectName(super.getBuildFile()); } /** @@ -221,10 +178,10 @@ private static PsiFile getPomFile(Project project) { */ private static boolean isValidPom(PsiFile pomFile) { try { - Node pomRoot = getPomRootNode(pomFile); - return getBuildNodes(pomRoot) + Node pomRoot = MavenUtil.getPomRootNode(pomFile); + return MavenUtil.getBuildNodes(pomRoot) .stream() - .anyMatch(MavenProject::isMicroPlugin); + .anyMatch(MicroMavenProject::isMicroPlugin); } catch (ParserConfigurationException | SAXException | IOException ex) { LOG.log(SEVERE, null, ex); } @@ -237,33 +194,7 @@ private static boolean isValidPom(PsiFile pomFile) { * @return true if pom.xml file includes Payara Micro Maven plugin */ private static boolean isMicroPlugin(Node buildNode) { - return getMicroPluginNode(buildNode) != null; - } - - private static Node getMicroPluginNode(Node buildNode) { - NodeList buildChildNodes = buildNode.getChildNodes(); - for (int buildChildNodeIndex = 0; buildChildNodeIndex < buildChildNodes.getLength(); buildChildNodeIndex++) { - Node buildChildNode = buildChildNodes.item(buildChildNodeIndex); - for (Node pluginNode : getPluginNodes(buildChildNode)) { - NodeList pluginChildNodes = pluginNode.getChildNodes(); - boolean microGroupId = false; - boolean microArtifactId = false; - for (int i = 0; i < pluginChildNodes.getLength(); i++) { - Node node = pluginChildNodes.item(i); - if (node.getNodeName().equals(GROUP_ID) - && node.getTextContent().equals(MICRO_GROUP_ID)) { - microGroupId = true; - } else if (node.getNodeName().equals(ARTIFACT_ID) - && node.getTextContent().equals(MICRO_ARTIFACT_ID)) { - microArtifactId = true; - } - if (microGroupId && microArtifactId) { - return pluginNode; - } - } - } - } - return null; + return MavenUtil.getPluginNode(buildNode, MICRO_GROUP_ID, MICRO_ARTIFACT_ID) != null; } /** @@ -271,9 +202,9 @@ private static Node getMicroPluginNode(Node buildNode) { */ private void parsePom() { try { - Node pomRoot = getPomRootNode(super.getBuildFile()); - for (Node buildNode : getBuildNodes(pomRoot)) { - Node plugin = getMicroPluginNode(buildNode); + Node pomRoot = MavenUtil.getPomRootNode(super.getBuildFile()); + for (Node buildNode : MavenUtil.getBuildNodes(pomRoot)) { + Node plugin = MavenUtil.getPluginNode(buildNode, MICRO_GROUP_ID, MICRO_ARTIFACT_ID); if (plugin == null) { continue; } @@ -300,80 +231,6 @@ private void parsePom() { } } - private static Node getPomRootNode(PsiFile pomFile) throws ParserConfigurationException, SAXException, IOException { - Node root = null; - if (pomFile.getVirtualFile() != null) { - File inputFile = new File(pomFile.getVirtualFile().getCanonicalPath()); - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document buildDocument = builder.parse(inputFile); - buildDocument.getDocumentElement().normalize(); - root = buildDocument.getDocumentElement(); - } - return root; - } - - private static List getBuildNodes(Node pomRoot) { - List buildNodes = new ArrayList<>(); - if (pomRoot != null) { - NodeList childNodes = pomRoot.getChildNodes(); - for (int childNodeIndex = 0; childNodeIndex < childNodes.getLength(); childNodeIndex++) { - Node childNode = childNodes.item(childNodeIndex); - - buildNodes.addAll( - getProfileNodes(childNode) - .stream() - .map(Node::getChildNodes) - .map(MavenProject::getBuildNode) - .filter(Objects::nonNull) - .collect(toList()) - ); - - if (childNode.getNodeName().equals(BUILD)) { - buildNodes.add(childNode); - } - } - } - return buildNodes; - } - - private static Node getBuildNode(NodeList childNode) { - for (int index = 0; index < childNode.getLength(); index++) { - if (childNode.item(index).getNodeName().equals(BUILD)) { - return childNode.item(index); - } - } - return null; - } - - private static List getProfileNodes(Node childNode) { - List profildes = new ArrayList<>(); - if (childNode.getNodeName().equals(PROFILES)) { - NodeList profileNodes = childNode.getChildNodes(); - for (int profileIndex = 0; profileIndex < profileNodes.getLength(); profileIndex++) { - Node profile = profileNodes.item(profileIndex); - if (profile.getNodeName().equals(PROFILE)) { - profildes.add(profile); - } - } - } - return profildes; - } - - private static List getPluginNodes(Node childNode) { - List plugins = new ArrayList<>(); - if (childNode.getNodeName().equals(PLUGINS)) { - NodeList pluginNodes = childNode.getChildNodes(); - for (int pluginIndex = 0; pluginIndex < pluginNodes.getLength(); pluginIndex++) { - Node pluginNode = pluginNodes.item(pluginIndex); - if (pluginNode.getNodeName().equals(PLUGIN)) { - plugins.add(pluginNode); - } - } - } - return plugins; - } - @Override public RuntimeException createError(Throwable error, PluginId pluginId) { return getProject().createError(error, pluginId); diff --git a/src/main/java/fish/payara/micro/maven/MicroMavenRemoteConnectionCreator.java b/src/main/java/fish/payara/micro/maven/MicroMavenRemoteConnectionCreator.java index 00df5b2..7c20f17 100644 --- a/src/main/java/fish/payara/micro/maven/MicroMavenRemoteConnectionCreator.java +++ b/src/main/java/fish/payara/micro/maven/MicroMavenRemoteConnectionCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * Copyright (c) 2020-2024 Payara Foundation and/or its affiliates and others. * All rights reserved. * * This program and the accompanying materials are made available under the @@ -46,7 +46,7 @@ public RemoteConnection createRemoteConnection(ExecutionEnvironment environment) ParametersList programParametersList = javaParameters.getProgramParametersList(); String port = String.valueOf(DEFAULT_DEBUG_PORT); - programParametersList.add(String.format(MavenProject.DEBUG_PROPERTY, port)); + programParametersList.add(String.format(MicroMavenProject.DEBUG_PROPERTY, port)); Project project = runConfiguration.getProject(); diff --git a/src/main/java/fish/payara/util/MavenUtil.java b/src/main/java/fish/payara/util/MavenUtil.java new file mode 100644 index 0000000..103bbd4 --- /dev/null +++ b/src/main/java/fish/payara/util/MavenUtil.java @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Payara Foundation and/or its affiliates and others. + * 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 fish.payara.util; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import static java.util.stream.Collectors.toList; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import com.intellij.psi.PsiFile; +import static java.util.logging.Level.SEVERE; +import java.util.logging.Logger; + +/** + * + * @author Gaurav Gupta + */ +public class MavenUtil { + + private static final Logger LOG = Logger.getLogger(MavenUtil.class.getName()); + + private static final String PROFILES = "profiles"; + private static final String PROFILE = "profile"; + private static final String BUILD = "build"; + private static final String PLUGINS = "plugins"; + private static final String PLUGIN = "plugin"; + private static final String GROUP_ID = "groupId"; + private static final String ARTIFACT_ID = "artifactId"; + private static final String NAME = "name"; + + public static String getProjectName(PsiFile pomFile) { + String artifactId = null; + String name = null; + try { + Node pomRoot = getPomRootNode(pomFile); + if (pomRoot != null) { + NodeList childNodes = pomRoot.getChildNodes(); + for (int childNodeIndex = 0; childNodeIndex < childNodes.getLength(); childNodeIndex++) { + Node childNode = childNodes.item(childNodeIndex); + if (childNode.getNodeName().equals(NAME) + && childNode.getTextContent() != null) { + name = childNode.getTextContent(); + break; + } + if (childNode.getNodeName().equals(ARTIFACT_ID) + && childNode.getTextContent() != null) { + artifactId = childNode.getTextContent(); + } + } + } + } catch (ParserConfigurationException | SAXException | IOException ex) { + LOG.log(SEVERE, pomFile.getVirtualFile().getPath(), ex); + } + if (name != null) { + return name; + } else { + return artifactId; + } + } + + public static Node getPluginNode(Node buildNode, String expectedGroupId, String expectedArtifactId) { + NodeList buildChildNodes = buildNode.getChildNodes(); + for (int buildChildNodeIndex = 0; buildChildNodeIndex < buildChildNodes.getLength(); buildChildNodeIndex++) { + Node buildChildNode = buildChildNodes.item(buildChildNodeIndex); + for (Node pluginNode : MavenUtil.getPluginNodes(buildChildNode)) { + NodeList pluginChildNodes = pluginNode.getChildNodes(); + boolean groupIdMatched = false; + boolean artifactIdMatched = false; + for (int i = 0; i < pluginChildNodes.getLength(); i++) { + Node node = pluginChildNodes.item(i); + if (node.getNodeName().equals(GROUP_ID) + && node.getTextContent().equals(expectedGroupId)) { + groupIdMatched = true; + } else if (node.getNodeName().equals(ARTIFACT_ID) + && node.getTextContent().equals(expectedArtifactId)) { + artifactIdMatched = true; + } + if (groupIdMatched && artifactIdMatched) { + return pluginNode; + } + } + } + } + return null; + } + + public static Node getPomRootNode(PsiFile pomFile) throws ParserConfigurationException, SAXException, IOException { + Node root = null; + if (pomFile.getVirtualFile() != null) { + File inputFile = new File(pomFile.getVirtualFile().getCanonicalPath()); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document buildDocument = builder.parse(inputFile); + buildDocument.getDocumentElement().normalize(); + root = buildDocument.getDocumentElement(); + } + return root; + } + + public static List getBuildNodes(Node pomRoot) { + List buildNodes = new ArrayList<>(); + if (pomRoot != null) { + NodeList childNodes = pomRoot.getChildNodes(); + for (int childNodeIndex = 0; childNodeIndex < childNodes.getLength(); childNodeIndex++) { + Node childNode = childNodes.item(childNodeIndex); + + buildNodes.addAll( + getProfileNodes(childNode) + .stream() + .map(Node::getChildNodes) + .map(MavenUtil::getBuildNode) + .filter(Objects::nonNull) + .collect(toList()) + ); + + if (childNode.getNodeName().equals(BUILD)) { + buildNodes.add(childNode); + } + } + } + return buildNodes; + } + + public static Node getBuildNode(NodeList childNode) { + for (int index = 0; index < childNode.getLength(); index++) { + if (childNode.item(index).getNodeName().equals(BUILD)) { + return childNode.item(index); + } + } + return null; + } + + public static List getProfileNodes(Node childNode) { + List profildes = new ArrayList<>(); + if (childNode.getNodeName().equals(PROFILES)) { + NodeList profileNodes = childNode.getChildNodes(); + for (int profileIndex = 0; profileIndex < profileNodes.getLength(); profileIndex++) { + Node profile = profileNodes.item(profileIndex); + if (profile.getNodeName().equals(PROFILE)) { + profildes.add(profile); + } + } + } + return profildes; + } + + public static List getPluginNodes(Node childNode) { + List plugins = new ArrayList<>(); + if (childNode.getNodeName().equals(PLUGINS)) { + NodeList pluginNodes = childNode.getChildNodes(); + for (int pluginIndex = 0; pluginIndex < pluginNodes.getLength(); pluginIndex++) { + Node pluginNode = pluginNodes.item(pluginIndex); + if (pluginNode.getNodeName().equals(PLUGIN)) { + plugins.add(pluginNode); + } + } + } + return plugins; + } + +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index eee5f72..fb49eed 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -34,9 +34,64 @@ + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/src/main/resources/fish/payara/PayaraBundle.properties b/src/main/resources/fish/payara/PayaraBundle.properties index a49fffa..e1748cb 100644 --- a/src/main/resources/fish/payara/PayaraBundle.properties +++ b/src/main/resources/fish/payara/PayaraBundle.properties @@ -16,3 +16,8 @@ PayaraMicroModuleType.validation.jdk.description=Payara Micro requires JDK 8+ MicroAction.notification.group=Payara Micro Action MicroAction.notification.message=Unable to resolve Payara Micro project type. + +CloudAction.notification.group=Payara Cloud Action +CloudAction.notification.message=Unable to resolve Payara Cloud project type. +CloudDebug.notification.group=Debugging Not Supported +CloudDebug.notification.message=Debugging is not supported for Payara Cloud configurations. diff --git a/src/main/resources/icons/cloud.svg b/src/main/resources/icons/cloud.svg new file mode 100644 index 0000000..1c9e9fb --- /dev/null +++ b/src/main/resources/icons/cloud.svg @@ -0,0 +1,27 @@ + + + + + + + + From 58a479101272633f7718cbd2471762bc9c057c7d Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 10 Jul 2024 10:44:31 +0530 Subject: [PATCH 02/10] FISH-7932 Copyright year update --- .../java/fish/payara/cloud/PayaraCloudConfigurationType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java b/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java index e309134..e749df2 100644 --- a/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java +++ b/src/main/java/fish/payara/cloud/PayaraCloudConfigurationType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Payara Foundation and/or its affiliates and others. + * Copyright (c) 2020-2024 Payara Foundation and/or its affiliates and others. * All rights reserved. * * This program and the accompanying materials are made available under the From 8e022ee1c8fb174c447d3e4526d907bd93769010 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 10 Jul 2024 17:57:16 +0530 Subject: [PATCH 03/10] FISH-7932 Fixes caching --- .../fish/payara/cloud/maven/CloudPanel.java | 101 ++++++++++-------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/src/main/java/fish/payara/cloud/maven/CloudPanel.java b/src/main/java/fish/payara/cloud/maven/CloudPanel.java index dd8538e..660f91f 100644 --- a/src/main/java/fish/payara/cloud/maven/CloudPanel.java +++ b/src/main/java/fish/payara/cloud/maven/CloudPanel.java @@ -74,7 +74,10 @@ public class CloudPanel { private ComboBox goalsComboBox; private ComboBox subscriptionComboBox; private ComboBox namespaceComboBox; - private static List subscriptions; + private String subscriptionValue; + private String namespaceValue; + private static List subscriptionsCache; + private Map> namespacesCache = new HashMap<>(); private final static String LOADING = "Loading..."; public CloudPanel(@NotNull Project p, boolean isRunConfiguration) { @@ -113,21 +116,6 @@ public JComponent createComponent() { goalsComboBox.setEditable(true); panel.add(goalsComboBox, c); -// List subscriptionTitles = new ArrayList<>(); -// try { -// if (subscriptions == null || subscriptions.isEmpty()) { -// subscriptions = CloudUtil.getSubscriptions(); // Fetch subscriptions if not already fetched -// } -// subscriptionTitles = subscriptions.stream() -// .map(link -> link.getTitle()) -// .collect(Collectors.toList()); -// } catch (Throwable e) { -// System.out.println("Exception " + e.getMessage()); -// e.printStackTrace(); -// } -// -// subscriptionTitles.add(0, ""); -// subscriptionComboBox = new ComboBox<>(subscriptionTitles.toArray(new String[0])); subscriptionComboBox = new ComboBox<>(); subscriptionComboBox.setEditable(true); subscriptionComboBox.addActionListener(e -> { @@ -241,15 +229,18 @@ protected List doInBackground() throws Exception { @Override protected void done() { try { - if (subscriptions == null || subscriptions.isEmpty()) { - subscriptions = get(); // Fetch subscriptions if not already fetched + if (subscriptionsCache == null || subscriptionsCache.isEmpty()) { + subscriptionsCache = get(); // Fetch subscriptions if not already fetched } - List subscriptionTitles = subscriptions.stream() + List subscriptionTitles = subscriptionsCache.stream() .map(link -> link.getTitle()) .collect(Collectors.toList()); subscriptionComboBox.removeAllItems(); -// subscriptionTitles.add(0, ""); subscriptionTitles.forEach(title -> subscriptionComboBox.addItem(title)); + + if (subscriptionValue != null && !subscriptionValue.isEmpty()) { + subscriptionComboBox.setSelectedItem(subscriptionValue); + } } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); JOptionPane.showMessageDialog(null, "Failed to load subscriptions.", "Error", JOptionPane.ERROR_MESSAGE); @@ -264,30 +255,40 @@ private void fetchNamespacesAsync(String selectedSubscription) { namespaceComboBox.addItem(LOADING); namespaceComboBox.setSelectedItem(LOADING); - SwingWorker, Void> worker = new SwingWorker<>() { - @Override - protected List doInBackground() throws Exception { - // Fetch namespaces in the background - return subscriptions != null ? CloudUtil.getNamespaces(selectedSubscription) : Collections.emptyList(); - } + if (namespacesCache.containsKey(selectedSubscription)) { + updateNamespaceComboBox(namespacesCache.get(selectedSubscription)); + } else { + SwingWorker, Void> worker = new SwingWorker<>() { + @Override + protected List doInBackground() throws Exception { + // Fetch namespaces in the background + return subscriptionsCache != null ? CloudUtil.getNamespaces(selectedSubscription) : Collections.emptyList(); + } - @Override - protected void done() { - try { - List namespaces = get(); - List namespaceTitles = namespaces.stream() - .map(Link::getTitle) - .collect(Collectors.toList()); - namespaceComboBox.removeAllItems(); -// namespaceTitles.add(0, ""); - namespaceTitles.forEach(namespaceComboBox::addItem); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(null, "Failed to load namespaces.", "Error", JOptionPane.ERROR_MESSAGE); + @Override + protected void done() { + try { + List namespaces = get(); + updateNamespaceComboBox(namespaces); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, "Failed to load namespaces.", "Error", JOptionPane.ERROR_MESSAGE); + } } - } - }; - worker.execute(); + }; + worker.execute(); + } + } + + private void updateNamespaceComboBox(List namespaces) { + List namespaceTitles = namespaces.stream() + .map(Link::getTitle) + .collect(Collectors.toList()); + namespaceComboBox.removeAllItems(); + namespaceTitles.forEach(namespaceComboBox::addItem); + if (namespaceValue != null && !namespaceValue.isEmpty()) { + namespaceComboBox.setSelectedItem(namespaceValue); + } } private void updateMavenProperties() { @@ -295,19 +296,20 @@ private void updateMavenProperties() { String subscription = (String) subscriptionComboBox.getSelectedItem(); String namespace = (String) namespaceComboBox.getSelectedItem(); - if (namespace != null && !namespace.isEmpty()) { + if (namespace != null && !namespace.isEmpty() && !namespace.equals(LOADING)) { mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); } else { mavenProperties.remove(CloudMavenProject.NAMESPACE_ATTR); } - if (subscription != null && !subscription.isEmpty()) { + if (subscription != null && !subscription.isEmpty() && !subscription.equals(LOADING)) { mavenProperties.put(CloudMavenProject.SUBSCRIPTION_ATTR, subscription); } else { mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); } myPropertiesPanel.setDataFromMap(mavenProperties); + System.out.println("updateMavenProperties namespaceValue " + namespaceValue); } private void collectProperties() { @@ -341,16 +343,20 @@ protected void getData(MavenRunnerSettings data, CloudMavenConfiguration config) if (mavenProperties.containsKey(CloudMavenProject.SUBSCRIPTION_ATTR)) { String subscriptionName = mavenProperties.get(CloudMavenProject.SUBSCRIPTION_ATTR); subscriptionComboBox.setSelectedItem(subscriptionName); + subscriptionValue = subscriptionName; } else { subscriptionComboBox.setSelectedItem(null); } if (mavenProperties.containsKey(CloudMavenProject.NAMESPACE_ATTR)) { String namespaceName = mavenProperties.get(CloudMavenProject.NAMESPACE_ATTR); namespaceComboBox.setSelectedItem(namespaceName); + namespaceValue = namespaceName; } else { namespaceComboBox.setSelectedItem(null); } + System.out.println("getData namespaceValue " + namespaceValue); + } protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) { @@ -367,13 +373,14 @@ protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) String subscription = (String) subscriptionComboBox.getSelectedItem(); String namespace = (String) namespaceComboBox.getSelectedItem(); - if (namespace != null && !namespace.isEmpty()) { + if (namespace != null && !namespace.isEmpty() && !namespace.equals(LOADING)) { mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); + namespaceValue = namespace; } else { mavenProperties.remove(CloudMavenProject.NAMESPACE_ATTR); } - if (subscription != null && !subscription.isEmpty()) { + if (subscription != null && !subscription.isEmpty() && !subscription.equals(LOADING)) { mavenProperties.put(CloudMavenProject.SUBSCRIPTION_ATTR, subscription); } else { mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); @@ -385,6 +392,8 @@ protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) data.setPassParentEnv(myEnvVariablesComponent.isPassParentEnvs()); config.setGoals((String) goalsComboBox.getSelectedItem()); + + System.out.println("set namespaceValue " + namespaceValue); } public Project getProject() { From 281ba6aad25247293c638e2f58ebc920755c6764 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 10 Jul 2024 18:02:02 +0530 Subject: [PATCH 04/10] FISH-7932 Naming Payara Community Tools --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a06d38f..5c0dbf6 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ dependencies { intellij { version = '241.14494.240' type = 'IC' - pluginName = 'Payara Micro' + pluginName = 'Payara Community Tools' plugins = ['java', 'maven', 'maven-model', 'gradle', 'terminal'] } From e48b0c9fd5ac767875d7af668939ea243640e04c Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 12 Jul 2024 13:44:30 +0530 Subject: [PATCH 05/10] FISH-7932 applicationName support --- .../payara/cloud/maven/CloudMavenProject.java | 1 + .../fish/payara/cloud/maven/CloudPanel.java | 48 +++++++++++++++---- .../fish/payara/ui/PlaceholderTextField.java | 42 ++++++++++++++++ 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 src/main/java/fish/payara/ui/PlaceholderTextField.java diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java index a4bc8c5..953e26e 100644 --- a/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java @@ -60,6 +60,7 @@ public class CloudMavenProject extends PayaraCloudProject { private static final String BUILD_FILE = "pom.xml"; public static final String NAMESPACE_ATTR = "namespaceName"; public static final String SUBSCRIPTION_ATTR = "subscriptionName"; + public static final String APPLICATION_NAME_ATTR = "applicationName"; @Override public String getLoginCommand() { diff --git a/src/main/java/fish/payara/cloud/maven/CloudPanel.java b/src/main/java/fish/payara/cloud/maven/CloudPanel.java index 660f91f..6fdb325 100644 --- a/src/main/java/fish/payara/cloud/maven/CloudPanel.java +++ b/src/main/java/fish/payara/cloud/maven/CloudPanel.java @@ -31,6 +31,7 @@ import com.intellij.ui.RawCommandLineEditor; import com.intellij.ui.UserActivityWatcher; import com.intellij.util.ui.JBFont; +import fish.payara.ui.PlaceholderTextField; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.project.MavenConfigurableBundle; @@ -44,6 +45,8 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.util.List; import java.util.*; import java.util.stream.IntStream; @@ -74,8 +77,8 @@ public class CloudPanel { private ComboBox goalsComboBox; private ComboBox subscriptionComboBox; private ComboBox namespaceComboBox; - private String subscriptionValue; - private String namespaceValue; + private JTextField applicationNameTextField; + private String subscriptionValue, namespaceValue, applicationNameValue; private static List subscriptionsCache; private Map> namespacesCache = new HashMap<>(); private final static String LOADING = "Loading..."; @@ -141,6 +144,20 @@ public JComponent createComponent() { namespaceComboBox.addActionListener(e -> { updateMavenProperties(); }); + + // Add Application Name TextField + c.gridx = 0; + c.gridy++; + panel.add(new JLabel("Application Name:"), c); + c.gridx = 1; + applicationNameTextField = new PlaceholderTextField("Enter application name (default value 'artifactId')"); + panel.add(applicationNameTextField, c); + applicationNameTextField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + updateMavenProperties(); + } + }); myJdkLabel = new JLabel(MavenConfigurableBundle.message("maven.settings.runner.jre")); myJdkLabel.setLabelFor(myJdkCombo = new ExternalSystemJdkComboBox(myProject)); @@ -295,6 +312,7 @@ private void updateMavenProperties() { Map mavenProperties = new HashMap<>(myPropertiesPanel.getDataAsMap()); String subscription = (String) subscriptionComboBox.getSelectedItem(); String namespace = (String) namespaceComboBox.getSelectedItem(); + String applicationName = applicationNameTextField.getText(); if (namespace != null && !namespace.isEmpty() && !namespace.equals(LOADING)) { mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); @@ -307,9 +325,15 @@ private void updateMavenProperties() { } else { mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); } + + System.out.println("applicationName " + applicationName); + if (applicationName != null && !applicationName.trim().isEmpty()) { + mavenProperties.put(CloudMavenProject.APPLICATION_NAME_ATTR, applicationName); + } else { + mavenProperties.remove(CloudMavenProject.APPLICATION_NAME_ATTR); + } myPropertiesPanel.setDataFromMap(mavenProperties); - System.out.println("updateMavenProperties namespaceValue " + namespaceValue); } private void collectProperties() { @@ -354,9 +378,13 @@ protected void getData(MavenRunnerSettings data, CloudMavenConfiguration config) } else { namespaceComboBox.setSelectedItem(null); } - - System.out.println("getData namespaceValue " + namespaceValue); - + if (mavenProperties.containsKey(CloudMavenProject.APPLICATION_NAME_ATTR)) { + String applicationName = mavenProperties.get(CloudMavenProject.APPLICATION_NAME_ATTR); + applicationNameTextField.setText(applicationName); + applicationNameValue = applicationName; + } else { + applicationNameTextField.setText(null); + } } protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) { @@ -372,6 +400,7 @@ protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) String subscription = (String) subscriptionComboBox.getSelectedItem(); String namespace = (String) namespaceComboBox.getSelectedItem(); + String applicationName = applicationNameTextField.getText(); if (namespace != null && !namespace.isEmpty() && !namespace.equals(LOADING)) { mavenProperties.put(CloudMavenProject.NAMESPACE_ATTR, namespace); @@ -385,6 +414,11 @@ protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) } else { mavenProperties.remove(CloudMavenProject.SUBSCRIPTION_ATTR); } + if (applicationName != null && !applicationName.trim().isEmpty()) { + mavenProperties.put(CloudMavenProject.APPLICATION_NAME_ATTR, applicationName); + } else { + mavenProperties.remove(CloudMavenProject.APPLICATION_NAME_ATTR); + } data.setMavenProperties(mavenProperties); @@ -392,8 +426,6 @@ protected void setData(MavenRunnerSettings data, CloudMavenConfiguration config) data.setPassParentEnv(myEnvVariablesComponent.isPassParentEnvs()); config.setGoals((String) goalsComboBox.getSelectedItem()); - - System.out.println("set namespaceValue " + namespaceValue); } public Project getProject() { diff --git a/src/main/java/fish/payara/ui/PlaceholderTextField.java b/src/main/java/fish/payara/ui/PlaceholderTextField.java new file mode 100644 index 0000000..48f133f --- /dev/null +++ b/src/main/java/fish/payara/ui/PlaceholderTextField.java @@ -0,0 +1,42 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package fish.payara.ui; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; + +public class PlaceholderTextField extends JTextField { + + private final String placeholder; + + public PlaceholderTextField(String placeholder) { + this.placeholder = placeholder; + addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + if (getText().isEmpty()) { + setText(""); + } + } + + @Override + public void focusLost(FocusEvent e) { + if (getText().isEmpty()) { + setText(placeholder); + } + } + }); + setText(placeholder); + } + + @Override + public String getText() { + String text = super.getText(); + return text.equals(placeholder) ? "" : text; + } + +} \ No newline at end of file From 5953707b5d75d584b1c68df32caa7b1fd666820f Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 12 Jul 2024 17:03:44 +0530 Subject: [PATCH 06/10] FISH-7932 Sync naming with Payara Cloud CLI --- .../java/fish/payara/cloud/maven/CloudMavenProject.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java index 953e26e..00228d5 100644 --- a/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java +++ b/src/main/java/fish/payara/cloud/maven/CloudMavenProject.java @@ -53,9 +53,9 @@ public class CloudMavenProject extends PayaraCloudProject { public static final String DEPLOY_GOAL = "deploy"; public static final String UNDEPLOY_GOAL = "undeploy"; private static final String STOP_GOAL = "stop"; - private static final String APPLICATION_GOAL = "application"; - private static final String NAMESPACE_GOAL = "namespace"; - private static final String SUBSCRIPTION_GOAL = "subscription"; + private static final String APPLICATION_GOAL = "list-applications"; + private static final String NAMESPACE_GOAL = "list-namespaces"; + private static final String SUBSCRIPTION_GOAL = "list-subscriptions"; public static final String PACKAGE_GOAL = "package"; private static final String BUILD_FILE = "pom.xml"; public static final String NAMESPACE_ATTR = "namespaceName"; From 3c919dd35065b43493915f4da447acba7b8e33db Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 12 Jul 2024 17:41:25 +0530 Subject: [PATCH 07/10] FISH-7932 Updated plugin info --- src/main/resources/META-INF/plugin.xml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index fb49eed..23c2a04 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,8 +1,8 @@ fish.payara.micro.intellij - Payara Micro Community Tools + Payara Community Tools Manage(Start, Stop, and Debug) Payara Micro application using project configuration
  • Manage(Start, Stop, and Debug) Payara Micro application using IntelliJ actions
  • + + The plugin also provides seamless integration with Payara Cloud for deploying and managing Jakarta EE applications: +
      +
    • Login to the Payara Cloud platform.
    • +
    • Start and Stop Payara Cloud applications.
    • +
    • Launch Payara Cloud applications in development mode.
    • +
    • Deploy and undeploy applications on Payara Cloud.
    • +
    • Retrieve lists of applications, namespaces, and subscriptions from the Payara Cloud.
    • +
    Download the Payara Platform tools available in the IntelliJ IDEA Ulitmate - to develop the application with the Payara Micro and/or Payara Server. + to develop the application with the Payara cloud, Payara Micro and Payara Server. Checkout the usage instructions of Payara IntelliJ tools for more details. From 1a38e7becdc38840b91a95ac023c8e596664e6f8 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 10 Jul 2024 18:01:31 +0530 Subject: [PATCH 08/10] FISH-7932 Release Payara Community Tools v1.8.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5c0dbf6..0fcdebe 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ apply plugin: 'idea' apply plugin: 'java' group 'fish.payara.micro.intellij' -version '1.8.0-SNAPSHOT' +version '1.8.0' sourceCompatibility = "17" targetCompatibility = "17" From 6b682b3b51f94a5778f9866e5dfd8cffe99eac78 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 19 Jul 2024 23:35:53 +0530 Subject: [PATCH 09/10] FISH-7932 Naming FISH-7932 Naming --- README.md | 6 +++--- build.gradle | 2 +- src/main/resources/META-INF/plugin.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9c31984..d36d8e1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Payara Micro Community Tools for IntelliJ IDEA Community Edition +# Payara IntelliJ Community Tools for IntelliJ IDEA Community Edition [![License](https://img.shields.io/badge/License-EPL%202.0-red.svg)](http://www.eclipse.org/legal/epl-2.0) ### Ecosystem Plugin Support -Support for the Payara Micro Community Tools plugin is handled in the [Ecosystem Support Repository](https://github.com/payara/ecosystem-support) +Support for the Payara IntelliJ Community Tools plugin is handled in the [Ecosystem Support Repository](https://github.com/payara/ecosystem-support) ### IntelliJ IDEA Payara Plugin Documentation -Full documentation for the configuration and usage of the Payara Micro Community Tools plugin can be found in the [technical documentation](https://docs.payara.fish/community/docs/Technical%20Documentation/Ecosystem/IDE%20Integration/IntelliJ%20Plugin/Overview.html) \ No newline at end of file +Full documentation for the configuration and usage of the Payara IntelliJ Community Tools plugin can be found in the [technical documentation](https://docs.payara.fish/community/docs/Technical%20Documentation/Ecosystem/IDE%20Integration/IntelliJ%20Plugin/Overview.html) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0fcdebe..151219b 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ dependencies { intellij { version = '241.14494.240' type = 'IC' - pluginName = 'Payara Community Tools' + pluginName = 'Payara IntelliJ Community Tools' plugins = ['java', 'maven', 'maven-model', 'gradle', 'terminal'] } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 23c2a04..f19b50a 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,11 +1,11 @@ fish.payara.micro.intellij - Payara Community Tools + Payara IntelliJ Community Tools
  • Creation of Payara Micro Maven Project
  • Manage(Start, Stop, and Debug) Payara Micro application using project configuration
  • From a4eea63198c5f1608493458581ea085be75a0797 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Fri, 19 Jul 2024 23:42:10 +0530 Subject: [PATCH 10/10] FISH-7932 Increment version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 151219b..c3935ae 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ apply plugin: 'idea' apply plugin: 'java' group 'fish.payara.micro.intellij' -version '1.8.0' +version '1.9.0-SNAPSHOT' sourceCompatibility = "17" targetCompatibility = "17"