This is an automated email from the ASF dual-hosted git repository.

geertjan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new bb672ba  NP-50 Upgrade Payara Micro Maven plugin to 1.0.6 and custom 
contextRoot support (#1471)
bb672ba is described below

commit bb672ba4119e17f11bbfc57fc940a0e1bbc47efc
Author: Gaurav Gupta <[email protected]>
AuthorDate: Wed Sep 4 14:15:39 2019 +0100

    NP-50 Upgrade Payara Micro Maven plugin to 1.0.6 and custom contextRoot 
support (#1471)
    
    Signed-off-by: Gaurav Gupta <[email protected]>
---
 .../fish/payara/micro/plugin/Constants.java        |  1 +
 .../micro/plugin/MicroPluginWizardDescriptor.java  | 11 ++++---
 .../fish/payara/micro/plugin/resources/pom.xml.ftl |  2 +-
 .../fish/payara/micro/project/ui/Bundle.properties |  5 ++-
 .../project/ui/MicroProjectWizardIterator.java     |  5 ++-
 .../payara/micro/project/ui/PayaraMicroPanel.form  | 36 ++++++++++++++++++----
 .../payara/micro/project/ui/PayaraMicroPanel.java  | 34 ++++++++++++++++----
 7 files changed, 74 insertions(+), 20 deletions(-)

diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Constants.java
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Constants.java
index 07edf9e..11d818f 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Constants.java
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Constants.java
@@ -39,6 +39,7 @@ public interface Constants {
     String PROP_JAVA_EE_VERSION = "javaeeVersion";
     String PROP_PAYARA_MICRO_VERSION = "payaraMicroVersion";
     String PROP_AUTO_BIND_HTTP = "autoBindHttp";
+    String PROP_CONTEXT_ROOT = "contextRoot";
 
     String VERSION = "version";
 
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/MicroPluginWizardDescriptor.java
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/MicroPluginWizardDescriptor.java
index ef905f6..52b2082 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/MicroPluginWizardDescriptor.java
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/MicroPluginWizardDescriptor.java
@@ -31,8 +31,6 @@ import java.util.NoSuchElementException;
 import java.util.Set;
 import javax.swing.event.ChangeListener;
 import org.netbeans.api.project.Project;
-import org.netbeans.api.project.ProjectManager;
-import org.netbeans.api.project.ui.OpenProjects;
 import org.netbeans.api.templates.TemplateRegistration;
 import static 
org.netbeans.modules.fish.payara.micro.plugin.Constants.POM_TEMPLATE;
 import static 
org.netbeans.modules.fish.payara.micro.plugin.Constants.PROJECT_ICON;
@@ -49,6 +47,7 @@ import 
org.netbeans.modules.maven.model.pom.POMExtensibilityElement;
 import org.netbeans.spi.project.ui.templates.support.Templates;
 import org.openide.WizardDescriptor;
 import org.openide.util.NbBundle;
+import static 
org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_CONTEXT_ROOT;
 
 @TemplateRegistration(
         folder = "PayaraResources",
@@ -67,9 +66,10 @@ public final class MicroPluginWizardDescriptor implements 
WizardDescriptor.Insta
 
     private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
     
-    public static void updateMicroMavenPlugin(Project project, String 
payaraMicroVersion, String autoBindHttp) throws IOException {
+    public static void updateMicroMavenPlugin(Project project, String 
payaraMicroVersion, String autoBindHttp, String contextRoot) throws IOException 
{
         Map<String, Object> params = new HashMap<>();
         params.put("autoBindHttp", autoBindHttp);
+        params.put("contextRoot", contextRoot);
         params.put("payaraMicroVersion", payaraMicroVersion);
 
         try (Reader sourceReader = new 
InputStreamReader(loadResource(POM_TEMPLATE))) {
@@ -114,8 +114,9 @@ public final class MicroPluginWizardDescriptor implements 
WizardDescriptor.Insta
     public Set instantiate() throws IOException {
         String payaraMicroVersion = (String) 
descriptor.getProperty(PROP_PAYARA_MICRO_VERSION);
         String autoBindHttp = (String) 
descriptor.getProperty(PROP_AUTO_BIND_HTTP);
-        
-        updateMicroMavenPlugin(project, payaraMicroVersion, autoBindHttp);
+        String contextRoot = (String) 
descriptor.getProperty(PROP_CONTEXT_ROOT);
+
+        updateMicroMavenPlugin(project, payaraMicroVersion, autoBindHttp, 
contextRoot);
         MicroApplication.registerInstance(project);
         new MicroProjectHook(project).projectOpened();
         NbMavenProject.fireMavenProjectReload(project);
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl
index 1173b02..88ab306 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl
@@ -36,7 +36,7 @@
             <plugin>
                 <groupId>fish.payara.maven.plugins</groupId>
                 <artifactId>payara-micro-maven-plugin</artifactId>
-                <version>1.0.5</version>
+                <version>1.0.6</version>
                 <configuration>
                     <payaraVersion>${r"${version.payara}"}</payaraVersion>
                     <deployWar>false</deployWar>
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties
index a10edd3..ef89cce 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties
@@ -23,4 +23,7 @@ TLTP_AUTO_BIND_HTTP=Enables auto-bind functionality for the 
HTTP port
 LBL_MavenProjectSettings=Name and Location
 LBL_PayaraMicroSettings=Payara Micro
 TTL_NewProjectWizard=Payara Micro Application
-LBL_NameFormat={0} of {1}
\ No newline at end of file
+LBL_NameFormat={0} of {1}
+PayaraMicroPanel.contextRootLabel.toolTipText=Enables auto-bind functionality 
for the HTTP port
+PayaraMicroPanel.contextRootLabel.text=Context Root:
+PayaraMicroPanel.contextRootTextField.text=/
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/MicroProjectWizardIterator.java
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/MicroProjectWizardIterator.java
index ac7351d..083ca86 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/MicroProjectWizardIterator.java
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/MicroProjectWizardIterator.java
@@ -48,6 +48,7 @@ import org.openide.WizardDescriptor;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 import static org.openide.util.NbBundle.getMessage;
+import static 
org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_CONTEXT_ROOT;
 
 /**
  *
@@ -79,12 +80,14 @@ public final class MicroProjectWizardIterator extends 
BaseWizardIterator {
         );
         String payaraMicroVersion = (String) 
descriptor.getProperty(PROP_PAYARA_MICRO_VERSION);
         String autoBindHttp = (String) 
descriptor.getProperty(PROP_AUTO_BIND_HTTP);
+        String contextRoot = (String) 
descriptor.getProperty(PROP_CONTEXT_ROOT);
         Archetype archetype = createMojoArchetype();
 
         Map<String, String> properties = new HashMap<>();
         properties.put(PROP_PAYARA_MICRO_VERSION, payaraMicroVersion);
         properties.put(PROP_JAVA_EE_VERSION, 
VersionRepository.getInstance().getJavaEEVersion(payaraMicroVersion));
         properties.put(PROP_AUTO_BIND_HTTP, autoBindHttp);
+        properties.put(PROP_CONTEXT_ROOT, contextRoot);
 
         ArchetypeWizards.logUsage(archetype.getGroupId(), 
archetype.getArtifactId(), archetype.getVersion());
 
@@ -98,7 +101,7 @@ public final class MicroProjectWizardIterator extends 
BaseWizardIterator {
                 continue;
             }
             MavenProjectSupport.changeServer(project, true);
-            updateMicroMavenPlugin(project, payaraMicroVersion, autoBindHttp);
+            updateMicroMavenPlugin(project, payaraMicroVersion, autoBindHttp, 
contextRoot);
         }
 
         return projects;
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.form
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.form
index 1138649..07a1f55 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.form
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.form
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
+
 <!--
 
     Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +20,7 @@
     under the License.
 
 -->
+
 <Form version="1.5" maxVersion="1.7" 
type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
   <AuxValues>
     <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" 
value="1"/>
@@ -39,18 +41,18 @@
               <Group type="103" groupAlignment="0" attributes="0">
                   <Component id="microVersionLabel" alignment="0" min="-2" 
max="-2" attributes="0"/>
                   <Component id="autoBindHttpLabel" alignment="0" min="-2" 
max="-2" attributes="0"/>
+                  <Component id="contextRootLabel" alignment="0" min="-2" 
max="-2" attributes="0"/>
               </Group>
               <EmptySpace max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
                   <Group type="102" attributes="0">
                       <Component id="autoBindHttpCheckBox" min="-2" max="-2" 
attributes="0"/>
-                      <EmptySpace max="32767" attributes="0"/>
-                  </Group>
-                  <Group type="102" attributes="0">
-                      <Component id="microVersionCombobox" max="32767" 
attributes="0"/>
-                      <EmptySpace min="-2" pref="69" max="-2" attributes="0"/>
+                      <EmptySpace min="0" pref="91" max="32767" 
attributes="0"/>
                   </Group>
+                  <Component id="microVersionCombobox" alignment="0" 
max="32767" attributes="0"/>
+                  <Component id="contextRootTextField" alignment="1" 
max="32767" attributes="0"/>
               </Group>
+              <EmptySpace max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
@@ -66,7 +68,12 @@
                   <Component id="autoBindHttpCheckBox" alignment="0" min="-2" 
max="-2" attributes="0"/>
                   <Component id="autoBindHttpLabel" min="-2" max="-2" 
attributes="0"/>
               </Group>
-              <EmptySpace pref="255" max="32767" attributes="0"/>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="contextRootLabel" alignment="3" min="-2" 
max="-2" attributes="0"/>
+                  <Component id="contextRootTextField" alignment="3" min="-2" 
max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace pref="217" max="32767" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
@@ -106,5 +113,22 @@
         </Property>
       </Properties>
     </Component>
+    <Component class="javax.swing.JLabel" name="contextRootLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties" 
key="PayaraMicroPanel.contextRootLabel.text" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+        </Property>
+        <Property name="toolTipText" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties" 
key="PayaraMicroPanel.contextRootLabel.toolTipText" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JTextField" name="contextRootTextField">
+      <Properties>
+        <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties" 
key="PayaraMicroPanel.contextRootTextField.text" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>
diff --git 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.java
 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.java
index 97049f1..c504c65 100644
--- 
a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.java
+++ 
b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.java
@@ -27,6 +27,7 @@ import 
org.netbeans.modules.fish.payara.micro.project.MicroVersion;
 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
 import org.openide.WizardDescriptor;
 import static org.openide.util.NbBundle.getMessage;
+import static 
org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_CONTEXT_ROOT;
 
 /**
  *
@@ -56,11 +57,18 @@ class PayaraMicroPanel extends JPanel {
             autoBindHTTP = Boolean.TRUE.toString();
         }
         autoBindHttpCheckBox.setSelected(Boolean.valueOf(autoBindHTTP));
+
+        String contextRoot = (String) 
descriptor.getProperty(PROP_CONTEXT_ROOT);
+        if (contextRoot == null) {
+            contextRoot = "/";
+        }
+        contextRootTextField.setText(contextRoot);
     }
 
     void storeSettings(WizardDescriptor descriptor) {
         descriptor.putProperty(PROP_PAYARA_MICRO_VERSION, 
((MicroVersion)microVersionCombobox.getSelectedItem()).getVersion());
         descriptor.putProperty(PROP_AUTO_BIND_HTTP, 
String.valueOf(autoBindHttpCheckBox.isSelected()));
+        descriptor.putProperty(PROP_CONTEXT_ROOT, 
String.valueOf(contextRootTextField.getText().trim()));
     }
 
     @SuppressWarnings("unchecked")
@@ -71,6 +79,8 @@ class PayaraMicroPanel extends JPanel {
         microVersionLabel = new javax.swing.JLabel();
         autoBindHttpLabel = new javax.swing.JLabel();
         autoBindHttpCheckBox = new javax.swing.JCheckBox();
+        contextRootLabel = new javax.swing.JLabel();
+        contextRootTextField = new javax.swing.JTextField();
 
         microVersionCombobox.setModel(new 
DefaultComboBoxModel(VersionRepository.getInstance().getMicroVersion().toArray()));
 
@@ -82,6 +92,11 @@ class PayaraMicroPanel extends JPanel {
         org.openide.awt.Mnemonics.setLocalizedText(autoBindHttpCheckBox, 
org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class, 
"PayaraMicroPanel.autoBindHttpCheckBox.text")); // NOI18N
         
autoBindHttpCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class,
 "TLTP_AUTO_BIND_HTTP")); // NOI18N
 
+        org.openide.awt.Mnemonics.setLocalizedText(contextRootLabel, 
org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class, 
"PayaraMicroPanel.contextRootLabel.text")); // NOI18N
+        
contextRootLabel.setToolTipText(org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class,
 "PayaraMicroPanel.contextRootLabel.toolTipText")); // NOI18N
+
+        
contextRootTextField.setText(org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class,
 "PayaraMicroPanel.contextRootTextField.text")); // NOI18N
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
         this.setLayout(layout);
         layout.setHorizontalGroup(
@@ -89,15 +104,16 @@ class PayaraMicroPanel extends JPanel {
             .addGroup(layout.createSequentialGroup()
                 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(microVersionLabel)
-                    .addComponent(autoBindHttpLabel))
+                    .addComponent(autoBindHttpLabel)
+                    .addComponent(contextRootLabel))
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(layout.createSequentialGroup()
                         .addComponent(autoBindHttpCheckBox)
-                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 
Short.MAX_VALUE))
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(microVersionCombobox, 0, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                        .addGap(69, 69, 69))))
+                        .addGap(0, 91, Short.MAX_VALUE))
+                    .addComponent(microVersionCombobox, 0, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addComponent(contextRootTextField, 
javax.swing.GroupLayout.Alignment.TRAILING))
+                .addContainerGap())
         );
         layout.setVerticalGroup(
             
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -109,13 +125,19 @@ class PayaraMicroPanel extends JPanel {
                 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(autoBindHttpCheckBox)
                     .addComponent(autoBindHttpLabel))
-                .addContainerGap(255, Short.MAX_VALUE))
+                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(contextRootLabel)
+                    .addComponent(contextRootTextField, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addContainerGap(217, Short.MAX_VALUE))
         );
     }// </editor-fold>//GEN-END:initComponents
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JCheckBox autoBindHttpCheckBox;
     private javax.swing.JLabel autoBindHttpLabel;
+    private javax.swing.JLabel contextRootLabel;
+    private javax.swing.JTextField contextRootTextField;
     private javax.swing.JComboBox microVersionCombobox;
     private javax.swing.JLabel microVersionLabel;
     // End of variables declaration//GEN-END:variables


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to