Merge pull request #1330 from apache/master
Sync master to release branch for NB 11.1-beta2
diff --git a/.travis.yml b/.travis.yml
index 868e75c..461b40b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -71,3 +71,106 @@
- env: SIGTEST=false COMPILETEST=false RAT=false EOL=false LICENSE=false CV=false RUN_TESTS_JDK8=false RUN_TESTS_JDK9PLUS=true TEST_JDK_VERSION="--feature 12 --license GPL" TEST_RUN_OPTIONS='-Dtest.run.args=--add-exports=jdk.javadoc/com.sun.tools.javadoc.main=ALL-UNNAMED -Dtest.use.jdk.javac=true' TEST_MODULES="java/java.completion" OPTS="-Dcluster.config=java -quiet build -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false"
jdk: openjdk8
+
+ - env: >
+ SIGTEST=false
+ COMPILETEST=false
+ RAT=false
+ EOL=false
+ LICENSE=false
+ CV=false
+ RUN_TESTS_JDK9PLUS=false
+ RUN_TESTS_JDK8=true
+ OPTS="-Dcluster.config=minimal -quiet build -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false -Dtest-unit-sys-prop.ignore.random.failures=true"
+ TEST_MODULES="ide/api.xml.ui
+ ide/bugtracking
+ ide/bugtracking.bridge
+ ide/bugtracking.commons
+ ide/bugzilla
+ ide/code.analysis
+ ide/core.ide
+ ide/csl.api
+ ide/csl.types
+ ide/css.editor
+ ide/css.lib
+ ide/css.model
+ ide/db.dataview
+ ide/db.sql.editor
+ ide/docker.api
+ ide/docker.ui
+ ide/editor.bookmarks
+ ide/editor.bracesmatching
+ ide/editor.document
+ ide/editor.fold
+ ide/editor.fold.nbui
+ ide/editor.guards
+ ide/editor.indent
+ ide/editor.indent.project
+ ide/editor.macros
+ ide/editor.search
+ ide/editor.settings
+ ide/editor.settings.storage
+ ide/editor.tools.storage
+ ide/editor.util
+ ide/extbrowser
+ ide/extexecution.base
+ ide/gsf.testrunner.ui
+ ide/html
+ ide/html.custom
+ ide/html.editor
+ ide/html.lexer
+ ide/html.parser
+ ide/html.validation
+ ide/hudson
+ ide/hudson.git
+ ide/hudson.mercurial
+ ide/hudson.subversion
+ ide/hudson.tasklist
+ ide/hudson.ui
+ ide/javascript2.debug
+ ide/languages.yaml
+ ide/lexer
+ ide/lib.terminalemulator
+ ide/libs.freemarker
+ ide/libs.git
+ ide/libs.graalsdk
+ ide/localhistory
+ ide/o.openidex.util
+ ide/parsing.api
+ ide/parsing.indexing
+ ide/parsing.lucene
+ ide/project.ant
+ ide/project.ant.compat8
+ ide/project.ant.ui
+ ide/project.libraries
+ ide/project.libraries.ui
+ ide/projectapi
+ ide/projectapi.nb
+ ide/projectuiapi.base
+ ide/refactoring.api
+ ide/schema2beans
+ ide/server
+ ide/spellchecker
+ ide/spi.editor.hints
+ ide/spi.palette
+ ide/spi.tasklist
+ ide/tasklist.ui
+ ide/team.commons
+ ide/terminal.nb
+ ide/utilities
+ ide/versioning.masterfs
+ ide/versioning.util
+ ide/web.common
+ ide/web.common.ui
+ ide/web.webkit.debugging
+ ide/xml
+ ide/xml.axi
+ ide/xml.core
+ ide/xml.lexer
+ ide/xml.multiview
+ ide/xml.text
+ ide/xml.text.obsolete90
+ ide/xml.xam
+ ide/xml.xdm
+ ide/xsl"
+ jdk: openjdk8
diff --git a/enterprise/glassfish.common/manifest.mf b/enterprise/glassfish.common/manifest.mf
index 31a47d0..0c4c004 100644
--- a/enterprise/glassfish.common/manifest.mf
+++ b/enterprise/glassfish.common/manifest.mf
@@ -4,6 +4,6 @@
OpenIDE-Module-Install: org/netbeans/modules/glassfish/common/Installer.class
OpenIDE-Module-Layer: org/netbeans/modules/glassfish/common/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/common/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.78
+OpenIDE-Module-Specification-Version: 1.79
OpenIDE-Module-Provides: org.netbeans.modules.glassfish.common
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/Bundle.properties b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/Bundle.properties
index 657e9c8..6fe995b 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/Bundle.properties
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/Bundle.properties
@@ -156,7 +156,8 @@
STR_411_SERVER_NAME=GlassFish Server 4.1.1
STR_412_SERVER_NAME=GlassFish Server 4.1.2
STR_50_SERVER_NAME=GlassFish Server 5.0
-STR_51_SERVER_NAME=GlassFish Server 5.1
+STR_501_SERVER_NAME=GlassFish Server 5.0.1
+STR_510_SERVER_NAME=GlassFish Server 5.1.0
# CommonServerSupport.java
MSG_FLAKEY_NETWORK=<html>Network communication problem<br/>Could not establish \
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java
index 2014eb0..acfade5 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java
@@ -63,9 +63,11 @@
private volatile static GlassfishInstanceProvider glassFishProvider;
public static final String EE6_DEPLOYER_FRAGMENT = "deployer:gfv3ee6"; // NOI18N
+ public static final String EE8_DEPLOYER_FRAGMENT = "deployer:gfv5ee8"; // NOI18N
public static final String EE6WC_DEPLOYER_FRAGMENT = "deployer:gfv3ee6wc"; // NOI18N
public static final String PRELUDE_DEPLOYER_FRAGMENT = "deployer:gfv3"; // NOI18N
static private String EE6_INSTANCES_PATH = "/GlassFishEE6/Instances"; // NOI18N
+ static private String EE8_INSTANCES_PATH = "/GlassFishEE8/Instances"; // NOI18N
static private String EE6WC_INSTANCES_PATH = "/GlassFishEE6WC/Instances"; // NOI18N
static public String PRELUDE_DEFAULT_NAME = "GlassFish_v3_Prelude"; //NOI18N
@@ -87,8 +89,8 @@
if (glassFishProvider == null) {
runInit = true;
glassFishProvider = new GlassfishInstanceProvider(
- new String[]{EE6_DEPLOYER_FRAGMENT, EE6WC_DEPLOYER_FRAGMENT},
- new String[]{EE6_INSTANCES_PATH, EE6WC_INSTANCES_PATH},
+ new String[]{EE6_DEPLOYER_FRAGMENT, EE6WC_DEPLOYER_FRAGMENT, EE8_DEPLOYER_FRAGMENT},
+ new String[]{EE6_INSTANCES_PATH, EE6WC_INSTANCES_PATH, EE8_INSTANCES_PATH},
null,
true,
new String[]{"--nopassword"}, // NOI18N
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java
index 8698558..08d6b8d 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/ServerDetails.java
@@ -38,6 +38,8 @@
import static org.netbeans.modules.glassfish.tooling.data.GlassFishVersion.GF_3_1_2_5;
import static org.netbeans.modules.glassfish.tooling.data.GlassFishVersion.GF_4;
import static org.netbeans.modules.glassfish.tooling.data.GlassFishVersion.GF_4_0_1;
+import static org.netbeans.modules.glassfish.tooling.data.GlassFishVersion.GF_5;
+import static org.netbeans.modules.glassfish.tooling.data.GlassFishVersion.GF_5_0_1;
import org.netbeans.modules.glassfish.tooling.utils.ServerUtils;
import org.openide.WizardDescriptor;
import org.openide.util.NbBundle;
@@ -171,7 +173,7 @@
* details for an instance of GlassFish Server 5
*/
GLASSFISH_SERVER_5_0(NbBundle.getMessage(ServerDetails.class, "STR_50_SERVER_NAME", new Object[]{}), // NOI18N
- "deployer:gfv3ee6wc", // NOI18N
+ "deployer:gfv5ee8", // NOI18N
500,
"https://download.oracle.com/glassfish/5.0/release/glassfish-5.0.zip", // NOI18N
"https://download.oracle.com/glassfish/5.0/release/glassfish-5.0.zip", // NOI18N
@@ -181,8 +183,19 @@
/**
* details for an instance of GlassFish Server 5
*/
- GLASSFISH_SERVER_5_1(NbBundle.getMessage(ServerDetails.class, "STR_51_SERVER_NAME", new Object[]{}), // NOI18N
- "deployer:gfv3ee6wc", // NOI18N
+ GLASSFISH_SERVER_5_0_1(NbBundle.getMessage(ServerDetails.class, "STR_501_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:gfv5ee8", // NOI18N
+ 501,
+ "https://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip", // NOI18N
+ "https://download.oracle.com/glassfish/5.0.1/release/glassfish-5.0.1.zip", // NOI18N
+ "https://javaee.github.io/glassfish/LICENSE" //NOI18N
+ ),
+
+ /**
+ * details for an instance of GlassFish Server 5
+ */
+ GLASSFISH_SERVER_5_1_0(NbBundle.getMessage(ServerDetails.class, "STR_510_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:gfv5ee8", // NOI18N
510,
"https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/5.1.0/glassfish-5.1.0.zip", // NOI18N
"https://repo1.maven.org/maven2/org/glassfish/main/distributions/glassfish/5.1.0/glassfish-5.1.0.zip", // NOI18N
@@ -198,7 +211,8 @@
public static WizardDescriptor.InstantiatingIterator
getInstantiatingIterator() {
return new ServerWizardIterator(new ServerDetails[]{
- GLASSFISH_SERVER_5_1,
+ GLASSFISH_SERVER_5_1_0,
+ GLASSFISH_SERVER_5_0_1,
GLASSFISH_SERVER_5_0,
GLASSFISH_SERVER_4_1_2,
GLASSFISH_SERVER_4_1_1,
@@ -210,14 +224,16 @@
GLASSFISH_SERVER_3_1_1,
GLASSFISH_SERVER_3_1,
GLASSFISH_SERVER_3_0_1,
- GLASSFISH_SERVER_3,},
+ GLASSFISH_SERVER_3},
new ServerDetails[]{
- GLASSFISH_SERVER_5_1,
+ GLASSFISH_SERVER_5_1_0,
+ GLASSFISH_SERVER_5_0_1,
GLASSFISH_SERVER_5_0,
GLASSFISH_SERVER_4_1_2,
GLASSFISH_SERVER_4_1_1,
GLASSFISH_SERVER_4_1,
- GLASSFISH_SERVER_4_0});
+ GLASSFISH_SERVER_4_0,
+ GLASSFISH_SERVER_3_1_2_2});
}
/**
@@ -250,7 +266,8 @@
case GF_4_1_1: return GLASSFISH_SERVER_4_1_1.getVersion();
case GF_4_1_2: return GLASSFISH_SERVER_4_1_2.getVersion();
case GF_5: return GLASSFISH_SERVER_5_0.getVersion();
- case GF_5_1: return GLASSFISH_SERVER_5_1.getVersion();
+ case GF_5_0_1: return GLASSFISH_SERVER_5_0_1.getVersion();
+ case GF_5_1_0: return GLASSFISH_SERVER_5_1_0.getVersion();
default: return -1;
}
}
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/registration/AutomaticRegistration.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/registration/AutomaticRegistration.java
index 13a9a12..efeafd7 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/registration/AutomaticRegistration.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/registration/AutomaticRegistration.java
@@ -86,6 +86,8 @@
GlassFishVersion version = ServerUtils.getServerVersion(glassfishRoot);
if (GlassFishVersion.ge(version, GlassFishVersion.GF_3_1)) {
deployer = "deployer:gfv3ee6wc";
+ } else if (GlassFishVersion.ge(version, GlassFishVersion.GF_5)) {
+ deployer = "deployer:gfv5ee8";
}
StringBuilder sb = new StringBuilder(
defaultDisplayNamePrefix.length() + 12);
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/Bundle.properties b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/Bundle.properties
index d36f899..f2eccbd 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/Bundle.properties
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/Bundle.properties
@@ -147,6 +147,15 @@
STR_3_SERVER_NAME=GlassFish Server 3.0
STR_31_SERVER_NAME=GlassFish Server 3.1
+STR_V4_FAMILY_NAME=GlassFish Server
+STR_4_SERVER_NAME=GlassFish Server 4.0
+STR_41_SERVER_NAME=GlassFish Server 4.1
+
+STR_V5_FAMILY_NAME=GlassFish Server
+STR_5_SERVER_NAME=GlassFish Server 5.0
+STR_501_SERVER_NAME=GlassFish Server 5.0.1
+STR_510 _SERVER_NAME=GlassFish Server 5.1.0
+
LBL_SELECT_BITS=Select
LBL_ChooseOne=Choose server to download:
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/GlassfishWizardProvider.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/GlassfishWizardProvider.java
index 93dbe4b..84febb4 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/GlassfishWizardProvider.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/common/wizards/GlassfishWizardProvider.java
@@ -37,6 +37,20 @@
);
}
+ public static GlassfishWizardProvider createEe7() {
+ return new GlassfishWizardProvider(
+ org.openide.util.NbBundle.getMessage(GlassfishWizardProvider.class,
+ "STR_V4_FAMILY_NAME", new Object[]{}) // NOI18N
+ );
+ }
+
+ public static GlassfishWizardProvider createEe8() {
+ return new GlassfishWizardProvider(
+ org.openide.util.NbBundle.getMessage(GlassfishWizardProvider.class,
+ "STR_V5_FAMILY_NAME", new Object[]{}) // NOI18N
+ );
+ }
+
private final String displayName;
private GlassfishWizardProvider(
diff --git a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java
index d6e1db9..e0b6e49 100644
--- a/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java
+++ b/enterprise/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java
@@ -77,6 +77,18 @@
GlassfishWizardProvider.createEe6());
}
+ public static ServerUtilities getEe7Utilities() {
+ GlassfishInstanceProvider gip = GlassfishInstanceProvider.getProvider();
+ return null == gip ? null : new ServerUtilities(gip,
+ GlassfishWizardProvider.createEe7());
+ }
+
+ public static ServerUtilities getEe8Utilities() {
+ GlassfishInstanceProvider gip = GlassfishInstanceProvider.getProvider();
+ return null == gip ? null : new ServerUtilities(gip,
+ GlassfishWizardProvider.createEe8());
+ }
+
// public static ServerUtilities getEe6WCUtilities() {
// GlassfishInstanceProvider gip = GlassfishInstanceProvider.getProvider();
// return null == gip ? null : new ServerUtilities(gip,
diff --git a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/GlassfishConfiguration.java b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/GlassfishConfiguration.java
index 489a2f4..37fbb8a 100644
--- a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/GlassfishConfiguration.java
+++ b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/GlassfishConfiguration.java
@@ -497,7 +497,8 @@
"JavaEEPlusSIP",
"gfv3",
"gfv3ee6",
- "gfv3ee6wc"
+ "gfv3ee6wc",
+ "gfv5ee8"
};
protected ASDDVersion getTargetAppServerVersion() {
diff --git a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/J2EEVersion.java b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/J2EEVersion.java
index afddda9..43aa747 100644
--- a/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/J2EEVersion.java
+++ b/enterprise/glassfish.eecommon/src/org/netbeans/modules/glassfish/eecommon/api/config/J2EEVersion.java
@@ -56,6 +56,18 @@
"6.0", 6000, // NOI18N
"6.0", 6000); // NOI18N
+ /** Represents JavaEE version 7.0
+ */
+ public static final J2EEVersion JAVAEE_7_0 = new J2EEVersion(
+ "7.0", 7000, // NOI18N
+ "7.0", 7000); // NOI18N
+
+ /** Represents JavaEE version 8.0
+ */
+ public static final J2EEVersion JAVAEE_8_0 = new J2EEVersion(
+ "8.0", 8000, // NOI18N
+ "8.0", 8000); // NOI18N
+
/** -----------------------------------------------------------------------
* Implementation
*/
@@ -89,6 +101,10 @@
result = JAVAEE_5_0;
} else if(JAVAEE_6_0.toString().equals(version)) {
result = JAVAEE_6_0;
+ } else if(JAVAEE_7_0.toString().equals(version)) {
+ result = JAVAEE_7_0;
+ } else if(JAVAEE_8_0.toString().equals(version)) {
+ result = JAVAEE_8_0;
}
return result;
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/AbstractHk2ConfigurationFactory.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/AbstractHk2ConfigurationFactory.java
index 4d61a9d..cb8e192 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/AbstractHk2ConfigurationFactory.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/AbstractHk2ConfigurationFactory.java
@@ -106,11 +106,25 @@
final GlassFishVersion version = instance != null
? instance.getVersion() : null;
try {
+ Hk2DeploymentManager evaluatedDm = null;
+ if(version != null && GlassFishVersion.ge(version, GlassFishVersion.GF_5)){
+ evaluatedDm = (Hk2DeploymentManager) Hk2DeploymentFactory.createEe8()
+ .getDisconnectedDeploymentManager(instanceUrl);
+ } else if(version != null && GlassFishVersion.ge(version, GlassFishVersion.GF_3_1)){
+ evaluatedDm = (Hk2DeploymentManager) Hk2DeploymentFactory.createEe6()
+ .getDisconnectedDeploymentManager(instanceUrl);
+ } else {
+ evaluatedDm = (Hk2DeploymentManager) Hk2DeploymentFactory.createEe8()
+ .getDisconnectedDeploymentManager(instanceUrl);
+ }
final Hk2DeploymentManager dm = hk2dm != null
? hk2dm
- : (Hk2DeploymentManager) Hk2DeploymentFactory.createEe6()
- .getDisconnectedDeploymentManager(instanceUrl);
+ : evaluatedDm;
if (version != null
+ && GlassFishVersion.ge(version, GlassFishVersion.GF_5)) {
+ retVal = new ModuleConfigurationImpl(
+ module, new Hk2Configuration(module, version), dm);
+ } else if (version != null
&& GlassFishVersion.ge(version, GlassFishVersion.GF_3_1)) {
retVal = new ModuleConfigurationImpl(
module, new Three1Configuration(module, version), dm);
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties
index ad3700e..3939e45 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties
@@ -44,11 +44,13 @@
LBL_V2ServerLibraries=Unsupported GlassFish Server 2 Libraries
LBL_V3ServerLibraries=GlassFish Server 3 Libraries
LBL_V4ServerLibraries=GlassFish Server 4 Libraries
+LBL_V5ServerLibraries=GlassFish Server 5 Libraries
MSG_V1ServerPlatform=Unsupported GlassFish Server 1 Platform
MSG_V2ServerPlatform=Unsupported GlassFish Server 2 Platform
MSG_V3ServerPlatform=GlassFish Server 3 Platform
MSG_V4ServerPlatform=GlassFish Server 4 Platform
+MSG_V5ServerPlatform=GlassFish Server 5 Platform
LBL_V3RunTimeDDCatalog=GlassFish Server 3 Catalog
DESC_V3RunTimeDDCatalog=List of all the runtime descriptors DTDs for GlassFish Server 3
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java
index fe1dce5..03146df 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2DeploymentFactory.java
@@ -36,6 +36,8 @@
private static Hk2DeploymentFactory preludeInstance;
private static Hk2DeploymentFactory ee6Instance;
+ private static Hk2DeploymentFactory ee7Instance;
+ private static Hk2DeploymentFactory ee8Instance;
private String[] uriFragments;
private String version;
private String displayName;
@@ -69,6 +71,38 @@
/**
*
+ * @return
+ */
+ public static synchronized DeploymentFactory createEe7() {
+ // FIXME -- these strings should come from some constant place
+ if (ee7Instance == null) {
+ ServerUtilities tmp = ServerUtilities.getEe7Utilities();
+ ee7Instance = new Hk2DeploymentFactory(new String[]{"deployer:gfv4ee7:", "deployer:gfv4ee7wc:", "deployer:gfv4"}, "0.2", // NOI18N
+ NbBundle.getMessage(Hk2DeploymentFactory.class, "TXT_FactoryDisplayName")); // NOI18N
+ DeploymentFactoryManager.getInstance().registerDeploymentFactory(ee7Instance);
+ ee7Instance.setServerUtilities(tmp);
+ }
+ return ee7Instance;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static synchronized DeploymentFactory createEe8() {
+ // FIXME -- these strings should come from some constant place
+ if (ee8Instance == null) {
+ ServerUtilities tmp = ServerUtilities.getEe8Utilities();
+ ee8Instance = new Hk2DeploymentFactory(new String[]{"deployer:gfv5ee8:", "deployer:gfv5"}, "0.2", // NOI18N
+ NbBundle.getMessage(Hk2DeploymentFactory.class, "TXT_FactoryDisplayName")); // NOI18N
+ DeploymentFactoryManager.getInstance().registerDeploymentFactory(ee8Instance);
+ ee8Instance.setServerUtilities(tmp);
+ }
+ return ee8Instance;
+ }
+
+ /**
+ *
* @param uri
* @return
*/
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformFactory.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformFactory.java
index 003aec7..c702fbb 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformFactory.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformFactory.java
@@ -58,7 +58,12 @@
/** GlassFish V4 JavaEE platform lookup key.
* <p/>We will keep V3 value now because no one knows what will get broken
* when changing it. */
- private static final String V4_LOOKUP_KEY = V3_LOOKUP_KEY;
+ private static final String V4_LOOKUP_KEY = "J2EE/DeploymentPlugins/gfv4ee7/Lookup";
+
+ /** GlassFish V5 JavaEE platform lookup key.
+ * <p/>We will keep V3 value now because no one knows what will get broken
+ * when changing it. */
+ private static final String V5_LOOKUP_KEY = "J2EE/DeploymentPlugins/gfv5ee8/Lookup";
/** GlassFish JavaEE platform factory singleton object. */
private static volatile Hk2JavaEEPlatformFactory instance;
@@ -94,7 +99,10 @@
*/
private static String getDisplayName(final GlassFishVersion version) {
final int ord = version.ordinal();
- if (ord >= GlassFishVersion.GF_4.ordinal()) {
+ if(ord >= GlassFishVersion.GF_5.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "MSG_V5ServerPlatform");
+ } else if (ord >= GlassFishVersion.GF_4.ordinal()) {
return NbBundle.getMessage(
Hk2JavaEEPlatformFactory.class, "MSG_V4ServerPlatform");
} else if (ord >= GlassFishVersion.GF_3.ordinal()) {
@@ -119,7 +127,10 @@
*/
private static String getLibraryName(final GlassFishVersion version) {
final int ord = version.ordinal();
- if (ord >= GlassFishVersion.GF_4.ordinal()) {
+ if (ord >= GlassFishVersion.GF_5.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "LBL_V5ServerLibraries");
+ } else if (ord >= GlassFishVersion.GF_4.ordinal()) {
return NbBundle.getMessage(
Hk2JavaEEPlatformFactory.class, "LBL_V4ServerLibraries");
} else if (ord >= GlassFishVersion.GF_3.ordinal()) {
@@ -144,7 +155,9 @@
*/
private static String getLookupKey(final GlassFishVersion version) {
final int ord = version.ordinal();
- if (ord >= GlassFishVersion.GF_4.ordinal()) {
+ if (ord >= GlassFishVersion.GF_5.ordinal()) {
+ return V5_LOOKUP_KEY;
+ } else if (ord >= GlassFishVersion.GF_4.ordinal()) {
return V4_LOOKUP_KEY;
} else {
return V3_LOOKUP_KEY;
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformImpl.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformImpl.java
index 3e97ade..1666625 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformImpl.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JavaEEPlatformImpl.java
@@ -190,6 +190,10 @@
break;
case v1_7: profiles[index++] = Profile.JAVA_EE_7_FULL;
break;
+ case v1_8_web: profiles[index++] = Profile.JAVA_EE_8_WEB;
+ break;
+ case v1_8: profiles[index++] = Profile.JAVA_EE_8_FULL;
+ break;
}
} else {
profiles = new Profile[0];
@@ -383,6 +387,9 @@
/** Application client container configuration file for GlassFish v4. */
private static final String GFv4_ACC_XML = "glassfish-acc.xml";
+ /** Application client container configuration file for GlassFish v5. */
+ private static final String GFv5_ACC_XML = "glassfish-acc.xml";
+
/**
*
* @param toolName
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JaxWsStack.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JaxWsStack.java
index 9c50106..0b8662c 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JaxWsStack.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2JaxWsStack.java
@@ -72,7 +72,11 @@
@Override
public WSStackVersion getVersion() {
Set<Profile> supportedProfiles = platform.getSupportedProfiles();
- if ( supportedProfiles.contains( Profile.JAVA_EE_6_FULL) ||
+ if (supportedProfiles.contains(Profile.JAVA_EE_8_FULL) ||
+ supportedProfiles.contains(Profile.JAVA_EE_8_WEB) ||
+ supportedProfiles.contains(Profile.JAVA_EE_7_FULL) ||
+ supportedProfiles.contains(Profile.JAVA_EE_7_WEB) ||
+ supportedProfiles.contains(Profile.JAVA_EE_6_FULL) ||
supportedProfiles.contains(Profile.JAVA_EE_6_WEB))
{
// gfv3ee6 GF id
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java
index 5a7ae58..3baebc4 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java
@@ -68,6 +68,12 @@
t, true);
}
+ public static Hk2OptionalFactory createEe8() {
+ ServerUtilities t = ServerUtilities.getEe8Utilities();
+ return null == t ? null : new Hk2OptionalFactory(Hk2DeploymentFactory.createEe8(),
+ t, true);
+ }
+
@Override
public StartServer getStartServer(DeploymentManager dm) {
return new Hk2StartServer(dm);
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/ide/FastDeploy.java b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/ide/FastDeploy.java
index c0f35e8..54893ae 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/ide/FastDeploy.java
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/ide/FastDeploy.java
@@ -139,7 +139,7 @@
if (null != rootOfWebApp) {
String fileName = null;
String SUNWEB = "WEB-INF/sun-web.xml"; // NOI18N
- if (url.contains("gfv3ee6wc")) { // NOI18N
+ if (url.contains("gfv3ee6wc") || url.contains("gfv4") || url.contains("gfv5")) { // NOI18N
String GFWEB = "WEB-INF/glassfish-web.xml"; // NOI18N
if (null == rootOfWebApp.getFileObject(GFWEB) &&
null == rootOfWebApp.getFileObject(SUNWEB)) {
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml
index 38cfc59..ff2f14f7 100644
--- a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/layer.xml
@@ -102,6 +102,67 @@
</folder>
</folder>
</folder>
+ <folder name="gfv5ee8">
+ <file name="Descriptor" url="nbdepee8.xml"/>
+ <!-- -->
+ <file name="Factory.instance">
+ <attr name="urlPattern" stringvalue="^\[.*deployer:gfv5ee8[w]?[c]?:.*$"/>
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.glassfish.javaee.Hk2DeploymentFactory.createEe8"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory"/>
+ <attr name="instanceOf" stringvalue="javax.enterprise.deploy.spi.factories.DeploymentFactory"/>
+ </file>
+ <file name="J2eePlatformFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.glassfish.javaee.Hk2JavaEEPlatformFactory.getFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.glassfish.javaee.Hk2JavaEEPlatformFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory"/>
+ </file>
+ <file name="OptionalFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyOptionalFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.glassfish.javaee.Hk2OptionalFactory.createEe8"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory"/>
+ </file>
+ <file name="ModuleConfigFactory.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.glassfish.javaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.glassfish.javaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory"/>
+ </file>
+ <file name="J2eeVerifierSupport.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.glassfish.javaee.verifier.VerifierImpl"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.glassfish.javaee.verifier.VerifierImpl"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport"/>
+ </file>
+ <!-- -->
+ <folder name="DeploymentFileNames">
+ <folder name="WAR">
+ <file name="WEB-INF\sun-web.xml"/>
+ <file name="WEB-INF\glassfish-web.xml"/>
+ <file name="WEB-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EJB">
+ <file name="META-INF\sun-ejb-jar.xml"/>
+ <file name="META-INF\sun-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-ejb-jar.xml"/>
+ <file name="META-INF\glassfish-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EAR">
+ <file name="META-INF\sun-application.xml"/>
+ <file name="META-INF\glassfish-application.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="RAR">
+ <file name="META-INF\sun-ra.xml"/>
+ <file name="META-INF\glassfish-ra.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="CAR">
+ <file name="META-INF\sun-application-client.xml"/>
+ <file name="META-INF\glassfish-application-client.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ </folder>
+ </folder>
</folder>
</folder>
diff --git a/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/nbdepee8.xml b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/nbdepee8.xml
new file mode 100644
index 0000000..103ea90
--- /dev/null
+++ b/enterprise/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/nbdepee8.xml
@@ -0,0 +1,54 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/glassfish/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:gfv5ee8</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <!-- v3 ee6 has no limitations...
+ <container-limitation>
+ <ear-deploy/>
+ <war-deploy/>
+ <ejbjar-deploy/>
+ </container-limitation>
+ -->
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/glassfish.javaee/test/unit/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManagerTest.java b/enterprise/glassfish.javaee/test/unit/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManagerTest.java
index d22c4b2..9ca25a0 100644
--- a/enterprise/glassfish.javaee/test/unit/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManagerTest.java
+++ b/enterprise/glassfish.javaee/test/unit/src/org/netbeans/modules/glassfish/javaee/db/Hk2DatasourceManagerTest.java
@@ -67,7 +67,7 @@
rootFolder.mkdirs();
FileObject rootFolderFO = FileUtil.toFileObject(rootFolder);
j2eeModuleImpl = new HK2TestEEModuleImpl(
- rootFolderFO, J2eeModule.Type.WAR, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ rootFolderFO, J2eeModule.Type.WAR, Profile.JAVA_EE_8_FULL.toPropertiesString());
j2eeModule = J2eeModuleFactory.createJ2eeModule(j2eeModuleImpl);
}
diff --git a/enterprise/glassfish.tooling/manifest.mf b/enterprise/glassfish.tooling/manifest.mf
index 3754a9b..bf6ff0a 100644
--- a/enterprise/glassfish.tooling/manifest.mf
+++ b/enterprise/glassfish.tooling/manifest.mf
@@ -2,5 +2,5 @@
AutoUpdate-Show-In-Client: false
OpenIDE-Module: org.netbeans.modules.glassfish.tooling/0
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/tooling/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.11
+OpenIDE-Module-Specification-Version: 1.12
diff --git a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/data/GlassFishVersion.java b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/data/GlassFishVersion.java
index 55f3137..ff31d1b 100644
--- a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/data/GlassFishVersion.java
+++ b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/data/GlassFishVersion.java
@@ -76,9 +76,10 @@
GF_4_1_2 ((short) 4, (short) 1, (short) 1, (short) 2, GlassFishVersion.GF_4_1_2_STR),
/** GlassFish 5. */
GF_5 ((short) 5, (short) 0, (short) 0, (short) 0, GlassFishVersion.GF_5_STR),
- /** GlassFish 5.1 */
- GF_5_1 ((short) 5, (short) 1, (short) 0, (short) 0, GlassFishVersion.GF_5_1_STR);
-
+ /** GlassFish 5.0.1 */
+ GF_5_0_1 ((short) 5, (short) 0, (short) 1, (short) 0, GlassFishVersion.GF_5_0_1_STR),
+ /** GlassFish 5.1.0 */
+ GF_5_1_0 ((short) 5, (short) 1, (short) 0, (short) 0, GlassFishVersion.GF_5_1_0_STR);
////////////////////////////////////////////////////////////////////////////
// Class attributes //
////////////////////////////////////////////////////////////////////////////
@@ -179,10 +180,16 @@
/** Additional <code>String</code> representations of GF_5 value. */
static final String GF_5_STR_NEXT[] = {"5.0", "5.0.0", "5.0.0.0"};
- /** A <code>String</code> representation of GF_5 value. */
- static final String GF_5_1_STR = "5.1";
- /** Additional <code>String</code> representations of GF_5 value. */
- static final String GF_5_1_STR_NEXT[] = {"5.1.0", "5.1.0.0"};
+ /** A <code>String</code> representation of GF_5_0_1 value. */
+ static final String GF_5_0_1_STR = "5.0.1";
+ /** Additional <code>String</code> representations of GF_5_0_1 value. */
+ static final String GF_5_0_1_STR_NEXT[] = {"5.0.1", "5.0.1"};
+
+ /** A <code>String</code> representation of GF_5_1_0 value. */
+ static final String GF_5_1_0_STR = "5.1.0";
+ /** Additional <code>String</code> representations of GF_5_1_0 value. */
+ static final String GF_5_1_0_STR_NEXT[] = {"5.1.0", "5.1.0"};
+
/**
* Stored <code>String</code> values for backward <code>String</code>
* conversion.
@@ -210,7 +217,7 @@
initStringValuesMapFromArray(GF_4_1_1, GF_4_1_1_STR_NEXT);
initStringValuesMapFromArray(GF_4_1_2, GF_4_1_2_STR_NEXT);
initStringValuesMapFromArray(GF_5, GF_5_STR_NEXT);
- initStringValuesMapFromArray(GF_5_1, GF_5_1_STR_NEXT);
+ initStringValuesMapFromArray(GF_5_1_0, GF_5_1_0_STR_NEXT);
}
////////////////////////////////////////////////////////////////////////////
diff --git a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java
index 4fd92dd..810f62c 100644
--- a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java
+++ b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/ConfigBuilderProvider.java
@@ -59,9 +59,24 @@
= new Config.Next(GlassFishVersion.GF_4_1,
ConfigBuilderProvider.class.getResource("GlassFishV4_1.xml"));
+ /** Library builder configuration since GlassFish 5. */
+ private static final Config.Next CONFIG_V5
+ = new Config.Next(GlassFishVersion.GF_5,
+ ConfigBuilderProvider.class.getResource("GlassFishV5.xml"));
+
+ /** Library builder configuration since GlassFish 5.0.1. */
+ private static final Config.Next CONFIG_V5_0_1
+ = new Config.Next(GlassFishVersion.GF_5_0_1,
+ ConfigBuilderProvider.class.getResource("GlassFishV5_1.xml"));
+
+ /** Library builder configuration since GlassFish 5.1. */
+ private static final Config.Next CONFIG_V5_1
+ = new Config.Next(GlassFishVersion.GF_5_1_0,
+ ConfigBuilderProvider.class.getResource("GlassFishV5_1.xml"));
+
/** Library builder configuration for GlassFish cloud. */
private static final Config config
- = new Config(CONFIG_V3, CONFIG_V4, CONFIG_V4_1);
+ = new Config(CONFIG_V3, CONFIG_V4, CONFIG_V4_1, CONFIG_V5, CONFIG_V5_0_1, CONFIG_V5_1);
/** Builders array for each server instance. */
private static final Map<GlassFishServer, ConfigBuilder> builders
diff --git a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5.xml b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5.xml
new file mode 100644
index 0000000..bce4c22
--- /dev/null
+++ b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<server>
+ <tools lib="lib">
+ <asadmin jar="client/appserver-cli.jar"/>
+ </tools>
+ <java version="1.8">
+ <platform version="1.7"/>
+ <platform version="1.8"/>
+ </java>
+ <javaee version="1.8">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <profile version="1.7" type="web"/>
+ <profile version="1.7" type="full" check="full"/>
+ <profile version="1.8" type="web"/>
+ <profile version="1.8" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="cdi-api.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="jaxr-api-osgi.jar"/>
+ <include name="jaxrpc-api-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ </fileset>
+ <fileset dir="modules/endorsed">
+ <include name=".+\.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 2">
+ <classpath>
+ <fileset dir="modules">
+ <include name="guava.+\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.0-m05-2/jersey-documentation-2.0-m05-2-docbook.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax.ws.rs-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5_1.xml b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5_1.xml
new file mode 100644
index 0000000..bce4c22
--- /dev/null
+++ b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/GlassFishV5_1.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<server>
+ <tools lib="lib">
+ <asadmin jar="client/appserver-cli.jar"/>
+ </tools>
+ <java version="1.8">
+ <platform version="1.7"/>
+ <platform version="1.8"/>
+ </java>
+ <javaee version="1.8">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <profile version="1.7" type="web"/>
+ <profile version="1.7" type="full" check="full"/>
+ <profile version="1.8" type="web"/>
+ <profile version="1.8" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="cdi-api.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="jaxr-api-osgi.jar"/>
+ <include name="jaxrpc-api-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ </fileset>
+ <fileset dir="modules/endorsed">
+ <include name=".+\.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 2">
+ <classpath>
+ <fileset dir="modules">
+ <include name="guava.+\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.0-m05-2/jersey-documentation-2.0-m05-2-docbook.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax.ws.rs-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/JavaEEProfile.java b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/JavaEEProfile.java
index 848d32d..5d1733e 100644
--- a/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/JavaEEProfile.java
+++ b/enterprise/glassfish.tooling/src/org/netbeans/modules/glassfish/tooling/server/config/JavaEEProfile.java
@@ -54,7 +54,13 @@
v1_7_web(Version.v1_7, Type.WEB, "1.7-web"),
/** JavaEE 1.7 full profile. */
- v1_7(Version.v1_7, Type.FULL, "1.7");
+ v1_7(Version.v1_7, Type.FULL, "1.7"),
+
+ /** JavaEE 1.8 web profile. */
+ v1_8_web(Version.v1_8, Type.WEB, "1.8-web"),
+
+ /** JavaEE 1.8 full profile. */
+ v1_8(Version.v1_8, Type.FULL, "1.8");
////////////////////////////////////////////////////////////////////////////
// Inner enums //
@@ -104,7 +110,9 @@
/** JavaEE 1.6. */
v1_6("1.6"),
/** JavaEE 1.7. */
- v1_7("1.7");
+ v1_7("1.7"),
+ /** JavaEE 1.8. */
+ v1_8("1.8");
/** JavaEE profile type name. */
private final String name;
diff --git a/enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java b/enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java
index a16cd53..7f99163 100644
--- a/enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java
+++ b/enterprise/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/wsclient/AppClientProjectJAXWSClientSupport.java
@@ -98,6 +98,10 @@
return JAVA_EE_VERSION_17;
} else if (Profile.JAVA_EE_7_FULL.equals(j2eeClientModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_17;
+ } else if (Profile.JAVA_EE_8_WEB.equals(j2eeClientModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
+ } else if (Profile.JAVA_EE_8_FULL.equals(j2eeClientModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
} else if (Profile.JAVA_EE_5.equals(j2eeClientModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_15;
}
diff --git a/enterprise/j2ee.common/licenseinfo.xml b/enterprise/j2ee.common/licenseinfo.xml
index 629843f..915bad4 100644
--- a/enterprise/j2ee.common/licenseinfo.xml
+++ b/enterprise/j2ee.common/licenseinfo.xml
@@ -25,6 +25,7 @@
<fileset>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/beans-1.0.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/beans-1.1.xml</file>
+ <file>src/org/netbeans/modules/j2ee/common/dd/resources/beans-2.0.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/constraint.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/ear-1.3.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/ear-1.4.xml</file>
@@ -37,8 +38,10 @@
<file>src/org/netbeans/modules/j2ee/common/dd/resources/web-2.5.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/web-3.0.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/web-3.1.xml</file>
+ <file>src/org/netbeans/modules/j2ee/common/dd/resources/web-4.0.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-3.0.xml</file>
<file>src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-3.1.xml</file>
+ <file>src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-4.0.xml</file>
<file>test/unit/src/templates/Class.template</file>
<file>test/unit/src/templates/Interface.template</file>
<license ref="Apache-2.0-ASF" />
diff --git a/enterprise/j2ee.common/manifest.mf b/enterprise/j2ee.common/manifest.mf
index 0d9af8f..23d5ea6 100644
--- a/enterprise/j2ee.common/manifest.mf
+++ b/enterprise/j2ee.common/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.netbeans.modules.j2ee.common/1
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/common/Bundle.properties
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
-OpenIDE-Module-Specification-Version: 1.107
+OpenIDE-Module-Specification-Version: 1.108
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/j2ee.common/nbproject/project.xml b/enterprise/j2ee.common/nbproject/project.xml
index 4667a01..36a4eba 100644
--- a/enterprise/j2ee.common/nbproject/project.xml
+++ b/enterprise/j2ee.common/nbproject/project.xml
@@ -507,6 +507,7 @@
</test-dependencies>
<friend-packages>
<friend>org.netbeans.modules.glassfish.eecommon</friend>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
<friend>org.netbeans.modules.gradle.javaee</friend>
<friend>org.netbeans.modules.j2ee.archive</friend>
<friend>org.netbeans.modules.j2ee.clientproject</friend>
diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilities.java b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilities.java
index fe1872c..8c2f91b 100644
--- a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilities.java
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilities.java
@@ -96,7 +96,7 @@
public boolean isEjb30Supported() {
J2eeModule.Type moduleType = provider.getJ2eeModule().getType();
boolean eeOk = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_5) ||
- ejbJarProfile.equals(Profile.JAVA_EE_6_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_7_FULL));
+ ejbJarProfile.equals(Profile.JAVA_EE_6_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_7_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_8_FULL));
return J2eeModule.Type.EJB.equals(moduleType) && eeOk;
}
@@ -106,7 +106,7 @@
*/
public boolean isEjb31Supported() {
J2eeModule.Type moduleType = provider.getJ2eeModule().getType();
- boolean ee6or7 = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_6_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_7_FULL));
+ boolean ee6or7 = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_6_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_7_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_8_FULL));
return ee6or7 && (J2eeModule.Type.EJB.equals(moduleType) ||
J2eeModule.Type.WAR.equals(moduleType));
}
@@ -117,7 +117,7 @@
*/
public boolean isEjb31LiteSupported() {
J2eeModule.Type moduleType = provider.getJ2eeModule().getType();
- boolean ee6or7Web = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_6_WEB) || ejbJarProfile.equals(Profile.JAVA_EE_7_WEB));
+ boolean ee6or7Web = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_6_WEB) || ejbJarProfile.equals(Profile.JAVA_EE_7_WEB) || ejbJarProfile.equals(Profile.JAVA_EE_8_WEB));
return isEjb31Supported() || (J2eeModule.Type.WAR.equals(moduleType) && ee6or7Web);
}
@@ -130,7 +130,7 @@
*/
public boolean isEjb32Supported() {
J2eeModule.Type moduleType = provider.getJ2eeModule().getType();
- boolean ee7 = ejbJarProfile != null && ejbJarProfile.equals(Profile.JAVA_EE_7_FULL);
+ boolean ee7 = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_7_FULL) || ejbJarProfile.equals(Profile.JAVA_EE_8_FULL));
return ee7 && (J2eeModule.Type.EJB.equals(moduleType) || J2eeModule.Type.WAR.equals(moduleType));
}
@@ -143,7 +143,7 @@
*/
public boolean isEjb32LiteSupported() {
J2eeModule.Type moduleType = provider.getJ2eeModule().getType();
- boolean ee7Web = ejbJarProfile != null && ejbJarProfile.equals(Profile.JAVA_EE_7_WEB);
+ boolean ee7Web = ejbJarProfile != null && (ejbJarProfile.equals(Profile.JAVA_EE_7_WEB) || ejbJarProfile.equals(Profile.JAVA_EE_8_WEB));
return isEjb32Supported() || (J2eeModule.Type.WAR.equals(moduleType) && ee7Web);
}
@@ -153,9 +153,11 @@
* @since 1.86
*/
public boolean isCdi11Supported() {
- return Profile.JAVA_EE_7_FULL.equals(ejbJarProfile) ||
+ return Profile.JAVA_EE_8_FULL.equals(ejbJarProfile) ||
+ Profile.JAVA_EE_8_WEB.equals(webProfile) ||
+ Profile.JAVA_EE_7_FULL.equals(ejbJarProfile) ||
Profile.JAVA_EE_7_WEB.equals(webProfile) ||
- Profile.JAVA_EE_7_FULL.equals(carProfile);
+ Profile.JAVA_EE_8_FULL.equals(carProfile);
}
/**
diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
index 154a0ce..1d4ce1e 100644
--- a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/DDHelper.java
@@ -66,7 +66,9 @@
*/
public static FileObject createWebXml(Profile j2eeProfile, boolean webXmlRequired, FileObject dir) throws IOException {
String template = null;
- if ((Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) && webXmlRequired) {
+ if ((Profile.JAVA_EE_8_FULL == j2eeProfile || Profile.JAVA_EE_8_WEB == j2eeProfile) && webXmlRequired) {
+ template = "web-4.0.xml"; //NOI18N
+ } else if ((Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) && webXmlRequired) {
template = "web-3.1.xml"; //NOI18N
} else if ((Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile) && webXmlRequired) {
template = "web-3.0.xml"; //NOI18N
@@ -98,7 +100,9 @@
*/
public static FileObject createWebFragmentXml(Profile j2eeProfile, FileObject dir) throws IOException {
String template = null;
- if (Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ if (Profile.JAVA_EE_8_FULL == j2eeProfile || Profile.JAVA_EE_8_WEB == j2eeProfile) {
+ template = "web-fragment-4.0.xml"; //NOI18N
+ } else if (Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
template = "web-fragment-3.1.xml"; //NOI18N
} else if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile) {
template = "web-fragment-3.0.xml"; //NOI18N
@@ -144,6 +148,9 @@
if (Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
template = "beans-1.1.xml"; //NOI18N
}
+ if (Profile.JAVA_EE_8_FULL == j2eeProfile || Profile.JAVA_EE_8_WEB == j2eeProfile) {
+ template = "beans-2.0.xml"; //NOI18N
+ }
if (template == null)
return null;
@@ -180,7 +187,8 @@
public static FileObject createValidationXml(Profile j2eeProfile, FileObject dir, String name) throws IOException {
String template = null;
if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile ||
+ Profile.JAVA_EE_8_FULL == j2eeProfile || Profile.JAVA_EE_8_WEB == j2eeProfile) {
template = "validation.xml"; //NOI18N
}
@@ -219,7 +227,8 @@
public static FileObject createConstraintXml(Profile j2eeProfile, FileObject dir, String name) throws IOException {
String template = null;
if (Profile.JAVA_EE_6_FULL == j2eeProfile || Profile.JAVA_EE_6_WEB == j2eeProfile ||
- Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile) {
+ Profile.JAVA_EE_7_FULL == j2eeProfile || Profile.JAVA_EE_7_WEB == j2eeProfile ||
+ Profile.JAVA_EE_8_FULL == j2eeProfile || Profile.JAVA_EE_8_WEB == j2eeProfile) {
template = "constraint.xml"; //NOI18N
}
diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/beans-2.0.xml b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/beans-2.0.xml
new file mode 100644
index 0000000..9120302
--- /dev/null
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/beans-2.0.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
+ bean-discovery-mode="annotated">
+</beans>
diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-4.0.xml b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-4.0.xml
new file mode 100644
index 0000000..a96b0f0
--- /dev/null
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-4.0.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
+ version="4.0">
+ <session-config>
+ <session-timeout>
+ 30
+ </session-timeout>
+ </session-config>
+</web-app>
diff --git a/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-4.0.xml b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-4.0.xml
new file mode 100644
index 0000000..0945d0c
--- /dev/null
+++ b/enterprise/j2ee.common/src/org/netbeans/modules/j2ee/common/dd/resources/web-fragment-4.0.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
+ version="4.0">
+
+</web-fragment>
diff --git a/enterprise/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilitiesTest.java b/enterprise/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilitiesTest.java
index f9d6122..69c4318 100644
--- a/enterprise/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilitiesTest.java
+++ b/enterprise/j2ee.common/test/unit/src/org/netbeans/modules/j2ee/common/J2eeProjectCapabilitiesTest.java
@@ -106,6 +106,14 @@
assertTrue(cap.isEjb32Supported());
assertTrue(cap.isEjb32LiteSupported());
+ p = createProject(Profile.JAVA_EE_8_FULL, Type.WAR);
+ cap = J2eeProjectCapabilities.forProject(p);
+ assertFalse(cap.isEjb30Supported());
+ assertTrue(cap.isEjb31Supported());
+ assertTrue(cap.isEjb31LiteSupported());
+ assertTrue(cap.isEjb32Supported());
+ assertTrue(cap.isEjb32LiteSupported());
+
p = createProject(Profile.JAVA_EE_7_FULL, Type.EJB);
cap = J2eeProjectCapabilities.forProject(p);
assertTrue(cap.isEjb30Supported());
@@ -129,6 +137,14 @@
assertTrue(cap.isEjb31LiteSupported());
assertFalse(cap.isEjb32Supported());
assertTrue(cap.isEjb32LiteSupported());
+
+ p = createProject(Profile.JAVA_EE_8_WEB, Type.WAR);
+ cap = J2eeProjectCapabilities.forProject(p);
+ assertFalse(cap.isEjb30Supported());
+ assertFalse(cap.isEjb31Supported());
+ assertTrue(cap.isEjb31LiteSupported());
+ assertFalse(cap.isEjb32Supported());
+ assertTrue(cap.isEjb32LiteSupported());
}
private Project createProject(final Profile profile, final Type type) throws IOException {
diff --git a/enterprise/j2ee.core/manifest.mf b/enterprise/j2ee.core/manifest.mf
index 1438d02..0d4abaa 100644
--- a/enterprise/j2ee.core/manifest.mf
+++ b/enterprise/j2ee.core/manifest.mf
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.j2ee.core/0
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/core/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.29
+OpenIDE-Module-Specification-Version: 1.30
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Bundle.properties b/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Bundle.properties
index fa56051..3d9277d 100644
--- a/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Bundle.properties
+++ b/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Bundle.properties
@@ -24,4 +24,5 @@
JavaEE6Web.displayName=Java EE 6 Web
JavaEE7Full.displayName=Java EE 7
JavaEE7Web.displayName=Java EE 7 Web
-
+JavaEE8Full.displayName=Java EE 8
+JavaEE8Web.displayName=Java EE 8 Web
diff --git a/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Profile.java b/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Profile.java
index 97bf20d..7222f44 100644
--- a/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Profile.java
+++ b/enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Profile.java
@@ -57,6 +57,10 @@
public static final Profile JAVA_EE_7_WEB = new Profile(7, "1.7", "web", "JavaEE7Web.displayName");
+ public static final Profile JAVA_EE_8_FULL = new Profile(8, "1.8", null, "JavaEE8Full.displayName");
+
+ public static final Profile JAVA_EE_8_WEB = new Profile(9, "1.8", "web", "JavaEE8Web.displayName");
+
private final int order;
// cache
@@ -120,24 +124,34 @@
@CheckForNull
public static Profile fromPropertiesString(@NullAllowed String value) {
- if (J2EE_13.toPropertiesString().equals(value)) {
+ String valueMinusQuotes = value;
+ if(value != null && value.contains("\"")){
+ valueMinusQuotes = value.replace("\"","");
+ }
+ if (J2EE_13.toPropertiesString().equals(valueMinusQuotes)) {
return J2EE_13;
- } else if (J2EE_14.toPropertiesString().equals(value)) {
+ } else if (J2EE_14.toPropertiesString().equals(valueMinusQuotes)) {
return J2EE_14;
- } else if (JAVA_EE_5.toPropertiesString().equals(value)) {
+ } else if (JAVA_EE_5.toPropertiesString().equals(valueMinusQuotes)) {
return JAVA_EE_5;
- } else if (JAVA_EE_6_FULL.toPropertiesString().equals(value)
- || "EE_6_FULL".equals(value)) { // NOI18N
+ } else if (JAVA_EE_6_FULL.toPropertiesString().equals(valueMinusQuotes)
+ || "EE_6_FULL".equals(value)){ // NOI18N
return JAVA_EE_6_FULL;
- } else if (JAVA_EE_6_WEB.toPropertiesString().equals(value)
+ } else if (JAVA_EE_6_WEB.toPropertiesString().equals(valueMinusQuotes)
|| "EE_6_WEB".equals(value)) {
return JAVA_EE_6_WEB;
- } else if (JAVA_EE_7_FULL.toPropertiesString().equals(value)
+ } else if (JAVA_EE_7_FULL.toPropertiesString().equals(valueMinusQuotes)
|| "EE_7_FULL".equals(value)) { // NOI18N
- return JAVA_EE_7_FULL;
- } else if (JAVA_EE_7_WEB.toPropertiesString().equals(value)
+ return JAVA_EE_8_FULL;
+ } else if (JAVA_EE_7_WEB.toPropertiesString().equals(valueMinusQuotes)
|| "EE_7_WEB".equals(value)) {
return JAVA_EE_7_WEB;
+ } else if (JAVA_EE_8_FULL.toPropertiesString().equals(valueMinusQuotes)
+ || "EE_8_FULL".equals(value)) { // NOI18N
+ return JAVA_EE_8_FULL;
+ } else if (JAVA_EE_8_WEB.toPropertiesString().equals(valueMinusQuotes)
+ || "EE_8_WEB".equals(value)) {
+ return JAVA_EE_8_WEB;
} else {
return null;
}
diff --git a/enterprise/j2ee.core/test/unit/src/org/netbeans/api/j2ee/core/ProfileTest.java b/enterprise/j2ee.core/test/unit/src/org/netbeans/api/j2ee/core/ProfileTest.java
index 8d89702..d8d3806 100644
--- a/enterprise/j2ee.core/test/unit/src/org/netbeans/api/j2ee/core/ProfileTest.java
+++ b/enterprise/j2ee.core/test/unit/src/org/netbeans/api/j2ee/core/ProfileTest.java
@@ -75,4 +75,17 @@
assertTrue(Profile.JAVA_EE_7_FULL.isAtLeast(Profile.JAVA_EE_7_WEB));
}
+ public void testIsHigherJavaEEVersionJavaEE8full() {
+ assertFalse(Profile.J2EE_13.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertFalse(Profile.J2EE_14.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertFalse(Profile.JAVA_EE_5.isAtLeast(Profile.JAVA_EE_8_WEB));
+
+ assertFalse(Profile.JAVA_EE_6_WEB.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertFalse(Profile.JAVA_EE_6_FULL.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertFalse(Profile.JAVA_EE_7_WEB.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertFalse(Profile.JAVA_EE_7_FULL.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertTrue(Profile.JAVA_EE_8_WEB.isAtLeast(Profile.JAVA_EE_8_WEB));
+ assertTrue(Profile.JAVA_EE_8_FULL.isAtLeast(Profile.JAVA_EE_8_WEB));
+}
+
}
diff --git a/enterprise/j2ee.dd/licenseinfo.xml b/enterprise/j2ee.dd/licenseinfo.xml
index 0eafc10..d7df398 100644
--- a/enterprise/j2ee.dd/licenseinfo.xml
+++ b/enterprise/j2ee.dd/licenseinfo.xml
@@ -35,6 +35,7 @@
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application_6.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application_6.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application_7.mdd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/application_7.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_1_4.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_1_4.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_5.mdd</file>
@@ -42,7 +43,9 @@
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_6.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_6.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_7.mdd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_7.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/connector_1_5.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/connector_1_7.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_2_1.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_2_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_0.mdd</file>
@@ -50,18 +53,26 @@
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_1.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_2.mdd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_2.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/j2ee_1_4.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/j2ee_web_services_1_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/j2ee_web_services_client_1_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_5.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_6.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_7.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_8.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_2.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_3.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_4.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_4_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_client_1_2.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_client_1_3.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_client_1_4.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/jsp_2_0.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/jsp_2_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/jsp_2_2.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/jsp_2_3.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/permissions_7.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_2_2.dtd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_2_2_1.dtd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_2_3.dtd</file>
@@ -73,26 +84,13 @@
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_3_0.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_3_0.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_3_1.mdd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_3_1.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_4_0.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-common_3_0.xsd</file>
+ <file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-common_3_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-fragment_3_0.mdd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-fragment_3_0.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-fragment_3_1.mdd</file>
- <license ref="CDDL-1.0" />
- <comment type="CATEGORY_B" />
- </fileset>
- <fileset>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/application_7.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/application-client_7.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/connector_1_7.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/ejb-jar_3_2.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_7.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_4.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_1_4_1.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_web_services_client_1_4.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/jsp_2_3.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/permissions_7.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_3_1.xsd</file>
- <file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-common_3_1.xsd</file>
<file>src/org/netbeans/modules/j2ee/dd/impl/resources/web-fragment_3_1.xsd</file>
<license ref="CDDL-1.1" />
<comment type="CATEGORY_B" />
diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/WebApp.java b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/WebApp.java
index f261f6f..c3d6b82 100644
--- a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/WebApp.java
+++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/WebApp.java
@@ -51,6 +51,7 @@
* @since 1.29
*/
static final String VERSION_3_1 = "3.1"; //NOI18N
+ static final String VERSION_4_0 = "4.0"; //NOI18N
static final int STATE_VALID = 0;
static final int STATE_INVALID_PARSABLE = 1;
static final int STATE_INVALID_UNPARSABLE = 2;
diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_8.xsd b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_8.xsd
new file mode 100644
index 0000000..72b53f5
--- /dev/null
+++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/javaee_8.xsd
@@ -0,0 +1,3098 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema targetNamespace="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="8">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 2009-2017 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following definitions that appear in the common
+ shareable schema(s) of Java EE deployment descriptors should be
+ interpreted with respect to the context they are included:
+
+ Deployment Component may indicate one of the following:
+ java ee application;
+ application client;
+ web application;
+ enterprise bean;
+ resource adapter;
+
+ Deployment File may indicate one of the following:
+ ear file;
+ war file;
+ jar file;
+ rar file;
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ <xsd:include schemaLocation="javaee_web_services_client_1_4.xsd"/>
+
+ <xsd:group name="descriptionGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained description related
+ elements consistent across Java EE deployment descriptors.
+
+ All elements may occur multiple times with different languages,
+ to support localization of the content.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="display-name"
+ type="javaee:display-nameType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="icon"
+ type="javaee:iconType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:group name="jndiEnvironmentRefsGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group keeps the usage of the contained JNDI environment
+ reference elements consistent across Java EE deployment descriptors.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="env-entry"
+ type="javaee:env-entryType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref"
+ type="javaee:ejb-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-local-ref"
+ type="javaee:ejb-local-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:group ref="javaee:service-refGroup"/>
+ <xsd:element name="resource-ref"
+ type="javaee:resource-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref"
+ type="javaee:resource-env-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref"
+ type="javaee:message-destination-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref"
+ type="javaee:persistence-context-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref"
+ type="javaee:persistence-unit-refType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="post-construct"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="pre-destroy"
+ type="javaee:lifecycle-callbackType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="data-source"
+ type="javaee:data-sourceType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="jms-connection-factory"
+ type="javaee:jms-connection-factoryType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="jms-destination"
+ type="javaee:jms-destinationType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="mail-session"
+ type="javaee:mail-sessionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="connection-factory"
+ type="javaee:connection-factory-resourceType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="administered-object"
+ type="javaee:administered-objectType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:group name="resourceGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group collects elements that are common to most
+ JNDI resource elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:resourceBaseGroup"/>
+ <xsd:element name="lookup-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The JNDI name to be looked up to resolve a resource reference.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:group name="resourceBaseGroup">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This group collects elements that are common to all the
+ JNDI resource elements. It does not include the lookup-name
+ element, that is only applicable to some resource elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A product specific name that this resource should be
+ mapped to. The name of this resource, as defined by the
+ resource's name element or defaulted, is a name that is
+ local to the application component using the resource.
+ (It's a name in the JNDI java:comp/env namespace.) Many
+ application servers provide a way to map these local
+ names to names of resources known to the application
+ server. This mapped name is often a global JNDI name,
+ but may be a name of any form.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="injection-target"
+ type="javaee:injection-targetType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="administered-objectType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of an administered object.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this administered object.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ administered object being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="interface-name"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The administered object's interface type.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="class-name"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The administered object's class name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-adapter"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Resource adapter name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Property of the administered object property. This may be a
+ vendor-specific property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="connection-factory-resourceType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of a Connector Connection Factory resource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this resource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ resource being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="interface-name"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The fully qualified class name of the connection factory
+ interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-adapter"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Resource adapter name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Maximum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="min-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Minimum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="transaction-support"
+ type="javaee:transaction-supportType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The level of transaction support the connection factory
+ needs to support.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Resource property. This may be a vendor-specific
+ property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="data-sourceType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of a DataSource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this DataSource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ data source being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="class-name"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DataSource, XADataSource or ConnectionPoolDataSource
+ implementation class.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="server-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Database server name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="port-number"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Port number where a server is listening for requests.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="database-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Name of a database on a server.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="url"
+ type="javaee:jdbc-urlType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ A JDBC URL. If the <code>url</code> property is specified
+ along with other standard <code>DataSource</code> properties
+ such as <code>serverName</code>, <code>databaseName</code>
+ and <code>portNumber</code>, the more specific properties will
+ take precedence and <code>url</code> will be ignored.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="user"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ User name to use for connection authentication.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="password"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Password to use for connection authentication.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ JDBC DataSource property. This may be a vendor-specific
+ property or a less commonly used DataSource property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="login-timeout"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Sets the maximum time in seconds that this data source
+ will wait while attempting to connect to a database.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="transactional"
+ type="javaee:xsdBooleanType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Set to false if connections should not participate in
+ transactions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="isolation-level"
+ type="javaee:isolation-levelType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Isolation level for connections.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="initial-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Number of connections that should be created when a
+ connection pool is initialized.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Maximum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="min-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Minimum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-idle-time"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The number of seconds that a physical connection should
+ remain unused in the pool before the connection is
+ closed for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-statements"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The total number of statements that a connection pool
+ should keep open.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="descriptionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The description type is used by a description element to
+ provide text describing the parent element. The elements
+ that use this type should include any information that the
+ Deployment Component's Deployment File file producer wants
+ to provide to the consumer of the Deployment Component's
+ Deployment File (i.e., to the Deployer). Typically, the
+ tools used by such a Deployment File consumer will display
+ the description when processing the parent element that
+ contains the description.
+
+ The lang attribute defines the language that the
+ description is provided in. The default value is "en" (English).
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:xsdStringType">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="dewey-versionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines a dewey decimal that is used
+ to describe versions of documents.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="\.?[0-9]+(\.[0-9]+)*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="display-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The display-name type contains a short name that is intended
+ to be displayed by tools. It is used by display-name
+ elements. The display name need not be unique.
+
+ Example:
+
+ ...
+ <display-name xml:lang="en">
+ Employee Self Service
+ </display-name>
+
+ The value of the xml:lang attribute is "en" (English) by default.
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:string">
+ <xsd:attribute ref="xml:lang"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The ejb-linkType is used by ejb-link
+ elements in the ejb-ref or ejb-local-ref elements to specify
+ that an EJB reference is linked to enterprise bean.
+
+ The value of the ejb-link element must be the ejb-name of an
+ enterprise bean in the same ejb-jar file or in another ejb-jar
+ file in the same Java EE application unit.
+
+ Alternatively, the name in the ejb-link element may be
+ composed of a path name specifying the ejb-jar containing the
+ referenced enterprise bean with the ejb-name of the target
+ bean appended and separated from the path name by "#". The
+ path name is relative to the Deployment File containing
+ Deployment Component that is referencing the enterprise
+ bean. This allows multiple enterprise beans with the same
+ ejb-name to be uniquely identified.
+
+ Examples:
+
+ <ejb-link>EmployeeRecord</ejb-link>
+
+ <ejb-link>../products/product.jar#ProductEJB</ejb-link>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-local-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-refType is used by ejb-local-ref elements for
+ the declaration of a reference to an enterprise bean's local
+ home or to the local business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of the Deployment
+ Component that's referencing the enterprise bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional expected local interface of the referenced
+ enterprise bean or the local business interface of the
+ referenced enterprise bean.
+ - the optional expected local home interface of the referenced
+ enterprise bean. Not applicable if this ejb-local-ref refers
+ to the local business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="local-home"
+ type="javaee:local-homeType"
+ minOccurs="0"/>
+ <xsd:element name="local"
+ type="javaee:localType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. The name must be unique within the
+ Deployment Component.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ Example:
+
+ <ejb-ref-name>ejb/Payroll</ejb-ref-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:jndi-nameType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-refType is used by ejb-ref elements for the
+ declaration of a reference to an enterprise bean's home or
+ to the remote business interface of a 3.0 bean.
+ The declaration consists of:
+
+ - an optional description
+ - the EJB reference name used in the code of
+ the Deployment Component that's referencing the enterprise
+ bean.
+ - the optional expected type of the referenced enterprise bean
+ - the optional remote interface of the referenced enterprise bean
+ or the remote business interface of the referenced enterprise
+ bean
+ - the optional expected home interface of the referenced
+ enterprise bean. Not applicable if this ejb-ref
+ refers to the remote business interface of a 3.0 bean.
+ - optional ejb-link information, used to specify the
+ referenced enterprise bean
+ - optional elements to define injection of the named enterprise
+ bean into a component field or property
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="ejb-ref-name"
+ type="javaee:ejb-ref-nameType"/>
+ <xsd:element name="ejb-ref-type"
+ type="javaee:ejb-ref-typeType"
+ minOccurs="0"/>
+ <xsd:element name="home"
+ type="javaee:homeType"
+ minOccurs="0"/>
+ <xsd:element name="remote"
+ type="javaee:remoteType"
+ minOccurs="0"/>
+ <xsd:element name="ejb-link"
+ type="javaee:ejb-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="ejb-ref-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-typeType contains the expected type of the
+ referenced enterprise bean.
+
+ The ejb-ref-type designates a value
+ that must be one of the following:
+
+ Entity
+ Session
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Entity"/>
+ <xsd:enumeration value="Session"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="emptyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is used to designate an empty
+ element when used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entryType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entryType is used to declare an application's
+ environment entry. The declaration consists of an optional
+ description, the name of the environment entry, a type
+ (optional if the value is injected, otherwise required), and
+ an optional value.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ If a value is not specified and injection is requested,
+ no injection will occur and no entry of the specified name
+ will be created. This allows an initial value to be
+ specified in the source code without being incorrectly
+ changed when no override has been specified.
+
+ If a value is not specified and no injection is requested,
+ a value must be supplied during deployment.
+
+ This type is used by env-entry elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="env-entry-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The env-entry-name element contains the name of a
+ Deployment Component's environment entry. The name
+ is a JNDI name relative to the java:comp/env
+ context. The name must be unique within a
+ Deployment Component. The uniqueness
+ constraints must be defined within the declared
+ context.
+
+ Example:
+
+ <env-entry-name>minAmount</env-entry-name>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="env-entry-type"
+ type="javaee:env-entry-type-valuesType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The env-entry-type element contains the Java language
+ type of the environment entry. If an injection target
+ is specified for the environment entry, the type may
+ be omitted, or must match the type of the injection
+ target. If no injection target is specified, the type
+ is required.
+
+ Example:
+
+ <env-entry-type>java.lang.Integer</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="env-entry-value"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The env-entry-value designates the value of a
+ Deployment Component's environment entry. The value
+ must be a String that is valid for the
+ constructor of the specified type that takes a
+ single String parameter, or for java.lang.Character,
+ a single character.
+
+ Example:
+
+ <env-entry-value>100.00</env-entry-value>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="env-entry-type-valuesType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ This type contains the fully-qualified Java type of the
+ environment entry value that is expected by the
+ application's code.
+
+ The following are the legal values of env-entry-type-valuesType:
+
+ java.lang.Boolean
+ java.lang.Byte
+ java.lang.Character
+ java.lang.String
+ java.lang.Short
+ java.lang.Integer
+ java.lang.Long
+ java.lang.Float
+ java.lang.Double
+ java.lang.Class
+ any enumeration type (i.e. a subclass of java.lang.Enum)
+
+ Examples:
+
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+ <env-entry-type>java.lang.Class</env-entry-type>
+ <env-entry-type>com.example.Color</env-entry-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate the name of a
+ Java class or interface. The name is in the form of a
+ "binary name", as defined in the JLS. This is the form
+ of name used in Class.forName(). Tools that need the
+ canonical name (the name used in source code) will need
+ to convert this binary name to the canonical name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="generic-booleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type defines four different values which can designate
+ boolean values. This includes values yes and no which are
+ not designated by xsd:boolean
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="true"/>
+ <xsd:enumeration value="false"/>
+ <xsd:enumeration value="yes"/>
+ <xsd:enumeration value="no"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="iconType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The icon type contains small-icon and large-icon elements
+ that specify the file names for small and large GIF, JPEG,
+ or PNG icon images used to represent the parent element in a
+ GUI tool.
+
+ The xml:lang attribute defines the language that the
+ icon file names are provided in. Its value is "en" (English)
+ by default.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="small-icon"
+ type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The small-icon element contains the name of a file
+ containing a small (16 x 16) icon image. The file
+ name is a relative path within the Deployment
+ Component's Deployment File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <small-icon>employee-service-icon16x16.jpg</small-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="large-icon"
+ type="javaee:pathType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The large-icon element contains the name of a file
+ containing a large
+ (32 x 32) icon image. The file name is a relative
+ path within the Deployment Component's Deployment
+ File.
+
+ The image may be in the GIF, JPEG, or PNG format.
+ The icon can be used by tools.
+
+ Example:
+
+ <large-icon>employee-service-icon32x32.jpg</large-icon>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute ref="xml:lang"/>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="injection-targetType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ An injection target specifies a class and a name within
+ that class into which a resource should be injected.
+
+ The injection target class specifies the fully qualified
+ class name that is the target of the injection. The
+ Java EE specifications describe which classes can be an
+ injection target.
+
+ The injection target name specifies the target within
+ the specified class. The target is first looked for as a
+ JavaBeans property name. If not found, the target is
+ looked for as a field name.
+
+ The specified resource will be injected into the target
+ during initialization of the class by either calling the
+ set method for the target property or by setting a value
+ into the named field.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="injection-target-class"
+ type="javaee:fully-qualified-classType"/>
+ <xsd:element name="injection-target-name"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:simpleType name="isolation-levelType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following transaction isolation levels are allowed
+ (see documentation for the java.sql.Connection interface):
+ TRANSACTION_READ_UNCOMMITTED
+ TRANSACTION_READ_COMMITTED
+ TRANSACTION_REPEATABLE_READ
+ TRANSACTION_SERIALIZABLE
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="TRANSACTION_READ_UNCOMMITTED"/>
+ <xsd:enumeration value="TRANSACTION_READ_COMMITTED"/>
+ <xsd:enumeration value="TRANSACTION_REPEATABLE_READ"/>
+ <xsd:enumeration value="TRANSACTION_SERIALIZABLE"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The java-identifierType defines a Java identifier.
+ The users of this type should further verify that
+ the content does not contain Java reserved keywords.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="($|_|\p{L})(\p{L}|\p{Nd}|_|$)*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="java-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a generic type that designates a Java primitive
+ type or a fully qualified name of a Java interface/type,
+ or an array of such types.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="[^\p{Z}]*"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jdbc-urlType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The jdbc-urlType contains the url pattern of the mapping.
+ It must follow the rules specified in Section 9.3 of the
+ JDBC Specification where the format is:
+
+ jdbc:<subprotocol>:<subname>
+
+ Example:
+
+ <url>jdbc:mysql://localhost:3307/testdb</url>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="jdbc:(.*):(.*)"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jms-connection-factoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of a JMS Connection Factory.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this JMS Connection Factory.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ JMS connection factory being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="interface-name"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Fully-qualified name of the JMS connection factory
+ interface. Permitted values are javax.jms.ConnectionFactory,
+ javax.jms.QueueConnectionFactory, or
+ javax.jms.TopicConnectionFactory. If not specified,
+ javax.jms.ConnectionFactory will be used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="class-name"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Fully-qualified name of the JMS connection factory
+ implementation class. Ignored if a resource adapter
+ is used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-adapter"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Resource adapter name. If not specified, the application
+ server will define the default behavior, which may or may
+ not involve the use of a resource adapter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="user"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ User name to use for connection authentication.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="password"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Password to use for connection authentication.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="client-id"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Client id to use for connection.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ JMS Connection Factory property. This may be a vendor-specific
+ property or a less commonly used ConnectionFactory property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="transactional"
+ type="javaee:xsdBooleanType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Set to false if connections should not participate in
+ transactions.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="max-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Maximum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="min-pool-size"
+ type="javaee:xsdIntegerType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Minimum number of connections that should be concurrently
+ allocated for a connection pool.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jms-destinationType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of a JMS Destination.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this JMS Destination.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ JMS destination being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="interface-name"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Fully-qualified name of the JMS destination interface.
+ Permitted values are javax.jms.Queue and javax.jms.Topic
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="class-name"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Fully-qualified name of the JMS destination implementation
+ class. Ignored if a resource adapter is used unless the
+ resource adapter defines more than one destination implementation
+ class for the specified interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-adapter"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Resource adapter name. If not specified, the application
+ server will define the default behavior, which may or may
+ not involve the use of a resource adapter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="destination-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Name of the queue or topic.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ JMS Destination property. This may be a vendor-specific
+ property or a less commonly used Destination property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The jndi-nameType type designates a JNDI name in the
+ Deployment Component's environment and is relative to the
+ java:comp/env context. A JNDI name must be unique within the
+ Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The homeType defines the fully-qualified name of
+ an enterprise bean's home interface.
+
+ Example:
+
+ <home>com.aardvark.payroll.PayrollHome</home>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="lifecycle-callbackType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The lifecycle-callback type specifies a method on a
+ class to be called when a lifecycle event occurs.
+ Note that each class may have only one lifecycle callback
+ method for any given event and that the method may not
+ be overloaded.
+
+ If the lifefycle-callback-class element is missing then
+ the class defining the callback is assumed to be the
+ component class in scope at the place in the descriptor
+ in which the callback definition appears.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="lifecycle-callback-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0"/>
+ <xsd:element name="lifecycle-callback-method"
+ type="javaee:java-identifierType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="listenerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listenerType indicates the deployment properties for a web
+ application listener bean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="listener-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The listener-class element declares a class in the
+ application must be registered as a web
+ application listener bean. The value is the fully
+ qualified classname of the listener class.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="localType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The localType defines the fully-qualified name of an
+ enterprise bean's local interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="local-homeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The local-homeType defines the fully-qualified
+ name of an enterprise bean's local home interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="mail-sessionType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Configuration of a Mail Session resource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Description of this Mail Session resource.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The name element specifies the JNDI name of the
+ Mail Session resource being defined.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="store-protocol"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Storage protocol.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="store-protocol-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Service provider store protocol implementation class
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="transport-protocol"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Transport protocol.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="transport-protocol-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Service provider transport protocol implementation class
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="host"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Mail server host name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="user"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Mail server user name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="password"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Password.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="from"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Email address to indicate the message sender.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Mail server property. This may be a vendor-specific
+ property.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="param-valueType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type is a general type that can be used to declare
+ parameter/value lists.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="param-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-name element contains the name of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="param-value"
+ type="javaee:xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The param-value element contains the value of a
+ parameter.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The elements that use this type designate either a relative
+ path or an absolute path starting with a "/".
+
+ In elements that specify a pathname to a file within the
+ same Deployment File, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the Deployment File's namespace. Absolute filenames (i.e.,
+ those starting with "/") also specify names in the root of
+ the Deployment File's namespace. In general, relative names
+ are preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The persistence-context-ref element contains a declaration
+ of Deployment Component's reference to a persistence context
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence context reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - an optional specification as to whether
+ the persistence context type is Transaction or
+ Extended. If not specified, Transaction is assumed.
+ - an optional specification as to whether
+ the persistence context synchronization with the current
+ transaction is Synchronized or Unsynchronized. If not
+ specified, Synchronized is assumed.
+ - an optional list of persistence properties
+ - optional injection targets
+
+ Examples:
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ </persistence-context-ref>
+
+ <persistence-context-ref>
+ <persistence-context-ref-name>myPersistenceContext
+ </persistence-context-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ <persistence-context-type>Extended</persistence-context-type>
+ </persistence-context-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-context-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-ref-name element specifies
+ the name of a persistence context reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-context-type"
+ type="javaee:persistence-context-typeType"
+ minOccurs="0"/>
+ <xsd:element name="persistence-context-synchronization"
+ type="javaee:persistence-context-synchronizationType"
+ minOccurs="0"/>
+ <xsd:element name="persistence-property"
+ type="javaee:propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Used to specify properties for the container or persistence
+ provider. Vendor-specific properties may be included in
+ the set of properties. Properties that are not recognized
+ by a vendor must be ignored. Entries that make use of the
+ namespace javax.persistence and its subnamespaces must not
+ be used for vendor-specific properties. The namespace
+ javax.persistence is reserved for use by the specification.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:group ref="javaee:resourceBaseGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-synchronizationType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-synchronizationType specifies
+ whether a container-managed persistence context is automatically
+ synchronized with the current transaction.
+
+ The value of the persistence-context-synchronization element
+ must be one of the following:
+ Synchronized
+ Unsynchronized
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Synchronized"/>
+ <xsd:enumeration value="Unsynchronized"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-context-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-context-typeType specifies the transactional
+ nature of a persistence context reference.
+
+ The value of the persistence-context-type element must be
+ one of the following:
+ Transaction
+ Extended
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Transaction"/>
+ <xsd:enumeration value="Extended"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="propertyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Specifies a name/value pair.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:xsdStringType">
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-unit-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The persistence-unit-ref element contains a declaration
+ of Deployment Component's reference to a persistence unit
+ associated within a Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the persistence unit reference name
+ - an optional persistence unit name. If not specified,
+ the default persistence unit is assumed.
+ - optional injection targets
+
+ Examples:
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ </persistence-unit-ref>
+
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>myPersistenceUnit
+ </persistence-unit-ref-name>
+ <persistence-unit-name>PersistenceUnit1
+ </persistence-unit-name>
+ </persistence-unit-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="persistence-unit-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The persistence-unit-ref-name element specifies
+ the name of a persistence unit reference; its
+ value is the environment entry name used in
+ Deployment Component code. The name is a JNDI name
+ relative to the java:comp/env context.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="persistence-unit-name"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The Application Assembler(or BeanProvider) may use the
+ following syntax to avoid the need to rename persistence
+ units to have unique names within a Java EE application.
+
+ The Application Assembler specifies the pathname of the
+ root of the persistence.xml file for the referenced
+ persistence unit and appends the name of the persistence
+ unit separated from the pathname by #. The pathname is
+ relative to the referencing application component jar file.
+ In this manner, multiple persistence units with the same
+ persistence unit name may be uniquely identified when the
+ Application Assembler cannot change persistence unit names.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:group ref="javaee:resourceBaseGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="remoteType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The remote element contains the fully-qualified name
+ of the enterprise bean's remote interface.
+
+ Example:
+
+ <remote>com.wombat.empl.EmployeeService</remote>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-env-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The resource-env-refType is used to define
+ resource-env-ref elements. It contains a declaration of a
+ Deployment Component's reference to an administered object
+ associated with a resource in the Deployment Component's
+ environment. It consists of an optional description, the
+ resource environment reference name, and an optional
+ indication of the resource environment reference type
+ expected by the Deployment Component code.
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The resource environment type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-env-ref>
+ <resource-env-ref-name>jms/StockQueue
+ </resource-env-ref-name>
+ <resource-env-ref-type>javax.jms.Queue
+ </resource-env-ref-type>
+ </resource-env-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="resource-env-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name
+ of a resource environment reference; its value is
+ the environment entry name used in
+ the Deployment Component code. The name is a JNDI
+ name relative to the java:comp/env context and must
+ be unique within a Deployment Component.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-env-ref-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-type element specifies the type
+ of a resource environment reference. It is the
+ fully qualified name of a Java language class or
+ interface.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="resource-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The resource-refType contains a declaration of a
+ Deployment Component's reference to an external resource. It
+ consists of an optional description, the resource manager
+ connection factory reference name, an optional indication of
+ the resource manager connection factory type expected by the
+ Deployment Component code, an optional type of authentication
+ (Application or Container), and an optional specification of
+ the shareability of connections obtained from the resource
+ (Shareable or Unshareable).
+
+ It also includes optional elements to define injection of
+ the named resource into fields or JavaBeans properties.
+
+ The connection factory type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Example:
+
+ <resource-ref>
+ <res-ref-name>jdbc/EmployeeAppDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="res-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference.
+ The name is a JNDI name relative to the
+ java:comp/env context.
+ The name must be unique within a Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="res-type"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-type element specifies the type of the data
+ source. The type is specified by the fully qualified
+ Java language class or interface
+ expected to be implemented by the data source.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="res-auth"
+ type="javaee:res-authType"
+ minOccurs="0"/>
+ <xsd:element name="res-sharing-scope"
+ type="javaee:res-sharing-scopeType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-authType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-authType specifies whether the Deployment Component
+ code signs on programmatically to the resource manager, or
+ whether the Container will sign on to the resource manager
+ on behalf of the Deployment Component. In the latter case,
+ the Container uses information that is supplied by the
+ Deployer.
+
+ The value must be one of the two following:
+
+ Application
+ Container
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Application"/>
+ <xsd:enumeration value="Container"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="res-sharing-scopeType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-sharing-scope type specifies whether connections
+ obtained through the given resource manager connection
+ factory reference can be shared. The value, if specified,
+ must be one of the two following:
+
+ Shareable
+ Unshareable
+
+ The default value is Shareable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Shareable"/>
+ <xsd:enumeration value="Unshareable"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="run-asType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The run-asType specifies the run-as identity to be
+ used for the execution of a component. It contains an
+ optional description, and the name of a security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-nameType designates the name of a security role.
+
+ The name must conform to the lexical rules for a token.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-roleType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The security-roleType contains the definition of a security
+ role. The definition consists of an optional description of
+ the security role, and the security role name.
+
+ Example:
+
+ <security-role>
+ <description>
+ This role includes all employees who are authorized
+ to access the employee service application.
+ </description>
+ <role-name>employee</role-name>
+ </security-role>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="security-role-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The security-role-refType contains the declaration of a
+ security role reference in a component's or a
+ Deployment Component's code. The declaration consists of an
+ optional description, the security role name used in the
+ code, and an optional link to a security role. If the
+ security role is not specified, the Deployer must choose an
+ appropriate security role.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="role-name"
+ type="javaee:role-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The value of the role-name element must be the String used
+ as the parameter to the
+ EJBContext.isCallerInRole(String roleName) method or the
+ HttpServletRequest.isUserInRole(String role) method.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="role-link"
+ type="javaee:role-nameType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The role-link element is a reference to a defined
+ security role. The role-link element must contain
+ the name of one of the security roles defined in the
+ security-role elements.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdQNameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:QName.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:QName">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdBooleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:boolean.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:boolean">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNMTOKENType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:NMTOKEN.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:NMTOKEN">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdAnyURIType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:anyURI.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:integer.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:integer">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdPositiveIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:positiveInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:positiveInteger">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdNonNegativeIntegerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:nonNegativeInteger.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:nonNegativeInteger">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="xsdStringType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This type adds an "id" attribute to xsd:string.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This is a special string datatype that is defined by Java EE as
+ a base type for defining collapsed strings. When schemas
+ require trailing/leading space elimination as well as
+ collapsing the existing whitespace, this base type may be
+ used.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:token">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="true-falseType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This simple type designates a boolean with only two
+ permissible values
+
+ - true
+ - false
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:xsdBooleanType">
+ <xsd:pattern value="(true|false)"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="url-patternType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The url-patternType contains the url pattern of the mapping.
+ It must follow the rules specified in Section 11.2 of the
+ Servlet API Specification. This pattern is assumed to be in
+ URL-decoded form and must not contain CR(#xD) or LF(#xA).
+ If it contains those characters, the container must inform
+ the developer with a descriptive error message.
+ The container must preserve all characters including whitespaces.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destinationType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The message-destinationType specifies a message
+ destination. The logical destination described by this
+ element is mapped to a physical destination by the Deployer.
+
+ The message destination element contains:
+
+ - an optional description
+ - an optional display-name
+ - an optional icon
+ - a message destination name which must be unique
+ among message destination names within the same
+ Deployment File.
+ - an optional mapped name
+ - an optional lookup name
+
+ Example:
+
+ <message-destination>
+ <message-destination-name>CorporateStocks
+ </message-destination-name>
+ </message-destination>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="message-destination-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-name element specifies a
+ name for a message destination. This name must be
+ unique among the names of message destinations
+ within the Deployment File.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="mapped-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A product specific name that this message destination
+ should be mapped to. Each message-destination-ref
+ element that references this message destination will
+ define a name in the namespace of the referencing
+ component or in one of the other predefined namespaces.
+ Many application servers provide a way to map these
+ local names to names of resources known to the
+ application server. This mapped name is often a global
+ JNDI name, but may be a name of any form. Each of the
+ local names should be mapped to this same global name.
+
+ Application servers are not required to support any
+ particular form or type of mapped name, nor the ability
+ to use mapped names. The mapped name is
+ product-dependent and often installation-dependent. No
+ use of a mapped name is portable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="lookup-name"
+ type="javaee:xsdStringType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The JNDI name to be looked up to resolve the message destination.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-refType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The message-destination-ref element contains a declaration
+ of Deployment Component's reference to a message destination
+ associated with a resource in Deployment Component's
+ environment. It consists of:
+
+ - an optional description
+ - the message destination reference name
+ - an optional message destination type
+ - an optional specification as to whether
+ the destination is used for
+ consuming or producing messages, or both.
+ if not specified, "both" is assumed.
+ - an optional link to the message destination
+ - optional injection targets
+
+ The message destination type must be supplied unless an
+ injection target is specified, in which case the type
+ of the target is used. If both are specified, the type
+ must be assignment compatible with the type of the injection
+ target.
+
+ Examples:
+
+ <message-destination-ref>
+ <message-destination-ref-name>jms/StockQueue
+ </message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+ <message-destination-usage>Consumes
+ </message-destination-usage>
+ <message-destination-link>CorporateStocks
+ </message-destination-link>
+ </message-destination-ref>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description"
+ type="javaee:descriptionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="message-destination-ref-name"
+ type="javaee:jndi-nameType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies
+ the name of a message destination reference; its
+ value is the environment entry name used in
+ Deployment Component code.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="message-destination-type"
+ type="javaee:message-destination-typeType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-usage"
+ type="javaee:message-destination-usageType"
+ minOccurs="0"/>
+ <xsd:element name="message-destination-link"
+ type="javaee:message-destination-linkType"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:resourceGroup"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-usageType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-usageType specifies the use of the
+ message destination indicated by the reference. The value
+ indicates whether messages are consumed from the message
+ destination, produced for the destination, or both. The
+ Assembler makes use of this information in linking producers
+ of a destination with its consumers.
+
+ The value of the message-destination-usage element must be
+ one of the following:
+ Consumes
+ Produces
+ ConsumesProduces
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="Consumes"/>
+ <xsd:enumeration value="Produces"/>
+ <xsd:enumeration value="ConsumesProduces"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-typeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ The message-destination-typeType specifies the type of
+ the destination. The type is specified by the Java interface
+ expected to be implemented by the destination.
+
+ Example:
+
+ <message-destination-type>javax.jms.Queue
+ </message-destination-type>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="message-destination-linkType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-linkType is used to link a message
+ destination reference or message-driven bean to a message
+ destination.
+
+ The Assembler sets the value to reflect the flow of messages
+ between producers and consumers in the application.
+
+ The value must be the message-destination-name of a message
+ destination in the same Deployment File or in another
+ Deployment File in the same Java EE application unit.
+
+ Alternatively, the value may be composed of a path name
+ specifying a Deployment File containing the referenced
+ message destination with the message-destination-name of the
+ destination appended and separated from the path name by
+ "#". The path name is relative to the Deployment File
+ containing Deployment Component that is referencing the
+ message destination. This allows multiple message
+ destinations with the same name to be uniquely identified.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="transaction-supportType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The transaction-supportType specifies the level of
+ transaction support provided by the resource adapter. It is
+ used by transaction-support elements.
+
+ The value must be one of the following:
+
+ NoTransaction
+ LocalTransaction
+ XATransaction
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:enumeration value="NoTransaction"/>
+ <xsd:enumeration value="LocalTransaction"/>
+ <xsd:enumeration value="XATransaction"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_4_0.xsd b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_4_0.xsd
new file mode 100644
index 0000000..8619ef6
--- /dev/null
+++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/resources/web-app_4_0.xsd
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="4.0">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 2009-2017 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+ This is the XML Schema for the Servlet 4.0 deployment descriptor.
+ The deployment descriptor must be named "WEB-INF/web.xml" in the
+ web application's war file. All Servlet deployment descriptors
+ must indicate the web application schema by using the Java EE
+ namespace:
+
+ http://xmlns.jcp.org/xml/ns/javaee
+
+ and by indicating the version of the schema by
+ using the version element as shown below:
+
+ <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="4.0">
+ ...
+ </web-app>
+
+ The instance documents may indicate the published version of
+ the schema using the xsi:schemaLocation attribute for Java EE
+ namespace with the following location:
+
+ http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The following conventions apply to all Java EE
+ deployment descriptor elements unless indicated otherwise.
+
+ - In elements that specify a pathname to a file within the
+ same JAR file, relative filenames (i.e., those not
+ starting with "/") are considered relative to the root of
+ the JAR file's namespace. Absolute filenames (i.e., those
+ starting with "/") also specify names in the root of the
+ JAR file's namespace. In general, relative names are
+ preferred. The exception is .war files where absolute
+ names are preferred for consistency with the Servlet API.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:include schemaLocation="web-common_4_0.xsd"/>
+
+
+<!-- **************************************************** -->
+
+ <xsd:element name="web-app"
+ type="javaee:web-appType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The web-app element is the root of the deployment
+ descriptor for a web application. Note that the sub-elements
+ of this element can be in the arbitrary order. Because of
+ that, the multiplicity of the elements of distributable,
+ session-config, welcome-file-list, jsp-config, login-config,
+ and locale-encoding-mapping-list was changed from "?" to "*"
+ in this schema. However, the deployment descriptor instance
+ file must not contain multiple elements of session-config,
+ jsp-config, and login-config. When there are multiple elements of
+ welcome-file-list or locale-encoding-mapping-list, the container
+ must concatenate the element contents. The multiple occurence
+ of the element distributable is redundant and the container
+ treats that case exactly in the same way when there is only
+ one distributable.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:unique name="web-common-servlet-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The servlet element contains the name of a servlet.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet"/>
+ <xsd:field xpath="javaee:servlet-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-filter-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The filter element contains the name of a filter.
+ The name must be unique within the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:filter"/>
+ <xsd:field xpath="javaee:filter-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-ejb-local-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-local-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-local-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-ejb-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The ejb-ref-name element contains the name of an EJB
+ reference. The EJB reference is an entry in the web
+ application's environment and is relative to the
+ java:comp/env context. The name must be unique within
+ the web application.
+
+ It is recommended that name is prefixed with "ejb/".
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:ejb-ref"/>
+ <xsd:field xpath="javaee:ejb-ref-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-resource-env-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The resource-env-ref-name element specifies the name of
+ a resource environment reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-env-ref"/>
+ <xsd:field xpath="javaee:resource-env-ref-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-message-destination-ref-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The message-destination-ref-name element specifies the name of
+ a message destination reference; its value is the
+ environment entry name used in the web application code.
+ The name is a JNDI name relative to the java:comp/env
+ context and must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:message-destination-ref"/>
+ <xsd:field xpath="javaee:message-destination-ref-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-res-ref-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The res-ref-name element specifies the name of a
+ resource manager connection factory reference. The name
+ is a JNDI name relative to the java:comp/env context.
+ The name must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:resource-ref"/>
+ <xsd:field xpath="javaee:res-ref-name"/>
+ </xsd:unique>
+ <xsd:unique name="web-common-env-entry-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The env-entry-name element contains the name of a web
+ application's environment entry. The name is a JNDI
+ name relative to the java:comp/env context. The name
+ must be unique within a web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:env-entry"/>
+ <xsd:field xpath="javaee:env-entry-name"/>
+ </xsd:unique>
+ <xsd:key name="web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ A role-name-key is specified to allow the references
+ from the security-role-refs.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:security-role"/>
+ <xsd:field xpath="javaee:role-name"/>
+ </xsd:key>
+ <xsd:keyref name="web-common-role-name-references"
+ refer="javaee:web-common-role-name-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The keyref indicates the references from
+ security-role-ref to a specified role-name.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:servlet/javaee:security-role-ref"/>
+ <xsd:field xpath="javaee:role-link"/>
+ </xsd:keyref>
+ </xsd:element>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="web-appType">
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="module-name"
+ type="javaee:string"
+ minOccurs="0"/>
+ <xsd:group ref="javaee:web-commonType"/>
+ <xsd:element name="default-context-path"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ When specified, this element provides a default context path
+ of the web application. An empty value for this element must cause
+ the web application to be deployed at the root for the container.
+ Otherwise, the default context path must start with
+ a “/“ character but not end with a “/“ character.
+ Servlet containers may provide vendor specific configuration
+ options that allows specifying a value that overrides the value
+ specified here.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="request-character-encoding"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ When specified, this element provides a default request
+ character encoding of the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="response-character-encoding"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ When specified, this element provides a default response
+ character encoding of the web application.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="deny-uncovered-http-methods"
+ type="javaee:emptyType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ When specified, this element causes uncovered http methods
+ to be denied. For every url-pattern that is the target of a
+ security-constrant, this element causes all HTTP methods that
+ are NOT covered (by a security constraint) at the url-pattern
+ to be denied.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="absolute-ordering"
+ type="javaee:absoluteOrderingType"/>
+ </xsd:choice>
+ <xsd:attributeGroup ref="javaee:web-common-attributes"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="absoluteOrderingType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Please see section 8.2.2 of the specification for details.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="others"
+ type="javaee:ordering-othersType"
+ minOccurs="0"
+ maxOccurs="1"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/enterprise/j2ee.ddloaders/src/org/netbeans/modules/j2ee/ddloaders/catalog/EnterpriseCatalog.java b/enterprise/j2ee.ddloaders/src/org/netbeans/modules/j2ee/ddloaders/catalog/EnterpriseCatalog.java
index cd02a87..ce0e942 100644
--- a/enterprise/j2ee.ddloaders/src/org/netbeans/modules/j2ee/ddloaders/catalog/EnterpriseCatalog.java
+++ b/enterprise/j2ee.ddloaders/src/org/netbeans/modules/j2ee/ddloaders/catalog/EnterpriseCatalog.java
@@ -47,7 +47,7 @@
private static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee"; //NOI18N
private static final String XML_NS = "http://www.w3.org/2001/XMLSchema"; //NOI18N
private static final String NEW_JAVAEE_NS = "http://xmlns.jcp.org/xml/ns/javaee"; //NOI18N
- private static final String RESOURCE_PATH = "nbres:/org/netbeans/modules/j2ee/dd/impl/resources/"; //NO18N
+ private static final String RESOURCE_PATH = "nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/"; //NO18N
private List<SchemaInfo> schemas = new ArrayList<SchemaInfo>();
@@ -93,6 +93,7 @@
schemas.add(new SchemaInfo("web-app_2_5.xsd", JAVAEE_NS));
schemas.add(new SchemaInfo("web-app_3_0.xsd", JAVAEE_NS));
schemas.add(new SchemaInfo("web-app_3_1.xsd", NEW_JAVAEE_NS));
+ schemas.add(new SchemaInfo("web-app_4_0.xsd", NEW_JAVAEE_NS));
schemas.add(new SchemaInfo("web-common_3_0.xsd", JAVAEE_NS));
schemas.add(new SchemaInfo("web-common_3_1.xsd", NEW_JAVAEE_NS));
@@ -109,6 +110,7 @@
schemas.add(new SchemaInfo("javaee_5.xsd", JAVAEE_NS));
schemas.add(new SchemaInfo("javaee_6.xsd", JAVAEE_NS));
schemas.add(new SchemaInfo("javaee_7.xsd", NEW_JAVAEE_NS));
+ schemas.add(new SchemaInfo("javaee_8.xsd", NEW_JAVAEE_NS));
// web 2.2 and 2.3 dtds
schemas.add(new SchemaInfo("web-app_2_2.dtd", "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN", true)); //NO18N
schemas.add(new SchemaInfo("web-app_2_3.dtd", "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN", true)); //NO18N
@@ -119,6 +121,7 @@
schemas.add(new SchemaInfo("permissions_7.xsd", NEW_JAVAEE_NS));
// batch API
schemas.add(new SchemaInfo("batchXML_1_0.xsd", NEW_JAVAEE_NS));
+ schemas.add(new SchemaInfo("jobXML_1_0.xsd", NEW_JAVAEE_NS));
}
diff --git a/enterprise/j2ee.ejbcore/manifest.mf b/enterprise/j2ee.ejbcore/manifest.mf
index 94a1498..5cc05ad 100644
--- a/enterprise/j2ee.ejbcore/manifest.mf
+++ b/enterprise/j2ee.ejbcore/manifest.mf
@@ -3,5 +3,5 @@
OpenIDE-Module-Layer: org/netbeans/modules/j2ee/ejbcore/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/ejbcore/Bundle.properties
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
-OpenIDE-Module-Specification-Version: 1.55
+OpenIDE-Module-Specification-Version: 1.56
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
index 2995f71..4d62c96 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/Utils.java
@@ -252,7 +252,8 @@
if (J2eeModule.Type.EJB.equals(type) || (J2eeModule.Type.WAR.equals(type) &&
(Profile.JAVA_EE_6_WEB.equals(profile) || Profile.JAVA_EE_6_FULL.equals(profile) ||
- Profile.JAVA_EE_7_WEB.equals(profile) || Profile.JAVA_EE_7_FULL.equals(profile)))){
+ Profile.JAVA_EE_7_WEB.equals(profile) || Profile.JAVA_EE_7_FULL.equals(profile) ||
+ Profile.JAVA_EE_8_WEB.equals(profile) || Profile.JAVA_EE_8_FULL.equals(profile)))){
isEJBModule = true;
}
}
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/dd/EjbJarXmlWizardIterator.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/dd/EjbJarXmlWizardIterator.java
index 277f4b6..70c5b42 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/dd/EjbJarXmlWizardIterator.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/dd/EjbJarXmlWizardIterator.java
@@ -94,7 +94,7 @@
String resource;
// see #213631 - caused by fact that EJB DD schemas have different numbering than WEB DD schemas
// (so Java EE6 Web-DD is of the version 3.0, but Ejb-DD is of the version 3.1)
- if (j2eeProfile == Profile.JAVA_EE_7_WEB) {
+ if (j2eeProfile == Profile.JAVA_EE_7_WEB || j2eeProfile == Profile.JAVA_EE_8_WEB) {
resource = "org-netbeans-modules-j2ee-ejbjarproject/ejb-jar-3.2.xml";
} else if (j2eeProfile == Profile.JAVA_EE_6_WEB) {
// ee6 web module is of the version 3.0 but the ee6 deployment descriptor schema should be of version 3.1
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
index 5f958a5..41e8d02 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/AppServerValidationPanel.java
@@ -57,7 +57,8 @@
WebModule wm = WebModule.getWebModule(project.getProjectDirectory());
if (wm != null && (wm.getJ2eeProfile() == Profile.JAVA_EE_6_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_6_WEB ||
- wm.getJ2eeProfile() == Profile.JAVA_EE_7_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_7_WEB)) {
+ wm.getJ2eeProfile() == Profile.JAVA_EE_7_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_7_WEB ||
+ wm.getJ2eeProfile() == Profile.JAVA_EE_8_FULL || wm.getJ2eeProfile() == Profile.JAVA_EE_8_WEB)) {
// check that server is EJB lite sufficient
EjbSupport ejbSupport = EjbSupport.getInstance(j2eePlatform);
if (!ejbSupport.isEjb31LiteSupported(j2eePlatform)) {
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
index 2a2ae0b..41d891e 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/jpa/dao/EjbFacadeVisualPanel2.java
@@ -71,7 +71,8 @@
J2eeProjectCapabilities projectCap = J2eeProjectCapabilities.forProject(project);
if (projectCap.isEjb31LiteSupported()){
boolean serverSupportsEJB31 = ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_6_FULL) ||
- ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL);
+ ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL) ||
+ ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_8_FULL);
if (!projectCap.isEjb31Supported() && !serverSupportsEJB31){
remoteCheckBox.setVisible(false);
remoteCheckBox.setEnabled(false);
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MdbWizard.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MdbWizard.java
index d6e5a44..9ca9f65 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MdbWizard.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/mdb/MdbWizard.java
@@ -79,6 +79,7 @@
static {
MAVEN_JAVAEE_API_LIBS.put(Profile.JAVA_EE_6_FULL, "javaee-api-6.0"); //NOI18N
MAVEN_JAVAEE_API_LIBS.put(Profile.JAVA_EE_7_FULL, "javaee-api-7.0"); //NOI18N
+ MAVEN_JAVAEE_API_LIBS.put(Profile.JAVA_EE_8_FULL, "javaee-api-8.0"); //NOI18N
}
@Override
@@ -176,7 +177,9 @@
private Profile getTargetFullProfile() {
Profile profile = JavaEEProjectSettings.getProfile(Templates.getProject(wiz));
if (profile != null) {
- if (profile.isAtLeast(Profile.JAVA_EE_7_WEB)) {
+ if (profile.isAtLeast(Profile.JAVA_EE_8_WEB)) {
+ return Profile.JAVA_EE_8_FULL;
+ } else if (profile.isAtLeast(Profile.JAVA_EE_7_WEB)) {
return Profile.JAVA_EE_7_FULL;
} else if (profile.isAtLeast(Profile.JAVA_EE_6_WEB)) {
return Profile.JAVA_EE_6_FULL;
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
index aaecfac..29fcab3 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ejb/wizard/session/SessionEJBWizard.java
@@ -89,7 +89,8 @@
// TODO: UI - add checkbox for Java EE 5 to create also EJB 2.1 style EJBs
Profile profile = ejbModule.getJ2eeProfile();
boolean isSimplified = Profile.JAVA_EE_5.equals(profile) || Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile);
+ Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile) ||
+ Profile.JAVA_EE_8_FULL.equals(profile) || Profile.JAVA_EE_8_WEB.equals(profile);
SessionGenerator sessionGenerator = SessionGenerator.create(
Templates.getTargetName(wiz),
pkg,
diff --git a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
index 4d9d793..3d8d4d0 100644
--- a/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
+++ b/enterprise/j2ee.ejbcore/src/org/netbeans/modules/j2ee/ejbcore/ui/logicalview/ejb/shared/EjbViewController.java
@@ -108,7 +108,9 @@
Profile.JAVA_EE_6_FULL.equals(profile) ||
Profile.JAVA_EE_6_WEB.equals(profile) ||
Profile.JAVA_EE_7_FULL.equals(profile) ||
- Profile.JAVA_EE_7_WEB.equals(profile);
+ Profile.JAVA_EE_7_WEB.equals(profile) ||
+ Profile.JAVA_EE_8_FULL.equals(profile) ||
+ Profile.JAVA_EE_8_WEB.equals(profile);
if (!isEE5orEE6or7) {
ejbModule.getMetadataModel().runReadAction(new MetadataModelAction<EjbJarMetadata, Void>() {
diff --git a/enterprise/j2ee.ejbverification/manifest.mf b/enterprise/j2ee.ejbverification/manifest.mf
index 842faf2..4cc923a 100644
--- a/enterprise/j2ee.ejbverification/manifest.mf
+++ b/enterprise/j2ee.ejbverification/manifest.mf
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.j2ee.ejbverification
OpenIDE-Module-Layer: org/netbeans/modules/j2ee/ejbverification/resources/layer.xml
-OpenIDE-Module-Specification-Version: 1.36
+OpenIDE-Module-Specification-Version: 1.37
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/ejbverification/Bundle.properties
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/rules/PersistentTimerInEjbLite.java b/enterprise/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/rules/PersistentTimerInEjbLite.java
index 70c72ac..da3ab8d 100644
--- a/enterprise/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/rules/PersistentTimerInEjbLite.java
+++ b/enterprise/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/rules/PersistentTimerInEjbLite.java
@@ -83,7 +83,7 @@
final List<ErrorDescription> problems = new ArrayList<>();
final EJBProblemContext ctx = HintsUtils.getOrCacheContext(hintContext);
if (ctx != null && ctx.getEjb() instanceof Session) {
- boolean ee7lite = ctx.getEjbModule().getJ2eeProfile() == Profile.JAVA_EE_7_WEB;
+ boolean ee7lite = (ctx.getEjbModule().getJ2eeProfile() == Profile.JAVA_EE_7_WEB) || (ctx.getEjbModule().getJ2eeProfile() == Profile.JAVA_EE_8_WEB);
boolean ee6lite = ctx.getEjbModule().getJ2eeProfile() == Profile.JAVA_EE_6_WEB;
J2eePlatform platform = ProjectUtil.getPlatform(ctx.getProject());
if ((ee6lite || ee7lite) && nonEeFullServer(platform)) {
diff --git a/enterprise/j2ee.kit/manifest.mf b/enterprise/j2ee.kit/manifest.mf
index 6f356d8..b8d87b8 100644
--- a/enterprise/j2ee.kit/manifest.mf
+++ b/enterprise/j2ee.kit/manifest.mf
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.j2ee.kit
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/j2ee/kit/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.29
+OpenIDE-Module-Specification-Version: 1.30
diff --git a/enterprise/j2ee.kit/nbproject/project.xml b/enterprise/j2ee.kit/nbproject/project.xml
index a4570a2..31f5911 100644
--- a/enterprise/j2ee.kit/nbproject/project.xml
+++ b/enterprise/j2ee.kit/nbproject/project.xml
@@ -89,6 +89,12 @@
</run-dependency>
</dependency>
<dependency>
+ <code-name-base>org.netbeans.modules.javaee8.api</code-name-base>
+ <run-dependency>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
<code-name-base>org.netbeans.modules.web.kit</code-name-base>
<run-dependency>
<specification-version>1.0</specification-version>
diff --git a/enterprise/j2ee.kit/test/qa-functional/src/org/netbeans/test/j2ee/lib/J2eeProjectSupport.java b/enterprise/j2ee.kit/test/qa-functional/src/org/netbeans/test/j2ee/lib/J2eeProjectSupport.java
index 64ab1a0..af3a7de 100644
--- a/enterprise/j2ee.kit/test/qa-functional/src/org/netbeans/test/j2ee/lib/J2eeProjectSupport.java
+++ b/enterprise/j2ee.kit/test/qa-functional/src/org/netbeans/test/j2ee/lib/J2eeProjectSupport.java
@@ -58,7 +58,7 @@
public static final int WEB_PROJECT = 1;
public static final int EJB_PROJECT = 2;
public static final int J2EE_PROJECT = 3;
- public static final String DEFAULT_J2EE_LEVEL = Profile.JAVA_EE_7_FULL.toPropertiesString();
+ public static final String DEFAULT_J2EE_LEVEL = Profile.JAVA_EE_8_FULL.toPropertiesString();
public static final String DEFAULT_SRC_STRUCTURE = WebProjectUtilities.SRC_STRUCT_BLUEPRINTS;
public static final int WAIT_APPSRV_INSTALL = 30000;
diff --git a/enterprise/j2ee.sun.dd/nbproject/project.xml b/enterprise/j2ee.sun.dd/nbproject/project.xml
index 3960a2e..4696f95 100644
--- a/enterprise/j2ee.sun.dd/nbproject/project.xml
+++ b/enterprise/j2ee.sun.dd/nbproject/project.xml
@@ -131,6 +131,8 @@
<friend>org.netbeans.modules.j2ee.sun.ws7</friend>
<friend>org.netbeans.modules.glassfish.javaee</friend>
<friend>org.netbeans.modules.glassfish.eecommon</friend>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
<friend>org.netbeans.modules.visualweb.ejb</friend>
<package>org.netbeans.modules.j2ee.sun.dd.api</package>
<package>org.netbeans.modules.j2ee.sun.dd.api.app</package>
diff --git a/enterprise/j2ee.sun.ddui/nbproject/project.xml b/enterprise/j2ee.sun.ddui/nbproject/project.xml
index 3676f03..b07372b 100644
--- a/enterprise/j2ee.sun.ddui/nbproject/project.xml
+++ b/enterprise/j2ee.sun.ddui/nbproject/project.xml
@@ -368,6 +368,8 @@
</test-dependencies>
<friend-packages>
<friend>org.netbeans.modules.glassfish.javaee</friend>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
<friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
<friend>org.netbeans.modules.j2ee.sun.appsrv90</friend>
<friend>org.netbeans.modules.j2ee.sun.avk</friend>
@@ -375,6 +377,15 @@
<package>org.netbeans.modules.j2ee.sun.share</package>
<package>org.netbeans.modules.j2ee.sun.share.configbean</package>
<package>org.netbeans.modules.j2ee.sun.share.plan</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.api</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.appclient</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.common</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.ejb</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.jms</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.web</package>
+ <package>org.netbeans.modules.j2ee.sun.ddloaders.multiview.webservice</package>
</friend-packages>
</data>
</configuration>
diff --git a/enterprise/javaee.project/manifest.mf b/enterprise/javaee.project/manifest.mf
index cd69c2f..0c1d56b 100644
--- a/enterprise/javaee.project/manifest.mf
+++ b/enterprise/javaee.project/manifest.mf
@@ -2,6 +2,6 @@
OpenIDE-Module: org.netbeans.modules.javaee.project
OpenIDE-Module-Layer: org/netbeans/modules/javaee/project/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javaee/project/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.23
+OpenIDE-Module-Specification-Version: 1.24
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/PersistenceProviderSupplierImpl.java b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/PersistenceProviderSupplierImpl.java
index 9a9cd75..adbbd0a 100644
--- a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/PersistenceProviderSupplierImpl.java
+++ b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/PersistenceProviderSupplierImpl.java
@@ -81,7 +81,7 @@
boolean defaultFound = false; // see issue #225071
- lessEE7 = !platform.getSupportedProfiles().contains(Profile.JAVA_EE_7_WEB) && !platform.getSupportedProfiles().contains(Profile.JAVA_EE_7_FULL);//we know gf4 do not support old providers, #233726
+ lessEE7 = !platform.getSupportedProfiles().contains(Profile.JAVA_EE_8_WEB) && !platform.getSupportedProfiles().contains(Profile.JAVA_EE_8_FULL) && !platform.getSupportedProfiles().contains(Profile.JAVA_EE_7_WEB) && !platform.getSupportedProfiles().contains(Profile.JAVA_EE_7_FULL);//we know gf4 do not support old providers, #233726
// Here we are mapping the JpaProvider to the correct Provider
for (Provider provider : ProviderUtil.getAllProviders()) {
diff --git a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/AntProjectConstants.java b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/AntProjectConstants.java
index 19e80d4..c1b5f1d 100644
--- a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/AntProjectConstants.java
+++ b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/AntProjectConstants.java
@@ -28,6 +28,8 @@
public static final String ENDORSED_LIBRARY_CLASSPATH_6 = "${libs." + ENDORSED_LIBRARY_NAME_6 + ".classpath}"; // NOI18N
public static final String ENDORSED_LIBRARY_NAME_7 = "javaee-endorsed-api-7.0"; // NOI18N
public static final String ENDORSED_LIBRARY_CLASSPATH_7 = "${libs." + ENDORSED_LIBRARY_NAME_7 + ".classpath}"; // NOI18N
+ public static final String ENDORSED_LIBRARY_NAME_8 = "javaee-endorsed-api-8.0"; // NOI18N
+ public static final String ENDORSED_LIBRARY_CLASSPATH_8 = "${libs." + ENDORSED_LIBRARY_NAME_8 + ".classpath}"; // NOI18N
public static final String DESTINATION_DIRECTORY_ROOT = "100";
public static final String DESTINATION_DIRECTORY_DO_NOT_COPY = "300";
public static final String DESTINATION_DIRECTORY = "destinationDirectory";
diff --git a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/J2eeVersionWarningPanel.java b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/J2eeVersionWarningPanel.java
index 37c02de..de269f2 100644
--- a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/J2eeVersionWarningPanel.java
+++ b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/J2eeVersionWarningPanel.java
@@ -40,13 +40,16 @@
public final static String WARN_SET_JDK_15 = "warnSetJdk15"; // NOI18N
public final static String WARN_SET_JDK_6 = "warnSetJdk6"; // NOI18N
public final static String WARN_SET_JDK_7 = "warnSetJdk7"; // NOI18N
+ public final static String WARN_SET_JDK_8 = "warnSetJdk8"; // NOI18N
public final static String WARN_SET_SOURCE_LEVEL_15 = "warnSetSourceLevel15"; // NOI18N
public final static String WARN_SET_SOURCE_LEVEL_6 = "warnSetSourceLevel6"; // NOI18N
public final static String WARN_SET_SOURCE_LEVEL_7 = "warnSetSourceLevel7"; // NOI18N
+ public final static String WARN_SET_SOURCE_LEVEL_8 = "warnSetSourceLevel8";
public final static String WARN_JDK_6_REQUIRED = "warnJdk6Required"; // NOI18N
public final static String WARN_JDK_7_REQUIRED = "warnJdk7Required"; // NOI18N
+ public final static String WARN_JDK_8_REQUIRED = "warnJdk8Required"; // NOI18N
private String warningType;
@@ -70,14 +73,20 @@
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetJdk6");
} else if (WARN_SET_JDK_7.equals(warningType)) {
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetJdk7");
+ } else if (WARN_SET_JDK_8.equals(warningType)) {
+ labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetJdk8");
} else if (WARN_SET_SOURCE_LEVEL_6.equals(warningType)) {
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetSourceLevel6");
} else if (WARN_SET_SOURCE_LEVEL_7.equals(warningType)) {
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetSourceLevel7");
+ } else if (WARN_SET_SOURCE_LEVEL_8.equals(warningType)) {
+ labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationSetSourceLevel8");
} else if (WARN_JDK_6_REQUIRED.equals(warningType)) {
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationJDK6");
} else if (WARN_JDK_7_REQUIRED.equals(warningType)) {
labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationJDK7");
+ } else if (WARN_JDK_8_REQUIRED.equals(warningType)) {
+ labelText = NbBundle.getMessage(J2eeVersionWarningPanel.class, "MSG_RecommendationJDK8");
}
jLabel.setText(labelText);
}
@@ -95,6 +104,10 @@
JavaPlatform[] javaPlatforms = getJavaPlatforms("1.7");
return getPreferredPlatform(javaPlatforms).getDisplayName();
}
+ if (WARN_SET_JDK_8.equals(warningType) ) {
+ JavaPlatform[] javaPlatforms = getJavaPlatforms("1.8");
+ return getPreferredPlatform(javaPlatforms).getDisplayName();
+ }
return JavaPlatform.getDefault().getDisplayName();
}
@@ -111,6 +124,10 @@
JavaPlatform[] javaPlatforms = getJavaPlatforms("1.7");
return getPreferredPlatform(javaPlatforms).getSpecification();
}
+ if (WARN_SET_JDK_8.equals(warningType) ) {
+ JavaPlatform[] javaPlatforms = getJavaPlatforms("1.8");
+ return getPreferredPlatform(javaPlatforms).getSpecification();
+ }
return JavaPlatform.getDefault().getSpecification();
}
@@ -146,6 +163,11 @@
isAcceptableSourceLevel("1.7", sourceLevel, acceptableSourceLevels)) // NOI18N
return null;
+ // no warning if 1.8 is the default for j2ee8
+ if ((j2eeProfile == Profile.JAVA_EE_8_FULL || j2eeProfile == Profile.JAVA_EE_8_WEB) &&
+ isAcceptableSourceLevel("1.8", sourceLevel, acceptableSourceLevels)) // NOI18N
+ return null;
+
if (j2eeProfile == Profile.JAVA_EE_5) {
JavaPlatform[] java15Platforms = getJavaPlatforms("1.5"); //NOI18N
if (java15Platforms.length > 0) {
@@ -175,6 +197,17 @@
return WARN_JDK_7_REQUIRED;
}
}
+ } else if (j2eeProfile == Profile.JAVA_EE_8_FULL || j2eeProfile == Profile.JAVA_EE_8_WEB) {
+ JavaPlatform[] java18Platforms = getJavaPlatforms("1.8"); //NOI18N
+ if (java18Platforms.length > 0) {
+ return WARN_SET_JDK_8;
+ } else {
+ if (canSetSourceLevel("1.8")) {
+ return WARN_SET_SOURCE_LEVEL_8;
+ } else {
+ return WARN_JDK_8_REQUIRED;
+ }
+ }
} else {
return null;
}
diff --git a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/ProjectServerPanel.java b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/ProjectServerPanel.java
index e441a04..907aeff 100644
--- a/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/ProjectServerPanel.java
+++ b/enterprise/javaee.project/src/org/netbeans/modules/javaee/project/api/ant/ui/wizard/ProjectServerPanel.java
@@ -430,12 +430,12 @@
continue;
}
if (j2eeModuleType ==J2eeModule.Type.WAR) {
- if (Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_7_FULL.equals(profile)) {
+ if (Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_8_FULL.equals(profile)) {
// for web apps always offer only JAVA_EE_6_WEB profile and skip full one
continue;
}
} else {
- if (Profile.JAVA_EE_6_WEB.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile)) {
+ if (Profile.JAVA_EE_6_WEB.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile) || Profile.JAVA_EE_8_WEB.equals(profile)) {
// for EE apps always skip web profile
continue;
}
@@ -722,6 +722,8 @@
boolean sjasFound = false;
boolean gfv3Found = false;
boolean gfv3ee6Found = false;
+ boolean gfv5Found = false;
+ boolean gfv5ee8Found = false;
for (String serverInstanceID : Deployment.getDefault().getServerInstanceIDs()) {
try {
ServerInstance si = Deployment.getDefault().getServerInstance(serverInstanceID);
@@ -739,9 +741,15 @@
// preselect the best server ;)
// FIXME replace with PriorityQueue mechanism
String shortName = si.getServerID();
- if ("gfv3ee6".equals(shortName)) { // NOI18N
+ if ("gfv5ee8".equals(shortName)) { // NOI18N
+ selectedItem = serverWrapper;
+ gfv5ee8Found = true;
+ } else if ("gfv3ee6".equals(shortName)) { // NOI18N
selectedItem = serverWrapper;
gfv3ee6Found = true;
+ } else if ("gfv5".equals(shortName) && !gfv5ee8Found) { // NOI18N
+ selectedItem = serverWrapper;
+ gfv5Found = true;
} else if ("gfv3".equals(shortName) && !gfv3ee6Found) { // NOI18N
selectedItem = serverWrapper;
gfv3Found = true;
diff --git a/enterprise/javaee.specs.support/nbproject/project.xml b/enterprise/javaee.specs.support/nbproject/project.xml
index 75516c7..ada9276 100644
--- a/enterprise/javaee.specs.support/nbproject/project.xml
+++ b/enterprise/javaee.specs.support/nbproject/project.xml
@@ -141,6 +141,7 @@
<friend-packages>
<friend>org.netbeans.modules.cloud.oracle</friend>
<friend>org.netbeans.modules.glassfish.javaee</friend>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
<friend>org.netbeans.modules.j2ee.common</friend>
<friend>org.netbeans.modules.j2ee.ejbcore</friend>
<friend>org.netbeans.modules.j2ee.ejbjarproject</friend>
diff --git a/enterprise/javaee8.api/build.xml b/enterprise/javaee8.api/build.xml
new file mode 100644
index 0000000..0be9282
--- /dev/null
+++ b/enterprise/javaee8.api/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project basedir="." default="build" name="enterprise/javaee8.api">
+ <description>Builds, tests, and runs the project org.netbeans.modules.javaee8.api</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
diff --git a/enterprise/javaee8.api/external/binaries-list b/enterprise/javaee8.api/external/binaries-list
new file mode 100644
index 0000000..9c71482
--- /dev/null
+++ b/enterprise/javaee8.api/external/binaries-list
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+5595992A15BF40CEDA8A831C77ECFE4043F8F161 javax:javaee-api:8.0
+DD21587DD7515F8DDAD285CF019A6ACB18D6E3BA javax:javaee-web-api:8.0
+479C1E06DB31C432330183F5CAE684163F186146 javax.annotation:javax.annotation-api:1.2
+2A642453AB5CE7A506B46164DE8258EE463A9197 javax.faces:javax.faces-api:2.3
+5FAAA3864FF6025CE69809B60D65BDA3E358610C javax.jms:javax.jms-api:2.0.1
+A055C648842C4954C1F7DB7254F45D9AD565E278 com.sun.mail:javax.mail:1.6.0
+AE40E0864EB1E92C48BF82A2A3399CBBF523FB79 javax.resource:javax.resource-api:1.7
+DFA282CEA1495277168697CB5C349EC29F82947C javax.management.j2ee:javax.management.j2ee-api:1.1.1
+5CFDC878B7A5A533F373493BE9F7B24E34C01800 javax.security.jacc:javax.security.jacc-api:1.5
+C392610C40AA3E0E7B57C47A1B561D4B3F974FAC javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0
+2562072EF44E364529EBF7C48CF44E4568CBD8F5 javax.batch:javax.batch-api:1.0.1
+020FD338DD025EAFC226CA90BD7CDCC60015D75D javax.enterprise.deploy:javax.enterprise.deploy-api:1.6
+C1E6D1DE3BA048B9D36FAA122D7BCA20ABCF12B0 javax.xml.registry:javax.xml.registry-api:1.0.7
+E21E7F033112BC4BCF54234EDB5AA5D782D4B568 javax.xml.rpc:javax.xml.rpc-api:1.1.1
diff --git a/enterprise/javaee8.api/external/javaee-api-8.0-license.txt b/enterprise/javaee8.api/external/javaee-api-8.0-license.txt
new file mode 100644
index 0000000..68ca36e
--- /dev/null
+++ b/enterprise/javaee8.api/external/javaee-api-8.0-license.txt
@@ -0,0 +1,406 @@
+Name: JavaEE API 8.0
+Version: 8.0
+License: CDDL-1.1
+Description: JavaEE API 8.0
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax/javaee-api/8.0)
+
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javaee-web-api-8.0-license.txt b/enterprise/javaee8.api/external/javaee-web-api-8.0-license.txt
new file mode 100644
index 0000000..0dd66f3
--- /dev/null
+++ b/enterprise/javaee8.api/external/javaee-web-api-8.0-license.txt
@@ -0,0 +1,405 @@
+Name: JavaEE Web API 8.0
+Version: 8.0
+License: CDDL-1.1
+Description: JavaEE Web API 8.0
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax/javaee-web-api/8.0)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.annotation-api-1.2-license.txt b/enterprise/javaee8.api/external/javax.annotation-api-1.2-license.txt
new file mode 100644
index 0000000..ac4cf01
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.annotation-api-1.2-license.txt
@@ -0,0 +1,405 @@
+Name: Javax Annotation API
+Version: 1.2
+License: CDDL-1.1
+Description: Javax Annotation API 1.2
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api/1.2)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.batch-api-1.0.1-license.txt b/enterprise/javaee8.api/external/javax.batch-api-1.0.1-license.txt
new file mode 100644
index 0000000..2998d1c
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.batch-api-1.0.1-license.txt
@@ -0,0 +1,207 @@
+Name: Java Batch API
+Version: 1.0.1
+License: Apache-2.0
+Description: Java Batch API 1.0.1
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.batch/javax.batch-api/1.0.1)
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/enterprise/javaee8.api/external/javax.enterprise.concurrent-api-1.0-license.txt b/enterprise/javaee8.api/external/javax.enterprise.concurrent-api-1.0-license.txt
new file mode 100644
index 0000000..b67ea87
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.enterprise.concurrent-api-1.0-license.txt
@@ -0,0 +1,405 @@
+Name: Javax Concurrent API
+Version: 1.0
+License: CDDL-1.1
+Description: Javax Concurrent API 1.0
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.enterprise.concurrent/javax.enterprise.concurrent-api/1.0)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.enterprise.deploy-api-1.6-license.txt b/enterprise/javaee8.api/external/javax.enterprise.deploy-api-1.6-license.txt
new file mode 100644
index 0000000..0956358
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.enterprise.deploy-api-1.6-license.txt
@@ -0,0 +1,405 @@
+Name: Javax Deploy API
+Version: 1.6
+License: CDDL-1.1
+Description: Javax Deploy API 1.6
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.enterprise.deploy/javax.enterprise.deploy-api/1.6)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.faces-api-2.3-license.txt b/enterprise/javaee8.api/external/javax.faces-api-2.3-license.txt
new file mode 100644
index 0000000..c1d555a
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.faces-api-2.3-license.txt
@@ -0,0 +1,405 @@
+Name: JavaServer Faces API
+Version: 2.3
+License: CDDL-1.1
+Description: JavaServer Faces API 2.3
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.faces/javax.faces-api/2.3)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.jms-api-2.0.1-license.txt b/enterprise/javaee8.api/external/javax.jms-api-2.0.1-license.txt
new file mode 100644
index 0000000..3d318a9
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.jms-api-2.0.1-license.txt
@@ -0,0 +1,405 @@
+Name: JMS API
+Version: 2.0.1
+License: CDDL-1.1
+Description: JMS API 2.0.1
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.jms/javax.jms-api/2.0.1)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.mail-1.6.0-license.txt b/enterprise/javaee8.api/external/javax.mail-1.6.0-license.txt
new file mode 100644
index 0000000..719b374
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.mail-1.6.0-license.txt
@@ -0,0 +1,405 @@
+Name: JavaMail API
+Version: 1.6.0
+License: CDDL-1.1
+Description: JavaMail API 1.6.0
+Origin: GlassFish Community (https://mvnrepository.com/artifact/com.sun.mail/javax.mail/1.6.0)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.management.j2ee-api-1.1.1-license.txt b/enterprise/javaee8.api/external/javax.management.j2ee-api-1.1.1-license.txt
new file mode 100644
index 0000000..44f6d73
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.management.j2ee-api-1.1.1-license.txt
@@ -0,0 +1,405 @@
+Name: Javax Management J2EE API
+Version: 1.1.1
+License: CDDL-1.1
+Description: Javax Management J2EE API 1.1.1
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.management.j2ee/javax.management.j2ee-api/1.1.1)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.resource-api-1.7-license.txt b/enterprise/javaee8.api/external/javax.resource-api-1.7-license.txt
new file mode 100644
index 0000000..df76dd2
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.resource-api-1.7-license.txt
@@ -0,0 +1,405 @@
+Name: Javax Resource API
+Version: 1.7
+License: CDDL-1.1
+Description: Javax Resource API 1.7
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.resource/javax.resource-api/1.7)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.security.jacc-api-1.5-license.txt b/enterprise/javaee8.api/external/javax.security.jacc-api-1.5-license.txt
new file mode 100644
index 0000000..e579f66
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.security.jacc-api-1.5-license.txt
@@ -0,0 +1,405 @@
+Name: Java Authorization Contract For Containers API
+Version: 1.5
+License: CDDL-1.1
+Description: Java Authorization Contract For Containers API 1.5
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.security.jacc/javax.security.jacc-api/1.5)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.xml.registry-api-1.0.7-license.txt b/enterprise/javaee8.api/external/javax.xml.registry-api-1.0.7-license.txt
new file mode 100644
index 0000000..e2a0565
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.xml.registry-api-1.0.7-license.txt
@@ -0,0 +1,405 @@
+Name: Javax XML Registry API
+Version: 1.0.7
+License: CDDL-1.1
+Description: Javax XML Registry API 1.0.7
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.xml.registry/javax.xml.registry-api/1.0.7)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/external/javax.xml.rpc-api-1.1.1-license.txt b/enterprise/javaee8.api/external/javax.xml.rpc-api-1.1.1-license.txt
new file mode 100644
index 0000000..fee4504
--- /dev/null
+++ b/enterprise/javaee8.api/external/javax.xml.rpc-api-1.1.1-license.txt
@@ -0,0 +1,405 @@
+Name: Javax XML RPC API
+Version: 1.1.1
+License: CDDL-1.1
+Description: Javax XML RPC API 1.1.1
+Origin: GlassFish Community (https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api/1.1.1)
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+1.1. "Contributor" means each individual or entity that
+creates or contributes to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the
+Original Software, prior Modifications used by a
+Contributor (if any), and the Modifications made by that
+particular Contributor.
+
+1.3. "Covered Software" means (a) the Original Software, or
+(b) Modifications, or (c) the combination of files
+containing Original Software with files containing
+Modifications, in each case including portions thereof.
+
+1.4. "Executable" means the Covered Software in any form
+other than Source Code.
+
+1.5. "Initial Developer" means the individual or entity
+that first makes Original Software available under this
+License.
+
+1.6. "Larger Work" means a work which combines Covered
+Software or portions thereof with code not governed by the
+terms of this License.
+
+1.7. "License" means this document.
+
+1.8. "Licensable" means having the right to grant, to the
+maximum extent possible, whether at the time of the initial
+grant or subsequently acquired, any and all of the rights
+conveyed herein.
+
+1.9. "Modifications" means the Source Code and Executable
+form of any of the following:
+
+A. Any file that results from an addition to,
+deletion from or modification of the contents of a
+file containing Original Software or previous
+Modifications;
+
+B. Any new file that contains any part of the
+Original Software or previous Modification; or
+
+C. Any new file that is contributed or otherwise made
+available under the terms of this License.
+
+1.10. "Original Software" means the Source Code and
+Executable form of computer software code that is
+originally released under this License.
+
+1.11. "Patent Claims" means any patent claim(s), now owned
+or hereafter acquired, including without limitation,
+method, process, and apparatus claims, in any patent
+Licensable by grantor.
+
+1.12. "Source Code" means (a) the common form of computer
+software code in which modifications are made and (b)
+associated documentation included in or with such code.
+
+1.13. "You" (or "Your") means an individual or a legal
+entity exercising rights under, and complying with all of
+the terms of, this License. For legal entities, "You"
+includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this
+definition, "control" means (a) the power, direct or
+indirect, to cause the direction or management of such
+entity, whether by contract or otherwise, or (b) ownership
+of more than fifty percent (50%) of the outstanding shares
+or beneficial ownership of such entity.
+
+2. License Grants.
+
+2.1. The Initial Developer Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, the
+Initial Developer hereby grants You a world-wide,
+royalty-free, non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Initial Developer,
+to use, reproduce, modify, display, perform,
+sublicense and distribute the Original Software (or
+portions thereof), with or without Modifications,
+and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using or selling of Original Software, to make, have
+made, use, practice, sell, and offer for sale, and/or
+otherwise dispose of the Original Software (or
+portions thereof).
+
+(c) The licenses granted in Sections 2.1(a) and (b)
+are effective on the date Initial Developer first
+distributes or otherwise makes the Original Software
+available to a third party under the terms of this
+License.
+
+(d) Notwithstanding Section 2.1(b) above, no patent
+license is granted: (1) for code that You delete from
+the Original Software, or (2) for infringements
+caused by: (i) the modification of the Original
+Software, or (ii) the combination of the Original
+Software with other software or devices.
+
+2.2. Contributor Grant.
+
+Conditioned upon Your compliance with Section 3.1 below and
+subject to third party intellectual property claims, each
+Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than
+patent or trademark) Licensable by Contributor to
+use, reproduce, modify, display, perform, sublicense
+and distribute the Modifications created by such
+Contributor (or portions thereof), either on an
+unmodified basis, with other Modifications, as
+Covered Software and/or as part of a Larger Work; and
+
+(b) under Patent Claims infringed by the making,
+using, or selling of Modifications made by that
+Contributor either alone and/or in combination with
+its Contributor Version (or portions of such
+combination), to make, use, sell, offer for sale,
+have made, and/or otherwise dispose of: (1)
+Modifications made by that Contributor (or portions
+thereof); and (2) the combination of Modifications
+made by that Contributor with its Contributor Version
+(or portions of such combination).
+
+(c) The licenses granted in Sections 2.2(a) and
+2.2(b) are effective on the date Contributor first
+distributes or otherwise makes the Modifications
+available to a third party.
+
+(d) Notwithstanding Section 2.2(b) above, no patent
+license is granted: (1) for any code that Contributor
+has deleted from the Contributor Version; (2) for
+infringements caused by: (i) third party
+modifications of Contributor Version, or (ii) the
+combination of Modifications made by that Contributor
+with other software (except as part of the
+Contributor Version) or other devices; or (3) under
+Patent Claims infringed by Covered Software in the
+absence of Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+3.1. Availability of Source Code.
+
+Any Covered Software that You distribute or otherwise make
+available in Executable form must also be made available in
+Source Code form and that Source Code form must be
+distributed only under the terms of this License. You must
+include a copy of this License with every copy of the
+Source Code form of the Covered Software You distribute or
+otherwise make available. You must inform recipients of any
+such Covered Software in Executable form as to how they can
+obtain such Covered Software in Source Code form in a
+reasonable manner on or through a medium customarily used
+for software exchange.
+
+3.2. Modifications.
+
+The Modifications that You create or to which You
+contribute are governed by the terms of this License. You
+represent that You believe Your Modifications are Your
+original creation(s) and/or You have sufficient rights to
+grant the rights conveyed by this License.
+
+3.3. Required Notices.
+
+You must include a notice in each of Your Modifications
+that identifies You as the Contributor of the Modification.
+You may not remove or alter any copyright, patent or
+trademark notices contained within the Covered Software, or
+any notices of licensing or any descriptive text giving
+attribution to any Contributor or the Initial Developer.
+
+3.4. Application of Additional Terms.
+
+You may not offer or impose any terms on any Covered
+Software in Source Code form that alters or restricts the
+applicable version of this License or the recipients'
+rights hereunder. You may choose to offer, and to charge a
+fee for, warranty, support, indemnity or liability
+obligations to one or more recipients of Covered Software.
+However, you may do so only on Your own behalf, and not on
+behalf of the Initial Developer or any Contributor. You
+must make it absolutely clear that any such warranty,
+support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial
+Developer and every Contributor for any liability incurred
+by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+3.5. Distribution of Executable Versions.
+
+You may distribute the Executable form of the Covered
+Software under the terms of this License or under the terms
+of a license of Your choice, which may contain terms
+different from this License, provided that You are in
+compliance with the terms of this License and that the
+license for the Executable form does not attempt to limit
+or alter the recipient's rights in the Source Code form
+from the rights set forth in this License. If You
+distribute the Covered Software in Executable form under a
+different license, You must make it absolutely clear that
+any terms which differ from this License are offered by You
+alone, not by the Initial Developer or Contributor. You
+hereby agree to indemnify the Initial Developer and every
+Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of any such terms
+You offer.
+
+3.6. Larger Works.
+
+You may create a Larger Work by combining Covered Software
+with other code not governed by the terms of this License
+and distribute the Larger Work as a single product. In such
+a case, You must make sure the requirements of this License
+are fulfilled for the Covered Software.
+
+4. Versions of the License.
+
+4.1. New Versions.
+
+Oracle is the initial license steward and
+may publish revised and/or new versions of this License
+from time to time. Each version will be given a
+distinguishing version number. Except as provided in
+Section 4.3, no one other than the license steward has the
+right to modify this License.
+
+4.2. Effect of New Versions.
+
+You may always continue to use, distribute or otherwise
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. If the Initial Developer includes a
+notice in the Original Software prohibiting it from being
+distributed or otherwise made available under any
+subsequent version of the License, You must distribute and
+make the Covered Software available under the terms of the
+version of the License under which You originally received
+the Covered Software. Otherwise, You may also choose to
+use, distribute or otherwise make the Covered Software
+available under the terms of any subsequent version of the
+License published by the license steward.
+
+4.3. Modified Versions.
+
+When You are an Initial Developer and You want to create a
+new license for Your Original Software, You may create and
+use a modified version of this License if You: (a) rename
+the license and remove any references to the name of the
+license steward (except to note that the license differs
+from this License); and (b) otherwise make it clear that
+the license contains terms which differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+6. TERMINATION.
+
+6.1. This License and the rights granted hereunder will
+terminate automatically if You fail to comply with terms
+herein and fail to cure such breach within 30 days of
+becoming aware of the breach. Provisions which, by their
+nature, must remain in effect beyond the termination of
+this License shall survive.
+
+6.2. If You assert a patent infringement claim (excluding
+declaratory judgment actions) against Initial Developer or
+a Contributor (the Initial Developer or Contributor against
+whom You assert such claim is referred to as "Participant")
+alleging that the Participant Software (meaning the
+Contributor Version where the Participant is a Contributor
+or the Original Software where the Participant is the
+Initial Developer) directly or indirectly infringes any
+patent, then any and all rights granted directly or
+indirectly to You by such Participant, the Initial
+Developer (if the Initial Developer is not the Participant)
+and all Contributors under Sections 2.1 and/or 2.2 of this
+License shall, upon 60 days notice from Participant
+terminate prospectively and automatically at the expiration
+of such 60 day notice period, unless if within such 60 day
+period You withdraw Your claim with respect to the
+Participant Software against such Participant either
+unilaterally or pursuant to a written agreement with
+Participant.
+
+6.3. If You assert a patent infringement claim against
+Participant alleging that the Participant Software directly
+or indirectly infringes any patent where such claim is
+resolved (such as by license or settlement) prior to the
+initiation of patent infringement litigation, then the
+reasonable value of the licenses granted by such Participant
+under Sections 2.1 or 2.2 shall be taken into account in
+determining the amount or value of any payment or license.
+
+6.4. In the event of termination under Sections 6.1 or 6.2
+above, all end user licenses that have been validly granted
+by You or any distributor hereunder prior to termination
+(excluding licenses granted to You by any distributor)
+shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+The Covered Software is a "commercial item," as that term is
+defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+computer software" (as that term is defined at 48 C.F.R.
+§ 252.227-7014(a)(1)) and "commercial computer software
+documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Software with only those rights set forth herein.
+This U.S. Government Rights clause is in lieu of, and supersedes,
+any other FAR, DFAR, or other clause or provision that addresses
+Government rights in computer software under this License.
+
+9. MISCELLANEOUS.
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the
+extent necessary to make it enforceable. This License shall be
+governed by the law of the jurisdiction specified in a notice
+contained within the Original Software (except to the extent
+applicable law, if any, provides otherwise), excluding such
+jurisdiction's conflict-of-law provisions. Any litigation
+relating to this License shall be subject to the jurisdiction of
+the courts located in the jurisdiction and venue specified in a
+notice contained within the Original Software, with the losing
+party responsible for costs, including, without limitation, court
+costs and reasonable attorneys' fees and expenses. The
+application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or
+regulation which provides that the language of a contract shall
+be construed against the drafter shall not apply to this License.
+You agree that You alone are responsible for compliance with the
+United States export administration regulations (and the export
+control laws and regulation of any other countries) when You use,
+distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or
+indirectly, out of its utilization of rights under this License
+and You agree to work with Initial Developer and Contributors to
+distribute such responsibility on an equitable basis. Nothing
+herein is intended or shall be deemed to constitute any admission
+of liability.
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws
+of the State of California (excluding conflict-of-law provisions).
+Any litigation relating to this License shall be subject to the
+jurisdiction of the Federal Courts of the Northern District of
+California and the state courts of the State of California, with
+venue lying in Santa Clara County, California.
diff --git a/enterprise/javaee8.api/manifest.mf b/enterprise/javaee8.api/manifest.mf
new file mode 100644
index 0000000..0891d30
--- /dev/null
+++ b/enterprise/javaee8.api/manifest.mf
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.javaee8.api
+OpenIDE-Module-Layer: org/netbeans/modules/javaee8/api/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javaee8/api/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.8
+
diff --git a/enterprise/javaee8.api/nbproject/project.properties b/enterprise/javaee8.api/nbproject/project.properties
new file mode 100644
index 0000000..e39c257
--- /dev/null
+++ b/enterprise/javaee8.api/nbproject/project.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+javac.source=1.6
+release.external/javaee-api-8.0.jar=modules/ext/javaee-api-8.0.jar
+release.external/javaee-web-api-8.0.jar=modules/ext/javaee-web-api-8.0.jar
diff --git a/enterprise/javaee8.api/nbproject/project.xml b/enterprise/javaee8.api/nbproject/project.xml
new file mode 100644
index 0000000..38ff5c7
--- /dev/null
+++ b/enterprise/javaee8.api/nbproject/project.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.javaee8.api</code-name-base>
+ <module-dependencies/>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/Bundle.properties b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/Bundle.properties
new file mode 100644
index 0000000..f37a9c6
--- /dev/null
+++ b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/Bundle.properties
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+OpenIDE-Module-Display-Category=Java EE
+OpenIDE-Module-Long-Description=\
+ Library wrapper which provides JavaEE 8 API (full API and web profile API)
+OpenIDE-Module-Name=Java EE 8 API Library
+OpenIDE-Module-Short-Description=Java EE 8 API Library
+
+#library display name
+javaee-api-8.0=Java EE 8 API Library
+javaee-web-api-8.0=Java EE Web 8 API Library
diff --git a/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-api-8.0.xml b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-api-8.0.xml
new file mode 100644
index 0000000..e992252
--- /dev/null
+++ b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-api-8.0.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<library version="3.0" xmlns="http://www.netbeans.org/ns/library-declaration/3">
+ <name>javaee-api-8.0</name>
+ <type>j2se</type>
+ <localizing-bundle>org/netbeans/modules/javaee8/api/Bundle</localizing-bundle>
+ <volume>
+ <type>classpath</type>
+ <resource>jar:nbinst://org.netbeans.modules.javaee8.api/modules/ext/javaee-api-8.0.jar!/</resource>
+ </volume>
+ <volume>
+ <type>javadoc</type>
+ <resource>jar:nbinst://org.netbeans.modules.j2ee.platform/docs/javaee-doc-api.jar!/</resource>
+ </volume>
+ <properties>
+ <property>
+ <name>maven-dependencies</name>
+ <value>javax:javaee-api:8.0:jar</value>
+ </property>
+ </properties>
+</library>
diff --git a/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-web-api-8.0.xml b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-web-api-8.0.xml
new file mode 100644
index 0000000..a7438e1
--- /dev/null
+++ b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/javaee-web-api-8.0.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<library version="3.0" xmlns="http://www.netbeans.org/ns/library-declaration/3">
+ <name>javaee-web-api-8.0</name>
+ <type>j2se</type>
+ <localizing-bundle>org/netbeans/modules/javaee8/api/Bundle</localizing-bundle>
+ <volume>
+ <type>classpath</type>
+ <resource>jar:nbinst://org.netbeans.modules.javaee8.api/modules/ext/javaee-web-api-8.0.jar!/</resource>
+ </volume>
+ <volume>
+ <type>javadoc</type>
+ <resource>jar:nbinst://org.netbeans.modules.j2ee.platform/docs/javaee-doc-api.jar!/</resource>
+ </volume>
+ <properties>
+ <property>
+ <name>maven-dependencies</name>
+ <value>javax:javaee-web-api:8.0:jar</value>
+ </property>
+ </properties>
+</library>
diff --git a/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/layer.xml b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/layer.xml
new file mode 100644
index 0000000..c9f14af
--- /dev/null
+++ b/enterprise/javaee8.api/src/org/netbeans/modules/javaee8/api/layer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
+<filesystem>
+ <folder name="org-netbeans-api-project-libraries">
+ <folder name="Libraries">
+ <file name="javaee-api-8.0.xml" url="javaee-api-8.0.xml">
+ <attr name="displayName" bundlevalue="org/netbeans/modules/javaee8/api/Bundle#javaee-api-8.0"/>
+ </file>
+ <file name="javaee-web-api-8.0.xml" url="javaee-web-api-8.0.xml">
+ <attr name="displayName" bundlevalue="org/netbeans/modules/javaee8/api/Bundle#javaee-web-api-8.0"/>
+ </file>
+ </folder>
+ </folder>
+</filesystem>
diff --git a/enterprise/maven.j2ee/manifest.mf b/enterprise/maven.j2ee/manifest.mf
index 275cd1c..a84f795 100644
--- a/enterprise/maven.j2ee/manifest.mf
+++ b/enterprise/maven.j2ee/manifest.mf
@@ -3,4 +3,4 @@
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/j2ee/Bundle.properties
OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
AutoUpdate-Show-In-Client: false
-OpenIDE-Module-Specification-Version: 1.65
+OpenIDE-Module-Specification-Version: 1.66
diff --git a/enterprise/maven.j2ee/nbproject/project.properties b/enterprise/maven.j2ee/nbproject/project.properties
index f658b53..5f9e836 100644
--- a/enterprise/maven.j2ee/nbproject/project.properties
+++ b/enterprise/maven.j2ee/nbproject/project.properties
@@ -18,5 +18,5 @@
is.eager=true
javac.compilerargs=-Xlint -Xlint:-serial -Xlint -Xlint:-serial
-javac.source=1.7
+javac.source=1.8
test.config.stableBTD.includes=**/*Test.class
diff --git a/enterprise/maven.j2ee/nbproject/project.xml b/enterprise/maven.j2ee/nbproject/project.xml
index 0cd6595..6d79637 100644
--- a/enterprise/maven.j2ee/nbproject/project.xml
+++ b/enterprise/maven.j2ee/nbproject/project.xml
@@ -538,7 +538,11 @@
</test-dependency>
</test-type>
</test-dependencies>
- <public-packages/>
+ <friend-packages>
+ <friend>org.netbeans.modules.payara.micro</friend>
+ <package>org.netbeans.modules.maven.j2ee.utils</package>
+ <package>org.netbeans.modules.maven.j2ee.ui</package>
+ </friend-packages>
</data>
</configuration>
</project>
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/MissingJavaEEForUnitTestExecutionHint.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/MissingJavaEEForUnitTestExecutionHint.java
index a8694d2..5d35554 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/MissingJavaEEForUnitTestExecutionHint.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/MissingJavaEEForUnitTestExecutionHint.java
@@ -119,7 +119,9 @@
continue;
}
if (fo.getNameExt().toLowerCase().contains("javaee-web-api-7.0") || // NOI18N
- fo.getNameExt().toLowerCase().contains("javaee-api-7.0")) { // NOI18N
+ fo.getNameExt().toLowerCase().contains("javaee-api-7.0") ||
+ fo.getNameExt().toLowerCase().contains("javaee-web-api-8.0") ||
+ fo.getNameExt().toLowerCase().contains("javaee-api-8.0")) { // NOI18N
javaeeJar = true;
}
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/customizer/impl/CustomizerRunWeb.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/customizer/impl/CustomizerRunWeb.java
index 193c68d..2a31a72 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/customizer/impl/CustomizerRunWeb.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/customizer/impl/CustomizerRunWeb.java
@@ -108,11 +108,13 @@
WEB_PROFILES.add(Profile.JAVA_EE_5);
WEB_PROFILES.add(Profile.JAVA_EE_6_WEB);
WEB_PROFILES.add(Profile.JAVA_EE_7_WEB);
+ WEB_PROFILES.add(Profile.JAVA_EE_8_WEB);
FULL_PROFILES = new TreeSet<>(Profile.UI_COMPARATOR);
FULL_PROFILES.add(Profile.JAVA_EE_5);
FULL_PROFILES.add(Profile.JAVA_EE_6_FULL);
FULL_PROFILES.add(Profile.JAVA_EE_7_FULL);
+ FULL_PROFILES.add(Profile.JAVA_EE_8_FULL);
}
@Messages({
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/BaseWizardIterator.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/BaseWizardIterator.java
index 80cb12f..be9cba6 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/BaseWizardIterator.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/BaseWizardIterator.java
@@ -85,17 +85,23 @@
JavaEEProjectSettings.setServerInstanceID(project, instanceID);
MavenProjectSupport.createWebXMLIfRequired(project, serverID);
- if (j2eeVersion != null && j2eeVersion.contains("1.7")) { //NOI18N
+ if (j2eeVersion != null && j2eeVersion.contains("1.8")) { //NOI18N
+ JavaPlatform platform = findJDK8Platform();
+ loadAuxillaryProps(platform,project);
+ } else if (j2eeVersion != null && j2eeVersion.contains("1.7")) { //NOI18N
JavaPlatform platform = findJDK7Platform();
-
- AuxiliaryProperties properties = project.getLookup().lookup(AuxiliaryProperties.class);
+ loadAuxillaryProps(platform,project);
+ }
+ }
+
+ private void loadAuxillaryProps(JavaPlatform platform, Project project){
+ AuxiliaryProperties properties = project.getLookup().lookup(AuxiliaryProperties.class);
if (platform == null || platform.equals(JavaPlatformManager.getDefault().getDefaultPlatform())) {
properties.put(Constants.HINT_JDK_PLATFORM, null, true);
} else {
properties.put(Constants.HINT_JDK_PLATFORM, platform.getDisplayName(), true);
}
- }
}
private JavaPlatform findJDK7Platform() {
@@ -114,6 +120,22 @@
return null;
}
+ private JavaPlatform findJDK8Platform() {
+ JavaPlatform defaultPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
+ List<JavaPlatform> jdk8Platforms = getJdk8Platforms();
+
+ // If the default platform support JDK 7 then choose it
+ if (jdk8Platforms.contains(defaultPlatform)) {
+ return defaultPlatform;
+ }
+
+ // Otherwise take one of the JDK 8 complient platforms
+ for (JavaPlatform platform : jdk8Platforms) {
+ return platform;
+ }
+ return null;
+ }
+
private List<JavaPlatform> getJdk7Platforms() {
List<JavaPlatform> jdk7platforms = new ArrayList<JavaPlatform>();
@@ -126,6 +148,18 @@
return jdk7platforms;
}
+ private List<JavaPlatform> getJdk8Platforms() {
+ List<JavaPlatform> jdk8platforms = new ArrayList<JavaPlatform>();
+
+ for (JavaPlatform platform : JavaPlatformManager.getDefault().getInstalledPlatforms()) {
+ SpecificationVersion version = platform.getSpecification().getVersion();
+ if ("1.8".equals(version.toString())) { //NOI18N
+ jdk8platforms.add(platform);
+ }
+ }
+ return jdk8platforms;
+ }
+
@Override
public void initialize(WizardDescriptor wiz) {
this.wiz = wiz;
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/EAVisualPanel.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/EAVisualPanel.java
index d3abfec..eed67c5 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/EAVisualPanel.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/EAVisualPanel.java
@@ -101,7 +101,7 @@
Profile profile = helper.getSelectedProfile();
if (profile == null) {
- profile = Profile.JAVA_EE_6_FULL;
+ profile = Profile.JAVA_EE_8_FULL;
}
helper.storeServerSettings(d);
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/ServerSelectionHelper.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/ServerSelectionHelper.java
index cbf8700..61e9901 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/ServerSelectionHelper.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/ServerSelectionHelper.java
@@ -35,6 +35,7 @@
import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerInstance;
import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerManager;
import org.netbeans.modules.javaee.project.api.ui.UserProjectSettings;
@@ -154,15 +155,19 @@
// If <No Server> option was selected, show all supported profiles except Java EE 7 profiles
if (ExecutionChecker.DEV_NULL.equals(serverInstance)) {
if (J2eeModule.Type.WAR.equals(projectType)) {
+ profiles.add(Profile.JAVA_EE_8_WEB);
profiles.add(Profile.JAVA_EE_7_WEB);
profiles.add(Profile.JAVA_EE_6_WEB);
} else {
+ profiles.add(Profile.JAVA_EE_8_FULL);
profiles.add(Profile.JAVA_EE_7_FULL);
profiles.add(Profile.JAVA_EE_6_FULL);
}
profiles.add(Profile.JAVA_EE_5);
} else {
try {
+ J2eePlatform pfm = findServerInstance(serverInstance).getJ2eePlatform();
+ Set<Profile> supported = pfm.getSupportedProfiles(projectType);
profiles.addAll(findServerInstance(serverInstance).getJ2eePlatform().getSupportedProfiles(projectType));
} catch (InstanceRemovedException ex) {
// If selected instance was removed during the process we can easily refresh Server model list and update versions again
@@ -179,9 +184,11 @@
// We want to have Java EE 6 Full profile for all project types except Web project
if (J2eeModule.Type.WAR.equals(projectType)) {
+ profiles.remove(Profile.JAVA_EE_8_FULL);
profiles.remove(Profile.JAVA_EE_7_FULL);
profiles.remove(Profile.JAVA_EE_6_FULL);
} else {
+ profiles.remove(Profile.JAVA_EE_8_WEB);
profiles.remove(Profile.JAVA_EE_7_WEB);
profiles.remove(Profile.JAVA_EE_6_WEB);
}
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/BaseJ2eeArchetypeProvider.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/BaseJ2eeArchetypeProvider.java
index 960a8a8..d0f85d0 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/BaseJ2eeArchetypeProvider.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/BaseJ2eeArchetypeProvider.java
@@ -54,6 +54,10 @@
map.put(j2eeProfile, createMojoArchetype(version, artifactId));
}
+ protected void addJavaEE8Archetype(Profile j2eeProfile, String groupId, String version, String artifactId) {
+ map.put(j2eeProfile, createArchetype(groupId, version, artifactId));
+ }
+
protected void addSameMojoArchetypeForAllProfiles(String version, String artifactId) {
Archetype archetype = createMojoArchetype(version, artifactId);
map.put(Profile.J2EE_14, archetype);
@@ -62,6 +66,10 @@
map.put(Profile.JAVA_EE_6_WEB, archetype);
map.put(Profile.JAVA_EE_7_FULL, archetype);
map.put(Profile.JAVA_EE_7_WEB, archetype);
+ Archetype javaEE8Archetype = createArchetype("io.github.juneau001","1.0.0", "webapp-javaee8");
+
+ map.put(Profile.JAVA_EE_8_FULL, javaEE8Archetype);
+ map.put(Profile.JAVA_EE_8_WEB, javaEE8Archetype);
}
private Archetype createMojoArchetype(String version, String artifactId) {
@@ -73,6 +81,15 @@
return archetype;
}
+ private Archetype createArchetype(String groupId, String version, String artifactId) {
+ Archetype archetype = new Archetype();
+ archetype.setGroupId(groupId); //NOI18N
+ archetype.setVersion(version);
+ archetype.setArtifactId(artifactId);
+
+ return archetype;
+ }
+
/**
* Returns archetype for a given profile.
* If an exception is thrown, it means we have some kind of an inconsistency between UI and ConcreteArchetype class
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/J2eeArchetypeFactory.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/J2eeArchetypeFactory.java
index 389e3b2..9ee1864 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/J2eeArchetypeFactory.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/ui/wizard/archetype/J2eeArchetypeFactory.java
@@ -90,16 +90,18 @@
private static class AppClientArchetypes extends BaseJ2eeArchetypeProvider {
@Override
protected void setUpProjectArchetypes() {
+ addJavaEE8Archetype(Profile.JAVA_EE_8_FULL,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_FULL, "1.1", "appclient-javaee7"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_FULL, "1.0", "appclient-javaee6"); //NOI18N
- addMojoArchetype(Profile.JAVA_EE_5, "1.0", "appclient-jee5"); //NOI18N
- addMojoArchetype(Profile.J2EE_14, "1.0", "appclient-jee5"); //NOI18N
+ // addMojoArchetype(Profile.JAVA_EE_5, "1.0", "appclient-jee5"); //NOI18N
+ // addMojoArchetype(Profile.J2EE_14, "1.0", "appclient-jee5"); //NOI18N
}
}
private static class EaArchetypes extends BaseJ2eeArchetypeProvider {
@Override
protected void setUpProjectArchetypes() {
+ addJavaEE8Archetype(Profile.JAVA_EE_8_FULL,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_FULL, "1.1", "pom-root"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_FULL, "1.1", "pom-root"); //NOI18N
}
@@ -108,6 +110,7 @@
private static class EarArchetypes extends BaseJ2eeArchetypeProvider {
@Override
protected void setUpProjectArchetypes() {
+ addJavaEE8Archetype(Profile.JAVA_EE_8_FULL,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_FULL, "1.0", "ear-javaee7"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_FULL, "1.5", "ear-javaee6"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_5, "1.4", "ear-jee5"); //NOI18N
@@ -118,6 +121,7 @@
private static class EjbArchetypes extends BaseJ2eeArchetypeProvider {
@Override
protected void setUpProjectArchetypes() {
+ addJavaEE8Archetype(Profile.JAVA_EE_8_FULL,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_FULL, "1.1", "ejb-javaee7"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_FULL, "1.5", "ejb-javaee6"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_5, "1.3", "ejb-jee5"); //NOI18N
@@ -128,15 +132,17 @@
private static class WebArchetypes extends BaseJ2eeArchetypeProvider {
@Override
protected void setUpProjectArchetypes() {
+ addJavaEE8Archetype(Profile.JAVA_EE_8_WEB,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_WEB, "1.1", "webapp-javaee7"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_WEB, "1.5", "webapp-javaee6"); //NOI18N
- addMojoArchetype(Profile.JAVA_EE_5, "1.3", "webapp-jee5"); //NOI18N
- addMojoArchetype(Profile.J2EE_14, "1.3", "webapp-j2ee14"); //NOI18N
+ // addMojoArchetype(Profile.JAVA_EE_5, "1.3", "webapp-jee5"); //NOI18N
+ // addMojoArchetype(Profile.J2EE_14, "1.3", "webapp-j2ee14"); //NOI18N
// This need to be here! It isn't one of an options when creating Web projects, but when creating Java EE projects
// using Java EE 6 Full profile, then the same profile applies to Ejb, Web and Parent project creation - In that case
// application is looking for Java EE 6 Full archetype to create the Web project with it, so we need to have it here
// or otherwise Java EE project would not be created properly
+ addJavaEE8Archetype(Profile.JAVA_EE_8_FULL,"io.github.juneau001", "1.0.0", "webapp-javaee8"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_7_FULL, "1.0", "webapp-javaee7"); //NOI18N
addMojoArchetype(Profile.JAVA_EE_6_FULL, "1.5", "webapp-javaee6"); //NOI18N
}
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebModuleImpl.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebModuleImpl.java
index 252640d..ac5fd3f 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebModuleImpl.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebModuleImpl.java
@@ -141,6 +141,9 @@
if (Profile.JAVA_EE_7_FULL.equals(pomProfile)) {
return Profile.JAVA_EE_7_WEB;
}
+ if (Profile.JAVA_EE_8_FULL.equals(pomProfile)) {
+ return Profile.JAVA_EE_8_WEB;
+ }
return pomProfile;
}
@@ -149,7 +152,7 @@
return descriptorProfile;
}
- return Profile.JAVA_EE_6_WEB;
+ return Profile.JAVA_EE_8_WEB;
}
private Profile getProfileFromDescriptor() {
@@ -172,6 +175,9 @@
if (WebApp.VERSION_3_1.equals(waVersion)) {
return Profile.JAVA_EE_7_WEB;
}
+ if (WebApp.VERSION_4_0.equals(waVersion)) {
+ return Profile.JAVA_EE_8_WEB;
+ }
} catch (IOException exc) {
ErrorManager.getDefault().notify(exc);
}
@@ -204,6 +210,8 @@
List<DependencyDesc> javaEE6Full = new ArrayList<>();
List<DependencyDesc> javaEE7Web = new ArrayList<>();
List<DependencyDesc> javaEE7Full = new ArrayList<>();
+ List<DependencyDesc> javaEE8Web = new ArrayList<>();
+ List<DependencyDesc> javaEE8Full = new ArrayList<>();
// Java EE specification
javaEE5.add(new DependencyDesc("javaee", "javaee-api", "5.0"));
@@ -212,6 +220,8 @@
javaEE6Web.add(new DependencyDesc("javax", "javaee-web-api", "6.0"));
javaEE7Full.add(new DependencyDesc("javax", "javaee-api", "7.0"));
javaEE7Web.add(new DependencyDesc("javax", "javaee-web-api", "7.0"));
+ javaEE8Full.add(new DependencyDesc("javax", "javaee-api", "8.0"));
+ javaEE8Web.add(new DependencyDesc("javax", "javaee-web-api", "8.0"));
// GlassFish implementations
javaEE5.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-all", "2"));
@@ -220,6 +230,8 @@
javaEE6Web.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-web", "3"));
javaEE7Full.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-all", "4"));
javaEE7Web.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-web", "4"));
+ javaEE8Full.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-all", "5.1.0"));
+ javaEE8Web.add(new DependencyDesc("org.glassfish.main.extras", "glassfish-embedded-web", "5.1.0"));
// WebLogic implementations
javaEE5.add(new DependencyDesc("weblogic", "weblogic", "10"));
@@ -237,6 +249,8 @@
javaEEMap.put(Profile.JAVA_EE_6_FULL, javaEE6Full);
javaEEMap.put(Profile.JAVA_EE_7_WEB, javaEE7Web);
javaEEMap.put(Profile.JAVA_EE_7_FULL, javaEE7Full);
+ javaEEMap.put(Profile.JAVA_EE_8_WEB, javaEE8Web);
+ javaEEMap.put(Profile.JAVA_EE_8_FULL, javaEE8Full);
}
private static class DependencyDesc {
@@ -353,7 +367,7 @@
version = wapp.getVersion();
}
if (version == null) {
- version = WebApp.VERSION_3_1;
+ version = WebApp.VERSION_4_0;
}
return version;
}
diff --git a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebRecoPrivTemplates.java b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebRecoPrivTemplates.java
index a659da9..e67ccc6 100644
--- a/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebRecoPrivTemplates.java
+++ b/enterprise/maven.j2ee/src/org/netbeans/modules/maven/j2ee/web/WebRecoPrivTemplates.java
@@ -192,7 +192,8 @@
private boolean isServerSupportingEJB31() {
if (ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_6_FULL) ||
- ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL)) {
+ ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_7_FULL) ||
+ ProjectUtil.getSupportedProfiles(project).contains(Profile.JAVA_EE_8_FULL)) {
return true;
}
diff --git a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEMavenTestBase.java b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEMavenTestBase.java
index e3dd6f2..2e1d485 100644
--- a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEMavenTestBase.java
+++ b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEMavenTestBase.java
@@ -51,7 +51,7 @@
public final String WEB_XML = "web.xml"; //NOI18N
public final String WEBLOGIC = "WebLogic"; //NOI18N
- public final String GLASSFISH = "gfv3ee6"; //NOI18N
+ public final String GLASSFISH = "gfv5ee8"; //NOI18N
public final String TOMCAT = "Tomcat"; //NOI18N
public final String JBOSS = "JBoss"; //NOI18N
diff --git a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEProjectSettingsImplTest.java b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEProjectSettingsImplTest.java
index acf6312..d885ee3 100644
--- a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEProjectSettingsImplTest.java
+++ b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/JavaEEProjectSettingsImplTest.java
@@ -52,6 +52,8 @@
}
public void checkProjectForProfileChange(Project prj) {
+ JavaEEProjectSettings.setProfile(prj, Profile.JAVA_EE_8_FULL);
+ assertEquals(Profile.JAVA_EE_8_FULL, JavaEEProjectSettings.getProfile(prj));
JavaEEProjectSettings.setProfile(prj, Profile.JAVA_EE_7_FULL);
assertEquals(Profile.JAVA_EE_7_FULL, JavaEEProjectSettings.getProfile(prj));
JavaEEProjectSettings.setProfile(prj, Profile.JAVA_EE_6_FULL);
diff --git a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/web/WebModuleImplTest.java b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/web/WebModuleImplTest.java
index de507bd..efeee01 100644
--- a/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/web/WebModuleImplTest.java
+++ b/enterprise/maven.j2ee/test/unit/src/org/netbeans/modules/maven/j2ee/web/WebModuleImplTest.java
@@ -113,6 +113,14 @@
checkJ2eeProfile(Profile.JAVA_EE_7_WEB, "javax", "javaee-web-api", "7.0"); //NOI18N
}
+ public void testGetJ2eeProfile_warProject_javaEE8FullSpecification() throws IOException {
+ checkJ2eeProfile(Profile.JAVA_EE_8_WEB, "javax", "javaee-api", "8.0"); //NOI18N
+ }
+
+ public void testGetJ2eeProfile_javaEE8WebSpecification() throws IOException {
+ checkJ2eeProfile(Profile.JAVA_EE_8_WEB, "javax", "javaee-web-api", "8.0"); //NOI18N
+ }
+
public void testGetJ2eeProfile_javaEE5Full_glassfish() throws IOException {
checkJ2eeProfile(Profile.JAVA_EE_5, "org.glassfish.main.extras", "glassfish-embedded-all", "2"); //NOI18N
}
@@ -137,6 +145,14 @@
checkJ2eeProfile(Profile.JAVA_EE_7_WEB, "org.glassfish.main.extras", "glassfish-embedded-web", "4.0.1"); //NOI18N
}
+ public void testGetJ2eeProfile_warProject_javaEE8Full_glassfish() throws IOException {
+ checkJ2eeProfile(Profile.JAVA_EE_8_WEB, "org.glassfish.main.extras", "glassfish-embedded-all", "5.0"); //NOI18N
+ }
+
+ public void testGetJ2eeProfile_javaEE8Web_glassfish() throws IOException {
+ checkJ2eeProfile(Profile.JAVA_EE_8_WEB, "org.glassfish.main.extras", "glassfish-embedded-web", "5.0"); //NOI18N
+ }
+
public void testGetJ2eeProfile_javaEE5_weblogic() throws IOException {
checkJ2eeProfile(Profile.JAVA_EE_5, "weblogic", "weblogic", "10.3.6"); //NOI18N
}
diff --git a/enterprise/payara.common/build.xml b/enterprise/payara.common/build.xml
new file mode 100644
index 0000000..5e603df
--- /dev/null
+++ b/enterprise/payara.common/build.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<project basedir="." default="build" name="enterprise/payara.common">
+ <description>Builds, tests, and runs the project org.netbeans.modules.payara.common</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
\ No newline at end of file
diff --git a/enterprise/payara.common/manifest.mf b/enterprise/payara.common/manifest.mf
new file mode 100644
index 0000000..f35cbc8
--- /dev/null
+++ b/enterprise/payara.common/manifest.mf
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.payara.common/0
+OpenIDE-Module-Install: org/netbeans/modules/payara/common/Installer.class
+OpenIDE-Module-Layer: org/netbeans/modules/payara/common/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/payara/common/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+OpenIDE-Module-Provides: org.netbeans.modules.payara.common
+
diff --git a/enterprise/payara.common/nbproject/org-netbeans-modules-payara-common.sig b/enterprise/payara.common/nbproject/org-netbeans-modules-payara-common.sig
new file mode 100644
index 0000000..2b0cd66
--- /dev/null
+++ b/enterprise/payara.common/nbproject/org-netbeans-modules-payara-common.sig
@@ -0,0 +1,2522 @@
+#Signature file v4.1
+#Version 1.77.1
+
+CLSS public abstract java.awt.Component
+cons protected init()
+fld protected javax.accessibility.AccessibleContext accessibleContext
+fld public final static float BOTTOM_ALIGNMENT = 1.0
+fld public final static float CENTER_ALIGNMENT = 0.5
+fld public final static float LEFT_ALIGNMENT = 0.0
+fld public final static float RIGHT_ALIGNMENT = 1.0
+fld public final static float TOP_ALIGNMENT = 0.0
+innr protected BltBufferStrategy
+innr protected FlipBufferStrategy
+innr protected abstract AccessibleAWTComponent
+innr public final static !enum BaselineResizeBehavior
+intf java.awt.MenuContainer
+intf java.awt.image.ImageObserver
+intf java.io.Serializable
+meth protected boolean requestFocus(boolean)
+meth protected boolean requestFocusInWindow(boolean)
+meth protected final void disableEvents(long)
+meth protected final void enableEvents(long)
+meth protected java.awt.AWTEvent coalesceEvents(java.awt.AWTEvent,java.awt.AWTEvent)
+meth protected java.lang.String paramString()
+meth protected void firePropertyChange(java.lang.String,boolean,boolean)
+meth protected void firePropertyChange(java.lang.String,int,int)
+meth protected void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth protected void processComponentEvent(java.awt.event.ComponentEvent)
+meth protected void processEvent(java.awt.AWTEvent)
+meth protected void processFocusEvent(java.awt.event.FocusEvent)
+meth protected void processHierarchyBoundsEvent(java.awt.event.HierarchyEvent)
+meth protected void processHierarchyEvent(java.awt.event.HierarchyEvent)
+meth protected void processInputMethodEvent(java.awt.event.InputMethodEvent)
+meth protected void processKeyEvent(java.awt.event.KeyEvent)
+meth protected void processMouseEvent(java.awt.event.MouseEvent)
+meth protected void processMouseMotionEvent(java.awt.event.MouseEvent)
+meth protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent)
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean action(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean areFocusTraversalKeysSet(int)
+meth public boolean contains(int,int)
+meth public boolean contains(java.awt.Point)
+meth public boolean getFocusTraversalKeysEnabled()
+meth public boolean getIgnoreRepaint()
+meth public boolean gotFocus(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean handleEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public boolean hasFocus()
+meth public boolean imageUpdate(java.awt.Image,int,int,int,int,int)
+meth public boolean inside(int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean isBackgroundSet()
+meth public boolean isCursorSet()
+meth public boolean isDisplayable()
+meth public boolean isDoubleBuffered()
+meth public boolean isEnabled()
+meth public boolean isFocusCycleRoot(java.awt.Container)
+meth public boolean isFocusOwner()
+meth public boolean isFocusTraversable()
+ anno 0 java.lang.Deprecated()
+meth public boolean isFocusable()
+meth public boolean isFontSet()
+meth public boolean isForegroundSet()
+meth public boolean isLightweight()
+meth public boolean isMaximumSizeSet()
+meth public boolean isMinimumSizeSet()
+meth public boolean isOpaque()
+meth public boolean isPreferredSizeSet()
+meth public boolean isShowing()
+meth public boolean isValid()
+meth public boolean isVisible()
+meth public boolean keyDown(java.awt.Event,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean keyUp(java.awt.Event,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean lostFocus(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseDown(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseDrag(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseEnter(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseExit(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseMove(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseUp(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean postEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public boolean prepareImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
+meth public boolean prepareImage(java.awt.Image,java.awt.image.ImageObserver)
+meth public boolean requestFocusInWindow()
+meth public final java.lang.Object getTreeLock()
+meth public final void dispatchEvent(java.awt.AWTEvent)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int checkImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
+meth public int checkImage(java.awt.Image,java.awt.image.ImageObserver)
+meth public int getBaseline(int,int)
+meth public int getHeight()
+meth public int getWidth()
+meth public int getX()
+meth public int getY()
+meth public java.awt.Color getBackground()
+meth public java.awt.Color getForeground()
+meth public java.awt.Component getComponentAt(int,int)
+meth public java.awt.Component getComponentAt(java.awt.Point)
+meth public java.awt.Component locate(int,int)
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component$BaselineResizeBehavior getBaselineResizeBehavior()
+meth public java.awt.ComponentOrientation getComponentOrientation()
+meth public java.awt.Container getFocusCycleRootAncestor()
+meth public java.awt.Container getParent()
+meth public java.awt.Cursor getCursor()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension getSize()
+meth public java.awt.Dimension getSize(java.awt.Dimension)
+meth public java.awt.Dimension minimumSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension preferredSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension size()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Font getFont()
+meth public java.awt.FontMetrics getFontMetrics(java.awt.Font)
+meth public java.awt.Graphics getGraphics()
+meth public java.awt.GraphicsConfiguration getGraphicsConfiguration()
+meth public java.awt.Image createImage(int,int)
+meth public java.awt.Image createImage(java.awt.image.ImageProducer)
+meth public java.awt.Point getLocation()
+meth public java.awt.Point getLocation(java.awt.Point)
+meth public java.awt.Point getLocationOnScreen()
+meth public java.awt.Point getMousePosition()
+meth public java.awt.Point location()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Rectangle bounds()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Rectangle getBounds()
+meth public java.awt.Rectangle getBounds(java.awt.Rectangle)
+meth public java.awt.Toolkit getToolkit()
+meth public java.awt.dnd.DropTarget getDropTarget()
+meth public java.awt.event.ComponentListener[] getComponentListeners()
+meth public java.awt.event.FocusListener[] getFocusListeners()
+meth public java.awt.event.HierarchyBoundsListener[] getHierarchyBoundsListeners()
+meth public java.awt.event.HierarchyListener[] getHierarchyListeners()
+meth public java.awt.event.InputMethodListener[] getInputMethodListeners()
+meth public java.awt.event.KeyListener[] getKeyListeners()
+meth public java.awt.event.MouseListener[] getMouseListeners()
+meth public java.awt.event.MouseMotionListener[] getMouseMotionListeners()
+meth public java.awt.event.MouseWheelListener[] getMouseWheelListeners()
+meth public java.awt.im.InputContext getInputContext()
+meth public java.awt.im.InputMethodRequests getInputMethodRequests()
+meth public java.awt.image.ColorModel getColorModel()
+meth public java.awt.image.VolatileImage createVolatileImage(int,int)
+meth public java.awt.image.VolatileImage createVolatileImage(int,int,java.awt.ImageCapabilities) throws java.awt.AWTException
+meth public java.awt.peer.ComponentPeer getPeer()
+ anno 0 java.lang.Deprecated()
+meth public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
+meth public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String)
+meth public java.lang.String getName()
+meth public java.lang.String toString()
+meth public java.util.Locale getLocale()
+meth public java.util.Set<java.awt.AWTKeyStroke> getFocusTraversalKeys(int)
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public void add(java.awt.PopupMenu)
+meth public void addComponentListener(java.awt.event.ComponentListener)
+meth public void addFocusListener(java.awt.event.FocusListener)
+meth public void addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
+meth public void addHierarchyListener(java.awt.event.HierarchyListener)
+meth public void addInputMethodListener(java.awt.event.InputMethodListener)
+meth public void addKeyListener(java.awt.event.KeyListener)
+meth public void addMouseListener(java.awt.event.MouseListener)
+meth public void addMouseMotionListener(java.awt.event.MouseMotionListener)
+meth public void addMouseWheelListener(java.awt.event.MouseWheelListener)
+meth public void addNotify()
+meth public void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void applyComponentOrientation(java.awt.ComponentOrientation)
+meth public void deliverEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public void disable()
+ anno 0 java.lang.Deprecated()
+meth public void doLayout()
+meth public void enable()
+ anno 0 java.lang.Deprecated()
+meth public void enable(boolean)
+ anno 0 java.lang.Deprecated()
+meth public void enableInputMethods(boolean)
+meth public void firePropertyChange(java.lang.String,byte,byte)
+meth public void firePropertyChange(java.lang.String,char,char)
+meth public void firePropertyChange(java.lang.String,double,double)
+meth public void firePropertyChange(java.lang.String,float,float)
+meth public void firePropertyChange(java.lang.String,long,long)
+meth public void firePropertyChange(java.lang.String,short,short)
+meth public void hide()
+ anno 0 java.lang.Deprecated()
+meth public void invalidate()
+meth public void layout()
+ anno 0 java.lang.Deprecated()
+meth public void list()
+meth public void list(java.io.PrintStream)
+meth public void list(java.io.PrintStream,int)
+meth public void list(java.io.PrintWriter)
+meth public void list(java.io.PrintWriter,int)
+meth public void move(int,int)
+ anno 0 java.lang.Deprecated()
+meth public void nextFocus()
+ anno 0 java.lang.Deprecated()
+meth public void paint(java.awt.Graphics)
+meth public void paintAll(java.awt.Graphics)
+meth public void print(java.awt.Graphics)
+meth public void printAll(java.awt.Graphics)
+meth public void remove(java.awt.MenuComponent)
+meth public void removeComponentListener(java.awt.event.ComponentListener)
+meth public void removeFocusListener(java.awt.event.FocusListener)
+meth public void removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
+meth public void removeHierarchyListener(java.awt.event.HierarchyListener)
+meth public void removeInputMethodListener(java.awt.event.InputMethodListener)
+meth public void removeKeyListener(java.awt.event.KeyListener)
+meth public void removeMouseListener(java.awt.event.MouseListener)
+meth public void removeMouseMotionListener(java.awt.event.MouseMotionListener)
+meth public void removeMouseWheelListener(java.awt.event.MouseWheelListener)
+meth public void removeNotify()
+meth public void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void repaint()
+meth public void repaint(int,int,int,int)
+meth public void repaint(long)
+meth public void repaint(long,int,int,int,int)
+meth public void requestFocus()
+meth public void reshape(int,int,int,int)
+ anno 0 java.lang.Deprecated()
+meth public void resize(int,int)
+ anno 0 java.lang.Deprecated()
+meth public void resize(java.awt.Dimension)
+ anno 0 java.lang.Deprecated()
+meth public void revalidate()
+meth public void setBackground(java.awt.Color)
+meth public void setBounds(int,int,int,int)
+meth public void setBounds(java.awt.Rectangle)
+meth public void setComponentOrientation(java.awt.ComponentOrientation)
+meth public void setCursor(java.awt.Cursor)
+meth public void setDropTarget(java.awt.dnd.DropTarget)
+meth public void setEnabled(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFocusTraversalKeysEnabled(boolean)
+meth public void setFocusable(boolean)
+meth public void setFont(java.awt.Font)
+meth public void setForeground(java.awt.Color)
+meth public void setIgnoreRepaint(boolean)
+meth public void setLocale(java.util.Locale)
+meth public void setLocation(int,int)
+meth public void setLocation(java.awt.Point)
+meth public void setMaximumSize(java.awt.Dimension)
+meth public void setMinimumSize(java.awt.Dimension)
+meth public void setName(java.lang.String)
+meth public void setPreferredSize(java.awt.Dimension)
+meth public void setSize(int,int)
+meth public void setSize(java.awt.Dimension)
+meth public void setVisible(boolean)
+meth public void show()
+ anno 0 java.lang.Deprecated()
+meth public void show(boolean)
+ anno 0 java.lang.Deprecated()
+meth public void transferFocus()
+meth public void transferFocusBackward()
+meth public void transferFocusUpCycle()
+meth public void update(java.awt.Graphics)
+meth public void validate()
+supr java.lang.Object
+hfds FOCUS_TRAVERSABLE_DEFAULT,FOCUS_TRAVERSABLE_SET,FOCUS_TRAVERSABLE_UNKNOWN,LOCK,acc,actionListenerK,adjustmentListenerK,appContext,autoFocusTransferOnDisposal,background,backgroundEraseDisabled,boundsOp,bufferStrategy,changeSupport,coalesceEventsParams,coalesceMap,coalescingEnabled,componentListener,componentListenerK,componentOrientation,componentSerializedDataVersion,compoundShape,containerListenerK,cursor,dropTarget,enabled,eventCache,eventLog,eventMask,focusListener,focusListenerK,focusLog,focusTraversalKeyPropertyNames,focusTraversalKeys,focusTraversalKeysEnabled,focusable,font,foreground,graphicsConfig,height,hierarchyBoundsListener,hierarchyBoundsListenerK,hierarchyListener,hierarchyListenerK,ignoreRepaint,incRate,inputMethodListener,inputMethodListenerK,isAddNotifyComplete,isFocusTraversableOverridden,isInc,isPacked,itemListenerK,keyListener,keyListenerK,locale,log,maxSize,maxSizeSet,minSize,minSizeSet,mixingCutoutRegion,mixingLog,mouseListener,mouseListenerK,mouseMotionListener,mouseMotionListenerK,mouseWheelListener,mouseWheelListenerK,name,nameExplicitlySet,newEventsOnly,objectLock,ownedWindowK,parent,peer,peerFont,popups,prefSize,prefSizeSet,requestFocusController,serialVersionUID,textListenerK,valid,visible,width,windowClosingException,windowFocusListenerK,windowListenerK,windowStateListenerK,x,y
+hcls AWTTreeLock,BltSubRegionBufferStrategy,DummyRequestFocusController,FlipSubRegionBufferStrategy,ProxyCapabilities,SingleBufferStrategy
+
+CLSS public java.awt.Container
+cons public init()
+innr protected AccessibleAWTContainer
+meth protected java.lang.String paramString()
+meth protected void addImpl(java.awt.Component,java.lang.Object,int)
+meth protected void processContainerEvent(java.awt.event.ContainerEvent)
+meth protected void processEvent(java.awt.AWTEvent)
+meth protected void validateTree()
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean areFocusTraversalKeysSet(int)
+meth public boolean isAncestorOf(java.awt.Component)
+meth public boolean isFocusCycleRoot()
+meth public boolean isFocusCycleRoot(java.awt.Container)
+meth public boolean isFocusTraversalPolicySet()
+meth public boolean isValidateRoot()
+meth public final boolean isFocusTraversalPolicyProvider()
+meth public final void setFocusTraversalPolicyProvider(boolean)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int countComponents()
+ anno 0 java.lang.Deprecated()
+meth public int getComponentCount()
+meth public int getComponentZOrder(java.awt.Component)
+meth public java.awt.Component add(java.awt.Component)
+meth public java.awt.Component add(java.awt.Component,int)
+meth public java.awt.Component add(java.lang.String,java.awt.Component)
+meth public java.awt.Component findComponentAt(int,int)
+meth public java.awt.Component findComponentAt(java.awt.Point)
+meth public java.awt.Component getComponent(int)
+meth public java.awt.Component getComponentAt(int,int)
+meth public java.awt.Component getComponentAt(java.awt.Point)
+meth public java.awt.Component locate(int,int)
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component[] getComponents()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension minimumSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension preferredSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.FocusTraversalPolicy getFocusTraversalPolicy()
+meth public java.awt.Insets getInsets()
+meth public java.awt.Insets insets()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.LayoutManager getLayout()
+meth public java.awt.Point getMousePosition(boolean)
+meth public java.awt.event.ContainerListener[] getContainerListeners()
+meth public java.util.Set<java.awt.AWTKeyStroke> getFocusTraversalKeys(int)
+meth public void add(java.awt.Component,java.lang.Object)
+meth public void add(java.awt.Component,java.lang.Object,int)
+meth public void addContainerListener(java.awt.event.ContainerListener)
+meth public void addNotify()
+meth public void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void applyComponentOrientation(java.awt.ComponentOrientation)
+meth public void deliverEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public void doLayout()
+meth public void invalidate()
+meth public void layout()
+ anno 0 java.lang.Deprecated()
+meth public void list(java.io.PrintStream,int)
+meth public void list(java.io.PrintWriter,int)
+meth public void paint(java.awt.Graphics)
+meth public void paintComponents(java.awt.Graphics)
+meth public void print(java.awt.Graphics)
+meth public void printComponents(java.awt.Graphics)
+meth public void remove(int)
+meth public void remove(java.awt.Component)
+meth public void removeAll()
+meth public void removeContainerListener(java.awt.event.ContainerListener)
+meth public void removeNotify()
+meth public void setComponentZOrder(java.awt.Component,int)
+meth public void setFocusCycleRoot(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
+meth public void setFont(java.awt.Font)
+meth public void setLayout(java.awt.LayoutManager)
+meth public void transferFocusDownCycle()
+meth public void update(java.awt.Graphics)
+meth public void validate()
+supr java.awt.Component
+hfds EMPTY_ARRAY,INCLUDE_SELF,SEARCH_HEAVYWEIGHTS,component,containerListener,containerSerializedDataVersion,descendUnconditionallyWhenValidating,descendantsCount,dispatcher,eventLog,focusCycleRoot,focusTraversalPolicy,focusTraversalPolicyProvider,isJavaAwtSmartInvalidate,layoutMgr,listeningBoundsChildren,listeningChildren,log,mixingLog,modalAppContext,modalComp,numOfHWComponents,numOfLWComponents,preserveBackgroundColor,printing,printingThreads,serialPersistentFields,serialVersionUID
+hcls DropTargetEventTargetFilter,EventTargetFilter,MouseEventTargetFilter,WakingRunnable
+
+CLSS public abstract interface java.awt.ItemSelectable
+meth public abstract java.lang.Object[] getSelectedObjects()
+meth public abstract void addItemListener(java.awt.event.ItemListener)
+meth public abstract void removeItemListener(java.awt.event.ItemListener)
+
+CLSS public abstract interface java.awt.MenuContainer
+meth public abstract boolean postEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public abstract java.awt.Font getFont()
+meth public abstract void remove(java.awt.MenuComponent)
+
+CLSS public abstract interface java.awt.event.ActionListener
+intf java.util.EventListener
+meth public abstract void actionPerformed(java.awt.event.ActionEvent)
+
+CLSS public abstract interface java.awt.image.ImageObserver
+fld public final static int ABORT = 128
+fld public final static int ALLBITS = 32
+fld public final static int ERROR = 64
+fld public final static int FRAMEBITS = 16
+fld public final static int HEIGHT = 2
+fld public final static int PROPERTIES = 4
+fld public final static int SOMEBITS = 8
+fld public final static int WIDTH = 1
+meth public abstract boolean imageUpdate(java.awt.Image,int,int,int,int,int)
+
+CLSS public java.beans.FeatureDescriptor
+cons public init()
+meth public boolean isExpert()
+meth public boolean isHidden()
+meth public boolean isPreferred()
+meth public java.lang.Object getValue(java.lang.String)
+meth public java.lang.String getDisplayName()
+meth public java.lang.String getName()
+meth public java.lang.String getShortDescription()
+meth public java.lang.String toString()
+meth public java.util.Enumeration<java.lang.String> attributeNames()
+meth public void setDisplayName(java.lang.String)
+meth public void setExpert(boolean)
+meth public void setHidden(boolean)
+meth public void setName(java.lang.String)
+meth public void setPreferred(boolean)
+meth public void setShortDescription(java.lang.String)
+meth public void setValue(java.lang.String,java.lang.Object)
+supr java.lang.Object
+hfds TRANSIENT,classRef,displayName,expert,hidden,name,preferred,shortDescription,table
+
+CLSS public abstract interface java.io.Externalizable
+intf java.io.Serializable
+meth public abstract void readExternal(java.io.ObjectInput) throws java.io.IOException,java.lang.ClassNotFoundException
+meth public abstract void writeExternal(java.io.ObjectOutput) throws java.io.IOException
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public abstract interface java.lang.Cloneable
+
+CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
+meth public abstract int compareTo({java.lang.Comparable%0})
+
+CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
+cons protected init(java.lang.String,int)
+intf java.io.Serializable
+intf java.lang.Comparable<{java.lang.Enum%0}>
+meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected final void finalize()
+meth public final boolean equals(java.lang.Object)
+meth public final int compareTo({java.lang.Enum%0})
+meth public final int hashCode()
+meth public final int ordinal()
+meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
+meth public final java.lang.String name()
+meth public java.lang.String toString()
+meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
+supr java.lang.Object
+hfds name,ordinal
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public abstract interface !annotation java.lang.FunctionalInterface
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public abstract interface java.lang.Runnable
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract void run()
+
+CLSS public java.lang.Thread
+cons public init()
+cons public init(java.lang.Runnable)
+cons public init(java.lang.Runnable,java.lang.String)
+cons public init(java.lang.String)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable,java.lang.String)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable,java.lang.String,long)
+cons public init(java.lang.ThreadGroup,java.lang.String)
+fld public final static int MAX_PRIORITY = 10
+fld public final static int MIN_PRIORITY = 1
+fld public final static int NORM_PRIORITY = 5
+innr public abstract interface static UncaughtExceptionHandler
+innr public final static !enum State
+intf java.lang.Runnable
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth public boolean isInterrupted()
+meth public final boolean isAlive()
+meth public final boolean isDaemon()
+meth public final int getPriority()
+meth public final java.lang.String getName()
+meth public final java.lang.ThreadGroup getThreadGroup()
+meth public final void checkAccess()
+meth public final void join() throws java.lang.InterruptedException
+meth public final void join(long) throws java.lang.InterruptedException
+meth public final void join(long,int) throws java.lang.InterruptedException
+meth public final void resume()
+ anno 0 java.lang.Deprecated()
+meth public final void setDaemon(boolean)
+meth public final void setName(java.lang.String)
+meth public final void setPriority(int)
+meth public final void stop()
+ anno 0 java.lang.Deprecated()
+meth public final void stop(java.lang.Throwable)
+ anno 0 java.lang.Deprecated()
+meth public final void suspend()
+ anno 0 java.lang.Deprecated()
+meth public int countStackFrames()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.ClassLoader getContextClassLoader()
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String toString()
+meth public java.lang.Thread$State getState()
+meth public java.lang.Thread$UncaughtExceptionHandler getUncaughtExceptionHandler()
+meth public long getId()
+meth public static boolean holdsLock(java.lang.Object)
+meth public static boolean interrupted()
+meth public static int activeCount()
+meth public static int enumerate(java.lang.Thread[])
+meth public static java.lang.Thread currentThread()
+meth public static java.lang.Thread$UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()
+meth public static java.util.Map<java.lang.Thread,java.lang.StackTraceElement[]> getAllStackTraces()
+meth public static void dumpStack()
+meth public static void setDefaultUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler)
+meth public static void sleep(long) throws java.lang.InterruptedException
+meth public static void sleep(long,int) throws java.lang.InterruptedException
+meth public static void yield()
+meth public void destroy()
+ anno 0 java.lang.Deprecated()
+meth public void interrupt()
+meth public void run()
+meth public void setContextClassLoader(java.lang.ClassLoader)
+meth public void setUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler)
+meth public void start()
+supr java.lang.Object
+hfds EMPTY_STACK_TRACE,SUBCLASS_IMPLEMENTATION_PERMISSION,blocker,blockerLock,contextClassLoader,daemon,defaultUncaughtExceptionHandler,eetop,group,inheritableThreadLocals,inheritedAccessControlContext,name,nativeParkEventPointer,parkBlocker,priority,single_step,stackSize,stillborn,target,threadInitNumber,threadLocalRandomProbe,threadLocalRandomSecondarySeed,threadLocalRandomSeed,threadLocals,threadQ,threadSeqNumber,threadStatus,tid,uncaughtExceptionHandler
+hcls Caches,WeakClassKey
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
+CLSS public abstract java.net.Authenticator
+cons public init()
+innr public final static !enum RequestorType
+meth protected final int getRequestingPort()
+meth protected final java.lang.String getRequestingHost()
+meth protected final java.lang.String getRequestingPrompt()
+meth protected final java.lang.String getRequestingProtocol()
+meth protected final java.lang.String getRequestingScheme()
+meth protected final java.net.InetAddress getRequestingSite()
+meth protected java.net.Authenticator$RequestorType getRequestorType()
+meth protected java.net.PasswordAuthentication getPasswordAuthentication()
+meth protected java.net.URL getRequestingURL()
+meth public static java.net.PasswordAuthentication requestPasswordAuthentication(java.lang.String,java.net.InetAddress,int,java.lang.String,java.lang.String,java.lang.String)
+meth public static java.net.PasswordAuthentication requestPasswordAuthentication(java.lang.String,java.net.InetAddress,int,java.lang.String,java.lang.String,java.lang.String,java.net.URL,java.net.Authenticator$RequestorType)
+meth public static java.net.PasswordAuthentication requestPasswordAuthentication(java.net.InetAddress,int,java.lang.String,java.lang.String,java.lang.String)
+meth public static void setDefault(java.net.Authenticator)
+supr java.lang.Object
+hfds requestingAuthType,requestingHost,requestingPort,requestingPrompt,requestingProtocol,requestingScheme,requestingSite,requestingURL,theAuthenticator
+
+CLSS public abstract interface java.util.Comparator<%0 extends java.lang.Object>
+ anno 0 java.lang.FunctionalInterface()
+meth public <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.function.Function<? super {java.util.Comparator%0},? extends {%%0}>)
+meth public <%0 extends java.lang.Object> java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.function.Function<? super {java.util.Comparator%0},? extends {%%0}>,java.util.Comparator<? super {%%0}>)
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int compare({java.util.Comparator%0},{java.util.Comparator%0})
+meth public java.util.Comparator<{java.util.Comparator%0}> reversed()
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.Comparator<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingDouble(java.util.function.ToDoubleFunction<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingInt(java.util.function.ToIntFunction<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingLong(java.util.function.ToLongFunction<? super {java.util.Comparator%0}>)
+meth public static <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{%%0}> naturalOrder()
+meth public static <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{%%0}> reverseOrder()
+meth public static <%0 extends java.lang.Object, %1 extends java.lang.Comparable<? super {%%1}>> java.util.Comparator<{%%0}> comparing(java.util.function.Function<? super {%%0},? extends {%%1}>)
+meth public static <%0 extends java.lang.Object, %1 extends java.lang.Object> java.util.Comparator<{%%0}> comparing(java.util.function.Function<? super {%%0},? extends {%%1}>,java.util.Comparator<? super {%%1}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingDouble(java.util.function.ToDoubleFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingInt(java.util.function.ToIntFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingLong(java.util.function.ToLongFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> nullsFirst(java.util.Comparator<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> nullsLast(java.util.Comparator<? super {%%0}>)
+
+CLSS public abstract interface java.util.EventListener
+
+CLSS public abstract interface java.util.Map<%0 extends java.lang.Object, %1 extends java.lang.Object>
+innr public abstract interface static Entry
+meth public abstract boolean containsKey(java.lang.Object)
+meth public abstract boolean containsValue(java.lang.Object)
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract boolean isEmpty()
+meth public abstract int hashCode()
+meth public abstract int size()
+meth public abstract java.util.Collection<{java.util.Map%1}> values()
+meth public abstract java.util.Set<java.util.Map$Entry<{java.util.Map%0},{java.util.Map%1}>> entrySet()
+meth public abstract java.util.Set<{java.util.Map%0}> keySet()
+meth public abstract void clear()
+meth public abstract void putAll(java.util.Map<? extends {java.util.Map%0},? extends {java.util.Map%1}>)
+meth public abstract {java.util.Map%1} get(java.lang.Object)
+meth public abstract {java.util.Map%1} put({java.util.Map%0},{java.util.Map%1})
+meth public abstract {java.util.Map%1} remove(java.lang.Object)
+meth public boolean remove(java.lang.Object,java.lang.Object)
+meth public boolean replace({java.util.Map%0},{java.util.Map%1},{java.util.Map%1})
+meth public void forEach(java.util.function.BiConsumer<? super {java.util.Map%0},? super {java.util.Map%1}>)
+meth public void replaceAll(java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
+meth public {java.util.Map%1} compute({java.util.Map%0},java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
+meth public {java.util.Map%1} computeIfAbsent({java.util.Map%0},java.util.function.Function<? super {java.util.Map%0},? extends {java.util.Map%1}>)
+meth public {java.util.Map%1} computeIfPresent({java.util.Map%0},java.util.function.BiFunction<? super {java.util.Map%0},? super {java.util.Map%1},? extends {java.util.Map%1}>)
+meth public {java.util.Map%1} getOrDefault(java.lang.Object,{java.util.Map%1})
+meth public {java.util.Map%1} merge({java.util.Map%0},{java.util.Map%1},java.util.function.BiFunction<? super {java.util.Map%1},? super {java.util.Map%1},? extends {java.util.Map%1}>)
+meth public {java.util.Map%1} putIfAbsent({java.util.Map%0},{java.util.Map%1})
+meth public {java.util.Map%1} replace({java.util.Map%0},{java.util.Map%1})
+
+CLSS public abstract interface java.util.concurrent.Callable<%0 extends java.lang.Object>
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract {java.util.concurrent.Callable%0} call() throws java.lang.Exception
+
+CLSS public abstract interface javax.accessibility.Accessible
+meth public abstract javax.accessibility.AccessibleContext getAccessibleContext()
+
+CLSS public abstract javax.swing.AbstractAction
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,javax.swing.Icon)
+fld protected boolean enabled
+fld protected javax.swing.event.SwingPropertyChangeSupport changeSupport
+intf java.io.Serializable
+intf java.lang.Cloneable
+intf javax.swing.Action
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth public boolean isEnabled()
+meth public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
+meth public java.lang.Object getValue(java.lang.String)
+meth public java.lang.Object[] getKeys()
+meth public void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void putValue(java.lang.String,java.lang.Object)
+meth public void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void setEnabled(boolean)
+supr java.lang.Object
+hfds RECONFIGURE_ON_NULL,arrayTable
+
+CLSS public abstract interface javax.swing.Action
+fld public final static java.lang.String ACCELERATOR_KEY = "AcceleratorKey"
+fld public final static java.lang.String ACTION_COMMAND_KEY = "ActionCommandKey"
+fld public final static java.lang.String DEFAULT = "Default"
+fld public final static java.lang.String DISPLAYED_MNEMONIC_INDEX_KEY = "SwingDisplayedMnemonicIndexKey"
+fld public final static java.lang.String LARGE_ICON_KEY = "SwingLargeIconKey"
+fld public final static java.lang.String LONG_DESCRIPTION = "LongDescription"
+fld public final static java.lang.String MNEMONIC_KEY = "MnemonicKey"
+fld public final static java.lang.String NAME = "Name"
+fld public final static java.lang.String SELECTED_KEY = "SwingSelectedKey"
+fld public final static java.lang.String SHORT_DESCRIPTION = "ShortDescription"
+fld public final static java.lang.String SMALL_ICON = "SmallIcon"
+intf java.awt.event.ActionListener
+meth public abstract boolean isEnabled()
+meth public abstract java.lang.Object getValue(java.lang.String)
+meth public abstract void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public abstract void putValue(java.lang.String,java.lang.Object)
+meth public abstract void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public abstract void setEnabled(boolean)
+
+CLSS public javax.swing.JComboBox<%0 extends java.lang.Object>
+cons public init()
+cons public init(java.util.Vector<{javax.swing.JComboBox%0}>)
+cons public init(javax.swing.ComboBoxModel<{javax.swing.JComboBox%0}>)
+cons public init({javax.swing.JComboBox%0}[])
+fld protected boolean isEditable
+fld protected boolean lightWeightPopupEnabled
+fld protected int maximumRowCount
+fld protected java.lang.Object selectedItemReminder
+fld protected java.lang.String actionCommand
+fld protected javax.swing.ComboBoxEditor editor
+fld protected javax.swing.ComboBoxModel<{javax.swing.JComboBox%0}> dataModel
+fld protected javax.swing.JComboBox$KeySelectionManager keySelectionManager
+fld protected javax.swing.ListCellRenderer<? super {javax.swing.JComboBox%0}> renderer
+innr protected AccessibleJComboBox
+innr public abstract interface static KeySelectionManager
+intf java.awt.ItemSelectable
+intf java.awt.event.ActionListener
+intf javax.accessibility.Accessible
+intf javax.swing.event.ListDataListener
+meth protected boolean processKeyBinding(javax.swing.KeyStroke,java.awt.event.KeyEvent,int,boolean)
+meth protected java.beans.PropertyChangeListener createActionPropertyChangeListener(javax.swing.Action)
+meth protected java.lang.String paramString()
+meth protected javax.swing.JComboBox$KeySelectionManager createDefaultKeySelectionManager()
+meth protected void actionPropertyChanged(javax.swing.Action,java.lang.String)
+meth protected void configurePropertiesFromAction(javax.swing.Action)
+meth protected void fireActionEvent()
+meth protected void fireItemStateChanged(java.awt.event.ItemEvent)
+meth protected void installAncestorListener()
+meth protected void selectedItemChanged()
+meth public boolean isEditable()
+meth public boolean isLightWeightPopupEnabled()
+meth public boolean isPopupVisible()
+meth public boolean selectWithKeyChar(char)
+meth public int getItemCount()
+meth public int getMaximumRowCount()
+meth public int getSelectedIndex()
+meth public java.awt.event.ActionListener[] getActionListeners()
+meth public java.awt.event.ItemListener[] getItemListeners()
+meth public java.lang.Object getSelectedItem()
+meth public java.lang.Object[] getSelectedObjects()
+meth public java.lang.String getActionCommand()
+meth public java.lang.String getUIClassID()
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public javax.swing.Action getAction()
+meth public javax.swing.ComboBoxEditor getEditor()
+meth public javax.swing.ComboBoxModel<{javax.swing.JComboBox%0}> getModel()
+meth public javax.swing.JComboBox$KeySelectionManager getKeySelectionManager()
+meth public javax.swing.ListCellRenderer<? super {javax.swing.JComboBox%0}> getRenderer()
+meth public javax.swing.event.PopupMenuListener[] getPopupMenuListeners()
+meth public javax.swing.plaf.ComboBoxUI getUI()
+meth public void actionPerformed(java.awt.event.ActionEvent)
+meth public void addActionListener(java.awt.event.ActionListener)
+meth public void addItem({javax.swing.JComboBox%0})
+meth public void addItemListener(java.awt.event.ItemListener)
+meth public void addPopupMenuListener(javax.swing.event.PopupMenuListener)
+meth public void configureEditor(javax.swing.ComboBoxEditor,java.lang.Object)
+meth public void contentsChanged(javax.swing.event.ListDataEvent)
+meth public void firePopupMenuCanceled()
+meth public void firePopupMenuWillBecomeInvisible()
+meth public void firePopupMenuWillBecomeVisible()
+meth public void hidePopup()
+meth public void insertItemAt({javax.swing.JComboBox%0},int)
+meth public void intervalAdded(javax.swing.event.ListDataEvent)
+meth public void intervalRemoved(javax.swing.event.ListDataEvent)
+meth public void processKeyEvent(java.awt.event.KeyEvent)
+meth public void removeActionListener(java.awt.event.ActionListener)
+meth public void removeAllItems()
+meth public void removeItem(java.lang.Object)
+meth public void removeItemAt(int)
+meth public void removeItemListener(java.awt.event.ItemListener)
+meth public void removePopupMenuListener(javax.swing.event.PopupMenuListener)
+meth public void setAction(javax.swing.Action)
+meth public void setActionCommand(java.lang.String)
+meth public void setEditable(boolean)
+meth public void setEditor(javax.swing.ComboBoxEditor)
+meth public void setEnabled(boolean)
+meth public void setKeySelectionManager(javax.swing.JComboBox$KeySelectionManager)
+meth public void setLightWeightPopupEnabled(boolean)
+meth public void setMaximumRowCount(int)
+meth public void setModel(javax.swing.ComboBoxModel<{javax.swing.JComboBox%0}>)
+meth public void setPopupVisible(boolean)
+meth public void setPrototypeDisplayValue({javax.swing.JComboBox%0})
+meth public void setRenderer(javax.swing.ListCellRenderer<? super {javax.swing.JComboBox%0}>)
+meth public void setSelectedIndex(int)
+meth public void setSelectedItem(java.lang.Object)
+meth public void setUI(javax.swing.plaf.ComboBoxUI)
+meth public void showPopup()
+meth public void updateUI()
+meth public {javax.swing.JComboBox%0} getItemAt(int)
+meth public {javax.swing.JComboBox%0} getPrototypeDisplayValue()
+supr javax.swing.JComponent
+hfds action,actionPropertyChangeListener,firingActionEvent,prototypeDisplayValue,selectingItem,uiClassID
+hcls ComboBoxActionPropertyChangeListener,DefaultKeySelectionManager
+
+CLSS public abstract javax.swing.JComponent
+cons public init()
+fld protected javax.swing.event.EventListenerList listenerList
+fld protected javax.swing.plaf.ComponentUI ui
+fld public final static int UNDEFINED_CONDITION = -1
+fld public final static int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT = 1
+fld public final static int WHEN_FOCUSED = 0
+fld public final static int WHEN_IN_FOCUSED_WINDOW = 2
+fld public final static java.lang.String TOOL_TIP_TEXT_KEY = "ToolTipText"
+innr public abstract AccessibleJComponent
+intf java.io.Serializable
+meth protected boolean isPaintingOrigin()
+meth protected boolean processKeyBinding(javax.swing.KeyStroke,java.awt.event.KeyEvent,int,boolean)
+meth protected boolean requestFocusInWindow(boolean)
+meth protected java.awt.Graphics getComponentGraphics(java.awt.Graphics)
+meth protected java.lang.String paramString()
+meth protected void fireVetoableChange(java.lang.String,java.lang.Object,java.lang.Object) throws java.beans.PropertyVetoException
+meth protected void paintBorder(java.awt.Graphics)
+meth protected void paintChildren(java.awt.Graphics)
+meth protected void paintComponent(java.awt.Graphics)
+meth protected void printBorder(java.awt.Graphics)
+meth protected void printChildren(java.awt.Graphics)
+meth protected void printComponent(java.awt.Graphics)
+meth protected void processComponentKeyEvent(java.awt.event.KeyEvent)
+meth protected void processKeyEvent(java.awt.event.KeyEvent)
+meth protected void processMouseEvent(java.awt.event.MouseEvent)
+meth protected void processMouseMotionEvent(java.awt.event.MouseEvent)
+meth protected void setUI(javax.swing.plaf.ComponentUI)
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean contains(int,int)
+meth public boolean getAutoscrolls()
+meth public boolean getInheritsPopupMenu()
+meth public boolean getVerifyInputWhenFocusTarget()
+meth public boolean isDoubleBuffered()
+meth public boolean isManagingFocus()
+ anno 0 java.lang.Deprecated()
+meth public boolean isOpaque()
+meth public boolean isOptimizedDrawingEnabled()
+meth public boolean isPaintingTile()
+meth public boolean isRequestFocusEnabled()
+meth public boolean isValidateRoot()
+meth public boolean requestDefaultFocus()
+ anno 0 java.lang.Deprecated()
+meth public boolean requestFocus(boolean)
+meth public boolean requestFocusInWindow()
+meth public final boolean isPaintingForPrint()
+meth public final java.lang.Object getClientProperty(java.lang.Object)
+meth public final javax.swing.ActionMap getActionMap()
+meth public final javax.swing.InputMap getInputMap()
+meth public final javax.swing.InputMap getInputMap(int)
+meth public final void putClientProperty(java.lang.Object,java.lang.Object)
+meth public final void setActionMap(javax.swing.ActionMap)
+meth public final void setInputMap(int,javax.swing.InputMap)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int getBaseline(int,int)
+meth public int getConditionForKeyStroke(javax.swing.KeyStroke)
+meth public int getDebugGraphicsOptions()
+meth public int getHeight()
+meth public int getWidth()
+meth public int getX()
+meth public int getY()
+meth public java.awt.Component getNextFocusableComponent()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component$BaselineResizeBehavior getBaselineResizeBehavior()
+meth public java.awt.Container getTopLevelAncestor()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension getSize(java.awt.Dimension)
+meth public java.awt.FontMetrics getFontMetrics(java.awt.Font)
+meth public java.awt.Graphics getGraphics()
+meth public java.awt.Insets getInsets()
+meth public java.awt.Insets getInsets(java.awt.Insets)
+meth public java.awt.Point getLocation(java.awt.Point)
+meth public java.awt.Point getPopupLocation(java.awt.event.MouseEvent)
+meth public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent)
+meth public java.awt.Rectangle getBounds(java.awt.Rectangle)
+meth public java.awt.Rectangle getVisibleRect()
+meth public java.awt.event.ActionListener getActionForKeyStroke(javax.swing.KeyStroke)
+meth public java.beans.VetoableChangeListener[] getVetoableChangeListeners()
+meth public java.lang.String getToolTipText()
+meth public java.lang.String getToolTipText(java.awt.event.MouseEvent)
+meth public java.lang.String getUIClassID()
+meth public javax.swing.InputVerifier getInputVerifier()
+meth public javax.swing.JPopupMenu getComponentPopupMenu()
+meth public javax.swing.JRootPane getRootPane()
+meth public javax.swing.JToolTip createToolTip()
+meth public javax.swing.KeyStroke[] getRegisteredKeyStrokes()
+meth public javax.swing.TransferHandler getTransferHandler()
+meth public javax.swing.border.Border getBorder()
+meth public javax.swing.event.AncestorListener[] getAncestorListeners()
+meth public static boolean isLightweightComponent(java.awt.Component)
+meth public static java.util.Locale getDefaultLocale()
+meth public static void setDefaultLocale(java.util.Locale)
+meth public void addAncestorListener(javax.swing.event.AncestorListener)
+meth public void addNotify()
+meth public void addVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public void computeVisibleRect(java.awt.Rectangle)
+meth public void disable()
+ anno 0 java.lang.Deprecated()
+meth public void enable()
+ anno 0 java.lang.Deprecated()
+meth public void firePropertyChange(java.lang.String,boolean,boolean)
+meth public void firePropertyChange(java.lang.String,char,char)
+meth public void firePropertyChange(java.lang.String,int,int)
+meth public void grabFocus()
+meth public void hide()
+ anno 0 java.lang.Deprecated()
+meth public void paint(java.awt.Graphics)
+meth public void paintImmediately(int,int,int,int)
+meth public void paintImmediately(java.awt.Rectangle)
+meth public void print(java.awt.Graphics)
+meth public void printAll(java.awt.Graphics)
+meth public void registerKeyboardAction(java.awt.event.ActionListener,java.lang.String,javax.swing.KeyStroke,int)
+meth public void registerKeyboardAction(java.awt.event.ActionListener,javax.swing.KeyStroke,int)
+meth public void removeAncestorListener(javax.swing.event.AncestorListener)
+meth public void removeNotify()
+meth public void removeVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public void repaint(java.awt.Rectangle)
+meth public void repaint(long,int,int,int,int)
+meth public void requestFocus()
+meth public void resetKeyboardActions()
+meth public void reshape(int,int,int,int)
+ anno 0 java.lang.Deprecated()
+meth public void revalidate()
+meth public void scrollRectToVisible(java.awt.Rectangle)
+meth public void setAlignmentX(float)
+meth public void setAlignmentY(float)
+meth public void setAutoscrolls(boolean)
+meth public void setBackground(java.awt.Color)
+meth public void setBorder(javax.swing.border.Border)
+meth public void setComponentPopupMenu(javax.swing.JPopupMenu)
+meth public void setDebugGraphicsOptions(int)
+meth public void setDoubleBuffered(boolean)
+meth public void setEnabled(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFont(java.awt.Font)
+meth public void setForeground(java.awt.Color)
+meth public void setInheritsPopupMenu(boolean)
+meth public void setInputVerifier(javax.swing.InputVerifier)
+meth public void setMaximumSize(java.awt.Dimension)
+meth public void setMinimumSize(java.awt.Dimension)
+meth public void setNextFocusableComponent(java.awt.Component)
+ anno 0 java.lang.Deprecated()
+meth public void setOpaque(boolean)
+meth public void setPreferredSize(java.awt.Dimension)
+meth public void setRequestFocusEnabled(boolean)
+meth public void setToolTipText(java.lang.String)
+meth public void setTransferHandler(javax.swing.TransferHandler)
+meth public void setVerifyInputWhenFocusTarget(boolean)
+meth public void setVisible(boolean)
+meth public void unregisterKeyboardAction(javax.swing.KeyStroke)
+meth public void update(java.awt.Graphics)
+meth public void updateUI()
+supr java.awt.Container
+hfds ACTIONMAP_CREATED,ANCESTOR_INPUTMAP_CREATED,ANCESTOR_USING_BUFFER,AUTOSCROLLS_SET,COMPLETELY_OBSCURED,CREATED_DOUBLE_BUFFER,DEBUG_GRAPHICS_LOADED,FOCUS_INPUTMAP_CREATED,FOCUS_TRAVERSAL_KEYS_BACKWARD_SET,FOCUS_TRAVERSAL_KEYS_FORWARD_SET,INHERITS_POPUP_MENU,INPUT_VERIFIER_SOURCE_KEY,IS_DOUBLE_BUFFERED,IS_OPAQUE,IS_PAINTING_TILE,IS_PRINTING,IS_PRINTING_ALL,IS_REPAINTING,KEYBOARD_BINDINGS_KEY,KEY_EVENTS_ENABLED,NEXT_FOCUS,NOT_OBSCURED,OPAQUE_SET,PARTIALLY_OBSCURED,REQUEST_FOCUS_DISABLED,RESERVED_1,RESERVED_2,RESERVED_3,RESERVED_4,RESERVED_5,RESERVED_6,WHEN_IN_FOCUSED_WINDOW_BINDINGS,WIF_INPUTMAP_CREATED,WRITE_OBJ_COUNTER_FIRST,WRITE_OBJ_COUNTER_LAST,aaTextInfo,actionMap,alignmentX,alignmentY,ancestorInputMap,autoscrolls,border,clientProperties,componentObtainingGraphicsFrom,componentObtainingGraphicsFromLock,defaultLocale,flags,focusController,focusInputMap,inputVerifier,isAlignmentXSet,isAlignmentYSet,managingFocusBackwardTraversalKeys,managingFocusForwardTraversalKeys,paintingChild,popupMenu,readObjectCallbacks,revalidateRunnableScheduled,tempRectangles,uiClassID,verifyInputWhenFocusTarget,vetoableChangeSupport,windowInputMap
+hcls ActionStandin,IntVector,KeyboardState,ReadObjectCallback
+
+CLSS public javax.swing.JPanel
+cons public init()
+cons public init(boolean)
+cons public init(java.awt.LayoutManager)
+cons public init(java.awt.LayoutManager,boolean)
+innr protected AccessibleJPanel
+intf javax.accessibility.Accessible
+meth protected java.lang.String paramString()
+meth public java.lang.String getUIClassID()
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public javax.swing.plaf.PanelUI getUI()
+meth public void setUI(javax.swing.plaf.PanelUI)
+meth public void updateUI()
+supr javax.swing.JComponent
+hfds uiClassID
+
+CLSS public javax.swing.JTabbedPane
+cons public init()
+cons public init(int)
+cons public init(int,int)
+fld protected int tabPlacement
+fld protected javax.swing.SingleSelectionModel model
+fld protected javax.swing.event.ChangeEvent changeEvent
+fld protected javax.swing.event.ChangeListener changeListener
+fld public final static int SCROLL_TAB_LAYOUT = 1
+fld public final static int WRAP_TAB_LAYOUT = 0
+innr protected AccessibleJTabbedPane
+innr protected ModelListener
+intf java.io.Serializable
+intf javax.accessibility.Accessible
+intf javax.swing.SwingConstants
+meth protected java.lang.String paramString()
+meth protected javax.swing.event.ChangeListener createChangeListener()
+meth protected void fireStateChanged()
+meth public boolean isEnabledAt(int)
+meth public int getDisplayedMnemonicIndexAt(int)
+meth public int getMnemonicAt(int)
+meth public int getSelectedIndex()
+meth public int getTabCount()
+meth public int getTabLayoutPolicy()
+meth public int getTabPlacement()
+meth public int getTabRunCount()
+meth public int indexAtLocation(int,int)
+meth public int indexOfComponent(java.awt.Component)
+meth public int indexOfTab(java.lang.String)
+meth public int indexOfTab(javax.swing.Icon)
+meth public int indexOfTabComponent(java.awt.Component)
+meth public java.awt.Color getBackgroundAt(int)
+meth public java.awt.Color getForegroundAt(int)
+meth public java.awt.Component add(java.awt.Component)
+meth public java.awt.Component add(java.awt.Component,int)
+meth public java.awt.Component add(java.lang.String,java.awt.Component)
+meth public java.awt.Component getComponentAt(int)
+meth public java.awt.Component getSelectedComponent()
+meth public java.awt.Component getTabComponentAt(int)
+meth public java.awt.Rectangle getBoundsAt(int)
+meth public java.lang.String getTitleAt(int)
+meth public java.lang.String getToolTipText(java.awt.event.MouseEvent)
+meth public java.lang.String getToolTipTextAt(int)
+meth public java.lang.String getUIClassID()
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public javax.swing.Icon getDisabledIconAt(int)
+meth public javax.swing.Icon getIconAt(int)
+meth public javax.swing.SingleSelectionModel getModel()
+meth public javax.swing.event.ChangeListener[] getChangeListeners()
+meth public javax.swing.plaf.TabbedPaneUI getUI()
+meth public void add(java.awt.Component,java.lang.Object)
+meth public void add(java.awt.Component,java.lang.Object,int)
+meth public void addChangeListener(javax.swing.event.ChangeListener)
+meth public void addTab(java.lang.String,java.awt.Component)
+meth public void addTab(java.lang.String,javax.swing.Icon,java.awt.Component)
+meth public void addTab(java.lang.String,javax.swing.Icon,java.awt.Component,java.lang.String)
+meth public void insertTab(java.lang.String,javax.swing.Icon,java.awt.Component,java.lang.String,int)
+meth public void remove(int)
+meth public void remove(java.awt.Component)
+meth public void removeAll()
+meth public void removeChangeListener(javax.swing.event.ChangeListener)
+meth public void removeTabAt(int)
+meth public void setBackgroundAt(int,java.awt.Color)
+meth public void setComponentAt(int,java.awt.Component)
+meth public void setDisabledIconAt(int,javax.swing.Icon)
+meth public void setDisplayedMnemonicIndexAt(int,int)
+meth public void setEnabledAt(int,boolean)
+meth public void setForegroundAt(int,java.awt.Color)
+meth public void setIconAt(int,javax.swing.Icon)
+meth public void setMnemonicAt(int,int)
+meth public void setModel(javax.swing.SingleSelectionModel)
+meth public void setSelectedComponent(java.awt.Component)
+meth public void setSelectedIndex(int)
+meth public void setTabComponentAt(int,java.awt.Component)
+meth public void setTabLayoutPolicy(int)
+meth public void setTabPlacement(int)
+meth public void setTitleAt(int,java.lang.String)
+meth public void setToolTipTextAt(int,java.lang.String)
+meth public void setUI(javax.swing.plaf.TabbedPaneUI)
+meth public void updateUI()
+supr javax.swing.JComponent
+hfds haveRegistered,pages,tabLayoutPolicy,uiClassID,visComp
+hcls Page
+
+CLSS public abstract interface javax.swing.SwingConstants
+fld public final static int BOTTOM = 3
+fld public final static int CENTER = 0
+fld public final static int EAST = 3
+fld public final static int HORIZONTAL = 0
+fld public final static int LEADING = 10
+fld public final static int LEFT = 2
+fld public final static int NEXT = 12
+fld public final static int NORTH = 1
+fld public final static int NORTH_EAST = 2
+fld public final static int NORTH_WEST = 8
+fld public final static int PREVIOUS = 13
+fld public final static int RIGHT = 4
+fld public final static int SOUTH = 5
+fld public final static int SOUTH_EAST = 4
+fld public final static int SOUTH_WEST = 6
+fld public final static int TOP = 1
+fld public final static int TRAILING = 11
+fld public final static int VERTICAL = 1
+fld public final static int WEST = 7
+
+CLSS public abstract interface javax.swing.event.ListDataListener
+intf java.util.EventListener
+meth public abstract void contentsChanged(javax.swing.event.ListDataEvent)
+meth public abstract void intervalAdded(javax.swing.event.ListDataEvent)
+meth public abstract void intervalRemoved(javax.swing.event.ListDataEvent)
+
+CLSS public javax.swing.text.DocumentFilter
+cons public init()
+innr public abstract static FilterBypass
+meth public void insertString(javax.swing.text.DocumentFilter$FilterBypass,int,java.lang.String,javax.swing.text.AttributeSet) throws javax.swing.text.BadLocationException
+meth public void remove(javax.swing.text.DocumentFilter$FilterBypass,int,int) throws javax.swing.text.BadLocationException
+meth public void replace(javax.swing.text.DocumentFilter$FilterBypass,int,int,java.lang.String,javax.swing.text.AttributeSet) throws javax.swing.text.BadLocationException
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.common.AdminAuthenticator
+cons public init()
+meth protected java.net.PasswordAuthentication getPasswordAuthentication()
+supr java.net.Authenticator
+hfds TIMEOUT,displayed,lastTry
+hcls PasswordPanel
+
+CLSS public abstract org.netbeans.modules.payara.common.BasicTask<%0 extends java.lang.Object>
+cons protected !varargs init(org.netbeans.modules.payara.common.PayaraInstance,org.netbeans.modules.payara.tooling.TaskStateListener[])
+fld protected java.lang.String instanceName
+fld protected org.netbeans.modules.payara.tooling.TaskStateListener[] stateListener
+fld protected volatile java.lang.Thread taskThread
+fld public final static int DELAY = 250
+fld public final static int PORT_CHECK_IDLE = 500
+fld public final static int RESTART_DELAY = 5000
+fld public final static int START_ADMIN_PORT_TIMEOUT = 120000
+fld public final static int START_TIMEOUT = 300000
+fld public final static int STOP_TIMEOUT = 180000
+fld public final static java.util.concurrent.TimeUnit TIMEUNIT
+innr protected static ShutdownStateListener
+innr protected static StartStateListener
+innr protected static StateChange
+intf java.util.concurrent.Callable<{org.netbeans.modules.payara.common.BasicTask%0}>
+meth protected !varargs final org.netbeans.modules.payara.tooling.TaskState fireOperationStateChanged(org.netbeans.modules.payara.tooling.TaskState,org.netbeans.modules.payara.tooling.TaskEvent,java.lang.String,java.lang.String[])
+meth protected org.netbeans.modules.payara.common.BasicTask$ShutdownStateListener prepareShutdownMonitoring()
+meth protected org.netbeans.modules.payara.common.BasicTask$StartStateListener forceStartMonitoring(boolean)
+meth protected org.netbeans.modules.payara.common.BasicTask$StartStateListener prepareStartMonitoring(boolean)
+meth protected org.netbeans.modules.payara.common.BasicTask$StateChange waitShutDown()
+meth protected org.netbeans.modules.payara.common.BasicTask$StateChange waitStartUp(boolean,boolean)
+meth protected void clearTaskThread()
+meth protected void setTaskThread()
+meth public abstract {org.netbeans.modules.payara.common.BasicTask%0} call()
+supr java.lang.Object
+hfds LOGGER,instance
+
+CLSS protected static org.netbeans.modules.payara.common.BasicTask$ShutdownStateListener
+ outer org.netbeans.modules.payara.common.BasicTask
+cons protected init()
+meth public void currentState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+supr org.netbeans.modules.payara.common.status.WakeUpStateListener
+
+CLSS protected static org.netbeans.modules.payara.common.BasicTask$StartStateListener
+ outer org.netbeans.modules.payara.common.BasicTask
+cons protected init(boolean)
+meth public void currentState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+supr org.netbeans.modules.payara.common.status.WakeUpStateListener
+hfds process,profile
+
+CLSS protected static org.netbeans.modules.payara.common.BasicTask$StateChange
+ outer org.netbeans.modules.payara.common.BasicTask
+cons protected !varargs init(org.netbeans.modules.payara.common.BasicTask,org.netbeans.modules.payara.tooling.TaskState,org.netbeans.modules.payara.tooling.TaskEvent,java.lang.String,java.lang.String[])
+cons protected init(org.netbeans.modules.payara.common.BasicTask,org.netbeans.modules.payara.tooling.TaskState,org.netbeans.modules.payara.tooling.TaskEvent,java.lang.String)
+meth protected org.netbeans.modules.payara.tooling.TaskState fireOperationStateChanged()
+supr java.lang.Object
+hfds event,msgArgs,msgKey,result,task
+
+CLSS public org.netbeans.modules.payara.common.CommonServerSupport
+intf org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie
+intf org.netbeans.modules.payara.spi.PayaraModule3
+meth public boolean isRemote()
+meth public boolean isRestfulLogAccessSupported()
+meth public boolean isWritable()
+meth public boolean supportsRestartInDebug()
+meth public final org.openide.util.RequestProcessor$Task refresh()
+meth public int getAdminPortNumber()
+ anno 0 java.lang.Deprecated()
+meth public int getHttpPortNumber()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getAdminPort()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getDeployerUri()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getDisplayName()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getDomainName()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getDomainsRoot()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getPayaraRoot()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getHostName()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getHttpPort()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getInstallRoot()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String getPassword()
+meth public java.lang.String getResourcesXmlName()
+meth public java.lang.String getUserName()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.String setEnvironmentProperty(java.lang.String,java.lang.String,boolean)
+meth public java.util.Map<java.lang.String,java.lang.String> getInstanceProperties()
+meth public java.util.Map<java.lang.String,java.util.List<org.netbeans.modules.payara.spi.AppDesc>> getApplications(java.lang.String)
+meth public java.util.Map<java.lang.String,org.netbeans.modules.payara.spi.ResourceDesc> getResourcesMap(java.lang.String)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> killServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> restartServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> startServer(org.netbeans.modules.payara.tooling.TaskStateListener,org.netbeans.modules.payara.spi.PayaraModule$ServerState)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> stopServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,java.io.File[])
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> disable(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> enable(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,boolean)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,java.lang.String,boolean)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,java.lang.String,java.io.File[],boolean)
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> restartServer(int,boolean,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> undeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public org.netbeans.modules.payara.common.PayaraInstance getInstance()
+meth public org.netbeans.modules.payara.common.PayaraInstanceProvider getInstanceProvider()
+meth public org.netbeans.modules.payara.spi.AppDesc[] getModuleList(java.lang.String)
+meth public org.netbeans.modules.payara.spi.CommandFactory getCommandFactory()
+meth public org.netbeans.modules.payara.spi.PayaraModule$ServerState getServerState()
+meth public org.openide.util.RequestProcessor$Task refresh(java.lang.String,java.lang.String)
+meth public static boolean isRunning(java.lang.String,int,java.lang.String)
+meth public static boolean isRunning(java.lang.String,int,java.lang.String,int)
+meth public static void displayPopUpMessage(org.netbeans.modules.payara.common.CommonServerSupport,java.lang.String)
+meth public void addChangeListener(javax.swing.event.ChangeListener)
+meth public void removeChangeListener(javax.swing.event.ChangeListener)
+meth public void setServerState(org.netbeans.modules.payara.spi.PayaraModule$ServerState)
+supr java.lang.Object
+hfds FAILED_HTTP_HOST,LOCALHOST,LOGGER,RP,WAIT_TASK_TO_DIE_MAX,WAIT_TASK_TO_DIE_SLEEP,changeSupport,instance,instanceFO,isRemote,latestWarningDisplayTime,localStartProcess,refreshRunning,serverState,startTask,startedByIde,stateMonitor,stopDisabled
+hcls KillOperationStateListener,LocationsTaskStateListener,StartOperationStateListener,StopOperationStateListener
+
+CLSS public org.netbeans.modules.payara.common.CreateDomain
+cons public init(java.lang.String,java.lang.String,java.io.File,java.util.Map<java.lang.String,java.lang.String>,org.netbeans.modules.payara.common.PayaraInstanceProvider,boolean,boolean,java.lang.String)
+meth public int getAdminPort()
+meth public int getHttpPort()
+meth public void run()
+supr java.lang.Thread
+hfds PORTBASE,pip,installRootKey,ip,map,platformLocation,pword,register,uname
+hcls PDCancel
+
+CLSS public org.netbeans.modules.payara.common.EnableComet
+cons public init(org.netbeans.modules.payara.common.PayaraInstance)
+intf java.lang.Runnable
+meth public void run()
+supr java.lang.Object
+hfds LOGGER,instance
+
+CLSS public org.netbeans.modules.payara.common.PayaraExecutors
+cons public init()
+meth public static java.util.concurrent.ExecutorService fetchLogExecutor()
+supr java.lang.Object
+hfds FETCH_LOG_EXECUTOR_POOL_KEEPALIVE_TIME,FETCH_LOG_EXECUTOR_POOL_MAX_SIZE,FETCH_LOG_EXECUTOR_POOL_MIN_SIZE,THREAD_GROUP_NAME_LOG,THREAD_GROUP_NAME_STAT,THREAD_GROUP_NAME_TOP,fetchLogExecutor,tgLog,tgStat,tgTop
+hcls FetchLogThreadFactory,StatusThreadFactory
+
+CLSS public final !enum org.netbeans.modules.payara.common.PayaraJvmMode
+fld public final static int length
+fld public final static org.netbeans.modules.payara.common.PayaraJvmMode DEBUG
+fld public final static org.netbeans.modules.payara.common.PayaraJvmMode NORMAL
+fld public final static org.netbeans.modules.payara.common.PayaraJvmMode PROFILE
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.common.PayaraJvmMode toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraJvmMode valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraJvmMode[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.common.PayaraJvmMode>
+hfds DEBUG_STR,LOGGER,NORMAL_STR,PROFILE_STR,stringValuesMap
+
+CLSS public org.netbeans.modules.payara.common.PayaraLogger
+cons public init()
+meth public static java.util.logging.Logger get(java.lang.Class)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.common.PayaraSettings
+cons public init()
+meth public static boolean getGf312WarningShowAgain()
+meth public static boolean getGfKillWarningShowAgain()
+meth public static boolean getGfShowPasswordInPropertiesForm()
+meth public static boolean showWindowSystem()
+meth public static void setGf312WarningShowAgain(boolean)
+meth public static void setGfKillWarningShowAgain(boolean)
+meth public static void setGfShowPasswordInPropertiesForm(boolean)
+supr java.lang.Object
+hfds LBL_GF312_WARNING_SHOW_AGAIN,LBL_GF_KILL_SHOW_AGAIN,LBL_GF_SHOW_PASSWORD_IN_PROPERTIES_FORM,NB_PREFERENCES_NODE
+
+CLSS public org.netbeans.modules.payara.common.PayaraState
+cons public init()
+innr public final static !enum Mode
+meth public static boolean canStart(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean isOffline(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean isOnline(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean monitor(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraServerStatus getStatus(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraServerStatus getStatus(org.netbeans.modules.payara.tooling.data.PayaraServer,long)
+supr java.lang.Object
+hfds INIT_MONITORING_TIMEOUT,LOGGER
+
+CLSS public final static !enum org.netbeans.modules.payara.common.PayaraState$Mode
+ outer org.netbeans.modules.payara.common.PayaraState
+fld public final static org.netbeans.modules.payara.common.PayaraState$Mode DEFAULT
+fld public final static org.netbeans.modules.payara.common.PayaraState$Mode REFRESH
+fld public final static org.netbeans.modules.payara.common.PayaraState$Mode STARTUP
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.common.PayaraState$Mode valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraState$Mode[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.common.PayaraState$Mode>
+
+CLSS public org.netbeans.modules.payara.common.PayaraInstance
+fld public final static int DEFAULT_ADMIN_PORT = 4848
+fld public final static int DEFAULT_DEBUG_PORT = 9009
+fld public final static int DEFAULT_HTTPS_PORT = 8181
+fld public final static int DEFAULT_HTTP_PORT = 8080
+fld public final static java.lang.String DEFAULT_ADMIN_NAME = "admin"
+fld public final static java.lang.String DEFAULT_ADMIN_PASSWORD = ""
+fld public final static java.lang.String DEFAULT_DOMAINS_FOLDER = "domains"
+fld public final static java.lang.String DEFAULT_DOMAIN_NAME = "domain1"
+fld public final static java.lang.String DEFAULT_HOST_NAME = "localhost"
+fld public final static java.lang.String OLD_DEFAULT_ADMIN_PASSWORD = "adminadmin"
+innr public Props
+intf org.netbeans.modules.payara.tooling.data.PayaraServer
+intf org.netbeans.spi.server.ServerInstanceImplementation
+intf org.openide.util.Lookup$Provider
+intf org.openide.util.LookupListener
+meth public boolean equals(java.lang.Object)
+meth public boolean isProcessRunning()
+meth public boolean isRemote()
+meth public boolean isRemovable()
+meth public final org.netbeans.modules.payara.common.CommonServerSupport getCommonSupport()
+meth public final org.netbeans.modules.payara.spi.PayaraModule$ServerState getServerState()
+ anno 0 java.lang.Deprecated()
+meth public int getAdminPort()
+meth public int getDebugPort()
+meth public int getPort()
+meth public int hashCode()
+meth public java.lang.Process getProcess()
+meth public java.lang.String getAdminPassword()
+meth public java.lang.String getAdminUser()
+meth public java.lang.String getDeployerUri()
+meth public java.lang.String getDisplayName()
+meth public java.lang.String getDomainName()
+meth public java.lang.String getDomainsFolder()
+meth public java.lang.String getDomainsRoot()
+meth public java.lang.String getPayaraRoot()
+meth public java.lang.String getHost()
+meth public java.lang.String getHttpAdminPort()
+meth public java.lang.String getHttpPort()
+meth public java.lang.String getInstallRoot()
+meth public java.lang.String getJavaHome()
+meth public java.lang.String getJvmModeAsString()
+meth public java.lang.String getName()
+meth public java.lang.String getPassword()
+meth public java.lang.String getProperty(java.lang.String)
+meth public java.lang.String getServerDisplayName()
+meth public java.lang.String getServerHome()
+meth public java.lang.String getServerRoot()
+meth public java.lang.String getTarget()
+meth public java.lang.String getUrl()
+meth public java.lang.String getUserName()
+meth public java.lang.String putProperty(java.lang.String,java.lang.String)
+meth public java.lang.String removeProperty(java.lang.String)
+meth public java.lang.String setDomainsFolder(java.lang.String)
+meth public java.lang.String setTarget(java.lang.String)
+meth public java.util.Map<java.lang.String,java.lang.String> getProperties()
+meth public javax.swing.JComponent getCustomizer()
+meth public org.netbeans.api.java.platform.JavaPlatform getJavaPlatform()
+meth public org.netbeans.api.server.ServerInstance getCommonInstance()
+meth public org.netbeans.modules.payara.common.PayaraJvmMode getJvmMode()
+meth public org.netbeans.modules.payara.common.PayaraInstanceProvider getInstanceProvider()
+meth public org.netbeans.modules.payara.common.parser.DomainXMLChangeListener getDomainXMLChangeListener()
+meth public org.netbeans.modules.payara.tooling.data.PayaraAdminInterface getAdminInterface()
+meth public org.netbeans.modules.payara.tooling.data.PayaraVersion getVersion()
+meth public org.openide.nodes.Node getBasicNode()
+meth public org.openide.nodes.Node getFullNode()
+meth public org.openide.util.Lookup getLookup()
+meth public static java.lang.String getPasswordFromKeyring(java.lang.String,java.lang.String)
+meth public static java.lang.String passwordKey(java.lang.String,java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraInstance create(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.payara.common.PayaraInstanceProvider)
+meth public static org.netbeans.modules.payara.common.PayaraInstance create(java.util.Map<java.lang.String,java.lang.String>,org.netbeans.modules.payara.common.PayaraInstanceProvider)
+meth public static org.netbeans.modules.payara.common.PayaraInstance create(java.util.Map<java.lang.String,java.lang.String>,org.netbeans.modules.payara.common.PayaraInstanceProvider,boolean)
+meth public static org.netbeans.modules.payara.common.PayaraInstance readInstanceFromFile(org.openide.filesystems.FileObject,boolean) throws java.io.IOException
+meth public static void writeInstanceToFile(org.netbeans.modules.payara.common.PayaraInstance) throws java.io.IOException
+meth public void remove()
+meth public void resetProcess()
+meth public void resultChanged(org.openide.util.LookupEvent)
+meth public void setAdminPassword(java.lang.String)
+meth public void setAdminPort(int)
+meth public void setAdminPort(java.lang.String)
+meth public void setAdminUser(java.lang.String)
+meth public void setHost(java.lang.String)
+meth public void setHttpPort(int)
+meth public void setHttpPort(java.lang.String)
+meth public void setJavaHome(java.lang.String)
+meth public void setProcess(java.lang.Process)
+meth public void setProperties(org.netbeans.modules.payara.common.PayaraInstance$Props)
+supr java.lang.Object
+hfds INSTANCE_FO_ATTR,KEYRING_IDENT_SEPARATOR,KEYRING_NAME_SEPARATOR,KEYRING_NAME_SPACE,LOGGER,LOWEST_USER_PORT,commonInstance,commonSupport,currentFactories,domainXMLListener,full,fullNode,ic,instanceProvider,localLookup,lookupResult,process,properties,removable,version
+
+CLSS public org.netbeans.modules.payara.common.PayaraInstance$Props
+ outer org.netbeans.modules.payara.common.PayaraInstance
+cons public init(java.util.Map<java.lang.String,java.lang.String>)
+intf java.util.Map<java.lang.String,java.lang.String>
+meth public boolean containsKey(java.lang.Object)
+meth public boolean containsValue(java.lang.Object)
+meth public boolean equals(java.lang.Object)
+meth public boolean isEmpty()
+meth public int hashCode()
+meth public int size()
+meth public java.lang.String get(java.lang.Object)
+meth public java.lang.String put(java.lang.String,java.lang.String)
+meth public java.lang.String remove(java.lang.Object)
+meth public java.util.Collection<java.lang.String> values()
+meth public java.util.Set<java.lang.String> keySet()
+meth public java.util.Set<java.util.Map$Entry<java.lang.String,java.lang.String>> entrySet()
+meth public void clear()
+meth public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.String>)
+supr java.lang.Object
+hfds delegate
+
+CLSS public final org.netbeans.modules.payara.common.PayaraInstanceProvider
+fld public final static java.lang.String EE6WC_DEPLOYER_FRAGMENT = "deployer:pfv3ee6wc"
+fld public final static java.lang.String EE6_DEPLOYER_FRAGMENT = "deployer:pfv3ee6"
+fld public final static java.lang.String PAYARA_AUTOREGISTERED_INSTANCE = "payara_autoregistered_instance"
+fld public final static java.util.Set<java.lang.String> activeRegistrationSet
+intf org.netbeans.spi.server.ServerInstanceProvider
+intf org.openide.util.LookupListener
+meth public <%0 extends java.lang.Object> java.util.List<{%%0}> getInstancesByCapability(java.lang.Class<{%%0}>)
+meth public <%0 extends java.lang.Object> {%%0} getInstanceByCapability(java.lang.String,java.lang.Class<{%%0}>)
+meth public boolean hasServer(java.lang.String)
+meth public boolean removeServerInstance(org.netbeans.modules.payara.common.PayaraInstance)
+meth public java.util.List<org.netbeans.api.server.ServerInstance> getInstances()
+meth public org.netbeans.api.server.ServerInstance getInstance(java.lang.String)
+meth public org.netbeans.modules.payara.common.PayaraInstance getPayaraInstance(java.lang.String)
+meth public org.netbeans.modules.payara.spi.CommandFactory getCommandFactory()
+meth public org.netbeans.spi.server.ServerInstanceImplementation getInternalInstance(java.lang.String)
+meth public org.openide.util.Lookup getLookupFor(org.netbeans.api.server.ServerInstance)
+meth public static boolean initialized()
+meth public static org.netbeans.api.server.ServerInstance getInstanceByUri(java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraInstance getPayaraInstanceByUri(java.lang.String)
+meth public static org.netbeans.modules.payara.common.PayaraInstanceProvider getProvider()
+meth public void addChangeListener(javax.swing.event.ChangeListener)
+meth public void addServerInstance(org.netbeans.modules.payara.common.PayaraInstance)
+meth public void removeChangeListener(javax.swing.event.ChangeListener)
+meth public void resultChanged(org.openide.util.LookupEvent)
+supr java.lang.Object
+hfds AUTOINSTANCECOPIED,EE6WC_INSTANCES_PATH,EE6_INSTANCES_PATH,LOGGER,activeDisplayNames,cf,displayName,glassFishProvider,instanceMap,instancesDirNames,lookupResult,needsJdk6,noPasswordOptions,support,uriFragments
+
+CLSS public org.netbeans.modules.payara.common.Installer
+cons public init()
+meth public void close()
+supr org.openide.modules.ModuleInstall
+
+CLSS public org.netbeans.modules.payara.common.KillTask
+cons public !varargs init(org.netbeans.modules.payara.common.PayaraInstance,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.common.BasicTask<org.netbeans.modules.payara.tooling.TaskState>
+hfds LOGGER
+
+CLSS public org.netbeans.modules.payara.common.LogViewMgr
+meth public !varargs void readInputStreams(java.util.List<org.netbeans.modules.payara.spi.Recognizer>,boolean,org.netbeans.modules.payara.common.PayaraInstance,org.netbeans.modules.payara.tooling.server.FetchLog[])
+meth public static org.netbeans.modules.payara.common.LogViewMgr getInstance(java.lang.String)
+meth public static org.openide.windows.InputOutput getServerIO(java.lang.String)
+meth public static void displayOutput(org.netbeans.modules.payara.common.PayaraInstance,org.openide.util.Lookup)
+meth public static void removeLog(org.netbeans.modules.payara.common.PayaraInstance)
+meth public void ensureActiveReader(java.util.List<org.netbeans.modules.payara.spi.Recognizer>,org.netbeans.modules.payara.tooling.server.FetchLog,org.netbeans.modules.payara.common.PayaraInstance)
+meth public void selectIO(boolean)
+meth public void stopReaders()
+meth public void write(java.lang.String,boolean)
+meth public void write(java.lang.String,org.openide.windows.OutputListener,boolean,boolean)
+supr java.lang.Object
+hfds DELAY,LOGGER,LOG_BLUE,LOG_CYAN,LOG_GREEN,LOG_MAGENTA,LOG_RED,LOG_YELLOW,OUTPUT_WINDOW_TCID,VISIBILITY_CHECK_DELAY,colorPattern,colorTable,instances,io,ioWeakMap,lastVisibleCheck,localizedLevels,localizedSevere,localizedWarning,logBundleName,logLocale,outputTCRef,readers,serverInputStreams,setClosedMethod,strictFilter,uri,visibleCheck
+hcls Filter,LogFileFilter,LogStateListener,LoggerRunnable,Message,StateFilter,StreamFilter
+
+CLSS public org.netbeans.modules.payara.common.PartialCompletionException
+cons public init(java.lang.String)
+meth public java.lang.String getMessage()
+supr java.lang.Exception
+hfds failedUpdates
+
+CLSS public org.netbeans.modules.payara.common.PortCollection
+cons public init()
+meth public int getAdminPort()
+meth public int getHttpPort()
+meth public int getHttpsPort()
+meth public void setAdminPort(int)
+meth public void setHttpPort(int)
+meth public void setHttpsPort(int)
+supr java.lang.Object
+hfds adminPort,httpPort,httpsPort
+
+CLSS public org.netbeans.modules.payara.common.ProcessCreationException
+meth public java.lang.String getLocalizedMessage()
+supr java.lang.Exception
+hfds args,messageName
+
+CLSS public org.netbeans.modules.payara.common.RegisteredDerbyServerImpl
+cons public init()
+intf org.netbeans.modules.payara.spi.RegisteredDerbyServer
+meth public void initialize(java.lang.String)
+meth public void start()
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.common.RestartTask
+cons public !varargs init(org.netbeans.modules.payara.common.CommonServerSupport,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+meth public org.netbeans.modules.payara.tooling.TaskState call2()
+supr org.netbeans.modules.payara.common.BasicTask<org.netbeans.modules.payara.tooling.TaskState>
+hfds LOGGER,RESTART_DELAY,support
+
+CLSS public final !enum org.netbeans.modules.payara.common.ServerDetails
+meth public boolean isInstalledInDirectory(java.io.File)
+meth public int getVersion()
+meth public java.lang.String getDirectUrl()
+meth public java.lang.String getIndirectUrl()
+meth public java.lang.String getLicenseUrl()
+meth public java.lang.String getUriFragment()
+meth public java.lang.String toString()
+meth public static int getVersionFromDomainXml(java.io.File)
+meth public static int getVersionFromInstallDirectory(java.io.File)
+meth public static org.netbeans.modules.payara.common.ServerDetails valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.common.ServerDetails[] values()
+meth public static org.openide.WizardDescriptor$InstantiatingIterator getInstantiatingIterator()
+supr java.lang.Enum<org.netbeans.modules.payara.common.ServerDetails>
+hfds directUrl,displayName,indirectUrl,licenseUrl,uriFragment,versionInt
+hcls DomainParser
+
+CLSS public org.netbeans.modules.payara.common.SimpleIO
+cons public init(java.lang.String,java.lang.Process)
+innr public CancelAction
+meth public !varargs void readInputStreams(java.io.InputStream[])
+meth public void closeIO()
+meth public void selectIO()
+meth public void write(java.lang.String)
+supr java.lang.Object
+hfds DELAY,cancelAction,io,name,process
+hcls IOReader
+
+CLSS public org.netbeans.modules.payara.common.SimpleIO$CancelAction
+ outer org.netbeans.modules.payara.common.SimpleIO
+cons public init(org.netbeans.modules.payara.common.SimpleIO)
+meth public boolean isEnabled()
+meth public void actionPerformed(java.awt.event.ActionEvent)
+meth public void updateEnabled()
+supr javax.swing.AbstractAction
+hfds ICON,PROP_ENABLED
+
+CLSS public org.netbeans.modules.payara.common.StartTask
+cons public !varargs init(org.netbeans.modules.payara.common.CommonServerSupport,java.util.List<org.netbeans.modules.payara.spi.Recognizer>,org.netbeans.modules.payara.spi.VMIntrospector,java.lang.String[],org.netbeans.modules.payara.tooling.TaskStateListener[])
+cons public !varargs init(org.netbeans.modules.payara.common.CommonServerSupport,java.util.List<org.netbeans.modules.payara.spi.Recognizer>,org.netbeans.modules.payara.spi.VMIntrospector,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.common.BasicTask<org.netbeans.modules.payara.tooling.TaskState>
+hfds LOGGER,NODE_REFRESHER,jdkHome,jvmArgs,recognizers,support,vmi
+
+CLSS public org.netbeans.modules.payara.common.StopProfilingTask
+cons public init(org.netbeans.modules.payara.common.CommonServerSupport,org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.common.BasicTask<org.netbeans.modules.payara.tooling.TaskState>
+hfds support
+
+CLSS public org.netbeans.modules.payara.common.StopTask
+cons public !varargs init(org.netbeans.modules.payara.common.CommonServerSupport,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.common.BasicTask<org.netbeans.modules.payara.tooling.TaskState>
+hfds support
+
+CLSS public abstract interface org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie
+intf org.openide.nodes.Node$Cookie
+meth public abstract org.openide.util.RequestProcessor$Task refresh()
+meth public abstract org.openide.util.RequestProcessor$Task refresh(java.lang.String,java.lang.String)
+
+CLSS public org.netbeans.modules.payara.common.parser.DomainXMLChangeListener
+cons public init(org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+intf org.openide.filesystems.FileChangeListener
+meth public static void registerListener(org.netbeans.modules.payara.common.PayaraInstance)
+meth public static void unregisterListener(org.netbeans.modules.payara.common.PayaraInstance)
+meth public void fileAttributeChanged(org.openide.filesystems.FileAttributeEvent)
+meth public void fileChanged(org.openide.filesystems.FileEvent)
+meth public void fileDataCreated(org.openide.filesystems.FileEvent)
+meth public void fileDeleted(org.openide.filesystems.FileEvent)
+meth public void fileFolderCreated(org.openide.filesystems.FileEvent)
+meth public void fileRenamed(org.openide.filesystems.FileRenameEvent)
+supr java.lang.Object
+hfds LOGGER,instance,path
+
+CLSS public org.netbeans.modules.payara.common.parser.JvmConfigReader
+cons public init(java.util.List<java.lang.String>,java.util.Map<java.lang.String,java.lang.String>,java.util.Map<java.lang.String,java.lang.String>,java.util.Map<java.lang.String,java.lang.String>)
+meth public org.netbeans.modules.payara.common.parser.TreeParser$NodeReader getConfigFinder()
+meth public org.netbeans.modules.payara.common.parser.TreeParser$NodeReader getMonitoringFinder(java.io.File)
+meth public org.netbeans.modules.payara.common.parser.TreeParser$NodeReader getServerFinder()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readCData(java.lang.String,char[],int,int) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.common.parser.TreeParser$NodeReader
+hfds SERVER_NAME,argMap,optList,pattern,propMap,readJvmConfig,serverConfigName,varMap
+
+CLSS public final org.netbeans.modules.payara.common.parser.TreeParser
+innr public abstract static NodeReader
+innr public static Path
+meth public org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+meth public static boolean readXml(java.io.File,java.util.List<org.netbeans.modules.payara.common.parser.TreeParser$Path>)
+meth public void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public void endDocument() throws org.xml.sax.SAXException
+meth public void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void startDocument() throws org.xml.sax.SAXException
+meth public void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.xml.sax.helpers.DefaultHandler
+hfds LOGGER,childNodeReader,depth,isFinerLoggable,isFinestLoggable,root,rover,skipping
+hcls Node
+
+CLSS public abstract static org.netbeans.modules.payara.common.parser.TreeParser$NodeReader
+ outer org.netbeans.modules.payara.common.parser.TreeParser
+cons public init()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readCData(java.lang.String,char[],int,int) throws org.xml.sax.SAXException
+meth public void readChildren(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.common.parser.TreeParser$Path
+ outer org.netbeans.modules.payara.common.parser.TreeParser
+cons public init(java.lang.String)
+cons public init(java.lang.String,org.netbeans.modules.payara.common.parser.TreeParser$NodeReader)
+meth public java.lang.String getPath()
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.common.parser.TreeParser$NodeReader getReader()
+supr java.lang.Object
+hfds path,reader
+
+CLSS public abstract org.netbeans.modules.payara.common.status.BasicStateListener
+cons public init()
+intf org.netbeans.modules.payara.tooling.PayaraStatusListener
+meth public boolean isActive()
+meth public void added()
+meth public void removed()
+supr java.lang.Object
+hfds active
+
+CLSS public abstract org.netbeans.modules.payara.common.status.WakeUpStateListener
+cons public init()
+meth protected void wakeUp()
+meth public boolean isWakeUp()
+meth public void error(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public void newState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+supr org.netbeans.modules.payara.common.status.BasicStateListener
+hfds wakeUp
+
+CLSS public org.netbeans.modules.payara.common.ui.AdminObjectCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds resourceEnabledCB,resourceTypeField,resourceTypeLabel
+
+CLSS public abstract org.netbeans.modules.payara.common.ui.BasePanel
+cons public init()
+innr public static Error
+meth protected abstract java.lang.String getPrefix()
+meth protected abstract java.util.List<java.awt.Component> getDataComponents()
+meth public final java.util.Map<java.lang.String,java.lang.String> getData()
+meth public final void initializeUI()
+meth public void initializeData(java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+supr javax.swing.JPanel
+hcls AttributedPropertyTableModel,ButtonSetter,ComboBoxSetter,DataTableModel,NameValueTableModel,TableSetter,TextFieldSetter
+
+CLSS public static org.netbeans.modules.payara.common.ui.BasePanel$Error
+ outer org.netbeans.modules.payara.common.ui.BasePanel
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+meth public void initializeData(java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+supr org.netbeans.modules.payara.common.ui.BasePanel
+
+CLSS public org.netbeans.modules.payara.common.ui.ConnectionPoolCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds connectionPropertiesTable,jScrollPane1
+
+CLSS public org.netbeans.modules.payara.common.ui.ConnectorConnectionPoolCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds connectionPropertiesTable,jScrollPane1
+
+CLSS public org.netbeans.modules.payara.common.ui.ConnectorCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds poolNameCombo,poolNameLabel
+
+CLSS public org.netbeans.modules.payara.common.ui.Filter
+cons public init()
+innr public static PortNumber
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.common.ui.Filter$PortNumber
+ outer org.netbeans.modules.payara.common.ui.Filter
+cons public init()
+meth public void insertString(javax.swing.text.DocumentFilter$FilterBypass,int,java.lang.String,javax.swing.text.AttributeSet) throws javax.swing.text.BadLocationException
+meth public void replace(javax.swing.text.DocumentFilter$FilterBypass,int,int,java.lang.String,javax.swing.text.AttributeSet) throws javax.swing.text.BadLocationException
+supr javax.swing.text.DocumentFilter
+
+CLSS public org.netbeans.modules.payara.common.ui.PayaraCredentials
+cons public init(org.openide.NotifyDescriptor,org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+meth public static boolean setCredentials(org.netbeans.modules.payara.common.PayaraInstance)
+meth public static boolean setCredentials(org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+meth public void clear()
+supr javax.swing.JPanel
+hfds LOGGER,messageLabel,password,passwordLabel,userLabel,userText
+
+CLSS public org.netbeans.modules.payara.common.ui.PayaraPassword
+cons public init(org.openide.NotifyDescriptor,org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+meth public static java.lang.String setPassword(org.netbeans.modules.payara.common.PayaraInstance)
+meth public void clear()
+supr javax.swing.JPanel
+hfds LOGGER,messageLabel,password,passwordLabel,passwordVerify,passwordVerifyLabel,passwordVerifyLabelText,userLabel,userText
+
+CLSS public org.netbeans.modules.payara.common.ui.PayaraPropertiesCustomizer
+cons public init(org.netbeans.modules.payara.common.PayaraInstance,org.openide.util.Lookup)
+supr javax.swing.JTabbedPane
+hfds LOGGER,customizerListener
+hcls CustomizerListener
+
+CLSS public org.netbeans.modules.payara.common.ui.InstanceLocalPanel
+cons public init(org.netbeans.modules.payara.common.PayaraInstance)
+meth protected java.lang.String getHost()
+meth protected void enableFields()
+meth protected void initHost()
+meth protected void initPorts()
+supr org.netbeans.modules.payara.common.ui.InstancePanel
+hfds LOGGER
+
+CLSS public abstract org.netbeans.modules.payara.common.ui.InstancePanel
+cons protected init(org.netbeans.modules.payara.common.PayaraInstance)
+fld protected boolean cometSupportFlag
+fld protected boolean configFileParsed
+fld protected boolean httpMonitorFlag
+fld protected boolean jdbcDriverDeploymentFlag
+fld protected boolean loopbackFlag
+fld protected boolean preserverSessionsFlag
+fld protected boolean showPasswordFlag
+fld protected boolean startDerbyFlag
+fld protected final org.netbeans.modules.payara.common.PayaraInstance instance
+fld protected java.util.Set<? extends java.net.InetAddress> ips
+fld protected javax.swing.JCheckBox commetSupport
+fld protected javax.swing.JCheckBox httpMonitor
+fld protected javax.swing.JCheckBox jdbcDriverDeployment
+fld protected javax.swing.JCheckBox localIpCB
+fld protected javax.swing.JCheckBox preserveSessions
+fld protected javax.swing.JCheckBox showPassword
+fld protected javax.swing.JCheckBox startDerby
+fld protected javax.swing.JComboBox hostLocalField
+fld protected javax.swing.JLabel dasPortLabel
+fld protected javax.swing.JLabel domainLabel
+fld protected javax.swing.JLabel domainsFolderLabel
+fld protected javax.swing.JLabel hostLocalLabel
+fld protected javax.swing.JLabel hostRemoteLabel
+fld protected javax.swing.JLabel httpPortLabel
+fld protected javax.swing.JLabel installationLocationLabel
+fld protected javax.swing.JLabel passwordLabel
+fld protected javax.swing.JLabel targetLabel
+fld protected javax.swing.JLabel userNameLabel
+fld protected javax.swing.JPasswordField passwordField
+fld protected javax.swing.JTextField dasPortField
+fld protected javax.swing.JTextField domainField
+fld protected javax.swing.JTextField domainsFolderField
+fld protected javax.swing.JTextField hostRemoteField
+fld protected javax.swing.JTextField httpPortField
+fld protected javax.swing.JTextField installationLocationField
+fld protected javax.swing.JTextField targetField
+fld protected javax.swing.JTextField userNameField
+innr protected static CheckBoxProperties
+meth protected abstract java.lang.String getHost()
+meth protected abstract void initHost()
+meth protected abstract void initPorts()
+meth protected void disableAllFields()
+meth protected void enableFields()
+meth protected void initCheckBoxes()
+meth protected void initCredentials()
+meth protected void initDirectoriesFields()
+meth protected void initDomainAndTarget()
+meth protected void initFlagsFromProperties(org.netbeans.modules.payara.common.ui.InstancePanel$CheckBoxProperties)
+meth protected void initFormFields()
+meth protected void storeCheckBoxes()
+meth protected void storeCredentials()
+meth protected void storeFormFields()
+meth protected void storeHost()
+meth protected void storePorts()
+meth protected void storeTarget()
+meth protected void updatePasswordVisibility()
+meth public void addNotify()
+meth public void removeNotify()
+supr javax.swing.JPanel
+hfds LOGGER,MAX_PORT_VALUE
+
+CLSS protected static org.netbeans.modules.payara.common.ui.InstancePanel$CheckBoxProperties
+ outer org.netbeans.modules.payara.common.ui.InstancePanel
+cons protected init(org.netbeans.modules.payara.common.PayaraInstance)
+meth protected boolean getCommetSupportProperty()
+meth protected boolean getHttpMonitorProperty()
+meth protected boolean getJdbcDriverDeploymentProperty()
+meth protected boolean getLoopbackProperty()
+meth protected boolean getPreserveSessionsProperty()
+meth protected boolean getStartDerbyProperty()
+meth protected void store(boolean,boolean,boolean,boolean,boolean,boolean,org.netbeans.modules.payara.common.PayaraInstance)
+meth protected void storeBooleanProperty(java.lang.String,boolean,org.netbeans.modules.payara.common.PayaraInstance)
+supr java.lang.Object
+hfds cometSupportProperty,httpMonitorProperty,jdbcDriverDeploymentProperty,loopbackProperty,preserveSessionsProperty,startDerbyProperty
+
+CLSS public org.netbeans.modules.payara.common.ui.InstanceRemotePanel
+cons public init(org.netbeans.modules.payara.common.PayaraInstance)
+meth protected java.lang.String getHost()
+meth protected void enableFields()
+meth protected void initHost()
+meth protected void initPorts()
+supr org.netbeans.modules.payara.common.ui.InstancePanel
+hfds LOGGER
+
+CLSS public org.netbeans.modules.payara.common.ui.IpComboBox
+cons public init(boolean)
+cons public init(java.lang.Object[])
+cons public init(java.util.Set<? extends java.net.InetAddress>,boolean)
+cons public init(java.util.Vector<?>)
+cons public init(javax.swing.ComboBoxModel)
+fld public final static java.lang.String IP_4_127_0_0_1_NAME = "localhost"
+innr public static InetAddr
+innr public static InetAddrComparator
+meth public java.lang.Object getSelectedItem()
+meth public java.net.InetAddress getSelectedIp()
+meth public static boolean isLocalhost(java.net.InetAddress)
+meth public void setSelectedIp(java.net.InetAddress)
+meth public void setSelectedItem(java.lang.Object)
+meth public void updateModel(boolean)
+meth public void updateModel(java.util.Set<? extends java.net.InetAddress>,boolean)
+supr javax.swing.JComboBox<org.netbeans.modules.payara.common.ui.IpComboBox$InetAddr>
+hfds CONSTRUCTOR_EXCEPTION_MSG,IP_4_127_0_0_1,ipComparator
+
+CLSS public static org.netbeans.modules.payara.common.ui.IpComboBox$InetAddr
+ outer org.netbeans.modules.payara.common.ui.IpComboBox
+meth public boolean isDefault()
+meth public java.lang.String toString()
+meth public java.net.InetAddress getIp()
+supr java.lang.Object
+hfds def,ip
+
+CLSS public static org.netbeans.modules.payara.common.ui.IpComboBox$InetAddrComparator
+ outer org.netbeans.modules.payara.common.ui.IpComboBox
+cons public init()
+intf java.util.Comparator<org.netbeans.modules.payara.common.ui.IpComboBox$InetAddr>
+meth public int compare(org.netbeans.modules.payara.common.ui.IpComboBox$InetAddr,org.netbeans.modules.payara.common.ui.IpComboBox$InetAddr)
+supr java.lang.Object
+hfds INET_ADDRESS_COMPARATOR
+
+CLSS public org.netbeans.modules.payara.common.ui.JavaMailCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds mailHostField,mailHostLabel,resourceEnabledCB,returnField,returnLabel,userField,userLabel
+
+CLSS public org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox
+cons public init()
+cons public init(java.lang.Object[])
+cons public init(java.util.Vector<?>)
+cons public init(javax.swing.ComboBoxModel)
+cons public init(org.netbeans.api.java.platform.JavaPlatform[])
+fld public final static java.lang.String EMPTY_DISPLAY_NAME
+innr public static Platform
+innr public static PlatformComparator
+meth public void setSelectedItem(java.lang.Object)
+meth public void updateModel()
+meth public void updateModel(org.netbeans.api.java.platform.JavaPlatform[])
+supr javax.swing.JComboBox<org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$Platform>
+hfds CONSTRUCTOR_EXCEPTION_MSG,platformComparator
+
+CLSS public static org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$Platform
+ outer org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox
+meth public boolean isDefault()
+meth public java.lang.String toString()
+meth public org.netbeans.api.java.platform.JavaPlatform getPlatform()
+supr java.lang.Object
+hfds platform
+
+CLSS public static org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$PlatformComparator
+ outer org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox
+cons public init()
+intf java.util.Comparator<org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$Platform>
+meth public int compare(org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$Platform,org.netbeans.modules.payara.common.ui.JavaPlatformsComboBox$Platform)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.common.ui.JavaSEPlatformPanel
+cons public init(org.openide.NotifyDescriptor,org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+meth public static org.openide.filesystems.FileObject selectServerSEPlatform(org.netbeans.modules.payara.common.PayaraInstance,java.io.File)
+supr javax.swing.JPanel
+hfds LOGGER,descriptor,instance,javaComboBox,javaLabel,javaLabelText,javaPlatforms,message,messageLabel,platformButton,platformButtonAction,platformButtonText,propertiesCheckBox,propertiesLabel,propertiesLabelText
+hcls PlatformAction
+
+CLSS public org.netbeans.modules.payara.common.ui.JdbcResourceCustomizer
+cons public init()
+meth protected java.lang.String getPrefix()
+meth protected java.util.List<java.awt.Component> getDataComponents()
+supr org.netbeans.modules.payara.common.ui.BasePanel
+hfds poolNameCombo,poolNameLabel,resourceEnabledCB
+
+CLSS public org.netbeans.modules.payara.common.ui.VmCustomizer
+cons public init(org.netbeans.modules.payara.common.PayaraInstance)
+meth public void addNotify()
+meth public void removeNotify()
+supr javax.swing.JPanel
+hfds PORT_MAX,PORT_MIN,addressValue,buttonGroup1,debugSettingsPanel,instance,jLabel1,javaComboBox,javaInstallLabel,javaPlatforms,pickerPanel,platformButton,platformButtonAction,platformButtonText,useIDEProxyInfo,useSharedMemRB,useSocketRB,useUserDefinedAddress
+hcls PlatformAction
+
+CLSS public org.netbeans.modules.payara.common.ui.WarnPanel
+cons public init(java.lang.String,boolean)
+meth public boolean showAgain()
+meth public static boolean gfKillWarning(java.lang.String)
+meth public static void pfUnknownVersionWarning(java.lang.String,java.lang.String)
+supr javax.swing.JPanel
+hfds showAgain,warning,warningLabel
+
+CLSS public org.netbeans.modules.payara.common.utils.AdminKeyFile
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer)
+fld public final static char HASH_ALGORITHM_PREFIX = '{'
+fld public final static char HASH_ALGORITHM_SUFFIX = '}'
+fld public final static char SEPARATOR = ';'
+fld public final static int RANDOM_PASSWORD_LENGTH = 12
+fld public final static java.lang.String ADMIN_KEYFILE_NAME = "admin-keyfile"
+fld public final static java.lang.String DEFAULT_TOOL = "asadmin"
+fld public final static java.lang.String DEFAULT_USER = "admin"
+fld public final static java.lang.String EOL
+fld public final static java.lang.String HASH_ALGORITHM = "SHA-1"
+fld public final static java.lang.String HASH_ALGORITHM_GALSSFISH = "SSHA"
+fld public final static java.lang.String PASSWORD_ENCODING = "UTF-8"
+fld public final static java.lang.String PASSWORD_RESET = "RESET"
+meth public boolean isReset()
+meth public boolean read()
+meth public boolean setPassword(java.lang.String)
+meth public boolean write()
+meth public static java.lang.String buildAdminKeyFilePath(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static java.lang.String randomPassword(int)
+supr java.lang.Object
+hfds CHARS_PW,CHARS_PW0,CHARS_PWL,LOGGER,MIN_PW_SIZE,adminKeyFile,passwordChars,passwordHash,reset,tool,user
+hcls Parser
+
+CLSS public org.netbeans.modules.payara.common.utils.JavaUtils
+cons public init()
+fld public final static java.lang.String JAVA_SE_SPECIFICATION_NAME = "j2se"
+meth public static boolean checkAndRegisterJavaPlatform(java.lang.String)
+meth public static boolean isJavaPlatformSupported(org.netbeans.modules.payara.common.PayaraInstance,java.io.File)
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+ anno 2 org.netbeans.api.annotations.common.NonNull()
+meth public static java.lang.String getDefaultJavaHome()
+meth public static java.lang.String getJavaHome(org.netbeans.api.java.platform.JavaPlatform)
+meth public static org.netbeans.api.java.platform.JavaPlatform findInstalledPlatform(java.io.File)
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+meth public static org.netbeans.api.java.platform.JavaPlatform findPlatformByJavaHome(org.netbeans.api.java.platform.JavaPlatform[],java.io.File)
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+ anno 2 org.netbeans.api.annotations.common.NonNull()
+meth public static org.netbeans.api.java.platform.JavaPlatform[] findSupportedPlatforms(org.netbeans.modules.payara.common.PayaraInstance)
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+meth public static org.netbeans.api.java.platform.JavaPlatform[] getInstalledJavaSEPlatforms()
+supr java.lang.Object
+hfds PF_PLATFORM_DISPLAY_NAME_PREFIX,PF_PLATFORM_DISPLAY_NAME_SUFFIX,LOGGER
+
+CLSS public org.netbeans.modules.payara.common.utils.ServerUtils
+cons public init()
+meth public static boolean isProcessRunning(java.lang.Process)
+meth public static boolean isValidFolder(java.lang.String)
+meth public static java.lang.String getDomainsFolder(org.netbeans.modules.payara.common.PayaraInstance)
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+meth public static java.lang.String getStringAttribute(org.openide.filesystems.FileObject,java.lang.String)
+meth public static java.lang.String getStringAttribute(org.openide.filesystems.FileObject,java.lang.String,java.lang.String)
+meth public static org.openide.filesystems.FileObject getRepositoryDir(java.lang.String,boolean)
+meth public static void setStringAttribute(org.openide.filesystems.FileObject,java.lang.String,java.lang.String)
+supr java.lang.Object
+hfds DOMAINS_FOLDER_PREFIX,LOGGER
+
+CLSS public final org.netbeans.modules.payara.common.utils.Util
+fld public final static java.lang.String PF_LOOKUP_PATH = "Servers/Payara"
+meth public final java.util.List<java.io.File> classPathToFileList(java.lang.String,java.io.File)
+meth public static boolean appearsToBeJdk6OrBetter(java.io.File)
+meth public static boolean isDefaultOrServerTarget(java.util.Map<java.lang.String,java.lang.String>)
+meth public static boolean readServerConfiguration(java.io.File,org.netbeans.modules.payara.common.PortCollection)
+meth public static java.lang.String computeTarget(java.util.Map<java.lang.String,java.lang.String>)
+meth public static java.lang.String escapePath(java.lang.String)
+ anno 0 java.lang.Deprecated()
+meth public static java.lang.String quote(java.lang.String)
+supr java.lang.Object
+hfds DOMAIN_XML_PATH,INDICATOR,JDK6_DETECTION_FILTER
+hcls HttpData
+
+CLSS public org.netbeans.modules.payara.spi.AppDesc
+cons public init(java.lang.String,java.lang.String,java.lang.String,boolean)
+meth public boolean getEnabled()
+meth public java.lang.String getContextRoot()
+meth public java.lang.String getName()
+meth public java.lang.String getPath()
+supr java.lang.Object
+hfds contextRoot,enabled,name,path
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.CommandFactory
+meth public abstract org.netbeans.modules.payara.tooling.admin.CommandSetProperty getSetPropertyCommand(java.lang.String,java.lang.String)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.CustomizerCookie
+meth public abstract java.util.Collection<javax.swing.JPanel> getCustomizerPages()
+
+CLSS public abstract org.netbeans.modules.payara.spi.Decorator
+cons public init()
+fld public final static java.awt.Image DISABLED_BADGE
+fld public final static java.lang.String DISABLED = "disabled "
+meth public boolean canCopy()
+meth public boolean canDeployTo()
+meth public boolean canDisable()
+meth public boolean canEditDetails()
+meth public boolean canEnable()
+meth public boolean canShowBrowser()
+meth public boolean canTest()
+meth public boolean canUndeploy()
+meth public boolean canUnregister()
+meth public boolean isRefreshable()
+meth public java.awt.Image getIcon(int)
+meth public java.awt.Image getIconBadge()
+meth public java.awt.Image getOpenedIcon(int)
+supr java.lang.Object
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.DecoratorFactory
+meth public abstract boolean isTypeSupported(java.lang.String)
+meth public abstract java.util.Map<java.lang.String,org.netbeans.modules.payara.spi.Decorator> getAllDecorators()
+meth public abstract org.netbeans.modules.payara.spi.Decorator getDecorator(java.lang.String)
+
+CLSS public org.netbeans.modules.payara.spi.ExecSupport
+cons public init()
+innr public static OutputCopier
+meth public void displayProcessOutputs(java.lang.Process,java.lang.String,java.lang.String) throws java.io.IOException,java.lang.InterruptedException
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.spi.ExecSupport$OutputCopier
+ outer org.netbeans.modules.payara.spi.ExecSupport
+cons public init(java.io.Reader,java.io.Writer,boolean)
+meth public void interrupt()
+meth public void run()
+supr java.lang.Thread
+hfds autoflush,done,is,os
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.PayaraModule
+fld public final static int PROPERTIES_FETCH_TIMEOUT = 10000
+fld public final static java.lang.String ADMINOBJECT_RESOURCE = "admin-object"
+fld public final static java.lang.String ADMINPORT_ATTR = "adminPort"
+fld public final static java.lang.String APPCLIENT_CONTAINER = "appclient"
+fld public final static java.lang.String COMET_FLAG = "v3.grizzly.cometSupport"
+fld public final static java.lang.String CONNECTORS = "CONNECTORS"
+fld public final static java.lang.String CONNECTOR_CONTAINER = "connector"
+fld public final static java.lang.String CONN_CONNECTION_POOL = "connector-connection-pool"
+fld public final static java.lang.String CONN_RESOURCE = "connector-resource"
+fld public final static java.lang.String DEBUG_MEM = "debugMem"
+fld public final static java.lang.String DEBUG_MODE
+fld public final static java.lang.String DEBUG_PORT = "debugPort"
+fld public final static java.lang.String DISPLAY_NAME_ATTR = "displayName"
+fld public final static java.lang.String DOMAINS_FOLDER_ATTR = "domainsfolder"
+fld public final static java.lang.String DOMAIN_NAME_ATTR = "domainname"
+fld public final static java.lang.String DRIVER_DEPLOY_FLAG = "driverDeployOn"
+fld public final static java.lang.String EAR_CONTAINER = "ear"
+fld public final static java.lang.String EJB_CONTAINER = "ejb"
+fld public final static java.lang.String GEM_HOME = "GEM_HOME"
+fld public final static java.lang.String GEM_PATH = "GEM_PATH"
+fld public final static java.lang.String PAYARA_FOLDER_ATTR = "homefolder"
+fld public final static java.lang.String HOSTNAME_ATTR = "host"
+fld public final static java.lang.String HTTPHOST_ATTR = "httphostname"
+fld public final static java.lang.String HTTPPORT_ATTR = "httpportnumber"
+fld public final static java.lang.String HTTP_MONITOR_FLAG = "httpMonitorOn"
+fld public final static java.lang.String INSTALL_FOLDER_ATTR = "installfolder"
+fld public final static java.lang.String JAVAMAIL = "JAVAMAIL"
+fld public final static java.lang.String JAVAMAIL_RESOURCE = "javamail-resource"
+fld public final static java.lang.String JAVA_PLATFORM_ATTR = "java.platform"
+fld public final static java.lang.String JDBC = "JDBC"
+fld public final static java.lang.String JDBC_CONNECTION_POOL = "jdbc-connection-pool"
+fld public final static java.lang.String JDBC_RESOURCE = "jdbc-resource"
+fld public final static java.lang.String JRUBY_CONTAINER = "jruby"
+fld public final static java.lang.String JRUBY_HOME = "jruby.home"
+fld public final static java.lang.String JVM_MODE = "jvmMode"
+fld public final static java.lang.String LOOPBACK_FLAG = "loopbackOn"
+fld public final static java.lang.String NB73_IMPORT_FIXED = "nb73ImportFixed"
+fld public final static java.lang.String NORMAL_MODE
+fld public final static java.lang.String PASSWORD_ATTR = "password"
+fld public final static java.lang.String PASSWORD_CONVERTED_FLAG = "this really long string is used to identify a password that has been stored in the Keyring"
+fld public final static java.lang.String PROFILE_MODE
+fld public final static java.lang.String SESSION_PRESERVATION_FLAG = "preserveSessionsOn"
+fld public final static java.lang.String START_DERBY_FLAG = "derbyStartOn"
+fld public final static java.lang.String TARGET_ATTR = "target"
+fld public final static java.lang.String URL_ATTR = "url"
+fld public final static java.lang.String USERNAME_ATTR = "username"
+fld public final static java.lang.String USE_IDE_PROXY_FLAG = "useIDEProxyOn"
+fld public final static java.lang.String USE_SHARED_MEM_ATTR = "use.shared.mem"
+fld public final static java.lang.String WEB_CONTAINER = "web"
+innr public final static !enum ServerState
+meth public abstract boolean isRemote()
+meth public abstract boolean isRestfulLogAccessSupported()
+meth public abstract boolean isWritable()
+meth public abstract boolean supportsRestartInDebug()
+meth public abstract java.lang.String getPassword()
+meth public abstract java.lang.String getResourcesXmlName()
+meth public abstract java.lang.String setEnvironmentProperty(java.lang.String,java.lang.String,boolean)
+meth public abstract java.util.Map<java.lang.String,java.lang.String> getInstanceProperties()
+meth public abstract java.util.Map<java.lang.String,org.netbeans.modules.payara.spi.ResourceDesc> getResourcesMap(java.lang.String)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> killServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> restartServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> startServer(org.netbeans.modules.payara.tooling.TaskStateListener,org.netbeans.modules.payara.spi.PayaraModule$ServerState)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.TaskState> stopServer(org.netbeans.modules.payara.tooling.TaskStateListener)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> disable(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> enable(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,boolean)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,java.lang.String,boolean)
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> undeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String)
+meth public abstract org.netbeans.modules.payara.common.PayaraInstanceProvider getInstanceProvider()
+meth public abstract org.netbeans.modules.payara.spi.AppDesc[] getModuleList(java.lang.String)
+meth public abstract org.netbeans.modules.payara.spi.CommandFactory getCommandFactory()
+meth public abstract org.netbeans.modules.payara.spi.PayaraModule$ServerState getServerState()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraServer getInstance()
+meth public abstract void addChangeListener(javax.swing.event.ChangeListener)
+meth public abstract void removeChangeListener(javax.swing.event.ChangeListener)
+
+CLSS public final static !enum org.netbeans.modules.payara.spi.PayaraModule$ServerState
+ outer org.netbeans.modules.payara.spi.PayaraModule
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState RUNNING
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState RUNNING_JVM_DEBUG
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState RUNNING_JVM_PROFILER
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState STARTING
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState STOPPED
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState STOPPED_JVM_BP
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState STOPPED_JVM_PROFILER
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState STOPPING
+fld public final static org.netbeans.modules.payara.spi.PayaraModule$ServerState UNKNOWN
+meth public static org.netbeans.modules.payara.spi.PayaraModule$ServerState valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.spi.PayaraModule$ServerState[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.spi.PayaraModule$ServerState>
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.PayaraModule2
+intf org.netbeans.modules.payara.spi.PayaraModule
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> deploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.io.File,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,java.io.File[])
+meth public abstract java.util.concurrent.Future<org.netbeans.modules.payara.tooling.admin.ResultString> redeploy(org.netbeans.modules.payara.tooling.TaskStateListener,java.lang.String,java.lang.String,java.io.File[],boolean)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.PayaraModule3
+intf org.netbeans.modules.payara.spi.PayaraModule2
+meth public abstract org.openide.util.RequestProcessor$Task refresh()
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.PayaraModuleFactory
+meth public abstract boolean isModuleSupported(java.lang.String,java.util.Properties)
+meth public abstract java.lang.Object createModule(org.openide.util.Lookup)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.JrePicker
+meth public abstract javax.swing.JPanel component(org.netbeans.modules.payara.spi.PayaraModule)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.PluggableNodeProvider
+meth public abstract org.openide.nodes.Node getPluggableNode(java.util.Map<java.lang.String,java.lang.String>)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.Recognizer
+meth public abstract org.openide.windows.OutputListener processLine(java.lang.String)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.RecognizerCookie
+meth public abstract java.util.Collection<? extends org.netbeans.modules.payara.spi.Recognizer> getRecognizers()
+
+CLSS public org.netbeans.modules.payara.spi.RegisterDatabase
+cons public init()
+meth public static org.netbeans.modules.payara.spi.RegisterDatabase getDefault()
+meth public void configureDatabase()
+meth public void setupDerby(java.lang.String)
+supr java.lang.Object
+hfds reg
+hcls DerbyLibraryRegistrar
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.RegisteredDDCatalog
+meth public abstract void refreshRunTimeDDCatalog(org.netbeans.spi.server.ServerInstanceProvider,java.lang.String)
+meth public abstract void registerRunTimeDDCatalog(org.netbeans.spi.server.ServerInstanceProvider)
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.RegisteredDerbyServer
+meth public abstract void initialize(java.lang.String)
+meth public abstract void start()
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.RemoveCookie
+meth public abstract void removeInstance(java.lang.String)
+
+CLSS public abstract org.netbeans.modules.payara.spi.ResourceDecorator
+cons public init()
+meth public abstract java.lang.String getCmdPropertyName()
+meth public boolean canEditDetails()
+meth public boolean isCascadeDelete()
+supr org.netbeans.modules.payara.spi.Decorator
+
+CLSS public org.netbeans.modules.payara.spi.ResourceDesc
+cons public init(java.lang.String,java.lang.String)
+intf java.lang.Comparable<org.netbeans.modules.payara.spi.ResourceDesc>
+meth public int compareTo(org.netbeans.modules.payara.spi.ResourceDesc)
+meth public java.lang.String getCommandType()
+meth public java.lang.String getName()
+meth public static java.util.List<org.netbeans.modules.payara.spi.ResourceDesc> getResources(org.netbeans.modules.payara.common.PayaraInstance,java.lang.String)
+supr java.lang.Object
+hfds LOGGER,cmdType,name
+
+CLSS public final org.netbeans.modules.payara.spi.ServerUtilities
+fld public final static int ACTION_TIMEOUT = 15000
+fld public final static java.lang.String GF_JAR_MATCHER = "glassfish(?:-[0-9bSNAPHOT]+(?:\u005c.[0-9]+(?:_[0-9]+|)|).*|).jar"
+fld public final static java.lang.String PF_LIB_DIR_NAME = "lib"
+fld public final static java.lang.String PF_MODULES_DIR_NAME = "modules"
+fld public final static java.lang.String VERSION_MATCHER = "(?:-[0-9bSNAPHOT]+(?:\u005c.[0-9]+(?:_[0-9]+|)|).*|).jar"
+fld public final static java.lang.String PROP_FIRST_RUN = "first_run"
+fld public final static java.util.concurrent.TimeUnit ACTION_TIMEOUT_UNIT
+meth public <%0 extends java.lang.Object> java.util.List<{%%0}> getInstancesByCapability(java.lang.Class<{%%0}>)
+meth public <%0 extends java.lang.Object> {%%0} getInstanceByCapability(java.lang.String,java.lang.Class<{%%0}>)
+meth public boolean isRegisteredUri(java.lang.String)
+meth public final static java.lang.String quote(java.lang.String)
+meth public org.netbeans.api.server.ServerInstance getServerInstance(java.lang.String)
+meth public org.netbeans.spi.server.ServerInstanceProvider getServerProvider()
+meth public org.openide.util.Lookup getLookupFor(org.netbeans.api.server.ServerInstance)
+meth public static boolean isTP2(java.lang.String)
+meth public static java.io.File getJarName(java.lang.String,java.lang.String)
+meth public static java.io.File getJarName(java.lang.String,java.lang.String,java.lang.String)
+meth public static java.io.File getWsJarName(java.lang.String,java.lang.String)
+meth public static java.net.URL fileToUrl(java.io.File) throws java.net.MalformedURLException
+meth public static java.util.List<java.lang.String> filterByManifest(java.util.List<java.lang.String>,org.openide.filesystems.FileObject,int,boolean)
+meth public static org.netbeans.modules.payara.spi.ServerUtilities getEe6Utilities()
+meth public static org.openide.WizardDescriptor$InstantiatingIterator getInstantiatingIterator()
+supr java.lang.Object
+hfds pip,gwp
+
+CLSS public org.netbeans.modules.payara.spi.Utils
+cons public init()
+fld public final static java.lang.String VERSIONED_JAR_SUFFIX_MATCHER = "(?:-[0-9]+(?:\u005c.[0-9]+(?:_[0-9]+|)|).*|).jar"
+meth public final static java.lang.String escapePath(java.lang.String)
+meth public static boolean canWrite(java.io.File)
+meth public static boolean isLocalPortOccupied(int)
+meth public static boolean isSecurePort(java.lang.String,int) throws java.io.IOException
+meth public static boolean usePayaraPrefix(java.lang.String)
+meth public static java.io.File getFileFromPattern(java.lang.String,java.io.File)
+meth public static java.lang.String getHttpListenerProtocol(java.lang.String,int)
+meth public static java.lang.String getHttpListenerProtocol(java.lang.String,java.lang.String)
+meth public static java.lang.String sanitizeName(java.lang.String)
+meth public static void doCopy(org.openide.filesystems.FileObject,org.openide.filesystems.FileObject) throws java.io.IOException
+supr java.lang.Object
+hfds PORT_CHECK_TIMEOUT
+hcls VersionFilter
+
+CLSS public abstract interface org.netbeans.modules.payara.spi.VMIntrospector
+meth public abstract boolean isSuspended(java.lang.String,java.lang.String)
+
+CLSS public org.netbeans.modules.payara.spi.WSDesc
+cons public init(java.lang.String)
+meth public java.lang.String getName()
+meth public java.lang.String getTestURL()
+meth public java.lang.String getWsdlUrl()
+meth public static java.util.List<org.netbeans.modules.payara.spi.WSDesc> getWebServices(org.netbeans.modules.payara.common.PayaraInstance)
+supr java.lang.Object
+hfds LOGGER,TEST_URL_EXTENSION,WSDL_URL_EXTENSION,name,testUrl,wsdlUrl
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.PayaraStatusListener
+meth public abstract void added()
+meth public abstract void currentState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void error(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void newState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void removed()
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.PayaraServer
+meth public abstract boolean isRemote()
+meth public abstract int getAdminPort()
+meth public abstract int getPort()
+meth public abstract java.lang.String getAdminPassword()
+meth public abstract java.lang.String getAdminUser()
+meth public abstract java.lang.String getDomainName()
+meth public abstract java.lang.String getDomainsFolder()
+meth public abstract java.lang.String getHost()
+meth public abstract java.lang.String getName()
+meth public abstract java.lang.String getServerHome()
+meth public abstract java.lang.String getServerRoot()
+meth public abstract java.lang.String getUrl()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraAdminInterface getAdminInterface()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraVersion getVersion()
+
+CLSS public abstract interface org.netbeans.spi.server.ServerInstanceImplementation
+meth public abstract boolean isRemovable()
+meth public abstract java.lang.String getDisplayName()
+meth public abstract java.lang.String getServerDisplayName()
+meth public abstract javax.swing.JComponent getCustomizer()
+meth public abstract org.openide.nodes.Node getBasicNode()
+meth public abstract org.openide.nodes.Node getFullNode()
+meth public abstract void remove()
+
+CLSS public abstract interface org.netbeans.spi.server.ServerInstanceProvider
+meth public abstract java.util.List<org.netbeans.api.server.ServerInstance> getInstances()
+meth public abstract void addChangeListener(javax.swing.event.ChangeListener)
+meth public abstract void removeChangeListener(javax.swing.event.ChangeListener)
+
+CLSS public abstract interface org.openide.filesystems.FileChangeListener
+intf java.util.EventListener
+meth public abstract void fileAttributeChanged(org.openide.filesystems.FileAttributeEvent)
+meth public abstract void fileChanged(org.openide.filesystems.FileEvent)
+meth public abstract void fileDataCreated(org.openide.filesystems.FileEvent)
+meth public abstract void fileDeleted(org.openide.filesystems.FileEvent)
+meth public abstract void fileFolderCreated(org.openide.filesystems.FileEvent)
+meth public abstract void fileRenamed(org.openide.filesystems.FileRenameEvent)
+
+CLSS public org.openide.modules.ModuleInstall
+cons public init()
+meth protected boolean clearSharedData()
+meth public boolean closing()
+meth public void close()
+meth public void installed()
+ anno 0 java.lang.Deprecated()
+meth public void restored()
+meth public void uninstalled()
+meth public void updated(int,java.lang.String)
+ anno 0 java.lang.Deprecated()
+meth public void validate()
+supr org.openide.util.SharedClassObject
+hfds serialVersionUID
+
+CLSS public abstract org.openide.nodes.Node
+cons protected init(org.openide.nodes.Children)
+cons protected init(org.openide.nodes.Children,org.openide.util.Lookup)
+fld public final static java.lang.String PROP_COOKIE = "cookie"
+fld public final static java.lang.String PROP_DISPLAY_NAME = "displayName"
+fld public final static java.lang.String PROP_ICON = "icon"
+fld public final static java.lang.String PROP_LEAF = "leaf"
+fld public final static java.lang.String PROP_NAME = "name"
+fld public final static java.lang.String PROP_OPENED_ICON = "openedIcon"
+fld public final static java.lang.String PROP_PARENT_NODE = "parentNode"
+fld public final static java.lang.String PROP_PROPERTY_SETS = "propertySets"
+fld public final static java.lang.String PROP_SHORT_DESCRIPTION = "shortDescription"
+fld public final static org.openide.nodes.Node EMPTY
+innr public abstract interface static Cookie
+innr public abstract interface static Handle
+innr public abstract static IndexedProperty
+innr public abstract static Property
+innr public abstract static PropertySet
+intf org.openide.util.HelpCtx$Provider
+intf org.openide.util.Lookup$Provider
+meth protected final boolean hasPropertyChangeListener()
+meth protected final void fireCookieChange()
+meth protected final void fireDisplayNameChange(java.lang.String,java.lang.String)
+meth protected final void fireIconChange()
+meth protected final void fireNameChange(java.lang.String,java.lang.String)
+meth protected final void fireNodeDestroyed()
+meth protected final void fireOpenedIconChange()
+meth protected final void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth protected final void firePropertySetsChange(org.openide.nodes.Node$PropertySet[],org.openide.nodes.Node$PropertySet[])
+meth protected final void fireShortDescriptionChange(java.lang.String,java.lang.String)
+meth protected final void setChildren(org.openide.nodes.Children)
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth public <%0 extends org.openide.nodes.Node$Cookie> {%%0} getCookie(java.lang.Class<{%%0}>)
+meth public abstract boolean canCopy()
+meth public abstract boolean canCut()
+meth public abstract boolean canDestroy()
+meth public abstract boolean canRename()
+meth public abstract boolean hasCustomizer()
+meth public abstract java.awt.Component getCustomizer()
+meth public abstract java.awt.Image getIcon(int)
+meth public abstract java.awt.Image getOpenedIcon(int)
+meth public abstract java.awt.datatransfer.Transferable clipboardCopy() throws java.io.IOException
+meth public abstract java.awt.datatransfer.Transferable clipboardCut() throws java.io.IOException
+meth public abstract java.awt.datatransfer.Transferable drag() throws java.io.IOException
+meth public abstract org.openide.nodes.Node cloneNode()
+meth public abstract org.openide.nodes.Node$Handle getHandle()
+meth public abstract org.openide.nodes.Node$PropertySet[] getPropertySets()
+meth public abstract org.openide.util.HelpCtx getHelpCtx()
+meth public abstract org.openide.util.datatransfer.NewType[] getNewTypes()
+meth public abstract org.openide.util.datatransfer.PasteType getDropType(java.awt.datatransfer.Transferable,int,int)
+meth public abstract org.openide.util.datatransfer.PasteType[] getPasteTypes(java.awt.datatransfer.Transferable)
+meth public boolean equals(java.lang.Object)
+meth public final boolean isLeaf()
+meth public final javax.swing.JPopupMenu getContextMenu()
+meth public final org.openide.nodes.Children getChildren()
+meth public final org.openide.nodes.Node getParentNode()
+meth public final org.openide.util.Lookup getLookup()
+meth public final void addNodeListener(org.openide.nodes.NodeListener)
+meth public final void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public final void removeNodeListener(org.openide.nodes.NodeListener)
+meth public final void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public int hashCode()
+meth public java.lang.String getHtmlDisplayName()
+meth public java.lang.String toString()
+meth public javax.swing.Action getPreferredAction()
+meth public javax.swing.Action[] getActions(boolean)
+meth public org.openide.util.actions.SystemAction getDefaultAction()
+ anno 0 java.lang.Deprecated()
+meth public org.openide.util.actions.SystemAction[] getActions()
+ anno 0 java.lang.Deprecated()
+meth public org.openide.util.actions.SystemAction[] getContextActions()
+ anno 0 java.lang.Deprecated()
+meth public void destroy() throws java.io.IOException
+meth public void setDisplayName(java.lang.String)
+meth public void setHidden(boolean)
+ anno 0 java.lang.Deprecated()
+meth public void setName(java.lang.String)
+meth public void setShortDescription(java.lang.String)
+supr java.beans.FeatureDescriptor
+hfds BLOCK_EVENTS,INIT_LOCK,LOCK,TEMPL_COOKIE,err,hierarchy,listeners,lookups,parent,warnedBadProperties
+hcls LookupEventList,PropertyEditorRef
+
+CLSS public abstract interface static org.openide.nodes.Node$Cookie
+ outer org.openide.nodes.Node
+
+CLSS public final org.openide.util.HelpCtx
+cons public init(java.lang.Class<?>)
+ anno 0 java.lang.Deprecated()
+cons public init(java.lang.String)
+cons public init(java.net.URL)
+ anno 0 java.lang.Deprecated()
+fld public final static org.openide.util.HelpCtx DEFAULT_HELP
+innr public abstract interface static Displayer
+innr public abstract interface static Provider
+meth public boolean display()
+meth public boolean equals(java.lang.Object)
+meth public int hashCode()
+meth public java.lang.String getHelpID()
+meth public java.lang.String toString()
+meth public java.net.URL getHelp()
+meth public static org.openide.util.HelpCtx findHelp(java.awt.Component)
+meth public static org.openide.util.HelpCtx findHelp(java.lang.Object)
+meth public static void setHelpIDString(javax.swing.JComponent,java.lang.String)
+supr java.lang.Object
+hfds err,helpCtx,helpID
+
+CLSS public abstract interface static org.openide.util.HelpCtx$Provider
+ outer org.openide.util.HelpCtx
+meth public abstract org.openide.util.HelpCtx getHelpCtx()
+
+CLSS public abstract org.openide.util.Lookup
+cons public init()
+fld public final static org.openide.util.Lookup EMPTY
+innr public abstract interface static Provider
+innr public abstract static Item
+innr public abstract static Result
+innr public final static Template
+meth public <%0 extends java.lang.Object> java.util.Collection<? extends {%%0}> lookupAll(java.lang.Class<{%%0}>)
+meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Item<{%%0}> lookupItem(org.openide.util.Lookup$Template<{%%0}>)
+meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookupResult(java.lang.Class<{%%0}>)
+meth public abstract <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookup(org.openide.util.Lookup$Template<{%%0}>)
+meth public abstract <%0 extends java.lang.Object> {%%0} lookup(java.lang.Class<{%%0}>)
+meth public static org.openide.util.Lookup getDefault()
+supr java.lang.Object
+hfds LOG,defaultLookup,defaultLookupProvider
+hcls DefLookup,Empty
+
+CLSS public abstract interface static org.openide.util.Lookup$Provider
+ outer org.openide.util.Lookup
+meth public abstract org.openide.util.Lookup getLookup()
+
+CLSS public abstract interface org.openide.util.LookupListener
+intf java.util.EventListener
+meth public abstract void resultChanged(org.openide.util.LookupEvent)
+
+CLSS public abstract org.openide.util.SharedClassObject
+cons protected init()
+intf java.io.Externalizable
+meth protected boolean clearSharedData()
+meth protected final java.lang.Object getLock()
+meth protected final java.lang.Object getProperty(java.lang.Object)
+meth protected final java.lang.Object putProperty(java.lang.Object,java.lang.Object)
+meth protected final java.lang.Object putProperty(java.lang.String,java.lang.Object,boolean)
+meth protected final void finalize() throws java.lang.Throwable
+meth protected java.lang.Object writeReplace()
+meth protected void addNotify()
+meth protected void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth protected void initialize()
+meth protected void removeNotify()
+meth protected void reset()
+meth public final boolean equals(java.lang.Object)
+meth public final int hashCode()
+meth public final void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public final void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public static <%0 extends org.openide.util.SharedClassObject> {%%0} findObject(java.lang.Class<{%%0}>)
+meth public static <%0 extends org.openide.util.SharedClassObject> {%%0} findObject(java.lang.Class<{%%0}>,boolean)
+meth public void readExternal(java.io.ObjectInput) throws java.io.IOException,java.lang.ClassNotFoundException
+meth public void writeExternal(java.io.ObjectOutput) throws java.io.IOException
+supr java.lang.Object
+hfds PROP_SUPPORT,addNotifySuper,alreadyWarnedAboutDupes,dataEntry,err,first,firstTrace,inReadExternal,initializeSuper,instancesBeingCreated,lock,prematureSystemOptionMutation,removeNotifySuper,serialVersionUID,systemOption,values,waitingOnSystemOption
+hcls DataEntry,SetAccessibleAction,WriteReplace
+
+CLSS public abstract interface org.xml.sax.ContentHandler
+meth public abstract void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public abstract void endDocument() throws org.xml.sax.SAXException
+meth public abstract void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void ignorableWhitespace(char[],int,int) throws org.xml.sax.SAXException
+meth public abstract void processingInstruction(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void setDocumentLocator(org.xml.sax.Locator)
+meth public abstract void skippedEntity(java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void startDocument() throws org.xml.sax.SAXException
+meth public abstract void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public abstract void startPrefixMapping(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.DTDHandler
+meth public abstract void notationDecl(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void unparsedEntityDecl(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.EntityResolver
+meth public abstract org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.ErrorHandler
+meth public abstract void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public abstract void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public abstract void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+
+CLSS public org.xml.sax.helpers.DefaultHandler
+cons public init()
+intf org.xml.sax.ContentHandler
+intf org.xml.sax.DTDHandler
+intf org.xml.sax.EntityResolver
+intf org.xml.sax.ErrorHandler
+meth public org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+meth public void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public void endDocument() throws org.xml.sax.SAXException
+meth public void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException
+meth public void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public void ignorableWhitespace(char[],int,int) throws org.xml.sax.SAXException
+meth public void notationDecl(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void processingInstruction(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void setDocumentLocator(org.xml.sax.Locator)
+meth public void skippedEntity(java.lang.String) throws org.xml.sax.SAXException
+meth public void startDocument() throws org.xml.sax.SAXException
+meth public void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void startPrefixMapping(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void unparsedEntityDecl(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+supr java.lang.Object
+
diff --git a/enterprise/payara.common/nbproject/project.properties b/enterprise/payara.common/nbproject/project.properties
new file mode 100644
index 0000000..d204c5f
--- /dev/null
+++ b/enterprise/payara.common/nbproject/project.properties
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.8
+
+test.config.stableBTD.includes=**/*Test.class
+test.config.stableBTD.excludes=\
+ **/UtilsTest.class
diff --git a/enterprise/payara.common/nbproject/project.xml b/enterprise/payara.common/nbproject/project.xml
new file mode 100644
index 0000000..0f21d19
--- /dev/null
+++ b/enterprise/payara.common/nbproject/project.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.payara.common</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.17</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.36</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.progress</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.40</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.progress.nb</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.40</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.db</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.25</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.derby</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.extexecution</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.30</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.tooling</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.j2seplatform</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.29</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.platform</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.36</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.platform.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.36</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.keyring</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.14</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.14</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.server</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.19</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.actions</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.execution</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.io</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.61</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.19</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.insane</code-name-base>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <!-- Verifier code should be cleaned up in trunk after 7.3.1 release -->
+ <friend-packages>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
+ <friend>org.netbeans.modules.j2ee.sun.ddui</friend>
+ <friend>org.netbeans.modules.jbi.fuji.server.gfsupport</friend>
+ <friend>org.netbeans.modules.jbi.fuji.server.plugin</friend>
+ <friend>org.netbeans.modules.web.kit</friend>
+ <!-- Temporary for 7.3.1/7.4 -->
+ <friend>org.netbeans.modules.payara.jakartaee.verifier</friend>
+ <package>org.netbeans.modules.payara.spi</package>
+ <!-- Temporary for 7.3.1/7.4 -->
+ <package>org.netbeans.modules.payara.common</package>
+ <package>org.netbeans.modules.payara.common.parser</package>
+ <package>org.netbeans.modules.payara.common.ui</package>
+ <package>org.netbeans.modules.payara.common.utils</package>
+ </friend-packages>
+ </data>
+ <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
+ <word>admin</word>
+ <word>fetchers</word>
+ <word>ms</word>
+ </spellchecker-wordlist>
+ </configuration>
+</project>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/AdminAuthenticator.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/AdminAuthenticator.java
new file mode 100644
index 0000000..abf4206
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/AdminAuthenticator.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.prefs.Preferences;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
+import org.openide.util.NetworkSettings;
+
+/** Global password protected sites Authenticator for IDE
+ *
+ * @author Ludo, Petr Hrebejk, vkraemer
+ */
+public class AdminAuthenticator extends java.net.Authenticator {
+
+ private boolean displayed = false;
+ private static final long TIMEOUT = 3000;
+ private static long lastTry = 0;
+
+ public AdminAuthenticator() {
+ Preferences proxySettingsNode = NbPreferences.root().node("/org/netbeans/core"); //NOI18N
+ assert proxySettingsNode != null;
+ }
+
+ @Override
+ protected java.net.PasswordAuthentication getPasswordAuthentication() {
+ Logger.getLogger("payara").log(Level.FINER, "AdminAuthenticator.getPasswordAuthentication() with prompt {0}", this.getRequestingPrompt()); //NOI18N
+
+ String title = getRequestingPrompt();
+ // if the request is coming from a proxy and the IDE has proxy auth values
+ // send them straight back...
+ if (RequestorType.PROXY == getRequestorType() && ProxySettings.useAuthentication()) {
+ Logger.getLogger("payara").log(Level.FINER, "Username set to {0} while request {1}", new Object[]{ProxySettings.getAuthenticationUsername(), this.getRequestingURL()}); //NOI18N
+ return new java.net.PasswordAuthentication(ProxySettings.getAuthenticationUsername(), ProxySettings.getAuthenticationPassword());
+ } else {
+ // if we haven't been called in the last three seconds...
+ //
+ if (System.currentTimeMillis() - lastTry > TIMEOUT) {
+
+ // if anything other than the GF AS is asking for authentication
+ // make it possible to see the dialog
+ if (!"admin-realm".equals(title)) { // NOI18N
+ displayed = false;
+ }
+ if (!displayed && !NetworkSettings.isAuthenticationDialogSuppressed()) {
+ // try to prevent the dialog from popping up too often... since the
+ // plugin sends a bunch of requests to the AS one after the other to try to
+ // populate its node tree.
+ //
+ displayed = true;
+
+ ResourceBundle bundle = NbBundle.getBundle(AdminAuthenticator.class);
+ String dialogTitle = getRequestingHost();
+ if (null == dialogTitle) {
+ dialogTitle = bundle.getString("CTL_PasswordProtected");
+ }
+ String name = ""; // NOI18N
+
+ PasswordPanel passwordPanel = new PasswordPanel(name);
+ String url = getRequestingURL().toString();
+ if (null == url || !url.contains("/__asadmin/")) { // NOI18N
+ passwordPanel.setPrompt(title);
+ } else {
+ dialogTitle = bundle.getString("CTL_PasswordProtected");
+ passwordPanel.setPrompt(NbBundle.getMessage(AdminAuthenticator.class,
+ "PROMPT_PAYARA_AUTH", getRequestingHost(),
+ Integer.toString(getRequestingPort())));
+ }
+ DialogDescriptor dd = new DialogDescriptor(passwordPanel, dialogTitle);
+ java.awt.Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
+ dialog.setVisible(true);
+
+ if (dd.getValue().equals(NotifyDescriptor.OK_OPTION)) {
+ lastTry = System.currentTimeMillis();
+ return new java.net.PasswordAuthentication(passwordPanel.getUsername(), passwordPanel.getPassword());
+ } else {
+ // cancelled... so just update the delay stamp.
+ lastTry = System.currentTimeMillis();
+ }
+ } // fi !displayed
+ } // fi time check...
+ }
+
+ Logger.getLogger("payara").log(Level.WARNING, "No authentication set while requesting {0}", this.getRequestingURL()); //NOI18N
+ return null;
+ }
+
+ /** Inner class for JPanel with Username & Password fields */
+ static class PasswordPanel extends javax.swing.JPanel {
+
+ private static final int DEFAULT_WIDTH = 200;
+ private static final int DEFAULT_HEIGHT = 0;
+ /** Generated serialVersionUID */
+ static final long serialVersionUID = 1555749205340031767L;
+ ResourceBundle bundle = org.openide.util.NbBundle.getBundle(AdminAuthenticator.class);
+
+ /** Creates new form PasswordPanel */
+ public PasswordPanel(String userName) {
+ initComponents();
+ usernameField.setText(userName);
+ usernameField.setSelectionStart(0);
+ usernameField.setSelectionEnd(userName.length());
+ usernameField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_UserNameField"));
+ passwordField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_PasswordField"));
+ }
+
+ @Override
+ public java.awt.Dimension getPreferredSize() {
+ java.awt.Dimension sup = super.getPreferredSize();
+ return new java.awt.Dimension(Math.max(sup.width, DEFAULT_WIDTH), Math.max(sup.height, DEFAULT_HEIGHT));
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the FormEditor.
+ */
+ private void initComponents() {
+ setLayout(new java.awt.BorderLayout());
+
+ mainPanel = new javax.swing.JPanel();
+ mainPanel.setLayout(new java.awt.GridBagLayout());
+ java.awt.GridBagConstraints gridBagConstraints1;
+ mainPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 0, 11)));
+
+ promptLabel = new javax.swing.JLabel();
+ promptLabel.setHorizontalAlignment(0);
+
+ gridBagConstraints1 = new java.awt.GridBagConstraints();
+ gridBagConstraints1.gridwidth = 0;
+ gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints1.insets = new java.awt.Insets(0, 0, 6, 0);
+ mainPanel.add(promptLabel, gridBagConstraints1);
+
+ jLabel1 = new javax.swing.JLabel();
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
+ bundle.getString("LAB_AUTH_User_Name")); // NOI18N
+
+ gridBagConstraints1 = new java.awt.GridBagConstraints();
+ gridBagConstraints1.insets = new java.awt.Insets(0, 0, 5, 12);
+ gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
+ mainPanel.add(jLabel1, gridBagConstraints1);
+
+ usernameField = new javax.swing.JTextField();
+ Font f = usernameField.getFont();
+ FontMetrics fm = usernameField.getFontMetrics(f);
+ int unFH = (fm.getHeight()*150)/100;
+ usernameField.setMinimumSize(new java.awt.Dimension(70, unFH));
+ usernameField.setPreferredSize(new java.awt.Dimension(70, unFH));
+ jLabel1.setLabelFor(usernameField);
+
+ gridBagConstraints1 = new java.awt.GridBagConstraints();
+ gridBagConstraints1.gridwidth = 0;
+ gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints1.insets = new java.awt.Insets(0, 0, 5, 0);
+ gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints1.weightx = 1.0;
+ mainPanel.add(usernameField, gridBagConstraints1);
+
+ jLabel2 = new javax.swing.JLabel();
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
+ bundle.getString("LAB_AUTH_Password")); // NOI18N
+
+ gridBagConstraints1 = new java.awt.GridBagConstraints();
+ gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 12);
+ gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
+ mainPanel.add(jLabel2, gridBagConstraints1);
+
+ passwordField = new javax.swing.JPasswordField();
+ passwordField.setMinimumSize(new java.awt.Dimension(70, unFH));
+ passwordField.setPreferredSize(new java.awt.Dimension(70, unFH));
+ jLabel2.setLabelFor(passwordField);
+
+ gridBagConstraints1 = new java.awt.GridBagConstraints();
+ gridBagConstraints1.gridwidth = 0;
+ gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
+ gridBagConstraints1.weightx = 1.0;
+ mainPanel.add(passwordField, gridBagConstraints1);
+
+ add(mainPanel, "Center"); // NOI18N
+
+ }
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel mainPanel;
+ private javax.swing.JLabel promptLabel;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JTextField usernameField;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JPasswordField passwordField;
+ // End of variables declaration//GEN-END:variables
+
+ String getUsername() {
+ return usernameField.getText();
+ }
+
+ char[] getPassword() {
+ return passwordField.getPassword();
+ }
+
+ String getTPassword() {
+ return passwordField.getText();
+ }
+
+ void setPrompt(String prompt) {
+ if (prompt == null) {
+ promptLabel.setVisible(false);
+ getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NbAuthenticatorPasswordPanel"));
+ } else {
+ promptLabel.setVisible(true);
+ promptLabel.setText(prompt);
+ getAccessibleContext().setAccessibleDescription(prompt);
+ }
+ }
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java
new file mode 100644
index 0000000..faf92a2
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/BasicTask.java
@@ -0,0 +1,548 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.OFFLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.ONLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.STARTUP;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+import org.netbeans.modules.payara.common.status.WakeUpStateListener;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.util.NbBundle;
+
+/**
+ * Basic common functionality of commands execution.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public abstract class BasicTask<V> implements Callable<V> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Notification about server state check results while waiting for server
+ * to start.
+ * <p/>
+ * Handles initial period of time after starting server.
+ * At least port checks are being executed periodically so this class will
+ * be called back in any situation.
+ */
+ protected static class StartStateListener extends WakeUpStateListener {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Is server starting in profiling mode? */
+ private final boolean profile;
+
+ /** Payara process being started. */
+ private volatile Process process;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state check results notification.
+ * <p/>
+ * @param profile Server is starting in profiling mode when
+ * <code>true</code>.
+ */
+ protected StartStateListener(final boolean profile) {
+ super();
+ this.profile = profile;
+ this.process = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set Payara process being started.
+ * <p/>
+ * @param process Payara process being started.
+ */
+ void setProcess(final Process process) {
+ this.process = process;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Callback to notify about current server status after every check
+ * when enabled.
+ * <p/>
+ * Wake up startup thread when administrator port is active
+ * in profiling mode or when illegal state was detected.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void currentState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ switch(status) {
+ // Consider server as ready when at least process exists
+ // when running in profiling mode.
+ case OFFLINE: case STARTUP:
+ if (profile && process != null) {
+ wakeUp();
+ }
+ break;
+ // Interrupt waiting for illegal states.
+ case ONLINE: case SHUTDOWN:
+ wakeUp();
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * Notification about server state check results while waiting for server
+ * to shut down.
+ * <p/>
+ * Handles period of time until server shuts down completely.
+ * At least port checks are being executed periodically so this class will
+ * be called back in any situation.
+ */
+ protected static class ShutdownStateListener extends WakeUpStateListener {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state check results notification.
+ */
+ protected ShutdownStateListener() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Callback to notify about current server status after every check
+ * when enabled.
+ * <p/>
+ * Wake up restart thread when server is not in <code>SHUTDOWN</code>
+ * state.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void currentState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ if (status != SHUTDOWN) {
+ wakeUp();
+ }
+ }
+
+ }
+
+ /**
+ * State change request data.
+ */
+ protected static class StateChange {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Command execution task. */
+ private final BasicTask task;
+
+ /** New state of current command execution. */
+ private final TaskState result;
+
+ /** Event that caused state change. */
+ private final TaskEvent event;
+
+ /** Message bundle key. */
+ private final String msgKey;
+
+ /** Message arguments. */
+ private final String[] msgArgs;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state change request data.
+ * <p/>
+ * @param task Command execution task.
+ * @param result New state of current command execution.
+ * @param event Event that caused state change.
+ * @param msgKey Message bundle key.
+ */
+ protected StateChange(final BasicTask task, final TaskState result,
+ final TaskEvent event, final String msgKey) {
+ this.task = task;
+ this.result = result;
+ this.event = event;
+ this.msgKey = msgKey;
+ this.msgArgs = null;
+ }
+
+ /**
+ * Constructs an instance of state change request data.
+ * <p/>
+ * @param task Command execution task.
+ * @param result New state of current command execution.
+ * @param event Event that caused state change.
+ * @param msgKey Message bundle key.
+ * @param msgArgs Message arguments.
+ */
+ protected StateChange(final BasicTask task, final TaskState result,
+ final TaskEvent event, final String msgKey,
+ final String... msgArgs) {
+ this.task = task;
+ this.result = result;
+ this.event = event;
+ this.msgKey = msgKey;
+ this.msgArgs = msgArgs;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Call all registered callback listeners to inform about state change.
+ * <p/>
+ * @return Passed new state of current command.
+ */
+ protected TaskState fireOperationStateChanged() {
+ return task.fireOperationStateChanged(
+ result, event, msgKey, msgArgs);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER = PayaraLogger.get(BasicTask.class);
+
+ /** Wait duration (ms) between server status checks. */
+ public static final int DELAY = 250;
+
+ /** Maximum amount of time (in ms) to wait for server to start. */
+ public static final int START_TIMEOUT = 300000;
+
+ /** Maximum amount of time (in ms) to wait for server to stop. */
+ public static final int STOP_TIMEOUT = 180000;
+
+ /** Maximum amount of time (in ms) to wait for server to open debug port
+ * during startup. */
+ public static final int START_ADMIN_PORT_TIMEOUT = 120000;
+
+ /** Delay why waiting server to shut down (in ms). */
+ public static final int RESTART_DELAY = 5000;
+
+ /** Port check idle (in ms). */
+ public static final int PORT_CHECK_IDLE = 500;
+
+ /** Unit (ms) for the DELAY and START_TIMEOUT constants. */
+ public static final TimeUnit TIMEUNIT = TimeUnit.MILLISECONDS;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara instance accessed in this task. */
+ PayaraInstance instance;
+
+ /** Callback to retrieve state changes. */
+ protected TaskStateListener [] stateListener;
+
+ /** Name of Payara instance accessed in this task. */
+ protected String instanceName;
+
+ /** Task thread when inside <code>call</code> method. */
+ protected volatile Thread taskThread;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Command execution is implemented as <code>call()</code> method in child
+ * classes.
+ * <p/>
+ * @return Command execution result.
+ */
+ @Override
+ public abstract V call();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>BasicTask</code> class.
+ * <p/>
+ * @param instance Payara instance accessed in this task.
+ * @param stateListener Callback listeners used to retrieve state changes.
+ */
+ protected BasicTask(PayaraInstance instance,
+ TaskStateListener... stateListener) {
+ this.instance = instance;
+ this.stateListener = stateListener;
+ this.instanceName = instance.getProperty(PayaraModule.DISPLAY_NAME_ATTR);
+ this.taskThread = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize task thread when <code>call</code> method is started.
+ * <p/>
+ * This should be called immediately after <code>call</code> method
+ * is started from inside.
+ */
+ protected void setTaskThread() {
+ taskThread = Thread.currentThread();
+ }
+
+ /**
+ * Clear task thread when <code>call</code> method is exiting.
+ * <p/>
+ * This should be called when <code>call</code> method
+ * is exiting.
+ */
+ protected void clearTaskThread() {
+ taskThread = null;
+ }
+
+ /**
+ * Initialize GlassFisg server startup monitoring.
+ * <p/>
+ * Creates and registers listener to monitor server status during startup.
+ * Switches server status monitoring into startup mode.
+ * <p/>
+ * @param profile Server is starting in profiling mode when
+ * <code>true</code>.
+ * @return Listener instance when server startup monitoring was successfully
+ * initialized or <code>null</code> when something failed.
+ */
+ protected StartStateListener prepareStartMonitoring(final boolean profile) {
+ StartStateListener listener = new StartStateListener(profile);
+ if (PayaraStatus.start(instance, false, listener,
+ PayaraStatus.ONLINE, PayaraStatus.SHUTDOWN)) {
+ PayaraStatus.addCheckListener(instance, listener);
+ return listener;
+ } else {
+ PayaraStatus.removeListener(instance, listener);
+ return null;
+ }
+ }
+
+ /**
+ * Force initialization of GlassFisg server startup monitoring.
+ * <p/>
+ * Creates and registers listener to monitor server status during startup.
+ * Switches server status monitoring into startup mode.
+ * <p/>
+ * @param profile Server is starting in profiling mode when
+ * <code>true</code>.
+ * @return Listener instance when server startup monitoring was successfully
+ * initialized or <code>null</code> when something failed.
+ */
+ protected StartStateListener forceStartMonitoring(final boolean profile) {
+ StartStateListener listener = new StartStateListener(profile);
+ if (PayaraStatus.start(instance, true, listener,
+ PayaraStatus.OFFLINE, PayaraStatus.ONLINE,
+ PayaraStatus.SHUTDOWN, PayaraStatus.UNKNOWN)) {
+ PayaraStatus.addCheckListener(instance, listener);
+ return listener;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Initialize GlassFisg server startup monitoring.
+ * <p/>
+ * Creates and registers listener to monitor server status during shutdown.
+ * <p/>
+ * @return Listener instance when server startup monitoring was successfully
+ * initialized or <code>null</code> when something failed.
+ */
+ protected ShutdownStateListener prepareShutdownMonitoring() {
+ ShutdownStateListener listener
+ = new ShutdownStateListener();
+ if (PayaraStatus.addListener(instance, listener, true,
+ PayaraStatus.OFFLINE)) {
+ return listener;
+ } else {
+ PayaraStatus.removeListener(instance, listener);
+ return null;
+ }
+ }
+
+ /**
+ * Wait for server to start up.
+ * <p/>
+ * Wait until server starts.
+ * <p/>
+ * @param force Force server startup mode.
+ * @param profile Server is starting in profiling mode when
+ * <code>true</code>.
+ * @return {@see StateChange} request on failure or null on success.
+ */
+ protected StateChange waitStartUp(final boolean force,
+ final boolean profile) {
+ StartStateListener listener = force
+ ? forceStartMonitoring(profile)
+ : prepareStartMonitoring(profile);
+ if (listener == null) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "BasicTask.waitShutDown.listenerError",
+ instanceName);
+ }
+ long start = System.currentTimeMillis();
+ LOGGER.log(Level.FINEST, NbBundle.getMessage(RestartTask.class,
+ "BasicTask.waitShutDown.waitingTime",
+ new Object[] {instanceName, Integer.toString(START_TIMEOUT)}));
+ try {
+ synchronized(listener) {
+ while (!listener.isWakeUp()
+ && (System.currentTimeMillis()
+ - start < START_TIMEOUT)) {
+ listener.wait(System.currentTimeMillis() - start);
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, NbBundle.getMessage(RestartTask.class,
+ "BasicTask.waitShutDown.interruptedException",
+ new Object[] {
+ instance.getName(), ie.getLocalizedMessage()}));
+
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+ if (!listener.isWakeUp()) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "BasicTask.waitShutDown.timeout", new String[]
+ {instanceName, Integer.toString(STOP_TIMEOUT)});
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Wait for server to shut down.
+ * <p/>
+ * Wait until server stops. Stop server log readers.
+ * <p/>
+ * @return {@see StateChange} request on failure or null on success.
+ */
+ protected StateChange waitShutDown() {
+ ShutdownStateListener listener = prepareShutdownMonitoring();
+ if (listener == null) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "BasicTask.waitShutDown.listenerError",
+ instanceName);
+ }
+ long start = System.currentTimeMillis();
+ LOGGER.log(Level.FINEST, NbBundle.getMessage(RestartTask.class,
+ "BasicTask.waitShutDown.waitingTime",
+ new Object[] {instanceName, Integer.toString(STOP_TIMEOUT)}));
+ try {
+ synchronized(listener) {
+ while (!listener.isWakeUp()
+ && (System.currentTimeMillis()
+ - start < STOP_TIMEOUT)) {
+ listener.wait(System.currentTimeMillis() - start);
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, NbBundle.getMessage(RestartTask.class,
+ "BasicTask.waitShutDown.interruptedException",
+ new Object[] {
+ instance.getName(), ie.getLocalizedMessage()}));
+
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+ LogViewMgr.removeLog(instance);
+ LogViewMgr logger = LogViewMgr.getInstance(instance.getProperty(PayaraModule.URL_ATTR));
+ logger.stopReaders();
+ if (!listener.isWakeUp()) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "BasicTask.waitShutDown.timeout", new String[]
+ {instanceName, Integer.toString(STOP_TIMEOUT)});
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Call all registered callback listeners to inform about state change.
+ * <p/>
+ * @param stateType New state of current command execution sent
+ * to listeners. This value will be returned by this method.
+ * @param resName Name of the resource to look for message.
+ * @param args Additional arguments passed to message.
+ * @return Passed new state of current command.
+ */
+ protected final TaskState fireOperationStateChanged(
+ TaskState stateType, TaskEvent te, String resName, String... args) {
+ if(stateListener != null && stateListener.length > 0) {
+ String msg = NbBundle.getMessage(BasicTask.class, resName, args);
+ for(int i = 0; i < stateListener.length; i++) {
+ if(stateListener[i] != null) {
+ stateListener[i].operationStateChanged(stateType, te, msg);
+ }
+ }
+ }
+ return stateType;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/Bundle.properties
new file mode 100644
index 0000000..cf6d569
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/Bundle.properties
@@ -0,0 +1,274 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+OpenIDE-Module-Display-Category=Libraries
+
+OpenIDE-Module-Long-Description=Common support and administration module \
+for servers based on the Payara codebase.
+
+OpenIDE-Module-Name=Payara Common
+
+OpenIDE-Module-Short-Description=Shared support module for integrating servers \
+based on the Payara codebase.
+
+# Error messages
+MSG_NullServerFolder=Attempt to save a server instance with null home folder
+
+MSG_START_SERVER_FAILED_NOJDK={0} Server can't start. No suitable Java SE JDK \
+was found.
+MSG_START_SERVER_FAILED_NOHOST={0} Server can't start. Host name is blank.
+MSG_START_SERVER_FAILED_BADPORT={0} Server can't start. Port is invalid.
+MSG_START_SERVER_FAILED_FNF={0} Server can't start. The start jar was not found.
+
+MSG_START_SERVER_FAILED_DOMAIN_FNF=Server can not start. The domain.xml file \
+is missing or corrupt.
+
+MSG_START_SERVER_FAILED_PD={0} Server start failed. Can't create start process.
+
+MSG_START_SERVER_NOT_INITIALIZED= {0} Server is not initialized.
+MSG_START_SERVER_IN_PROGRESS=Starting {0}
+MSG_SERVER_STARTED={0} is running.
+
+MSG_START_SERVER_FAILED2=Could not connect to admin listener for {0}.\n\
+Verify that NetBeans can make outbound connections to {1}:{2}
+
+MSG_START_SERVER_DASDOWN={0} can't start because the Domain Admin Server \
+is down.
+
+MSG_START_TARGET_FAILED={0} did not start. {1} would not start.
+
+MSG_STOP_SERVER_FAILED_FNF={0} Server cannot stop.
+MSG_STOP_SERVER_FAILED_PD={0} Server stop failed. Can't create stop process.
+MSG_STOP_SERVER_IN_PROGRESS=Server {0} is stopping
+MSG_SERVER_STOPPED={0} was stopped.
+MSG_SERVER_PROFILING_STOPPED={0} Profiling stopped.
+MSG_STOP_SERVER_FAILED={0} Stop Failed
+MSG_STOP_TARGET_FAILED={0} stop failed. Cannot stop {1}.
+
+MSG_RESTART_SERVER_IN_PROGRESS=Restarting {0}
+MSG_RESTART_SERVER_FAILED_WONT_START={0} Server failed to start.
+MSG_RESTART_SERVER_FAILED_WONT_STOP={0} Server failed to stop.
+MSG_RESTART_SERVER_FAILED_REASON_UNKNOWN={0} Server failed to start \
+for unknown reason.
+
+MSG_SERVER_RESTARTED={0} has been restarted.
+
+MSG_ServerCmdException={0} failed on {1} : {2}
+MSG_ServerCmdRunning={0} running on {1}
+MSG_ServerCmdCompleted={0} completed on {1}
+MSG_ServerCmdFailed={0} failed on {1} \n {2}
+
+MSG_ServerCmdFailedIncorrectInstance={0} failed. Instance is not {1} \
+or it is not running.
+
+MSG_AuthorizationFailed=Authorization failed for {0} on {1}. Bad password?
+
+MSG_AuthorizationFailedRemote=Authorization failed for {0} on {1}. \
+Have you run the enable-secure-admin command?
+
+MSG_Exception={0}
+
+# SimpleIO Output window cancel action
+CTL_Cancel=Cancel
+LBL_CancelDesc=Terminate this job.
+
+MSG_QueryCancel=This will forcibly kill this process. \
+Are you sure you want to do this?
+
+DEFAULT_PRELUDE_DOMAIN_NAME=Payara Prelude
+PERSONAL_PRELUDE_DOMAIN_NAME=Personal Payara Prelude
+LBL_Creating_personal_domain=Creating personal domain
+LBL_outputtab=Output
+LBL_RunningCreateDomainCommand=Running the create-domain subcommand
+ERR_Failed_cleanup=Failed to cleanup cancelled domain creation
+
+MSG_delete_password_file=Failed to delete temporary password file: {0}
+
+# This message is used to tell a user that the server process has been started
+# in a particular Locale and should remain as technical as possible.
+MSG_LocaleSwitched=<html>Server cannot operate in current Locale. Locale \
+switched to en_US for the processs.</html>
+
+STR_SERVER_NAME=Payara Server {0}
+STR_PRELUDE_SERVER_NAME=Payara Prelude
+STR_PRELUDE_AUTO_REGISTERED_NAME=Payara Prelude Domain
+STR_PRELUDE_AUTO_CREATED_NAME=Personal Payara Prelude Domain
+MSG_FAILED_TO_UPDATE=Failed to update: {0}
+nothingToList=Nothing to list.
+
+MSG_START_SERVER_FAILED_INVALIDPORT=<html>{0} Server cannot start in \
+debug mode on port {1}</html>
+
+MSG_PASS_THROUGH={0}
+MSG_INVALID_JAVA=<html>{0} Server cannot be started with {1}</html>
+
+MSG_see_successful_results=<html>Domain creation successful.<br/><br/>View \
+the results?</html>
+
+MSG_see_failure_results=<html>Domain creation failed.<br/><br/>Do you want \
+to see the detail?</html>
+
+CTL_PasswordProtected=Password Protected
+ACSD_UserNameField=Username:
+ACSD_PasswordField=Password:
+LAB_AUTH_User_Name=&Username:
+LAB_AUTH_Password=&Password:
+ACSD_NbAuthenticatorPasswordPanel=Password panel
+PROMPT_PAYARA_AUTH=Admin Credentials for Payara Server @ {0}:{1}
+
+MSG_NOOP=NoOp
+
+WARN_UNREADABLE_LOG_STREAM=Failed to connect to log for instance {0}
+
+# ServerDetails.java
+STR_41144_SERVER_NAME=Payara Server 4.1.144
+STR_41151_SERVER_NAME=Payara Server 4.1.151
+STR_41152_SERVER_NAME=Payara Server 4.1.152
+STR_41153_SERVER_NAME=Payara Server 4.1.153
+STR_411154_SERVER_NAME=Payara Server 4.1.1.154
+STR_411161_SERVER_NAME=Payara Server 4.1.1.161
+STR_411162_SERVER_NAME=Payara Server 4.1.1.162
+STR_411163_SERVER_NAME=Payara Server 4.1.1.163
+STR_411164_SERVER_NAME=Payara Server 4.1.1.164
+STR_411171_SERVER_NAME=Payara Server 4.1.1.171
+STR_412172_SERVER_NAME=Payara Server 4.1.2.172
+STR_412173_SERVER_NAME=Payara Server 4.1.2.173
+STR_412174_SERVER_NAME=Payara Server 4.1.2.174
+STR_412181_SERVER_NAME=Payara Server 4.1.2.181
+STR_5181_SERVER_NAME=Payara Server 5.181
+STR_5182_SERVER_NAME=Payara Server 5.182
+STR_5183_SERVER_NAME=Payara Server 5.183
+STR_5184_SERVER_NAME=Payara Server 5.184
+STR_5191_SERVER_NAME=Payara Server 5.191
+STR_5192_SERVER_NAME=Payara Server 5.192
+
+# CommonServerSupport.java
+MSG_FLAKEY_NETWORK=<html>Network communication problem<br/>Could not establish \
+a reliable connection with<br/> \
+{0}:{1}<br/>\Error message:<br/> {2}
+
+MSG_FLAKEY_NETWORK2=<html>Network communication problem<br/>Could not \
+establish a reliable connection with<br/> \
+{3} ({0}:{1})<br/>Error message:<br/> {2}
+
+MSG_COMMAND_SSL_ERROR=Administration command {0} timed out on {1} while \
+port {2} is alive. Have you run the enable-secure-admin command?
+
+MSG_EmptyMessage=
+MSG_ADMIN_FAILED={0} admin command {1} failed
+MSG_ADMIN_EXCEPTION={0} admin command {1} failed: {2}
+MSG_ADMIN_AUTH_FAILED={0} admin command {1} authorization failed
+
+PayaraInstance.getDomainsFolder.versionIsNull=Value of server {0} version \
+shall not be null
+
+# BasicTask class messages
+BasicTask.waitShutDown.listenerError=Could not stop server {0}: \
+Could not initialize server state listener
+BasicTask.waitShutDown.waitingTime=Waiting for server {0} to stop for \
+{1} ms
+BasicTask.waitShutDown.interruptedException=Caught \
+InterruptedException while waiting for {0} to stop: {1}
+BasicTask.waitShutDown.timeout=Server {0} did not stop in {1} ms
+BasicTask.waitStartUp.listenerError=Could not wait for server {0} \
+to start: Could not initialize server state listener
+BasicTask.waitStartUp.waitingTime=Waiting for server {0} to start for \
+{1} ms
+BasicTask.waitStartUp.interruptedException=Caught \
+InterruptedException while waiting for {0} to start: {1}
+BasicTask.waitStartUp.timeout=Server {0} did not start in {1} ms
+
+# PayaraInstance class messages
+PayaraInstance.init.versionNull=Unable to retrieve version of Payara \
+server instance {0} installed in {1}. Opening window with warning.
+
+# PayaraJvmMode class exceptions
+PayaraJvmMode.toString.invalid=Invalid PayaraJvmMode value.
+
+# PayaraState class exceptions
+PayaraState.getStatus.statusNull=Payara status monitoring returned null \
+for monitored server.
+
+# KillTask class messages
+KillTask.call.noProcess=Server {0} process is not known.
+KillTask.call.finished=Server {0} process is already finished.
+KillTask.call.running=Server {0} is being terminated.
+KillTask.kill.completed=Server {0} was terminated.
+
+# RestartTask class messages
+RestartTask.call.unknownState=Could not restart server {0}: Server state \
+is unknown.
+RestartTask.remoteOfflineStart.failed=Could not restart server {0}: Remote \
+server is offline
+RestartTask.localOfflineStart.failed=Could not restart server {0}: Local \
+server start failed
+RestartTask.localOfflineStart.completed=Server {0} has been restarted
+RestartTask.remoteShutdownStart.failed=Could not restart server {0}: Remote \
+server is shutting down
+RestartTask.localShutdownStart.notOffline=Could not restart server {0}: Server \
+did not shut down
+RestartTask.localShutdownStart.portOccupied=Could not restart server {0}: \
+Administrator port is occupied after shutdown
+RestartTask.startupWait.listenerError=Could not restart server {0}: \
+Could not initialize server state listener
+RestartTask.startupWait.interruptedException=Caught \
+InterruptedException while waiting for {0} to start: {1}
+RestartTask.startupWait.completed=Server {0} has been restarted
+RestartTask.startupWait.failed=Could not restart server {0}: Server \
+did not start up
+RestartTask.localRestart.cmdFailed=Could not restart server {0}: Asadmin \
+stop-domain command failed
+RestartTask.localRestart.failed=Could not restart server {0}: Unable to switch \
+server monitoring into shutdown mode
+RestartTask.remoteRestart.completed=Server {0} has been restarted
+RestartTask.remoteRestart.failed=Could not restart server {0}: Remote \
+server restart failed: {1}
+
+# StartTask class messages
+StartTask.call.unknownVersion=Could not start {0}: Administrator port \
+is occupied but not responding
+StartTask.call.matchVersion={0} is already running and responding on \
+administrator port
+StartTask.call.anotherVersion=Could not start {0}: Administrator port \
+is occupied by {1}
+StartTask.call.authFailed=Could not start {0}: Authorization failed for \
+another server running on administrator port
+StartTask.restartDAS.inProgress=Starting {0}
+StartTask.startDAS.alreadyRunning=Could not start {0}: Server is already \
+running
+StartTask.startDAS.adminPortOccupied=Could not start {0}: DAS port \
+is occupied while server is not running
+StartTask.startDAS.httpPortOccupied=Could not start {0}: HTTP or HTTPS \
+listener port is occupied while server is not running
+StartTask.startDAS.shutdown=Could not start {0}: Server is currently \
+shutting down
+StartTask.startDAS.startup=Could not start {0}: Server is already \
+starting up
+StartTask.startDAS.inProgress=Starting {0}
+StartTask.startDAS.startFailed=<html>{0} start failed<br/>\
+Please check server admin user name and password properties.<br/>\
+Also please check the server log file for other possible causes.</html>
+StartTask.startDAS.domainUpgrade=<html>Automated domain upgrade failed.<br/>\
+<br/>Use <strong>asadmin start-domain --upgrade</strong> to complete the \
+required upgrade.</html>
+StartTask.startDAS.startupMonitoring=Initialization of {0} startup monitoring \
+failed.
+StartTask.initJDK.null=Could not find Java SE Development Kit to start {0}
+StartTask.initJDK.exception=Could not initialize Java SE Development Kit \
+to start {0}: {1}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/CommonServerSupport.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/CommonServerSupport.java
new file mode 100644
index 0000000..5aa9748
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/CommonServerSupport.java
@@ -0,0 +1,1254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.tooling.admin.CommandRedeploy;
+import org.netbeans.modules.payara.tooling.admin.CommandRestartDAS;
+import org.netbeans.modules.payara.tooling.admin.CommandUndeploy;
+import org.netbeans.modules.payara.tooling.admin.CommandDeploy;
+import org.netbeans.modules.payara.tooling.admin.CommandDisable;
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.CommandEnable;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.CommandListComponents;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.OFFLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.STARTUP;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.AppDesc;
+import org.netbeans.modules.payara.spi.CommandFactory;
+import static org.netbeans.modules.payara.spi.PayaraModule.HOSTNAME_ATTR;
+import static org.netbeans.modules.payara.spi.PayaraModule.PROPERTIES_FETCH_TIMEOUT;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.netbeans.modules.payara.spi.Recognizer;
+import org.netbeans.modules.payara.spi.RecognizerCookie;
+import org.netbeans.modules.payara.spi.ResourceDesc;
+import org.netbeans.modules.payara.spi.VMIntrospector;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.ChangeSupport;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.lookup.Lookups;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule3;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Payara server support API.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public class CommonServerSupport
+ implements PayaraModule3, RefreshModulesCookie {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Task state listener watching __locations command execution.
+ */
+ private static class LocationsTaskStateListener
+ implements TaskStateListener {
+
+ /** Payara server support object instance. */
+ final CommonServerSupport css;
+
+ /**
+ * Creates an instance of task state listener watching __locations
+ * command execution.
+ * <p/>
+ * @param css Payara server support object instance.
+ */
+ LocationsTaskStateListener(CommonServerSupport css) {
+ this.css = css;
+ }
+
+ private String adminCommandFailedMsg(String resName, String[] args) {
+ String serverName = args[0];
+ String command = args[1];
+ String exMessage = args.length > 2 ? args[2] : null;
+ return args.length > 2
+ ? NbBundle.getMessage(CommonServerSupport.class, resName,
+ args[0], args[1], args[2])
+ : NbBundle.getMessage(CommonServerSupport.class, resName,
+ args[0], args[1]);
+ }
+
+ /**
+ * Callback to notify about Payara __locations command execution
+ * state change.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener
+ * from runner:<ul>
+ * <li><code>args[0]</code> server name</li>
+ * <li><code>args[1]</code> administration command</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <li><code>args[3]</code> display message in GUI</li></ul>
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args <code>String</codce> arguments passed to state
+ * listener.
+ */
+ @Override
+ public void operationStateChanged(
+ TaskState newState, TaskEvent event,
+ String[] args) {
+ // Server name and command are mandatory.
+ if (args.length > 1) {
+ String exMessage = args.length > 2 ? args[2] : null;
+ boolean display = args.length > 3
+ ? Boolean.parseBoolean(args[3]) : false;
+ if (display) {
+ long lastDisplayed = css.getLatestWarningDisplayTime();
+ long currentTime = System.currentTimeMillis();
+ if (TaskState.FAILED == newState
+ && currentTime - lastDisplayed > 5000) {
+ String message;
+
+ switch (event) {
+ case EXCEPTION:
+ if (exMessage != null
+ && exMessage.length() > 0) {
+ message = adminCommandFailedMsg(
+ "MSG_ADMIN_EXCEPTION", args);
+ } else {
+ message = adminCommandFailedMsg(
+ "MSG_ADMIN_FAILED", args);
+ }
+ break;
+ case AUTH_FAILED: case AUTH_FAILED_HTTP:
+ message = adminCommandFailedMsg(
+ "MSG_ADMIN_AUTH_FAILED", args);
+ break;
+ default:
+ message = adminCommandFailedMsg(
+ "MSG_ADMIN_FAILED", args);
+ }
+ displayPopUpMessage(css, message);
+ }
+ }
+ }
+ }
+ }
+
+ class StartOperationStateListener implements TaskStateListener {
+ private ServerState endState;
+
+ StartOperationStateListener(ServerState endState) {
+ this.endState = endState;
+ }
+
+ @Override
+ public void operationStateChanged(TaskState newState, TaskEvent event,
+ String... args) {
+ if(newState == TaskState.RUNNING) {
+ setServerState(ServerState.STARTING);
+ } else if(newState == TaskState.COMPLETED) {
+ startedByIde = isRemote
+ ? false : PayaraState.isOnline(instance);
+ setServerState(endState);
+ } else if(newState == TaskState.FAILED) {
+ setServerState(ServerState.STOPPED);
+ // Open a warning dialog here...
+ NotifyDescriptor nd = new NotifyDescriptor.Message(Utils.concatenate(args));
+ DialogDisplayer.getDefault().notifyLater(nd);
+ }
+ }
+ }
+ class StopOperationStateListener implements TaskStateListener {
+
+ @Override
+ public void operationStateChanged(
+ TaskState newState, TaskEvent event, String... args) {
+ if (newState == TaskState.RUNNING) {
+ setServerState(ServerState.STOPPING);
+ } else if (newState == TaskState.COMPLETED) {
+ setServerState(ServerState.STOPPED);
+ } else if (newState == TaskState.FAILED) {
+ // Possible bug: What if server was started in other mode
+ // than RUNNING.
+ setServerState(ServerState.RUNNING);
+ }
+ }
+ };
+
+ class KillOperationStateListener implements TaskStateListener {
+
+ @Override
+ public void operationStateChanged(final TaskState newState,
+ final TaskEvent event, final String... args) {
+ if (newState == TaskState.RUNNING) {
+ setServerState(ServerState.STOPPING);
+ } else if (newState == TaskState.COMPLETED) {
+ setServerState(ServerState.STOPPED);
+ } else if (newState == TaskState.FAILED) {
+ // Registered process has already finished.
+ if (event == TaskEvent.PROCESS_NOT_RUNNING) {
+ setServerState(ServerState.STOPPED);
+ }
+ // Otherwise do nothing for TaskEvent.PROCESS_NOT_EXISTS.
+ }
+ }
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(CommonServerSupport.class);
+
+ /** Local host name (DNS). */
+ private static final String LOCALHOST = "localhost";
+
+ /** String to return for failed {@see getHttpHostFromServer()} search. */
+ private static final String FAILED_HTTP_HOST = LOCALHOST + "FAIL";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Display pop up window with given message.
+ * <p/>
+ * Method is thread safe.
+ * <p/>
+ * @param css Payara server support object.
+ * @param message Message to be displayed.
+ */
+ public static void displayPopUpMessage(final CommonServerSupport css,
+ final String message) {
+ synchronized (css) {
+ NotifyDescriptor nd = new NotifyDescriptor.Message(message);
+ DialogDisplayer.getDefault().notifyLater(nd);
+ css.setLatestWarningDisplayTime(System.currentTimeMillis());
+ LOGGER.log(Level.INFO, message);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Managed Payara instance. */
+ private final PayaraInstance instance;
+
+ private volatile ServerState serverState = ServerState.UNKNOWN;
+ private final Object stateMonitor = new Object();
+
+ private ChangeSupport changeSupport = new ChangeSupport(this);
+
+ private FileObject instanceFO;
+
+ private volatile boolean startedByIde = false;
+
+ /** Cache local/remote test for instance. */
+ private transient boolean isRemote = false;
+
+ // prevent j2eeserver from stopping an authenticated domain that
+ // the IDE did not start.
+ private boolean stopDisabled = false;
+
+ private Process localStartProcess;
+
+ /** Last executed start task. */
+ private volatile FutureTask<TaskState> startTask;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ CommonServerSupport(PayaraInstance instance) {
+ this.instance = instance;
+ this.isRemote = instance.isRemote();
+ // !PW FIXME temporary patch for JavaONE 2008 to make it easier
+ // to persist per-instance property changes made by the user.
+ instanceFO = getInstanceFileObject();
+ startTask = null;
+ }
+
+ /**
+ * Get <code>PayaraInstance</code> object associated with this object.
+ * <p/>
+ * @return <code>PayaraInstance</code> object associated with this object.
+ */
+ @Override
+ public PayaraInstance getInstance() {
+ return this.instance;
+ }
+
+ private FileObject getInstanceFileObject() {
+ FileObject dir = FileUtil.getConfigFile(
+ instance.getInstanceProvider().getInstancesDirFirstName());
+ if(dir != null) {
+ String instanceFN = instance
+ .getProperty(PayaraInstance.INSTANCE_FO_ATTR);
+ if(instanceFN != null) {
+ return dir.getFileObject(instanceFN);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getPassword() {
+ return instance.getPassword();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getInstallRoot() {
+ return instance.getInstallRoot();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getPayaraRoot() {
+ return instance.getPayaraRoot();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getDisplayName() {
+ return instance.getDisplayName();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getDeployerUri() {
+ return instance.getDeployerUri();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getUserName() {
+ return instance.getUserName();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getAdminPort() {
+ return instance.getHttpAdminPort();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getHttpPort() {
+ return instance.getHttpPort();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public int getHttpPortNumber() {
+ return instance.getPort();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public int getAdminPortNumber() {
+ return instance.getAdminPort();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getHostName() {
+ return instance.getProperty(HOSTNAME_ATTR);
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getDomainsRoot() {
+ return instance.getDomainsRoot();
+ }
+
+ /** @deprecated Use in <code>PayaraInstance</code> context. */
+ @Deprecated
+ public String getDomainName() {
+ return instance.getDomainName();
+ }
+
+ public void setServerState(final ServerState newState) {
+ // Synchronized on private monitor to serialize changes in state.
+ // Storage of serverState is volatile to facilitate readability of
+ // current state regardless of lock status.
+ boolean fireChange = false;
+
+ synchronized (stateMonitor) {
+ if(serverState != newState) {
+ serverState = newState;
+ fireChange = true;
+ }
+ }
+
+ if(fireChange) {
+ changeSupport.fireChange();
+ }
+ }
+
+ boolean isStartedByIde() {
+ return startedByIde;
+ }
+
+ // ------------------------------------------------------------------------
+ // PayaraModule interface implementation
+ // ------------------------------------------------------------------------
+ @Override
+ public Map<String, String> getInstanceProperties() {
+ // force the domains conversion
+ getDomainsRoot();
+ return Collections.unmodifiableMap(instance.getProperties());
+ }
+
+ @Override
+ public PayaraInstanceProvider getInstanceProvider() {
+ return instance.getInstanceProvider();
+ }
+
+ @Override
+ public boolean isRemote() {
+ return isRemote;
+ }
+
+ private static final RequestProcessor RP = new RequestProcessor("CommonServerSupport - start/stop/refresh",5); // NOI18N
+
+ @Override
+ public Future<TaskState> startServer(
+ final TaskStateListener stateListener, ServerState endState) {
+ LOGGER.log(Level.FINEST,
+ "CSS.startServer called on thread \"{0}\"",
+ Thread.currentThread().getName());
+ TaskStateListener startServerListener = new StartOperationStateListener(endState);
+ VMIntrospector vmi = Lookups.forPath(Util.PF_LOOKUP_PATH).lookup(VMIntrospector.class);
+ FutureTask<TaskState> task = new FutureTask<TaskState>(
+ new StartTask(this, getRecognizers(), vmi,
+ (String[]) (endState == ServerState.STOPPED_JVM_PROFILER
+ ? new String[]{""} : null),
+ startServerListener, stateListener));
+ startTask = task;
+ RP.post(task);
+ return task;
+ }
+
+ private List<Recognizer> getRecognizers() {
+ List<Recognizer> recognizers;
+ Collection<? extends RecognizerCookie> cookies =
+ instance.localLookup().lookupAll(RecognizerCookie.class);
+ if(!cookies.isEmpty()) {
+ recognizers = new LinkedList<Recognizer>();
+ for(RecognizerCookie cookie: cookies) {
+ recognizers.addAll(cookie.getRecognizers());
+ }
+ recognizers = Collections.unmodifiableList(recognizers);
+ } else {
+ recognizers = Collections.emptyList();
+ }
+ return recognizers;
+ }
+
+
+ @Override
+ public Future<TaskState> stopServer(final TaskStateListener stateListener) {
+ LOGGER.log(Level.FINEST, "CSS.stopServer called on thread \"{0}\"", Thread.currentThread().getName()); // NOI18N
+ TaskStateListener stopServerListener = new StopOperationStateListener();
+ FutureTask<TaskState> task;
+ if (!isRemote() || !Util.isDefaultOrServerTarget(instance.getProperties())) {
+ if (getServerState() == ServerState.STOPPED_JVM_PROFILER) {
+ task = new FutureTask<TaskState>(
+ new StopProfilingTask(this, stateListener));
+ } else {
+ task = new FutureTask<TaskState>(
+ new StopTask(this, stopServerListener, stateListener));
+ }
+ // prevent j2eeserver from stopping a server it did not start.
+ } else {
+ task = new FutureTask<TaskState>(
+ new NoopTask(this,stopServerListener,stateListener));
+ }
+ if (stopDisabled) {
+ stopServerListener.operationStateChanged(
+ TaskState.COMPLETED, TaskEvent.CMD_COMPLETED, "");
+ if (null != stateListener) {
+ stateListener.operationStateChanged(
+ TaskState.COMPLETED, TaskEvent.CMD_COMPLETED, "");
+ }
+ return task;
+ }
+ RP.post(task);
+ return task;
+ }
+
+ /** Delay between checking task state while waiting it
+ * to die [ms]. */
+ private static final int WAIT_TASK_TO_DIE_SLEEP = 300;
+
+ /** Maximum time to wait for task to die [ms]. */
+ private static final int WAIT_TASK_TO_DIE_MAX = 3000;
+
+ /**
+ * Terminates local Payara server process when started from UI.
+ * <p/>
+ * @param stateListener External state listener to register.
+ * @return Asynchronous Payara server termination task when
+ */
+ @Override
+ @SuppressWarnings("SleepWhileInLoop")
+ public Future<TaskState> killServer(final TaskStateListener stateListener) {
+ TaskStateListener killServerListener = new KillOperationStateListener();
+ FutureTask<TaskState> task;
+ boolean isStateListener = stateListener != null;
+ if (!isRemote() && instance.getProcess() != null) {
+ FutureTask<TaskState> stTask = this.startTask;
+ // Stop running StartTask and wait for it to die.
+ if (stTask != null && !stTask.isDone()) {
+ stTask.cancel(true);
+ long startTime = System.currentTimeMillis();
+ while(!stTask.isDone()
+ && System.currentTimeMillis() - startTime
+ < WAIT_TASK_TO_DIE_MAX) {
+ try {
+ Thread.sleep(WAIT_TASK_TO_DIE_SLEEP);
+ } catch (InterruptedException ex) {
+ LOGGER.log(Level.INFO,
+ "Caught InterruptedException while waiting for "
+ + "{0} start task to die.",
+ instance.getName());
+ }
+ }
+ if (!stTask.isDone()) {
+ LOGGER.log(Level.INFO,
+ "Start task for {0} did not finish within {1} ms.",
+ new String[] {instance.getName(),
+ Integer.toString(WAIT_TASK_TO_DIE_MAX)});
+
+ }
+ }
+ TaskStateListener[] listeners
+ = new TaskStateListener[isStateListener ? 2 : 1];
+ listeners[0] = killServerListener;
+ if (isStateListener) {
+ listeners[1] = stateListener;
+ }
+ task = new FutureTask<TaskState>(new KillTask(instance, listeners));
+ } else {
+ task = new FutureTask<TaskState>(
+ new NoopTask(this, null, stateListener));
+ }
+ RP.post(task);
+ return task;
+ }
+
+ @Override
+ public Future<TaskState> restartServer(TaskStateListener stateListener) {
+ LOGGER.log(Level.FINEST,
+ "CSS.restartServer called on thread \"{0}\"",
+ Thread.currentThread().getName());
+ FutureTask<TaskState> task = new FutureTask<TaskState>(
+ new RestartTask(this, stateListener));
+ RP.post(task);
+ return task;
+ }
+
+ /**
+ * Sends restart-domain command to server (asynchronous)
+ *
+ */
+ public Future<ResultString> restartServer(final int debugPort,
+ boolean debug, TaskStateListener[] listeners) {
+ if (-1 == debugPort) {
+ Command command = new CommandRestartDAS(false);
+ return ServerAdmin.<ResultString>exec(
+ instance, command, null, listeners);
+ }
+ TaskState state = null;
+ try {
+ ResultMap<String, String> result
+ = CommandGetProperty.getProperties(instance,
+ "configs.config.server-config.java-config.debug-options");
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> values = result.getValue();
+ if (values != null && !values.isEmpty()) {
+ String oldValue = values.get(
+ "configs.config.server-config.java-config.debug-options");
+ CommandSetProperty setCmd =
+ getCommandFactory().getSetPropertyCommand(
+ "configs.config.server-config.java-config.debug-options",
+ oldValue.replace("transport=dt_shmem", "transport=dt_socket").
+ replace("address=[^,]+", "address=" + debugPort));
+ try {
+ CommandSetProperty.setProperty(instance, setCmd);
+ debug = true;
+ } catch (PayaraIdeException gfie) {
+ debug = false;
+ LOGGER.log(Level.INFO, debugPort + "", gfie);
+ }
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ Command command = new CommandRestartDAS(debug);
+ return ServerAdmin.<ResultString>exec(
+ instance, command, null, listeners);
+ }
+
+ @Override
+ public Future<ResultString> deploy(final TaskStateListener stateListener,
+ final File application, final String name) {
+ return deploy(stateListener, application, name, null);
+ }
+
+ @Override
+ public Future<ResultString> deploy(final TaskStateListener stateListener,
+ final File application, final String name,
+ final String contextRoot) {
+ return deploy(stateListener, application, name, contextRoot, null);
+ }
+
+ @Override
+ public Future<ResultString> deploy(final TaskStateListener stateListener,
+ final File application, final String name, final String contextRoot,
+ final Map<String,String> properties) {
+ return deploy(stateListener, application, name, contextRoot, null, new File[0]);
+ }
+
+ @Override
+ public Future<ResultString> deploy(final TaskStateListener stateListener,
+ final File application, final String name, final String contextRoot,
+ final Map<String, String> properties, final File[] libraries) {
+ try {
+ return ServerAdmin.<ResultString>exec(instance, new CommandDeploy(
+ name, Util.computeTarget(instance.getProperties()),
+ application, contextRoot, properties, libraries
+ ), null, new TaskStateListener[]{stateListener});
+ } finally {
+ refreshChildren();
+ }
+ }
+
+ @Override
+ public Future<ResultString> redeploy(
+ final TaskStateListener stateListener,
+ final String name, boolean resourcesChanged) {
+ return redeploy(stateListener, name, null, resourcesChanged);
+ }
+
+ @Override
+ public Future<ResultString> redeploy(
+ final TaskStateListener stateListener,
+ final String name, final String contextRoot,
+ boolean resourcesChanged) {
+ return redeploy(stateListener, name, contextRoot, new File[0],
+ resourcesChanged);
+ }
+
+ @Override
+ public Future<ResultString> redeploy(TaskStateListener stateListener,
+ String name, String contextRoot, File[] libraries,
+ boolean resourcesChanged) {
+ Map<String, String> properties = new HashMap<String, String>();
+ String url = instance.getProperty(PayaraModule.URL_ATTR);
+ String sessionPreservationFlag = instance.getProperty(PayaraModule.SESSION_PRESERVATION_FLAG);
+ if (sessionPreservationFlag == null) {
+ // If there isn't a value stored for the instance, use the value of
+ // the command-line flag.
+ sessionPreservationFlag = System.getProperty(
+ "glassfish.session.preservation.enabled", "false");
+ }
+ if (Boolean.parseBoolean(sessionPreservationFlag)) {
+ properties.put("keepSessions", "true");
+ }
+ if (resourcesChanged) {
+ properties.put("preserveAppScopedResources", "true");
+ }
+ try {
+ return ServerAdmin.<ResultString>exec(instance, new CommandRedeploy(
+ name, Util.computeTarget(instance.getProperties()),
+ contextRoot, properties, libraries,
+ url != null && url.contains("ee6wc")), stateListener);
+ } finally {
+ refreshChildren();
+ }
+ }
+
+ @Override
+ public Future<ResultString> undeploy(
+ final TaskStateListener stateListener, final String name) {
+ return ServerAdmin.<ResultString>exec(
+ instance, new CommandUndeploy(name, Util.computeTarget(
+ instance.getProperties())), null,
+ new TaskStateListener[]{stateListener});
+ }
+
+ @Override
+ public Future<ResultString> enable(
+ final TaskStateListener stateListener, final String name) {
+ return ServerAdmin.<ResultString>exec(instance, new CommandEnable(
+ name, Util.computeTarget(instance.getProperties())), null,
+ new TaskStateListener[] {stateListener});
+ }
+
+ @Override
+ public Future<ResultString> disable(
+ final TaskStateListener stateListener, final String name) {
+ return ServerAdmin.<ResultString>exec(instance, new CommandDisable(
+ name, Util.computeTarget(instance.getProperties())), null,
+ new TaskStateListener[] {stateListener});
+ }
+
+ @Override
+ public AppDesc [] getModuleList(String container) {
+ int total = 0;
+ Map<String, List<AppDesc>> appMap = getApplications(container);
+ Collection<List<AppDesc>> appLists = appMap.values();
+ for(List<AppDesc> appList: appLists) {
+ total += appList.size();
+ }
+ AppDesc [] result = new AppDesc[total];
+ int index = 0;
+ for(List<AppDesc> appList: appLists) {
+ for(AppDesc app: appList) {
+ result[index++] = app;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, ResourceDesc> getResourcesMap(String type) {
+ Map<String, ResourceDesc> resourcesMap
+ = new HashMap<String, ResourceDesc>();
+ List<ResourceDesc> resourcesList
+ = ResourceDesc.getResources(instance, type);
+ for (ResourceDesc resource : resourcesList) {
+ resourcesMap.put(resource.getName(), resource);
+ }
+ return resourcesMap;
+ }
+
+ @Override
+ public ServerState getServerState() {
+ if (serverState == ServerState.UNKNOWN) {
+ RequestProcessor.Task task = refresh();
+ if (task != null) {
+ task.waitFinished();
+ }
+ }
+ return serverState;
+ }
+
+ @Override
+ public void addChangeListener(final ChangeListener listener) {
+ changeSupport.addChangeListener(listener);
+ }
+
+ @Override
+ public void removeChangeListener(final ChangeListener listener) {
+ changeSupport.removeChangeListener(listener);
+ }
+
+ @Override
+ public String setEnvironmentProperty(final String name, final String value,
+ final boolean overwrite) {
+ String result;
+
+ synchronized (instance.getProperties()) {
+ result = instance.getProperty(name);
+ if(result == null || overwrite == true) {
+ instance.putProperty(name, value);
+ setInstanceAttr(name, value);
+ result = value;
+ }
+ }
+
+ return result;
+ }
+
+ // ------------------------------------------------------------------------
+ // bookkeeping & impl managment, not exposed via interface.
+ // ------------------------------------------------------------------------
+ void setProperty(final String key, final String value) {
+ instance.putProperty(key, value);
+ }
+
+ void getProperty(String key) {
+ instance.getProperty(key);
+ }
+
+ boolean setInstanceAttr(String name, String value) {
+ boolean retVal = false;
+ if(instanceFO == null || !instanceFO.isValid()) {
+ instanceFO = getInstanceFileObject();
+ }
+ if(instanceFO != null && instanceFO.canWrite()) {
+ try {
+ Object currentValue = instanceFO.getAttribute(name);
+ if (null != currentValue && currentValue.equals(value)) {
+ // do nothing
+ } else {
+ instanceFO.setAttribute(name, value);
+ }
+ retVal = true;
+ } catch(IOException ex) {
+ LOGGER.log(Level.WARNING,
+ "Unable to save attribute " + name + " in " + instanceFO.getPath() + " for " + getDeployerUri(), ex); // NOI18N
+ }
+ } else {
+ if (null == instanceFO)
+ LOGGER.log(Level.WARNING,
+ "Unable to save attribute {0} for {1} in {3}. Instance file is writable? {2}",
+ new Object[]{name, getDeployerUri(), false, "null"}); // NOI18N
+ else
+ LOGGER.log(Level.WARNING,
+ "Unable to save attribute {0} for {1} in {3}. Instance file is writable? {2}",
+ new Object[]{name, getDeployerUri(), instanceFO.canWrite(), instanceFO.getPath()}); // NOI18N
+ }
+ return retVal;
+ }
+
+ void setFileObject(FileObject fo) {
+ instanceFO = fo;
+ }
+
+
+ public static boolean isRunning(final String host, final int port,
+ final String name, final int timeout) {
+ if(null == host)
+ return false;
+
+ try {
+ InetSocketAddress isa = new InetSocketAddress(host, port);
+ Socket socket = new Socket();
+ Logger.getLogger("payara-socket-connect-diagnostic").log(
+ Level.FINE, "Using socket.connect", new Exception());
+ socket.connect(isa, timeout);
+ socket.setSoTimeout(timeout);
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ LOGGER.log(
+ Level.INFO, "Socket closing failed: {0}",
+ ioe.getMessage());
+ }
+ return true;
+ } catch (java.net.ConnectException | java.net.SocketTimeoutException ex) {
+ return false;
+ } catch (IOException ioe) {
+ String message = NbBundle.getMessage(CommonServerSupport.class,
+ name == null || "".equals(name.trim())
+ ? "MSG_FLAKEY_NETWORK" : "MSG_FLAKEY_NETWORK2",
+ host, Integer.toString(port), ioe.getLocalizedMessage());
+ NotifyDescriptor nd = new NotifyDescriptor.Message(message);
+ DialogDisplayer.getDefault().notifyLater(nd);
+ LOGGER.log(Level.INFO,
+ "Evidence of network flakiness: {0}", ioe.getMessage());
+ return false;
+ }
+ }
+
+ public static boolean isRunning(final String host, final int port,
+ final String name) {
+ return isRunning(host, port, name, 2000);
+ }
+
+ // ------------------------------------------------------------------------
+ // RefreshModulesCookie implementation (for refreshing server state)
+ // ------------------------------------------------------------------------
+ private final AtomicBoolean refreshRunning = new AtomicBoolean(false);
+
+ @Override
+ public final RequestProcessor.Task refresh() {
+ return refresh(null,null);
+ }
+
+ @Override
+ public RequestProcessor.Task refresh(String expected, String unexpected) {
+
+ if(refreshRunning.compareAndSet(false, true)) {
+ return RP.post(new Runnable() {
+ @Override
+ public void run() {
+ // Get current server status.
+ PayaraServerStatus status
+ = PayaraStatus.get(instance);
+ // Start monitoring of this Payara server instance
+ // when status is null and refresh status.
+ if (status == null) {
+ PayaraState.monitor(instance);
+ status = PayaraStatus.get(instance);
+ }
+ ServerState currentState = serverState;
+ switch(currentState) {
+ case UNKNOWN:
+ switch(status.getStatus()) {
+ case ONLINE:
+ setServerState(ServerState.RUNNING);
+ break;
+ case STARTUP:
+ setServerState(ServerState.STARTING);
+ break;
+ case SHUTDOWN:
+ setServerState(ServerState.STOPPING);
+ break;
+ case OFFLINE:
+ setServerState(ServerState.STOPPED);
+ }
+ break;
+ case STOPPED:
+ if (status.getStatus() == PayaraStatus.ONLINE) {
+ setServerState(ServerState.RUNNING);
+ }
+ break;
+ case RUNNING:
+ switch(status.getStatus()) {
+ case STARTUP:
+ setServerState(ServerState.STARTING);
+ break;
+ case SHUTDOWN:
+ setServerState(ServerState.STOPPING);
+ break;
+ case OFFLINE:
+ setServerState(ServerState.STOPPED);
+ }
+ break;
+ case STOPPED_JVM_PROFILER:
+ if (status.getStatus() == PayaraStatus.ONLINE) {
+ setServerState(ServerState.RUNNING);
+ }
+ }
+ refreshRunning.set(false);
+ }
+ });
+ } else {
+ return null;
+ }
+ }
+
+ void disableStop() {
+ stopDisabled = true;
+ }
+
+ void setLocalStartProcess(Process process) {
+ this.localStartProcess = process;
+ }
+
+ Process getLocalStartProcess() {
+ return localStartProcess;
+ }
+
+ void stopLocalStartProcess() {
+ localStartProcess.destroy();
+ localStartProcess = null;
+ }
+
+ @Override
+ public CommandFactory getCommandFactory() {
+ return instance.getInstanceProvider().getCommandFactory();
+ }
+
+ @Override
+ public String getResourcesXmlName() {
+ return org.netbeans.modules.payara.spi.Utils
+ .useGlassFishPrefix(getDeployerUri()) ?
+ "glassfish-resources" : "sun-resources"; // NOI18N
+ }
+
+ @Override
+ public boolean supportsRestartInDebug() {
+ return getDeployerUri().contains(PayaraInstanceProvider.EE6WC_DEPLOYER_FRAGMENT);
+ }
+
+ @Override
+ public boolean isRestfulLogAccessSupported() {
+ return getDeployerUri().contains(PayaraInstanceProvider.EE6WC_DEPLOYER_FRAGMENT);
+ }
+
+ @Override
+ public boolean isWritable() {
+ return (null == instanceFO) ? false : instanceFO.canWrite();
+ }
+
+ private long latestWarningDisplayTime = System.currentTimeMillis();
+
+ private long getLatestWarningDisplayTime() {
+ return latestWarningDisplayTime;
+ }
+
+ private void setLatestWarningDisplayTime(long currentTime) {
+ latestWarningDisplayTime = currentTime;
+ }
+
+ /**
+ * Update HTTP port value from server properties.
+ */
+ void updateHttpPort() {
+ String target = Util.computeTarget(instance.getProperties());
+ String gpc;
+ if (Util.isDefaultOrServerTarget(instance.getProperties())) {
+ gpc = "*.server-config.*.http-listener-1.port";
+ setEnvironmentProperty(PayaraModule.HTTPHOST_ATTR,
+ instance.getProperty(PayaraModule.HOSTNAME_ATTR), true); // NOI18N
+ } else {
+ String server = getServerFromTarget(target);
+ String adminHost = instance.getProperty(PayaraModule.HOSTNAME_ATTR);
+ setEnvironmentProperty(PayaraModule.HTTPHOST_ATTR,
+ getHttpHostFromServer(server,adminHost), true);
+ gpc = "servers.server."+server+".system-property.HTTP_LISTENER_PORT.value";
+ }
+ try {
+ ResultMap<String, String> result = CommandGetProperty.getProperties(
+ instance, gpc, PayaraModule.PROPERTIES_FETCH_TIMEOUT);
+ boolean didSet = false;
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> values = result.getValue();
+ for (Entry<String, String> entry : values.entrySet()) {
+ String val = entry.getValue();
+ try {
+ if (null != val && val.trim().length() > 0) {
+ Integer.parseInt(val);
+ setEnvironmentProperty(PayaraModule.HTTPPORT_ATTR, val, true);
+ didSet = true;
+ }
+ } catch (NumberFormatException nfe) {
+ LOGGER.log(Level.FINEST,
+ "Property value {0} was not a number", val);
+ }
+ }
+ }
+ if (!didSet && !Util.isDefaultOrServerTarget(instance.getProperties())) {
+ setEnvironmentProperty(PayaraModule.HTTPPORT_ATTR, "28080", true); // NOI18N
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO, "Could not get http port value.", gfie);
+ }
+ }
+
+ /**
+ * Sends list-applications command to server (synchronous)
+ *
+ * @param container
+ * @return String array of names of deployed applications.
+ */
+ public Map<String, List<AppDesc>> getApplications(String container) {
+ Map<String, List<AppDesc>> result = Collections.emptyMap();
+ Map<String, List<String>> apps = Collections.emptyMap();
+ try {
+ ResultMap<String, List<String>> resultMap
+ = CommandListComponents.listComponents(instance,
+ Util.computeTarget(instance.getProperties()));
+ if (resultMap.getState() == TaskState.COMPLETED) {
+ apps = resultMap.getValue();
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO,
+ "Could not retrieve components server.", gfie);
+ }
+ if (null == apps || apps.isEmpty()) {
+ return result;
+ }
+ try {
+ ResultMap<String, String> appPropsResult = CommandGetProperty
+ .getProperties(instance, "applications.application.*");
+ if (appPropsResult.getState() == TaskState.COMPLETED) {
+ ResultMap<String, String> appRefResult
+ = CommandGetProperty.getProperties(
+ instance, "servers.server.*.application-ref.*");
+ if (appRefResult.getState() == TaskState.COMPLETED) {
+ result = processApplications(apps,
+ appPropsResult.getValue(),
+ appRefResult.getValue());
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ return result;
+ }
+
+ private Map<String, List<AppDesc>> processApplications(Map<String,
+ List<String>> appsList, Map<String, String> properties,
+ Map<String, String> refProperties){
+ Map<String, List<AppDesc>> result = new HashMap<String, List<AppDesc>>();
+ Iterator<String> appsItr = appsList.keySet().iterator();
+ while (appsItr.hasNext()) {
+ String engine = appsItr.next();
+ List<String> apps = appsList.get(engine);
+ for (int i = 0; i < apps.size(); i++) {
+ String name = apps.get(i).trim();
+ String appname = "applications.application." + name; // NOI18N
+ String contextKey = appname + ".context-root"; // NOI18N
+ String pathKey = appname + ".location"; // NOI18N
+
+ String contextRoot = properties.get(contextKey);
+ if (contextRoot == null) {
+ contextRoot = name;
+ }
+ if (contextRoot.startsWith("/")) { // NOI18N
+ contextRoot = contextRoot.substring(1);
+ }
+
+ String path = properties.get(pathKey);
+ if (path == null) {
+ path = "unknown"; //NOI18N
+ }
+ if (path.startsWith("file:")) { // NOI18N
+ path = path.substring(5);
+ path = (new File(path)).getAbsolutePath();
+ }
+
+ String enabledKey = "servers.server.server.application-ref."
+ +name+ ".enabled"; //NOI18N
+ // This needs to be more focused. Does it need to list
+ // of servers that are associated with the target?
+ for (String possibleKey : refProperties.keySet()) {
+ if (possibleKey.endsWith(".application-ref."
+ + name + ".enabled")) { // NOI18N
+ enabledKey = possibleKey;
+ }
+ }
+ String enabledValue = refProperties.get(enabledKey);
+ if (null != enabledValue) {
+ boolean enabled = Boolean.parseBoolean(enabledValue);
+
+ List<AppDesc> appList = result.get(engine);
+ if(appList == null) {
+ appList = new ArrayList<AppDesc>();
+ result.put(engine, appList);
+ }
+ appList.add(new AppDesc(name, path, contextRoot, enabled));
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Retrieve server name using target name from server properties.
+ * <p/>
+ * @param target Server target name.
+ * @return Name of server having this target.
+ */
+ private String getServerFromTarget(String target) {
+ String retVal = target; // NOI18N
+ String gpc = "clusters.cluster."+target+".server-ref.*.ref";
+ try {
+ ResultMap<String, String> result = CommandGetProperty.getProperties(
+ instance, gpc, PROPERTIES_FETCH_TIMEOUT);
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> values = result.getValue();
+ for (Entry<String, String> entry : values.entrySet()) {
+ String val = entry.getValue();
+ if (null != val && val.trim().length() > 0) {
+ retVal = val;
+ break;
+ }
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO, "Could not get server value from target.", gfie);
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Retrieve HTTP host name for server from server properties.
+ * <p/>
+ * @param server Server name.
+ * @param nameOfLocalhost Local host DNS name.
+ * @return HTTP host name for server.
+ */
+ private String getHttpHostFromServer(
+ String server, String nameOfLocalhost) {
+ String retVal = FAILED_HTTP_HOST;
+ String refVal = null;
+ String gpc = "servers.server."+server+".node-ref";
+ try {
+ ResultMap<String, String> result = CommandGetProperty.getProperties(
+ instance, gpc, PROPERTIES_FETCH_TIMEOUT);
+ if (result.getState() == TaskState.COMPLETED) {
+ for (Entry<String, String> entry
+ : result.getValue().entrySet()) {
+ String val = entry.getValue();
+ if (null != val && val.trim().length() > 0) {
+ refVal = val;
+ break;
+ }
+ }
+ if (refVal != null) {
+ gpc = "nodes.node." + refVal + ".node-host";
+ result = CommandGetProperty.getProperties(
+ instance, gpc, PROPERTIES_FETCH_TIMEOUT);
+ if (result.getState() == TaskState.COMPLETED) {
+ for (Entry<String, String> entry
+ : result.getValue().entrySet()) {
+ String val = entry.getValue();
+ if (null != val && val.trim().length() > 0) {
+ retVal = val;
+ break;
+ }
+ }
+ }
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO, "Could not get http host value.", gfie);
+ }
+ return LOCALHOST.equals(retVal) ? nameOfLocalhost : retVal; // NOI18N
+ }
+
+ private void refreshChildren() {
+ PayaraInstance instance = getInstance();
+ RefreshModulesCookie cookie = instance.getFullNode().getLookup().lookup(RefreshModulesCookie.class);
+ if (cookie != null) {
+ cookie.refresh(null, null);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/CreateDomain.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/CreateDomain.java
new file mode 100644
index 0000000..92f56fe
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/CreateDomain.java
@@ -0,0 +1,321 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import static java.util.Arrays.asList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import javax.swing.SwingUtilities;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.progress.ProgressHandleFactory;
+import org.netbeans.modules.payara.spi.ExecSupport;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.DialogDisplayer;
+import org.openide.ErrorManager;
+import org.openide.NotifyDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Cancellable;
+import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
+import org.openide.windows.InputOutput;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+public class CreateDomain extends Thread {
+
+ static final String PORTBASE = "portbase"; // NOI18N
+ private final String uname;
+ private final String pword;
+ private final File platformLocation;
+ private final Map<String, String> map;
+ private final Map<String, String> instanceProperties;
+ private final PayaraInstanceProvider instanceProvider;
+ private final boolean register;
+ private final String installRootKey;
+
+ public CreateDomain(String uname, String pword, File platformLocation,
+ Map<String, String> instanceProperties, PayaraInstanceProvider instanceProvider, boolean register,
+ boolean useDefaultPorts, String installRootKey) {
+ this.uname = uname;
+ this.pword = pword;
+ this.platformLocation = platformLocation;
+ this.instanceProperties = instanceProperties;
+ this.map = new HashMap<>();
+ this.instanceProvider = instanceProvider;
+ map.putAll(instanceProperties);
+ this.register = register;
+ this.installRootKey = installRootKey;
+ computePorts(instanceProperties,map, useDefaultPorts);
+ }
+
+ static private void computePorts(Map<String, String> ip, Map<String, String> createProps, boolean useDefaultPorts) {
+ int portBase = 8900;
+ int kicker = ((new Date()).toString() + ip.get(PayaraModule.DOMAINS_FOLDER_ATTR)+ip.get(PayaraModule.DOMAIN_NAME_ATTR)).hashCode() % 40000;
+ kicker = kicker < 0 ? -kicker : kicker;
+
+ int httpPort;
+ int adminPort;
+ if (useDefaultPorts) {
+ httpPort = 8080;
+ adminPort = 4848;
+ } else {
+ if (ip.get(PayaraModule.HTTPPORT_ATTR) != null) {
+ httpPort = Integer.parseInt(ip.get(PayaraModule.HTTPPORT_ATTR));
+ } else {
+ httpPort = portBase + kicker + 80;
+ }
+ if (ip.get(PayaraModule.ADMINPORT_ATTR) != null) {
+ adminPort = Integer.parseInt(ip.get(PayaraModule.ADMINPORT_ATTR));
+ } else {
+ adminPort = portBase + kicker + 48;
+ }
+ }
+ ip.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));
+ ip.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));
+ createProps.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));
+ createProps.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));
+// if (!useDefaultPorts) {
+// createProps.put(CreateDomain.PORTBASE, Integer.toString(portBase+kicker));
+// }
+ }
+
+ @Override
+ public void run() {
+ Process process = null;
+ // attempt to do the domian/instance create HERE
+ File irf = platformLocation;
+ int retVal = 0;
+ if (null != irf && irf.exists()) {
+ PDCancel pdcan;
+ String startScript = System.getProperty("java.home") + File.separatorChar + "bin" + File.separatorChar + "java"; // NOI18N
+ if ("\\".equals(File.separator)) { // NOI18N
+ startScript += ".exe"; // NOI18N
+ }
+ File jar = new File(irf, "modules" + File.separator + "admin-cli.jar"); // NOI18N
+ String jarLocation = jar.getAbsolutePath();
+ String domain = map.get(PayaraModule.DOMAIN_NAME_ATTR);
+ String domainDir = map.get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ File passWordFile = createTempPasswordFile(pword, "changeit"); //NOI18N
+ String adminPort = instanceProperties.get(PayaraModule.ADMINPORT_ATTR);
+ String httpPort = instanceProperties.get(PayaraModule.HTTPPORT_ATTR);
+
+ if (passWordFile == null) {
+ return;
+ }
+
+ List<String> args = new ArrayList<>();
+ args.addAll(asList(new String[]{
+ startScript,
+ "-client", // NOI18N
+ "-jar", // NOI18N
+ jarLocation,
+ "create-domain", //NOI18N
+ "--domaindir", //NOI18N
+ domainDir,
+ "--user", //NOI18N
+ uname
+ }));
+
+ if ("".equals(pword) && instanceProvider.getNoPasswordOptions().size() > 0) {
+ args.addAll(instanceProvider.getNoPasswordOptions());
+ } else {
+ args.add("--passwordfile"); //NOI18N
+ args.add(passWordFile.getAbsolutePath());
+ }
+ if (null != map.get(PORTBASE)) {
+ args.add("--portbase"); //NOI18N
+ args.add(map.get(PORTBASE));
+ } else {
+ args.add("--adminport"); //NOI18N
+ args.add(adminPort);
+ args.add("--instanceport"); //NOI18N
+ args.add(httpPort);
+ }
+ args.add(domain);
+
+ ProgressHandle ph = null;
+ try {
+ ExecSupport ee = new ExecSupport();
+ process = Runtime.getRuntime().exec(args.toArray(new String[0]), null, irf);
+ pdcan = new PDCancel(process, domainDir + File.separator + domain);
+ ph = ProgressHandleFactory.createHandle(
+ NbBundle.getMessage(this.getClass(), "LBL_Creating_personal_domain"), // NOI18N
+ pdcan);
+ ph.start();
+
+ ee.displayProcessOutputs(process,
+ NbBundle.getMessage(this.getClass(), "LBL_outputtab"),//NOI18N
+ NbBundle.getMessage(this.getClass(), "LBL_RunningCreateDomainCommand")//NOI18N
+ );
+ } catch (MissingResourceException | IOException | InterruptedException ex) {
+ showInformation(ex.getLocalizedMessage());
+ } catch (RuntimeException ex) {
+ showInformation(ex.getLocalizedMessage());
+ // this is more interesting
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
+ ex);
+ }
+ if (null != process) {
+ try {
+ retVal = process.waitFor();
+ if (!passWordFile.delete()) {
+ showInformation(NbBundle.getMessage(this.getClass(), "MSG_delete_password_failed", passWordFile.getAbsolutePath())); // NOI18N
+ }
+ } catch (InterruptedException ie) {
+ retVal = -1;
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
+ ie);
+ }
+ } else {
+ retVal = -1;
+ }
+ if (null != ph) {
+ ph.finish();
+ }
+ if (0 == retVal) {
+ // The create was successful... create the instance and register it.
+ if (register) {
+ PayaraInstance gi = PayaraInstance.create(instanceProperties,instanceProvider);
+ }
+ } else {
+ if (register) {
+ NbPreferences.forModule(this.getClass()).put(ServerUtilities.PROP_FIRST_RUN+installRootKey,
+ "false");
+ }
+ }
+
+ String mess = 0 == retVal ?
+ NbBundle.getMessage(this.getClass(), "MSG_see_successful_results") :
+ NbBundle.getMessage(this.getClass(), "MSG_see_failure_results");
+ Object ret = DialogDisplayer.getDefault().notify(
+ new NotifyDescriptor.Confirmation(mess, NotifyDescriptor.YES_NO_OPTION));
+ if (NotifyDescriptor.YES_OPTION.equals(ret)) {
+ InputOutput io = org.openide.windows.IOProvider.getDefault().getIO(NbBundle.getMessage(this.getClass(), "LBL_outputtab"), false);
+ io.select();
+ }
+ }
+ }
+
+ public int getHttpPort() {
+ return Integer.parseInt(instanceProperties.get(PayaraModule.HTTPPORT_ATTR));
+ }
+
+ public int getAdminPort() {
+ return Integer.parseInt(instanceProperties.get(PayaraModule.ADMINPORT_ATTR));
+ }
+
+ static class PDCancel implements Cancellable {
+
+ final private Process p;
+ final private String dirname;
+ private boolean notFired = true;
+
+ PDCancel(Process p, String newDirName) {
+ this.p = p;
+ this.dirname = newDirName;
+ }
+
+ synchronized public boolean isNotFired() {
+ return notFired;
+ }
+
+ @Override
+ synchronized public boolean cancel() {
+ notFired = false;
+ p.destroy();
+ File domainDir = new File(dirname);
+ if (domainDir.exists()) {
+ FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(domainDir));
+ try {
+ fo.delete();
+ } catch (IOException ex) {
+ Logger.getLogger(this.getClass().getName()).log(Level.FINER,"",ex); // NOI18N
+ showError(NbBundle.getMessage(PayaraInstanceProvider.class, "ERR_Failed_cleanup", dirname)); // NOI18N
+ }
+ }
+ return true;
+ }
+ }
+
+ /*
+ * This create a temporary file, deleted at exit, that contains
+ * the necessary password infos for starting or creating a domain
+ * bot admu and master password are there.
+ * @returns the temporary file
+ * or null if for some reason, this file cannot be created.
+ */
+ private static File createTempPasswordFile(String password, String masterPassword) {
+ OutputStream output;
+ PrintWriter p = null;
+ File retVal = null;
+ try {
+ retVal = File.createTempFile("admin", null);//NOI18N
+
+ retVal.deleteOnExit();
+ output = new FileOutputStream(retVal);
+ p = new PrintWriter(output);
+ p.println("AS_ADMIN_ADMINPASSWORD=" + password);//NOI18N for create domains
+
+ p.println("AS_ADMIN_PASSWORD=" + password);//NOI18N for start domains
+
+ p.println("AS_ADMIN_MASTERPASSWORD=" + masterPassword);//NOI18N
+
+ } catch (IOException e) {
+ // this should not happen... If it does we should at least log it
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ } finally {
+ if (p != null) {
+ p.close();
+ }
+ }
+ return retVal;
+ }
+
+ private static void showInformation(final String msg){
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE);
+ DialogDisplayer.getDefault().notify(d);
+ }
+ });
+ }
+
+ private static void showError(final String msg){
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(d);
+ }
+ });
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/EnableComet.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/EnableComet.java
new file mode 100644
index 0000000..05aa3d5
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/EnableComet.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class EnableComet implements Runnable {
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(CommonServerSupport.class);
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server instance to be modified. */
+ private final PayaraInstance instance;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Comet support enable handler.
+ * @param instance Payara server instance to be modified.
+ */
+ public EnableComet(PayaraInstance instance) {
+ this.instance = instance;
+ }
+
+ /**
+ * Thread execution method.
+ */
+ @Override
+ public void run() {
+ String propertiesPattern = "*.comet-support-enabled";
+ try {
+ ResultMap<String, String> result = CommandGetProperty.getProperties(
+ instance, propertiesPattern,
+ CommonServerSupport.PROPERTIES_FETCH_TIMEOUT);
+ if (result.getState() == TaskState.COMPLETED) {
+ String newValue
+ = instance.getProperty(PayaraModule.COMET_FLAG);
+ if (null == newValue || newValue.trim().length() < 1) {
+ newValue = "false"; // NOI18N
+ }
+ for (Entry<String, String> entry
+ : result.getValue().entrySet()) {
+ String key = entry.getKey();
+ // do not update the admin listener....
+ if (null != key && !key.contains("admin-listener")) {
+ CommandSetProperty command
+ = PayaraInstanceProvider.getProvider()
+ .getCommandFactory().getSetPropertyCommand(
+ key, newValue);
+ ResultString setResult = CommandSetProperty.setProperty(
+ instance, command,
+ CommonServerSupport.PROPERTIES_FETCH_TIMEOUT);
+ }
+ }
+
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO,
+ "Could not get comment-support-enabeld value.", gfie);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/Installer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/Installer.java
new file mode 100644
index 0000000..852163f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/Installer.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import org.openide.modules.ModuleInstall;
+
+/**
+ * Manages a module's lifecycle. Remember that an installer is optional and
+ * often not needed at all.
+ *
+ * @auther Peter Williams
+ */
+public class Installer extends ModuleInstall {
+
+ @Override
+ public void close() {
+ super.close();
+
+ // Send a shutdown message to any V3 server instances we started.
+ for (PayaraInstance instance :
+ PayaraInstanceProvider.getProvider().getInternalInstances()) {
+ instance.stopIfStartedByIde(0L);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/KillTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/KillTask.java
new file mode 100644
index 0000000..5083cb3
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/KillTask.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.common.utils.ServerUtils;
+
+/**
+ * Asynchronous Payara server termination task.
+ * @author Tomas Kraus
+ */
+public class KillTask extends BasicTask<TaskState> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER = PayaraLogger.get(StartTask.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server termination task.
+ * <p/>
+ * @param instance Payara instance accessed in this task.
+ * @param stateListener Callback listeners used to retrieve state changes.
+ */
+ public KillTask(PayaraInstance instance,
+ TaskStateListener... stateListener) {
+ super(instance, stateListener);
+ taskThread = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Asynchronous task method started by {@see Executors}.
+ * <p/>
+ * @return Task execution result.
+ */
+ @Override
+ public TaskState call() {
+ setTaskThread();
+ TaskState state;
+ LOGGER.log(Level.FINEST,
+ "[0] Payara server termination task started",
+ taskThread.getName());
+ Process process = instance.getProcess();
+ if (process == null) {
+ return fireOperationStateChanged(
+ TaskState.FAILED, TaskEvent.PROCESS_NOT_EXISTS,
+ "KillTask.call.noProcess", instanceName);
+ }
+ if (!ServerUtils.isProcessRunning(process)) {
+ // Clear process stored in instance when already finished.
+ return fireOperationStateChanged(
+ TaskState.FAILED, TaskEvent.PROCESS_NOT_RUNNING,
+ "KillTask.call.finished", instanceName);
+ }
+ fireOperationStateChanged(
+ TaskState.RUNNING, TaskEvent.CMD_RUNNING,
+ "KillTask.call.running", instanceName);
+ state = kill(process);
+ clearTaskThread();
+ return state;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Terminate running Payara server task.
+ * <p/>
+ * @param process Payara server running process to be terminated.
+ */
+ private TaskState kill(final Process process) {
+ process.destroy();
+ StateChange stateChange = waitShutDown();
+ if (stateChange != null) {
+ return stateChange.fireOperationStateChanged();
+ }
+ // Clear process stored in instance after being killed.
+ instance.setProcess(null);
+ return fireOperationStateChanged(
+ TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ "KillTask.kill.completed", instanceName);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/LogViewMgr.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/LogViewMgr.java
new file mode 100644
index 0000000..63bb0d7
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/LogViewMgr.java
@@ -0,0 +1,1205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.awt.Color;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.swing.Action;
+import org.netbeans.modules.payara.tooling.server.FetchLog;
+import org.netbeans.modules.payara.tooling.server.FetchLogEvent;
+import org.netbeans.modules.payara.tooling.server.FetchLogEventListener;
+import org.netbeans.modules.payara.tooling.server.FetchLogPiped;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.actions.DebugAction;
+import org.netbeans.modules.payara.common.actions.RefreshAction;
+import org.netbeans.modules.payara.common.actions.RestartAction;
+import org.netbeans.modules.payara.common.actions.StartServerAction;
+import org.netbeans.modules.payara.common.actions.StopServerAction;
+import org.netbeans.modules.payara.spi.Recognizer;
+import org.netbeans.modules.payara.spi.RecognizerCookie;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.Mutex;
+import org.openide.util.Utilities;
+import org.openide.windows.*;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ * This class is capable of tailing the specified file or input stream. It
+ * checks for changes at the specified intervals and outputs the changes to
+ * the given I/O panel in NetBeans.
+ *
+ * FIXME Refactor: LogViewMgr should be a special case of SimpleIO
+ *
+ * @author Peter Williams
+ * @author Michal Mocnak
+ */
+public class LogViewMgr {
+
+ /** Local logger. */
+ private static final Logger LOGGER = PayaraLogger.get(LogViewMgr.class);
+
+ private static final boolean strictFilter = Boolean.getBoolean("glassfish.logger.strictfilter"); // NOI18N
+
+ /**
+ * Amount of time in milliseconds to wait between checks of the input
+ * stream
+ */
+ private static final int DELAY = Utilities.isWindows() ? 1 : 100;
+
+ /**
+ * Singleton model pattern
+ */
+ private static final Map<String, WeakReference<LogViewMgr>> INSTANCES =
+ new HashMap<>();
+
+ /**
+ * Server URI for this log view
+ */
+ private final String uri;
+
+ /**
+ * The I/O window where to output the changes
+ */
+ private InputOutput io;
+
+ /**
+ * Active readers for this log view. This list contains references either
+ * to nothing (which means log is not active), a single file reader to
+ * monitor server log if the server is running outside the IDE, or two
+ * stream readers for servers started within the IDE.
+ *
+ * !PW not sure this complexity is worth it. Reading server log correctly
+ * is a major pain compared to reading server I/O streams directly. But we
+ * don't have that luxury for servers created outside the IDE, so this is a
+ * feeble attempt to have our cake and eat it too :) I'll probably regret
+ * it later.
+ */
+ private final List<WeakReference<LoggerRunnable>> readers
+ = Collections.synchronizedList(new ArrayList<WeakReference<LoggerRunnable>>());
+
+ private final Map<String, String> localizedLevels = getLevelMap();
+
+ /**
+ * Creates and starts a new instance of LogViewMgr
+ *
+ * @param uri the uri of the server
+ */
+ private LogViewMgr(final String uri) {
+ this.uri = uri;
+ io = getServerIO(uri);
+
+ if (io == null) {
+ return; // finish, it looks like this server instance has been unregistered
+ }
+
+ // clear the old output
+ try {
+ io.getOut().reset();
+ } catch (IOException ex) {
+ // no op
+ }
+ }
+
+ /**
+ * Returns uri specific instance of LogViewMgr
+ *
+ * @param uri the uri of the server
+ * @return uri specific instance of LogViewMgr
+ */
+ public static LogViewMgr getInstance(String uri) {
+ LogViewMgr logViewMgr;
+ synchronized (INSTANCES) {
+ WeakReference<LogViewMgr> viewRef = INSTANCES.get(uri);
+ logViewMgr = viewRef != null ? viewRef.get() : null;
+ if(logViewMgr == null) {
+ logViewMgr = new LogViewMgr(uri);
+ INSTANCES.put(uri, new WeakReference<>(logViewMgr));
+ }
+ }
+ return logViewMgr;
+ }
+
+ public void ensureActiveReader(List<Recognizer> recognizers,
+ FetchLog serverLog, PayaraInstance instance) {
+ synchronized (readers) {
+ boolean activeReader = false;
+ for(WeakReference<LoggerRunnable> ref: readers) {
+ LoggerRunnable logger = ref.get();
+ if(logger != null) {
+ activeReader = true;
+ break;
+ }
+ }
+
+ if(!activeReader && serverLog != null) {
+ readInputStreams(recognizers,
+ serverLog.getInputStream() instanceof FileInputStream,
+ instance, serverLog);
+ }
+ }
+ }
+
+ /**
+ * Reads a newly included InputSreams.
+ *
+ * @param recognizers
+ * @param fromFile
+ * @param instance
+ * @param serverLogs
+ */
+ public void readInputStreams(List<Recognizer> recognizers, boolean fromFile,
+ PayaraInstance instance, FetchLog... serverLogs) {
+ synchronized (readers) {
+ stopReaders();
+
+ for(FetchLog serverLog : serverLogs){
+ // LoggerRunnable will close the stream if necessary.
+ LoggerRunnable logger = new LoggerRunnable(recognizers,
+ serverLog, fromFile, instance);
+ readers.add(new WeakReference<>(logger));
+ Thread t = new Thread(logger);
+ t.start();
+ }
+ }
+ }
+
+ public void stopReaders() {
+ synchronized (readers) {
+ for(WeakReference<LoggerRunnable> ref: readers) {
+ LoggerRunnable logger = ref.get();
+ if(logger != null) {
+ logger.stop();
+ }
+ }
+ readers.clear();
+ }
+ }
+
+ private void removeReader(LoggerRunnable logger) {
+ synchronized (readers) {
+ int size = readers.size();
+ for(int i = 0; i < size; i++) {
+ WeakReference<LoggerRunnable> ref = readers.get(i);
+ if(logger == ref.get()) {
+ readers.remove(i);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Writes a message into output
+ *
+ * @param s message to write
+ */
+ public synchronized void write(String s, boolean error) {
+ OutputWriter writer = getWriter(error);
+ if(writer != null) {
+ writer.print(s);
+ }
+ }
+
+ /**
+ * Writes a message into output, including a link to a portion of the
+ * content being written.
+ *
+ * @param s message to write
+ * @param link
+ * @param important
+ * @param error
+ */
+ public synchronized void write(String s, OutputListener link, boolean important, boolean error) {
+ try {
+ OutputWriter writer = getWriter(error);
+ if(writer != null) {
+ writer.println(s, link, important);
+ }
+ } catch(IOException ex) {
+ LOGGER.log(Level.FINE, ex.getLocalizedMessage(), ex);
+ }
+ }
+
+ private OutputWriter getWriter(boolean error) {
+ if (null == io) {
+ return null;
+ }
+ OutputWriter writer = error ? io.getErr() : io.getOut();
+ if(LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.log(Level.FINEST, "getIOWriter: closed = {0} [ {1}" + " ]" + ", output error flag = " + "{2}", new Object[]{io.isClosed(), error ? "STDERR" : "STDOUT", writer.checkError()}); // NOI18N
+ }
+ if(writer.checkError() == true) {
+ InputOutput newIO = getServerIO(uri);
+ if(newIO == null) {
+ if(LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.log(Level.INFO, "Unable to recreate I/O for {0}, still in error state", uri); // NOI18N
+ }
+ writer = null;
+ } else {
+ io = newIO;
+ writer = error ? io.getErr() : io.getOut();
+ }
+ }
+ return writer;
+ }
+
+ private Map<String, String> getLevelMap() {
+ Map<String, String> levelMap = new HashMap<String, String>();
+ for(Level l: new Level [] { Level.ALL, Level.CONFIG, Level.FINE,
+ Level.FINER, Level.FINEST, Level.INFO, Level.SEVERE, Level.WARNING } ) {
+ String name = l.getName();
+ levelMap.put(name, l.getLocalizedName());
+ }
+ return levelMap;
+ }
+
+ /**
+ * Selects output panel
+ * @param force
+ */
+ public synchronized void selectIO(boolean force) {
+ if(LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.log(Level.FINEST, "selectIO: closed = {0}, output error flag = {1}", new Object[]{io.isClosed(), io.getOut().checkError()}); // NOI18N
+ }
+
+ // Only select the output window if it's closed. This makes sure it's
+ // created properly and displayed. However, if the user minimizes the
+ // output window or switches to another one, we don't switch back.
+ if(io.isClosed()) {
+ try {
+ io.getOut().reset();
+ } catch (IOException ex) {
+ LOGGER.log(Level.FINE, "ignorable problem", ex);
+ }
+ io.select();
+
+ // Horrible hack. closed flag is never reset, so reset it after reopening.
+ invokeSetClosed(io, false);
+ }
+
+ if (force) {
+ lastVisibleCheck = 0;
+ io.select();
+ }
+
+ // If the user happened to close the OutputWindow TopComponent, reopen it.
+ // Don't this check too often, but often enough.
+ if(System.currentTimeMillis() > lastVisibleCheck + VISIBILITY_CHECK_DELAY) {
+ Mutex.EVENT.readAccess(new Runnable() {
+ @Override
+ public void run() {
+ if(visibleCheck.getAndSet(true)) {
+ try {
+ TopComponent tc = null;
+ if(outputTCRef != null) {
+ tc = outputTCRef.get();
+ }
+ if(tc == null) {
+ tc = WindowManager.getDefault().findTopComponent(OUTPUT_WINDOW_TCID);
+ if(tc != null) {
+ outputTCRef = new WeakReference<>(tc);
+ }
+ }
+ if(tc != null && !tc.isOpened()) {
+ tc.open();
+ }
+ lastVisibleCheck = System.currentTimeMillis();
+ } finally {
+ visibleCheck.set(false);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ private AtomicBoolean visibleCheck = new AtomicBoolean();
+ private final long VISIBILITY_CHECK_DELAY = 60 * 1000;
+ private final String OUTPUT_WINDOW_TCID = "output"; // NOI18N
+ private volatile long lastVisibleCheck = 0;
+ private WeakReference<TopComponent> outputTCRef =
+ new WeakReference<>(null);
+ private volatile Method setClosedMethod;
+
+ private void invokeSetClosed(InputOutput io, boolean closed) {
+ if(setClosedMethod == null) {
+ setClosedMethod = initSetClosedMethod(io);
+ }
+ if(setClosedMethod != null) {
+ try {
+ setClosedMethod.invoke(io, Boolean.valueOf(closed));
+ } catch (Exception ex) {
+ if(LOGGER.isLoggable(Level.FINER)) {
+ LOGGER.log(Level.FINER, "invokeSetClosed", ex); // NOI18N
+ }
+ }
+ }
+ }
+
+ private Method initSetClosedMethod(InputOutput io) {
+ Method method = null;
+ try {
+ Class clazz = io.getClass();
+ method = clazz.getDeclaredMethod("setClosed", boolean.class); // NOI18N
+ method.setAccessible(true);
+ } catch(Exception ex) {
+ if(LOGGER.isLoggable(Level.FINER)) {
+ LOGGER.log(Level.FINER, "initSetClosedMethod", ex); // NOI18N
+ }
+ }
+ return method;
+ }
+
+ private class LoggerRunnable implements Runnable {
+
+ private final List<Recognizer> recognizers;
+ private FetchLog serverLog;
+ private final boolean ignoreEof;
+ private volatile boolean shutdown;
+ private final PayaraInstance instance;
+ //private final Map<String, String> properties;
+
+ public LoggerRunnable(List<Recognizer> recognizers, FetchLog serverLog,
+ boolean ignoreEof, PayaraInstance instance) {
+ this.recognizers = recognizers;
+ this.serverLog = serverLog;
+ this.ignoreEof = ignoreEof;
+ this.shutdown = false;
+ this.instance = instance;
+ }
+
+ public void stop() {
+ shutdown = true;
+ }
+
+ /**
+ * Implementation of the Runnable interface. Here all tailing is
+ * performed
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public void run() {
+ final String originalName = Thread.currentThread().getName();
+ BufferedReader reader = null;
+
+ try {
+ Thread.currentThread().setName(this.getClass().getName()
+ + " - " + serverLog.getInputStream()); // NOI18N
+
+ reader = new BufferedReader(new InputStreamReader(
+ serverLog.getInputStream()));
+
+ // ignoreEof is true for log files and false for process streams.
+ // FIXME Should differentiate filter types more cleanly.
+ Filter filter = ignoreEof ? new LogFileFilter(localizedLevels) :
+ (uri.contains("]deployer:pfv3ee6") ? new LogFileFilter(localizedLevels) :new StreamFilter());
+
+ // read from the input stream and put all the changes to the I/O window
+ char [] chars = new char[1024];
+ int len = 0;
+
+ while(!shutdown && len != -1) {
+ if(ignoreEof) {
+ reader = followLogRotation(reader);
+ // For file streams, only read if there is something there.
+ while(!shutdown && reader.ready()) {
+ String text = filter.process((char) reader.read());
+ if(text != null) {
+ processLine(text);
+ }
+ }
+ } else {
+ // For process streams, check for EOF every <DELAY> interval.
+ // We don't use readLine() here because it blocks.
+ while(!shutdown && (len = reader.read(chars)) != -1) {
+ for(int i = 0; i < len; i++) {
+ String text = filter.process(chars[i]);
+ if(text != null) {
+ processLine(text);
+ }
+ }
+ if(!reader.ready()) {
+ break;
+ }
+ }
+ }
+
+ // sleep for a while when the stream is empty
+ try {
+ if (ignoreEof) {
+ // read from file case... not associated with a process...
+ // make sure there is no star
+ io.getErr().close();
+ io.getOut().close();
+ }
+ Thread.sleep(DELAY);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, "I/O exception reading server log", ex); // NOI18N
+ } finally {
+ serverLog.close();
+ if(reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, "I/O exception closing stream buffer", ex); // NOI18N
+ }
+ }
+
+ removeReader(this);
+
+ Thread.currentThread().setName(originalName);
+ }
+ io.getErr().close();
+ io.getOut().close();
+ }
+
+ private void processLine(String line) {
+ if(LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.log(Level.FINEST, "processing text: ''{0}''", line); // NOI18N
+ }
+ // XXX sort of a hack to eliminate specific glassfish messages that
+ // ought not to be printed at their current level (INFO vs FINE+).
+ if(strictFilter && filter(line)) {
+ return;
+ }
+ // Track level, color, listener
+ Message message = new Message(line);
+ message.process(recognizers);
+ message.print();
+ selectIO(false);
+ if (shutdown) {
+ // some messages get processed after the server has 'stopped'
+ // prevent new stars on the output caption.
+ io.getErr().close();
+ io.getOut().close();
+ }
+ }
+
+ private synchronized BufferedReader followLogRotation(
+ BufferedReader reader) {
+ BufferedReader retVal = reader;
+ if (instance != null && instance.getProperties() != null) {
+ FetchLog newServerLog = null;
+ String dir = instance.getProperty(PayaraModule.DOMAINS_FOLDER_ATTR);
+ if (null == dir) {
+ // this log cannot rotate... it isn't based on a file
+ return retVal;
+ }
+ try {
+ newServerLog = getServerLogStream(instance);
+ if (serverLog.getInputStream() instanceof FileInputStream
+ && newServerLog.getInputStream()
+ instanceof FileInputStream) {
+ FileInputStream fis = (FileInputStream)newServerLog
+ .getInputStream();
+ long newSize = fis.getChannel().size();
+ long oldSize = ((FileInputStream)serverLog
+ .getInputStream()).getChannel().size();
+ if (oldSize != newSize) {
+ retVal = new BufferedReader(new InputStreamReader(
+ newServerLog.getInputStream()));
+ serverLog.close();
+ serverLog = newServerLog;
+ }
+ }
+ } catch (IOException ioe) {
+ Logger.getLogger("payara").log(Level.WARNING, null, ioe);
+ } finally {
+ if (null != newServerLog && !(newServerLog == serverLog)) {
+ newServerLog.close();
+ }
+ }
+ }
+ return retVal;
+ }
+ }
+
+ private static final Pattern COLOR_PATTERN = Pattern.compile(
+ "\\033\\[([\\d]{1,3})(?:;([\\d]{1,3}))?(?:;([\\d]{1,3}))?(?:;([\\d]{1,3}))?(?:;([\\d]{1,3}))?m"); // NOI18N
+
+ private static final Color LOG_RED = new Color(204, 0, 0);
+ private static final Color LOG_GREEN = new Color(0, 192, 0);
+ private static final Color LOG_YELLOW = new Color(204, 204, 0);
+ private static final Color LOG_BLUE = Color.BLUE;
+ private static final Color LOG_MAGENTA = new Color(204, 0, 204);
+ private static final Color LOG_CYAN = new Color(0, 153, 255);
+
+ private static final Color [] COLOR_TABLE = {
+ Color.BLACK, LOG_RED, LOG_GREEN, LOG_YELLOW, LOG_BLUE, LOG_MAGENTA, LOG_CYAN,
+ };
+
+ private class Message {
+
+ private String message;
+ private int level;
+ private Color color;
+ private OutputListener listener;
+
+ public Message(String line) {
+ message = line;
+ }
+
+ void process(List<Recognizer> recognizers) {
+ processLevel();
+ processColors();
+ processRecognizers(recognizers);
+ }
+
+ private void processLevel() {
+ level = 0;
+ int colon = message.substring(0, Math.min(message.length(), 15)).indexOf(':');
+ if(colon != -1) {
+ try {
+ String levelPrefix = message.substring(0, colon);
+ level = Level.parse(levelPrefix).intValue();
+ } catch(IllegalArgumentException ex) {
+ }
+ }
+ }
+
+ private void processColors() {
+ try {
+ Matcher matcher = COLOR_PATTERN.matcher(message);
+ boolean result = matcher.find();
+ if(result) {
+ StringBuffer sb = new StringBuffer(message.length());
+ do {
+ int count = matcher.groupCount();
+ for(int i = 1; i < count && matcher.group(i) != null; i++) {
+ int code = Integer.parseInt(matcher.group(i));
+ if(code >= 30 && code <= 36 && color == null) {
+ color = COLOR_TABLE[code - 30];
+ }
+ }
+ matcher.appendReplacement(sb, "");
+ result = matcher.find();
+ } while(result);
+ matcher.appendTail(sb);
+ message = sb.toString();
+ }
+ } catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ if(color == null && level > 0) {
+ if(level <= Level.FINE.intValue()) {
+ color = LOG_GREEN;
+ } else if(level <= Level.INFO.intValue()) {
+ color = Color.GRAY;
+ }
+ }
+ }
+
+ private void processRecognizers(List<Recognizer> recognizers) {
+ // Don't run recognizers on excessively long lines
+ if(message.length() > 500) {
+ return;
+ }
+ Iterator<Recognizer> iterator = recognizers.iterator();
+ while(iterator.hasNext() && listener == null) {
+ Recognizer r = iterator.next();
+ try {
+ listener = r.processLine(message);
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, "Recognizer " + r.getClass().getName() + " generated an exception.", ex);
+ }
+ }
+ }
+
+ void print() {
+ OutputWriter writer = getWriter(level >= 900);
+ try {
+ if(color != null && listener == null && IOColorLines.isSupported(io)) {
+ message = stripNewline(message);
+ IOColorLines.println(io, message, color);
+ } else if(writer != null) {
+ if(listener != null) {
+ message = stripNewline(message);
+ writer.println(message, listener, false);
+ } else {
+ writer.print(message);
+ }
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.FINE, ex.getLocalizedMessage(), ex);
+ }
+ }
+
+ }
+
+ private boolean filter(String line) {
+ return line.startsWith("INFO: Started bundle ")
+ || line.startsWith("INFO: Stopped bundle ")
+ || line.startsWith("INFO: ### ")
+ || line.startsWith("felix.")
+ || line.startsWith("log4j:")
+ ;
+ }
+
+ private static String stripNewline(String s) {
+ int len = s.length();
+ if(len > 0 && '\n' == s.charAt(len-1)) {
+ s = s.substring(0, len-1);
+ }
+ return s;
+ }
+
+ private static interface Filter {
+
+ public String process(char c);
+
+ }
+
+ private static abstract class StateFilter implements Filter {
+
+ protected String message;
+
+ protected int state;
+ protected StringBuilder msg;
+
+ StateFilter() {
+ state = 0;
+ msg = new StringBuilder(128);
+ }
+
+ protected void reset() {
+ message = ""; // NOI18N
+ }
+
+ @Override
+ public abstract String process(char c);
+
+ }
+
+ private static final class StreamFilter extends StateFilter {
+
+ private static final Pattern MESSAGE_PATTERN = Pattern.compile("([\\p{Lu}]{0,16}?):|([^\\r\\n]{0,24}?\\d\\d?:\\d\\d?:\\d\\d?)"); // NOI18N
+
+ private String line;
+
+ public StreamFilter() {
+ reset();
+ }
+
+ @Override
+ protected void reset() {
+ super.reset();
+ line = ""; // NOI18N
+ }
+
+ /**
+ * Payara server log format, when read from process stream:
+ *
+ * Aug 13, 2008 3:01:49 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
+ * INFO: Launching Payara on Apache Felix OSGi platform
+ * Aug 13, 2008 3:01:50 PM com.sun.enterprise.glassfish.bootstrap.ASMainHelper setUpOSGiCache
+ * INFO: Removing Felix cache profile dir /space/tools/v3Aug7/domains/domain1/.felix/gf left from a previous run
+ *
+ * Welcome to Felix.
+ * =================
+ *
+ * Aug 13, 2008 3:01:51 PM HK2Main start
+ * INFO: contextRootDir = /space/tools/v3Aug7/modules
+ * ...
+ * Aug 13, 2008 3:02:14 PM
+ * SEVERE: Exception in thread "pool-6-thread-1"
+ * Aug 13, 2008 3:02:14 PM org.glassfish.scripting.rails.RailsDeployer load
+ * INFO: Loading application RailsGFV3 at /RailsGFV3
+ * Aug 13, 2008 3:02:14 PM
+ * SEVERE: /...absolute.path.../connection_specification.rb:232:in `establish_connection':
+ *
+ * !PW FIXME This parser should be checked for I18N stability.
+ */
+ @Override
+ public String process(char c) {
+ String result = null;
+
+ if(c == '\n') {
+ if(msg.length() > 0) {
+ msg.append(c);
+ line = msg.toString();
+ msg.setLength(0);
+
+ Matcher matcher = MESSAGE_PATTERN.matcher(line);
+ if(matcher.find() && matcher.start() == 0 && matcher.groupCount() > 1 && matcher.group(2) != null) {
+ result = null;
+ } else {
+ result = line;
+ }
+ }
+ } else if(c != '\r') {
+ msg.append(c);
+ }
+
+ return result;
+ }
+
+ }
+
+ private static final class LogFileFilter extends StateFilter {
+
+ private String time;
+ private String type;
+ private String version;
+ private String classinfo;
+ private String threadinfo;
+ private boolean multiline;
+ private final Map<String, String> typeMap;
+
+ public LogFileFilter(Map<String, String> typeMap) {
+ this.typeMap = typeMap;
+ reset();
+ }
+
+ @Override
+ protected void reset() {
+ super.reset();
+ time = type = version = classinfo = threadinfo = ""; // NOI18N
+ multiline = false;
+ }
+
+ private String getLocalizedType(String type) {
+ String localizedType = typeMap.get(type);
+ return localizedType != null ? localizedType : type;
+ }
+
+ /**
+ * Payara server log entry format (unformatted), when read from file:
+ *
+ * [#|
+ * 2008-07-20T16:59:11.738-0700|
+ * INFO|
+ * Payara10.0|
+ * org.jvnet.hk2.osgiadapter|
+ * _ThreadID=11;_ThreadName=Thread-6;org.glassfish.admin.config-api [1794];|
+ * Started bundle org.glassfish.admin.config-api [1794]
+ * |#]
+ *
+ * !PW FIXME This parser should be checked for I18N stability.
+ */
+ @Override
+ public String process(char c) {
+ String result = null;
+
+ switch(state) {
+ case 0:
+ if(c == '[') {
+ state = 1;
+ } else {
+ if(c == '\n') {
+ if(msg.length() > 0) {
+ msg.append(c);
+ result = msg.toString();
+ msg.setLength(0);
+ }
+ } else if(c != '\r') {
+ msg.append(c);
+ }
+ }
+ break;
+ case 1:
+ if(c == '#') {
+ state = 2;
+ } else {
+ state = 0;
+ if(c == '\n') {
+ if(msg.length() > 0) {
+ msg.append(c);
+ result = msg.toString();
+ msg.setLength(0);
+ }
+ } else if(c != '\r') {
+ msg.append('[');
+ msg.append(c);
+ }
+ }
+ break;
+ case 2:
+ if(c == '|') {
+ state = 3;
+ msg.setLength(0);
+ } else {
+ if(c == '\n') {
+ if(msg.length() > 0) {
+ msg.append(c);
+ result = msg.toString();
+ msg.setLength(0);
+ }
+ } else if(c != '\r') {
+ state = 0;
+ msg.append('[');
+ msg.append('#');
+ msg.append(c);
+ }
+ }
+ break;
+ case 3:
+ if(c == '|') {
+ state = 4;
+ time = msg.toString();
+ msg.setLength(0);
+ } else {
+ msg.append(c);
+ }
+ break;
+ case 4:
+ if(c == '|') {
+ state = 5;
+ type = getLocalizedType(msg.toString());
+ msg.setLength(0);
+ } else {
+ msg.append(c);
+ }
+ break;
+ case 5:
+ if(c == '|') {
+ state = 6;
+ version = msg.toString();
+ msg.setLength(0);
+ } else {
+ msg.append(c);
+ }
+ break;
+ case 6:
+ if(c == '|') {
+ state = 7;
+ classinfo = msg.toString();
+ msg.setLength(0);
+ } else {
+ msg.append(c);
+ }
+ break;
+ case 7:
+ if(c == '|') {
+ state = 8;
+ threadinfo = msg.toString();
+ msg.setLength(0);
+ } else {
+ msg.append(c);
+ }
+ break;
+ case 8:
+ if(c == '|') {
+ state = 9;
+ message = msg.toString();
+ } else if(c == '\n') {
+ if(msg.length() > 0) { // suppress blank lines in multiline messages
+ msg.append('\n');
+ result = !multiline ? type + ": " + msg.toString() : msg.toString(); // NOI18N
+ multiline = true;
+ msg.setLength(0);
+ }
+ } else if(c != '\r') {
+ msg.append(c);
+ }
+ break;
+ case 9:
+ if(c == '#') {
+ state = 10;
+ } else {
+ state = 8;
+ msg.append('|');
+ msg.append(c);
+ }
+ break;
+ case 10:
+ if(c == ']') {
+ state = 0;
+ msg.setLength(0);
+ result = (multiline ? message : type + ": " + message) + '\n'; // NOI18N
+ reset();
+ } else {
+ state = 8;
+ msg.append('|');
+ msg.append('#');
+ msg.append(c);
+ }
+ break;
+ }
+ return result;
+ }
+ }
+
+ private static final WeakHashMap<ServerInstance, InputOutput> ioWeakMap =
+ new WeakHashMap<ServerInstance, InputOutput>();
+
+ public static InputOutput getServerIO(String uri) {
+
+ ServerInstance si = PayaraInstanceProvider.getInstanceByUri(uri);
+ if(null == si) {
+ return null;
+ }
+
+ synchronized (ioWeakMap) {
+ // look in the cache
+ InputOutput serverIO = ioWeakMap.get(si);
+ if(serverIO != null) {
+ boolean valid = true;
+ if(serverIO.isClosed()) {
+ if(LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Output window for {0} is closed.", uri); // NOI18N
+ }
+ }
+ if(serverIO.getOut().checkError()) {
+ if(LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Standard out for {0} is in error state.", uri); // NOI18N
+ }
+ valid = false;
+ }
+ if(serverIO.getErr().checkError()) {
+ if(LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Standard error for {0} is in error state.", uri); // NOI18N
+ }
+ valid = false;
+ }
+
+ if(valid) {
+ return serverIO;
+ } else {
+ if(!serverIO.isClosed()) {
+ serverIO.closeInputOutput();
+ }
+ ioWeakMap.put(si, null);
+ }
+ }
+ }
+
+ // look up the node that belongs to the given server instance
+ Node node = si.getFullNode();
+
+ // it looks like that the server instance has been removed
+ if (node == null) {
+ return null;
+ }
+
+ // No server control interface...
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport == null) {
+ return null;
+ }
+
+ Action[] actions = new Action[] {
+ new StartServerAction.OutputAction(commonSupport),
+ new DebugAction.OutputAction(commonSupport),
+ new RestartAction.OutputAction(commonSupport),
+ new StopServerAction.OutputAction(commonSupport),
+ new RefreshAction.OutputAction(commonSupport)
+ };
+
+ InputOutput newIO;
+ synchronized (ioWeakMap) {
+ newIO = ioWeakMap.get(si);
+ if(newIO == null) {
+ newIO = IOProvider.getDefault().getIO(si.getDisplayName(), actions);
+ ioWeakMap.put(si, newIO);
+ }
+ }
+ return newIO;
+ }
+
+ static public void displayOutput(PayaraInstance instance, Lookup lookup) {
+ String uri = instance.getProperty(PayaraModule.URL_ATTR);
+ if (null != uri && (uri.contains("pfv3ee6wc") || uri.contains("localhost"))) {
+ FetchLog log = getServerLogStream(instance);
+ LogViewMgr mgr = LogViewMgr.getInstance(uri);
+ List<Recognizer> recognizers = new ArrayList<Recognizer>();
+ if (null != lookup) {
+ recognizers = getRecognizers(lookup.lookupAll(RecognizerCookie.class));
+ }
+ mgr.ensureActiveReader(recognizers, log, instance);
+ mgr.selectIO(true);
+ }
+ }
+
+ static private List<Recognizer> getRecognizers(Collection<? extends RecognizerCookie> cookies) {
+ List<Recognizer> recognizers;
+ if(!cookies.isEmpty()) {
+ recognizers = new LinkedList<Recognizer>();
+ for(RecognizerCookie cookie: cookies) {
+ recognizers.addAll(cookie.getRecognizers());
+ }
+ recognizers = Collections.unmodifiableList(recognizers);
+ } else {
+ recognizers = Collections.emptyList();
+ }
+ return recognizers;
+ }
+
+ /**
+ * Log fetcher state change listener.
+ */
+ private static class LogStateListener implements FetchLogEventListener {
+
+ /** Payara server instance associated with log fetcher
+ * and it's state change listener. */
+ private final PayaraInstance instance;
+
+ /** Log fetcher associated with log fetcher state change listener. */
+ private final FetchLogPiped log;
+
+ /**
+ * Creates an instance of log fetcher state change listener.
+ * @param instance Payara server instance associated with log fetcher
+ * and it's state change listener.
+ * @param log Log fetcher associated with log fetcher state change
+ * listener.
+ */
+ LogStateListener(PayaraInstance instance, FetchLogPiped log) {
+ this.instance = instance;
+ this.log = log;
+ }
+
+ /**
+ * Remove log fetcher from instance to log fetcher mapping
+ * when log fetcher task is finished or has failed.
+ * <p/>
+ * @param event Payara log fetcher state change event.
+ */
+ @Override
+ public void stateChanged(final FetchLogEvent event) {
+ switch (event.getState()) {
+ case COMPLETED: case FAILED:
+ FetchLog oldLog = null;
+ synchronized (serverInputStreams) {
+ FetchLog storedLog = serverInputStreams.get(instance);
+ if (this.log.equals(storedLog)) {
+ oldLog = serverInputStreams.remove(instance);
+ }
+ }
+ if (oldLog != null) {
+ oldLog.close();
+ }
+ }
+ }
+
+ }
+
+ /** Internal Payara server instance to log fetcher mapping.*/
+ private static final Map<PayaraInstance, FetchLog> serverInputStreams
+ = new HashMap<PayaraInstance, FetchLog>();
+
+ /**
+ * Add log fetcher into local instance to fetcher mapping.
+ * <p/>
+ * Log fetcher life cycle is linked with internal fetcher mapping. Fetcher
+ * removed from map must be cleaned up.
+ * Do not access internal Payara server instance to log fetcher mapping
+ * without using those access methods!
+ * <p/>
+ * @param instance Payara server instance used as key in local
+ * instance to fetcher mapping.
+ * @param log New Payara log fetcher for given server instance
+ * to be stored into mapping.
+ */
+ private static void addLog(final PayaraInstance instance,
+ final FetchLogPiped log) {
+ FetchLog oldLog;
+ synchronized (serverInputStreams) {
+ oldLog = serverInputStreams.put(instance, log);
+ }
+ log.addListener(new LogStateListener(instance, log));
+ if (oldLog != null) {
+ oldLog.close();
+ }
+ }
+
+ /**
+ * Remove log fetcher from local instance to fetcher mapping.
+ * <p/>
+ * Log fetcher life cycle is linked with internal fetcher mapping. Fetcher
+ * removed from map must be cleaned up.
+ * Do not access internal Payara server instance to log fetcher mapping
+ * without using those access methods!
+ * <p/>
+ * @param instance Payara server instance used as key in local
+ * instance to fetcher mapping.
+ * @param log New Payara log fetcher for given server instance
+ * to be stored into mapping.
+ */
+ public static void removeLog(final PayaraInstance instance) {
+ FetchLog oldLog;
+ synchronized (serverInputStreams) {
+ oldLog = serverInputStreams.remove(instance);
+ }
+ if (oldLog != null) {
+ oldLog.close();
+ }
+ }
+
+ /**
+ * Get Payara stored log fetcher for given server instance.
+ * <p/>
+ * Payara log fetchers are reused so only one log fetcher exists for
+ * each running server instance.
+ * <p/>
+ * @param instance Payara server instance used as key to retrieve
+ * log fetcher.
+ * @return Payara log fetcher stored for given server instance or newly
+ * cerated one when no log fetcher was found.
+ * @throws IOException
+ */
+ static private FetchLog getServerLogStream(
+ final PayaraInstance instance) {
+ FetchLog log;
+ FetchLog deadLog = null;
+ synchronized (serverInputStreams) {
+ log = serverInputStreams.get(instance);
+ if (log != null) {
+ if (log instanceof FetchLogPiped) {
+ // Log reading task in running state
+ if (((FetchLogPiped) log).isRunning()) {
+ return log;
+ // Log reading task is dead
+ } else {
+ // Postpone cleanup after synchronized block.
+ deadLog = log;
+ removeLog(instance);
+ }
+ } else {
+ return log;
+ }
+ }
+ log = FetchLogPiped.create(
+ PayaraExecutors.fetchLogExecutor(), instance);
+ addLog(instance, (FetchLogPiped)log);
+ }
+ if (deadLog != null) {
+ deadLog.close();
+ }
+ return log;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/NoopTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/NoopTask.java
new file mode 100644
index 0000000..4e8636f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/NoopTask.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+
+/**
+ * Empty command execution.
+ * <p/>
+ * Running this task does nothing.
+ * <p/>
+ * @author vkraemer
+ */
+class NoopTask extends BasicTask<TaskState> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of empty command execution class.
+ * <p/>
+ * @param serverSupport Payara server
+ * @param stopServerListener
+ * @param stateListener
+ */
+ public NoopTask(CommonServerSupport serverSupport,
+ TaskStateListener stopServerListener,
+ TaskStateListener stateListener) {
+ super(serverSupport.getInstance(), stopServerListener, stateListener);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Callable call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Executes nothing on remote Payara instance.
+ * <p/>
+ * @return Always returns <code>OperationState.COMPLETED</code> value.
+ */
+ @Override
+ public TaskState call() {
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED, "MSG_NOOP");
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PartialCompletionException.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PartialCompletionException.java
new file mode 100644
index 0000000..c465227
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PartialCompletionException.java
@@ -0,0 +1,42 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common;
+
+/**
+ *
+ * @author vbk
+ */
+public class PartialCompletionException extends Exception {
+
+ private String failedUpdates;
+
+ public PartialCompletionException(String itemsNotUpdated) {
+ //throw new UnsupportedOperationException("Not yet implemented");
+ failedUpdates = itemsNotUpdated;
+ }
+
+ @Override
+ public String getMessage() {
+ return org.openide.util.NbBundle.getMessage(PartialCompletionException.class, "MSG_FAILED_TO_UPDATE", new Object[] {failedUpdates} );
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraExecutors.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraExecutors.java
new file mode 100644
index 0000000..1cf1ca6
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraExecutors.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Executors Payara tasks.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraExecutors {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara log fetchers executor {@see ThreadFactory}.
+ * <p/>
+ * Constructs new threads for Payara log fetcher tasks.
+ */
+ private static final class FetchLogThreadFactory implements ThreadFactory {
+
+ /**
+ * Constructs a new {@see Thread}.
+ * <p/>
+ * @param r A runnable to be executed by new {@see Thread} instance.
+ * @return Constructed thread.
+ */
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(tgLog, r, THREAD_GROUP_NAME_LOG);
+ t.setDaemon(true);
+ return t;
+ }
+ }
+
+ /**
+ * Payara status tasks scheduler {@see ThreadFactory}.
+ * <p/>
+ * Constructs new threads for Payara log fetcher tasks.
+ */
+ private static final class StatusThreadFactory
+ implements java.util.concurrent.ThreadFactory {
+
+ /**
+ * Constructs a new {@see Thread}.
+ * <p/>
+ * @param r A runnable to be executed by new {@see Thread} instance.
+ * @return Constructed thread.
+ */
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(tgStat, r, THREAD_GROUP_NAME_STAT);
+ t.setDaemon(true);
+ return t;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Top level thread group name. */
+ private static final String THREAD_GROUP_NAME_TOP = "Payara";
+
+ /** Log reader thread group name. */
+ private static final String THREAD_GROUP_NAME_LOG = "Log Reader";
+
+ /** Log reader thread group name. */
+ private static final String THREAD_GROUP_NAME_STAT = "Status Task";
+
+ /** Top level thread group. */
+ private static final ThreadGroup tgTop = initTgTop();
+
+ /** Thread group for log readers tasks executor. */
+ private static final ThreadGroup tgLog = initTgLog();
+
+ /** Thread group for server status checking tasks executor. */
+ private static final ThreadGroup tgStat = initTgStat();
+
+ /** Minimal number of Payara log fetchers executor threads in thread
+ * pool. */
+ private static final int FETCH_LOG_EXECUTOR_POOL_MIN_SIZE = 1;
+
+ /** Default maximum number of Payara log fetchers executor threads
+ * in thread pool. */
+ private static final int FETCH_LOG_EXECUTOR_POOL_MAX_SIZE
+ = Integer.MAX_VALUE;
+
+ /** Inactive Threads keep alive time [ms] in Payara log fetchers executor
+ * thread pool. */
+ private static final long FETCH_LOG_EXECUTOR_POOL_KEEPALIVE_TIME = 0;
+
+ /**
+ * Payara log fetchers executor.
+ */
+ private static final ThreadPoolExecutor fetchLogExecutor
+ = new ThreadPoolExecutor(
+ FETCH_LOG_EXECUTOR_POOL_MIN_SIZE,
+ FETCH_LOG_EXECUTOR_POOL_MAX_SIZE,
+ FETCH_LOG_EXECUTOR_POOL_KEEPALIVE_TIME,
+ TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<Runnable>(),
+ new FetchLogThreadFactory());
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods - class attributes initializers //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize top level {@see ThreadGroup} object for threads being created
+ * in thread factories.
+ * <p/>
+ * @return {@see ThreadGroup} object for threads being created
+ * in this factory.
+ */
+ private static ThreadGroup initTgTop() {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ if (tg != null) {
+ ThreadGroup tgParrent;
+ while ((tgParrent = tg.getParent()) != null) {
+ tg = tgParrent;
+ }
+ }
+ return new ThreadGroup(tg, THREAD_GROUP_NAME_TOP);
+ }
+
+ /**
+ * Initialize {@see ThreadGroup} object for threads being created
+ * in thread factory of log readers tasks executor.
+ * <p/>
+ * @return {@see ThreadGroup} object for threads being created
+ * in this factory.
+ */
+ private static ThreadGroup initTgLog() {
+ return new ThreadGroup(tgTop, THREAD_GROUP_NAME_LOG);
+ }
+
+ /**
+ * Initialize {@see ThreadGroup} object for threads being created
+ * in thread factory of server status checking tasks executor.
+ * <p/>
+ * @return {@see ThreadGroup} object for threads being created
+ * in this factory.
+ */
+ private static ThreadGroup initTgStat() {
+ return new ThreadGroup(tgTop, THREAD_GROUP_NAME_STAT);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * {@see ExecutorService} class instance for running log fetchers.
+ * <p/>
+ * Maximum thread pool size is resized when needed to run all threads.
+ * <p/>
+ * @return {@see ExecutorService} class instance for running log fetchers.
+ */
+ public static ExecutorService fetchLogExecutor() {
+ return fetchLogExecutor;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstance.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstance.java
new file mode 100644
index 0000000..1c1963a
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstance.java
@@ -0,0 +1,1771 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JComponent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.data.PayaraAdminInterface;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.keyring.Keyring;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.nodes.Hk2InstanceNode;
+import org.netbeans.modules.payara.common.parser.DomainXMLChangeListener;
+import org.netbeans.modules.payara.common.ui.PayaraPropertiesCustomizer;
+import org.netbeans.modules.payara.common.ui.WarnPanel;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.netbeans.modules.payara.spi.RemoveCookie;
+import org.netbeans.modules.payara.spi.Utils;
+import org.netbeans.spi.server.ServerInstanceFactory;
+import org.netbeans.spi.server.ServerInstanceImplementation;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.LookupEvent;
+import org.openide.util.LookupListener;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ProxyLookup;
+import org.openide.windows.InputOutput;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModuleFactory;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server instance.
+ * <p/>
+ * Represents any Payara server registered in NetBeans.
+ * <p/>
+ * @author Peter Williams, Vince Kraemer, Tomas Kraus
+ */
+public class PayaraInstance implements ServerInstanceImplementation,
+ Lookup.Provider, LookupListener, PayaraServer {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Properties map used to store Payara server properties in Payara
+ * server instance.
+ */
+ public class Props implements Map<String, String> {
+
+ private final Map<String, String> delegate;
+
+ /**
+ * Constructs a new properties map with the same mappings as the
+ * specified <code>Map</code>.
+ * <p/>
+ * The <code>Props</code> is created with default load factor (0.75)
+ * and an initial capacity sufficient to hold the mappings in the
+ * specified <code>Map</code>.
+ * <p/>
+ * @param map Properties <code>Map</code> whose mappings are to be
+ * placed in this map.
+ * @throws NullPointerException if the specified map is null.
+ */
+ public Props(Map<String, String> map) {
+ if (map == null) {
+ throw new NullPointerException("Source Map shall not be null.");
+ }
+ this.delegate = map;
+ }
+
+ @Override
+ public Collection<String> values() {
+ synchronized(delegate) {
+ return Collections.<String>unmodifiableCollection(
+ delegate.values());
+ }
+ }
+
+ @Override
+ public Set<String> keySet() {
+ synchronized(delegate) {
+ return Collections.<String>unmodifiableSet(delegate.keySet());
+ }
+ }
+
+ @Override
+ public Set<Entry<String, String>> entrySet() {
+ synchronized(delegate) {
+ return Collections.<Entry<String, String>>unmodifiableSet(
+ delegate.entrySet());
+ }
+ }
+
+ @Override
+ public int size() {
+ synchronized(delegate) {return delegate.size();}
+ }
+
+ @Override
+ public String remove(Object key) {
+ synchronized(delegate) {return delegate.remove(key);}
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends String> m) {
+ synchronized(delegate) {delegate.putAll(m);}
+ }
+
+ @Override
+ public String put(String key, String value) {
+ if (PayaraModule.PASSWORD_ATTR.equals(key)) {
+ String serverName = get(PayaraModule.DISPLAY_NAME_ATTR);
+ String userName = get(PayaraModule.USERNAME_ATTR);
+ if (serverName != null && userName != null) {
+ Keyring.save(PayaraInstance.passwordKey(
+ serverName, userName), value.toCharArray(),
+ "Payara administrator user password");
+ }
+ }
+ synchronized(delegate) {return delegate.put(key, value);}
+ }
+
+
+ @Override
+ public boolean isEmpty() {
+ synchronized(delegate) {return delegate.isEmpty();}
+ }
+
+ @Override
+ public int hashCode() {
+ synchronized(delegate) {return delegate.hashCode();}
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+ if (o instanceof Map)
+ synchronized(delegate) {return delegate.equals(o);}
+ else
+ return false;
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ synchronized(delegate) {return delegate.containsValue(value);}
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ synchronized(delegate) {return delegate.containsKey(key);}
+ }
+
+ @Override
+ public void clear() {
+ synchronized(delegate) {delegate.clear();}
+ }
+
+ /**
+ * Returns the property value to which the specified property key
+ * is mapped, or <code>null</code> if this map contains no mapping for
+ * the key.
+ * <p/>
+ * @param key Property key used to search for mapped property value.
+ * @return Property value mapped to specified property key
+ * or <code>null</code> if no such property value exists.
+ */
+ @Override
+ public String get(Object key) {
+ if (PayaraModule.PASSWORD_ATTR.equals(key)) {
+ String value;
+ synchronized(delegate) {
+ value = delegate.get(key);
+ }
+ if (value == null) {
+ value = getPasswordFromKeyring(delegate.get(PayaraModule.DISPLAY_NAME_ATTR),
+ delegate.get(PayaraModule.USERNAME_ATTR));
+ synchronized(delegate) {
+ delegate.put((String)key, value);
+ }
+ }
+ return value;
+ } else {
+ synchronized(delegate) {return delegate.get(key);}
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraInstance.class);
+
+ // Reasonable default values for various server parameters. Note, don't use
+ // these unless the server's actual setting cannot be determined in any way.
+ public static final String DEFAULT_HOST_NAME = "localhost"; // NOI18N
+ public static final String DEFAULT_ADMIN_NAME = "admin"; // NOI18N
+ public static final String DEFAULT_ADMIN_PASSWORD = ""; // NOI18N
+ /** Administrator's password being used in old NetBeans. */
+ public static final String OLD_DEFAULT_ADMIN_PASSWORD = "adminadmin"; // NOI18N
+ public static final int DEFAULT_HTTP_PORT = 8080;
+ public static final int DEFAULT_HTTPS_PORT = 8181;
+ public static final int DEFAULT_ADMIN_PORT = 4848;
+ public static final int DEFAULT_DEBUG_PORT = 9009;
+ static final int LOWEST_USER_PORT
+ = org.openide.util.Utilities.isWindows() ? 1 : 1025;
+ public static final String DEFAULT_DOMAINS_FOLDER = "domains"; //NOI18N
+ public static final String DEFAULT_DOMAIN_NAME = "domain1"; // NOI18N
+
+ static final String INSTANCE_FO_ATTR = "InstanceFOPath"; // NOI18N
+
+ /** Payara user account instance key ring name space. */
+ static final String KEYRING_NAME_SPACE="Payara.admin";
+
+ /**
+ * Payara user account instance key ring field separator.
+ * <p/>
+ * Key ring name is constructed in following form:
+ * <field>{'.'<field>}':'<identifier>
+ * e.g. "Payara.cloud.userAccount.userPassword:someUser".
+ */
+ static final String KEYRING_NAME_SEPARATOR=".";
+
+ /**
+ * Payara user account instance key ring identifier separator.
+ * <p/>
+ * Key ring name is constructed in following form:
+ * <field>{'.'<field>}':'<identifier>
+ * e.g. "Payara.cloud.userAccount.userPassword:someUser".
+ */
+ static final String KEYRING_IDENT_SEPARATOR=":";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build key ring identifier for password related to given user name.
+ * <p/>
+ * @param serverName Name of server to add into password key.
+ * @param userName User name of account user who's password will be stored.
+ * @return Key ring identifier for password related to given user name
+ */
+ public static String passwordKey(String serverName, String userName) {
+ StringBuilder pwKey = new StringBuilder(
+ KEYRING_NAME_SPACE.length() + KEYRING_NAME_SEPARATOR.length()
+ + PayaraModule.PASSWORD_ATTR.length()
+ + KEYRING_IDENT_SEPARATOR.length()
+ + (serverName != null ? serverName.length() : 0)
+ + KEYRING_IDENT_SEPARATOR.length()
+ + (userName != null ? userName.length() : 0));
+ pwKey.append(KEYRING_NAME_SPACE);
+ pwKey.append(KEYRING_NAME_SEPARATOR);
+ pwKey.append(PayaraModule.PASSWORD_ATTR);
+ pwKey.append(KEYRING_IDENT_SEPARATOR);
+ pwKey.append(serverName != null ? serverName : "");
+ pwKey.append(KEYRING_IDENT_SEPARATOR);
+ pwKey.append(userName != null ? userName : "");
+ return pwKey.toString();
+ }
+
+ /**
+ * Retrieve password stored in {@see Keyring}.
+ * <p/>
+ * @param serverName Name of server to add into password key.
+ * @param userName User name of account user who's password will be read.
+ * @return
+ */
+ public static String getPasswordFromKeyring(final String serverName,
+ final String userName) {
+ char[] passwordChars = Keyring.read(PayaraInstance.passwordKey(serverName, userName));
+ String value = passwordChars != null
+ ? new String(passwordChars)
+ : DEFAULT_ADMIN_PASSWORD;
+ return value;
+ }
+
+ /**
+ * Find all modules that have NetBeans support, add them to
+ * <code>PayaraInstance<code> local lookup if server supports them.
+ * <p/>
+ * @param instance <code>PayaraInstance<code> local lookup to be updated.
+ */
+ static void updateModuleSupport(PayaraInstance instance) {
+ instance.updateFactories();
+ instance.lookupResult.addLookupListener(instance);
+ }
+
+ /**
+ * Mark this Payara server URL as under construction.
+ * <p/>
+ * Will do nothing if provided <code>url</code> argument
+ * is <code>null</code>.
+ * <p/>
+ * @param url Payara server URL
+ */
+ private static void tagUnderConstruction(String url) {
+ if (url != null) {
+ PayaraInstanceProvider.activeRegistrationSet.add(url);
+ }
+ }
+
+ /**
+ * Remove under construction URL mark from this Payara server.
+ * <p/>
+ * Will do nothing if provided <code>url</code> argument
+ * is <code>null</code>.
+ * <p/>
+ * @param url Payara server URL
+ */
+ private static void untagUnderConstruction(String url) {
+ if (url != null) {
+ PayaraInstanceProvider.activeRegistrationSet.remove(url);
+ }
+ }
+
+ /**
+ * Creates a PayaraInstance object for a server installation. This
+ * instance should be added to the the provider registry if the caller wants
+ * it to be persisted for future sessions or searchable.
+ * <p/>
+ * @param displayName Display name for this server instance.
+ * @param installRoot Payara installation root directory.
+ * @param payaraRoot Payara server home directory.
+ * @param domainsDir Payara server domains directory.
+ * @param domainName Payara server registered domain name.
+ * @param httpPort Payara server HTTP port for applications.
+ * @param adminPort Payara server HTTP port for administration.
+ * @param userName Payara server administrator's user name.
+ * @param password Payara server administrator's password.
+ * @param url Payara server URL (Java EE SPI unique identifier).
+ * @param pip Payara instance provider.
+ * @return PayaraInstance object for this server instance.
+ */
+ public static PayaraInstance create(String displayName,
+ String installRoot, String payaraRoot, String domainsDir,
+ String domainName, int httpPort, int adminPort,
+ String userName, String password, String target, String url,
+ PayaraInstanceProvider pip) {
+ Map<String, String> ip = new HashMap<>();
+ ip.put(PayaraModule.DISPLAY_NAME_ATTR, displayName);
+ ip.put(PayaraModule.INSTALL_FOLDER_ATTR, installRoot);
+ ip.put(PayaraModule.PAYARA_FOLDER_ATTR, payaraRoot);
+ ip.put(PayaraModule.DOMAINS_FOLDER_ATTR, domainsDir);
+ ip.put(PayaraModule.DOMAIN_NAME_ATTR, domainName);
+ ip.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));
+ ip.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));
+ ip.put(PayaraModule.TARGET_ATTR, target);
+ ip.put(PayaraModule.USERNAME_ATTR,
+ userName != null
+ ? userName : DEFAULT_ADMIN_NAME);
+ if (password != null) {
+ ip.put(PayaraModule.PASSWORD_ATTR, password);
+ }
+ ip.put(PayaraModule.URL_ATTR, url);
+ // extract the host from the URL
+ String[] bigUrlParts = url.split("]");
+ if (null != bigUrlParts && bigUrlParts.length > 1) {
+ String[] urlParts = bigUrlParts[1].split(":"); // NOI18N
+ if (null != urlParts && urlParts.length > 2) {
+ ip.put(PayaraModule.HOSTNAME_ATTR, urlParts[2]);
+ ip.put(PayaraModule.HTTPHOST_ATTR, urlParts[2]);
+ }
+ }
+ return create(ip, pip, true);
+ }
+
+ /**
+ * Constructs an instance of Payara instance data object and initializes
+ * it.
+ * <p/>
+ * @param ip Payara instance properties.
+ * @param pip Payara instance provider.
+ * @param updateNow Trigger lookup update.
+ * @return Initialized Payara instance data object.
+ */
+ public static PayaraInstance create(Map<String, String> ip,
+ PayaraInstanceProvider pip, boolean updateNow) {
+ String deployerUri = ip.get(PayaraModule.URL_ATTR);
+ PayaraInstance instance = null;
+ PayaraVersion version = ServerUtils.getServerVersion(ip.get(PayaraModule.PAYARA_FOLDER_ATTR));
+ try {
+ instance = new PayaraInstance(ip, version, pip, updateNow);
+ tagUnderConstruction(deployerUri);
+ if (!instance.isPublicAccess()) {
+ instance.ic.add(instance.commonSupport);
+ instance.allowPublicAccess();
+ }
+ if (updateNow) {
+ updateModuleSupport(instance);
+ }
+ } finally {
+ untagUnderConstruction(deployerUri);
+ }
+ LOGGER.log(Level.INFO,
+ "Created Payara Server {0} instance with name {1}",
+ new String[] {version != null ? version.toString() : "null",
+ instance != null ? instance.getName() : "null"});
+ return instance;
+ }
+
+ /**
+ * Constructs an instance of Payara instance data object and initializes
+ * it.
+ * <p/>
+ * Lookup update will be done by default.
+ * <p/>
+ * @param ip Payara instance properties.
+ * @param pip Payara instance provider.
+ * @param updateNow Trigger lookup update.
+ * @return Initialized Payara instance data object.
+ */
+ public static PayaraInstance create(Map<String, String> ip,
+ PayaraInstanceProvider pip) {
+ return create(ip, pip, true);
+ }
+
+ /**
+ * Add new <code>String</code> storedValue into <code>Map</code> when storedValue
+ * with specified key does not exist.
+ * <p/>
+ * @param map Map to be checked and updated.
+ * @param key Key used to search for already existing storedValue.
+ * @param value Value to be added when nothing is found.
+ * @return Value stored in <code>Map</code> or <code>value</code> argument
+ * when no value was stored int the <code>Map</code>
+ */
+ private static String updateString(Map<String, String> map, String key,
+ String value) {
+ String result = map.get(key);
+ if(result == null) {
+ map.put(key, value);
+ result = value;
+ }
+ return result;
+ }
+
+ /**
+ * Add new <code>Integer</code> storedValue into <code>Map</code> when storedValue
+ * with specified key does not exist.
+ * <p/>
+ * @param map Map to be checked and updated.
+ * @param key Key used to search for already existing storedValue.
+ * @param value Value to be added when nothing is found.
+ * @return Value stored in <code>Map</code> or <code>value</code> argument
+ * when no value was stored int the <code>Map</code>
+ */
+ private static int updateInt(Map<String, String> map, String key, int value) {
+ int result;
+ String storedValue = map.get(key);
+ try {
+ // Throws NumberFormatException also when storedValue is null.
+ result = Integer.parseInt(storedValue);
+ } catch(NumberFormatException ex) {
+ map.put(key, Integer.toString(value));
+ result = value;
+ }
+ return result;
+ }
+
+ /**
+ * Check if given Payara instance properties keys should be filtered
+ * when persisting Payara instance.
+ * <p/>
+ * @param key Payara instance properties key to be checked.
+ * @return Value of <code>true</code> when property with given key shall not
+ * be persisted or <code>false</code> otherwise.
+ */
+
+ private static boolean filterKey(String key) {
+ return INSTANCE_FO_ATTR.equals(key);
+ }
+
+ /**
+ * Fix attributes being imported from old NetBeans.
+ * <p/>
+ * Password for local server is changed from <code>"adminadmin"</code>
+ * to <code>""</code>.
+ * Fixed attributes are marked with new property to avoid multiple fixes
+ * in the future.
+ * <p/>
+ * Argument <code>ip</code> shall not be <code>null</code>.
+ * <p/>
+ * @param ip Instance properties <code>Map</code>.
+ * @param fo Instance file object.
+ */
+ private static void fixImportedAttributes(Map<String, String> ip,
+ FileObject fo) {
+ if (!ip.containsKey(PayaraModule.NB73_IMPORT_FIXED)) {
+ String password = ip.get(PayaraModule.PASSWORD_ATTR);
+ if (password != null) {
+ boolean local
+ = ip.get(PayaraModule.DOMAINS_FOLDER_ATTR) != null;
+ if (local && PayaraInstance.OLD_DEFAULT_ADMIN_PASSWORD
+ .equals(password)) {
+ if (PayaraInstance.DEFAULT_ADMIN_PASSWORD == null
+ || PayaraInstance
+ .DEFAULT_ADMIN_PASSWORD.length() == 0) {
+ ip.remove(PayaraModule.PASSWORD_ATTR);
+ } else {
+ ip.put(PayaraModule.PASSWORD_ATTR,
+ PayaraInstance.DEFAULT_ADMIN_PASSWORD);
+ }
+ org.netbeans.modules.payara.common.utils.ServerUtils
+ .setStringAttribute(fo,
+ PayaraModule.PASSWORD_ATTR,
+ PayaraInstance.DEFAULT_ADMIN_PASSWORD);
+ }
+ }
+ ip.put(PayaraModule.NB73_IMPORT_FIXED, Boolean.toString(true));
+ }
+ }
+
+ // Password from keyring (PayaraModule.PASSWORD_ATTR) is read on demand
+ // using code in PayaraInstance.Props class.
+ /**
+ * Read Payara server instance data from persistent storage.
+ * <p/>
+ * @param instanceFO Persistent storage file.
+ * @param uriFragment Payara server URI fragment.
+ * @return Payara server instance reconstructed from persistent storage.
+ * @throws IOException
+ */
+ public static PayaraInstance readInstanceFromFile(
+ FileObject instanceFO, boolean autoregistered) throws IOException {
+ PayaraInstance instance = null;
+
+ String installRoot
+ = org.netbeans.modules.payara.common.utils.ServerUtils
+ .getStringAttribute(instanceFO,
+ PayaraModule.INSTALL_FOLDER_ATTR);
+ String payaraRoot
+ = org.netbeans.modules.payara.common.utils.ServerUtils
+ .getStringAttribute(instanceFO,
+ PayaraModule.PAYARA_FOLDER_ATTR);
+
+ // Existing installs may lack "installRoot", but payaraRoot and
+ // installRoot are the same in that case.
+ if(installRoot == null) {
+ installRoot = payaraRoot;
+ }
+ // TODO: Implement better folders content validation.
+ if(org.netbeans.modules.payara.common.utils.ServerUtils
+ .isValidFolder(installRoot)
+ && org.netbeans.modules.payara.common.utils.ServerUtils
+ .isValidFolder(payaraRoot)) {
+ // collect attributes and pass to create()
+ Map<String, String> ip = new HashMap<>();
+ Enumeration<String> iter = instanceFO.getAttributes();
+ while(iter.hasMoreElements()) {
+ String name = iter.nextElement();
+ String value
+ = org.netbeans.modules.payara.common.utils
+ .ServerUtils.getStringAttribute(instanceFO, name);
+ ip.put(name, value);
+ }
+ ip.put(INSTANCE_FO_ATTR, instanceFO.getName());
+ fixImportedAttributes(ip, instanceFO);
+ instance = create(ip,PayaraInstanceProvider.getProvider(), autoregistered);
+ } else {
+ LOGGER.log(Level.FINER,
+ "Payara folder {0} is not a valid install.",
+ instanceFO.getPath()); // NOI18N
+ instanceFO.delete();
+ }
+ return instance;
+ }
+
+ /**
+ * Write Payara server instance data into persistent storage.
+ * <p/>
+ * @param instance Payara server instance to be written.
+ * @throws IOException
+ */
+ public static void writeInstanceToFile(
+ PayaraInstance instance) throws IOException {
+ String payaraRoot = instance.getPayaraRoot();
+ if(payaraRoot == null) {
+ LOGGER.log(Level.SEVERE,
+ NbBundle.getMessage(PayaraInstanceProvider.class,
+ "MSG_NullServerFolder")); // NOI18N
+ return;
+ }
+
+ String url = instance.getDeployerUri();
+
+ // For GFV3 managed instance files
+ {
+ FileObject dir
+ = org.netbeans.modules.payara.common.utils.ServerUtils
+ .getRepositoryDir(PayaraInstanceProvider.getProvider()
+ .getInstancesDirFirstName(), true);
+ FileObject[] instanceFOs = dir.getChildren();
+ FileObject instanceFO = null;
+
+ for (int i = 0; i < instanceFOs.length; i++) {
+ if (url.equals(instanceFOs[i].getAttribute(PayaraModule.URL_ATTR))
+ && !instanceFOs[i].getName().startsWith(PayaraInstanceProvider.PAYARA_AUTOREGISTERED_INSTANCE)) {
+ instanceFO = instanceFOs[i];
+ }
+ }
+
+ if(instanceFO == null) {
+ String name = FileUtil.findFreeFileName(dir, "instance", null); // NOI18N
+ instanceFO = dir.createData(name);
+ }
+
+ Map<String, String> attrMap = instance.getProperties();
+ for(Map.Entry<String, String> entry: attrMap.entrySet()) {
+ String key = entry.getKey();
+ if(!filterKey(key)) {
+ Object currentValue = instanceFO.getAttribute(key);
+ if (null != currentValue && currentValue.equals(entry.getValue())) {
+ // do nothing
+ } else {
+ if (key.equals(PayaraModule.PASSWORD_ATTR)) {
+ String serverName = attrMap.get(PayaraModule.DISPLAY_NAME_ATTR);
+ String userName = attrMap.get(PayaraModule.USERNAME_ATTR);
+ Keyring.save(PayaraInstance.passwordKey(
+ serverName, userName),
+ entry.getValue().toCharArray(),
+ "Payara administrator user password");
+ LOGGER.log(Level.FINEST,
+ "{0} attribute stored in keyring: {1}",
+ new String[] {instance.getDisplayName(),
+ key});
+ } else {
+ instanceFO.setAttribute(key, entry.getValue());
+ LOGGER.log(Level.FINEST,
+ "{0} attribute stored: {1} = {2}",
+ new String[] {instance.getDisplayName(),
+ key, entry.getValue()});
+ }
+ }
+ }
+ }
+ // Remove FO attributes that are no more stored in server instance.
+ for (Enumeration<String> foAttrs = instanceFO.getAttributes(); foAttrs.hasMoreElements(); ) {
+ String foAttr = foAttrs.nextElement();
+ if (!attrMap.containsKey(foAttr)) {
+ instanceFO.setAttribute(foAttr, null);
+ LOGGER.log(Level.FINEST,
+ "{0} attribute deleted: {1}",
+ new String[]{instance.getDisplayName(),
+ foAttr});
+ }
+ }
+
+ instance.putProperty(INSTANCE_FO_ATTR, instanceFO.getName());
+ instance.getCommonSupport().setFileObject(instanceFO);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Server properties
+ private boolean removable = true;
+
+ /** Payara server properties. */
+ private transient Map<String, String> properties;
+
+ /** Payara server version.
+ * <p/>
+ * This is always version of local Payara related to JavaEE platform,
+ * even when registered domain is remote. */
+ private final PayaraVersion version;
+
+ /** Process information of local running server started from IDE.
+ * <p/>
+ * This value shall be <code>null</code> when there is no server started
+ * from IDE running. But <code>null</code> <i>does not mean</i> that server
+ * is not running at all. */
+ private transient volatile Process process;
+
+ /** Configuration changes listener watching <code>domain.xml</code> file. */
+ private transient final DomainXMLChangeListener domainXMLListener;
+
+ private transient InstanceContent ic;
+ private transient Lookup localLookup;
+ private transient Lookup full;
+ private final transient Lookup.Result<PayaraModuleFactory>
+ lookupResult = Lookups.forPath(Util.PF_LOOKUP_PATH).lookupResult(PayaraModuleFactory.class);
+ private transient Collection<? extends PayaraModuleFactory>
+ currentFactories = Collections.emptyList();
+
+ /** Payara server support API for this instance. */
+ private transient final CommonServerSupport commonSupport;
+ // API instance
+ private ServerInstance commonInstance;
+ private PayaraInstanceProvider instanceProvider;
+
+ // GuardedBy("lookupResult")
+ private Node fullNode;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ private PayaraInstance(Map<String, String> ip, PayaraVersion version,
+ PayaraInstanceProvider instanceProvider, boolean prepareProperties) {
+ this.version = version;
+ this.process = null;
+ ic = new InstanceContent();
+ localLookup = new AbstractLookup(ic);
+ full = localLookup;
+ this.instanceProvider = instanceProvider;
+ String domainDirPath = ip.get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ String domainName = ip.get(PayaraModule.DOMAIN_NAME_ATTR);
+ if (null != domainDirPath && null != domainName) {
+ File domainDir = new File(domainDirPath,domainName);
+ PortCollection pc = new PortCollection();
+ if (Util.readServerConfiguration(domainDir, pc)) {
+ ip.put(PayaraModule.ADMINPORT_ATTR,
+ Integer.toString(pc.getAdminPort()));
+ ip.put(PayaraModule.HTTPPORT_ATTR,
+ Integer.toString(pc.getHttpPort()));
+ }
+ domainXMLListener = new DomainXMLChangeListener(this,
+ ServerUtils.getDomainConfigFile(domainDirPath, domainName));
+ } else {
+ domainXMLListener = null;
+ }
+ if (prepareProperties) {
+ this.properties = prepareProperties(ip);
+ } else {
+ this.properties = new Props(ip);
+ }
+ if (!isPublicAccess()) {
+ // Add this instance into local lookup (to find instance from
+ // node lookup).
+ ic.add(this);
+ commonInstance = ServerInstanceFactory.createServerInstance(this);
+ }
+ // Warn when creating instance of unknown version.
+ if (this.version == null) {
+ String installroot = ip.get(PayaraModule.PAYARA_FOLDER_ATTR);
+ String displayName = ip.get(PayaraModule.DISPLAY_NAME_ATTR);
+ WarnPanel.pfUnknownVersionWarning(displayName, installroot);
+ LOGGER.log(Level.INFO, NbBundle.getMessage(PayaraInstance.class,
+ "PayaraInstance.init.versionNull",
+ new String[] {displayName, installroot}));
+ }
+ this.commonSupport = new CommonServerSupport(this);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara properties.
+ * <p/>
+ * @return Payara properties.
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Set Payara properties.
+ * <p/>
+ * @param properties Payara properties to set
+ */
+ public void setProperties(final Props properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Get local <code>Lookup</code> object.
+ * <P/>
+ * Allow to access local lookup object in server support objects (e.g.
+ * <code>CommonServerSupport</code>).
+ * <p/>
+ * @return Local <code>Lookup</code> object.
+ */
+ Lookup localLookup() {
+ return localLookup;
+ }
+
+ /**
+ * Get local instance provider object.
+ * <p/>
+ * Allow to access local instance provider object in server support objects
+ * (e.g. <code>CommonServerSupport</code>).
+ * <p/>
+ * @return Local instance provider object.
+ */
+ public PayaraInstanceProvider getInstanceProvider() {
+ return instanceProvider;
+ }
+
+ /**
+ * Get process information of local running server started from IDE.
+ * <p/>
+ * @return Process information of local running server started from IDE.
+ */
+ public Process getProcess() {
+ return process;
+ }
+
+ /**
+ * Get Payara configuration file <code>domain.xml</code> changes
+ * listener.
+ * <p/>
+ * @return Payara configuration file <code>domain.xml</code> changes
+ * listener.
+ */
+ public DomainXMLChangeListener getDomainXMLChangeListener() {
+ return domainXMLListener;
+ }
+
+ /**
+ * Set process information of local running server started from IDE.
+ * <p/>
+ * @param process Process information of local running server started
+ * from IDE.
+ */
+ public void setProcess(final Process process) {
+ this.process = process;
+ }
+
+ /**
+ * Reset process information of local running server started from IDE.
+ * <p/>
+ * Value of process information of local running server started from IDE
+ * is set to <code>null</code>.
+ */
+ public void resetProcess() {
+ this.process = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters from PayaraServer interface //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara display name stored properties.
+ * <p/>
+ * @return Payara display name.
+ */
+ @Override
+ public String getName() {
+ return properties.get(PayaraModule.DISPLAY_NAME_ATTR);
+ }
+
+ /**
+ * Get Payara server host from stored properties.
+ * <p/>
+ * @return lassFish server host.
+ */
+ @Override
+ public String getHost() {
+ return properties.get(PayaraModule.HOSTNAME_ATTR);
+ }
+
+ /**
+ * Set Payara server host from stored properties.
+ * <p/>
+ * @param host Payara server host to be stored.
+ */
+ public void setHost(final String host) {
+ properties.put(PayaraModule.HOSTNAME_ATTR, host);
+ }
+
+ /**
+ * Get Payara server HTTP port from stored properties.
+ * <p/>
+ * @return Payara server HTTP port.
+ */
+ @Override
+ public int getPort() {
+ return intProperty(PayaraModule.HTTPPORT_ATTR);
+ }
+
+ /**
+ * Set Payara server HTTP port in stored properties.
+ * <p/>
+ * @param httpPort Payara server HTTP port to be stored.
+ * @throws NumberFormatException if <code>httpPort</code> does not contain
+ * valid integer value.
+ */
+ public void setHttpPort(String httpPort) {
+ Integer.parseInt(httpPort);
+ properties.put(PayaraModule.HTTPPORT_ATTR, httpPort);
+ }
+
+ /**
+ * Set Payara server HTTP port in stored properties.
+ * <p/>
+ * @param httpPort Payara server HTTP port to be stored.
+ */
+ public void setHttpPort(int httpPort) {
+ properties.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(httpPort));
+ }
+
+ /**
+ * Get Payara server administration port from stored properties.
+ * <p/>
+ * @return Payara server administration port.
+ */
+ @Override
+ public int getAdminPort() {
+ return intProperty(PayaraModule.ADMINPORT_ATTR);
+ }
+
+ /**
+ * Set Payara server administration port in stored properties.
+ * <p/>
+ * @param adminPort Payara server administration port to be stored.
+ * @throws NumberFormatException if <code>httadminPortpPort</code> does not contain
+ * valid integer value.
+ */
+ public void setAdminPort(String adminPort) {
+ properties.put(PayaraModule.ADMINPORT_ATTR, adminPort);
+ }
+
+ /**
+ * Set Payara server administration port in stored properties.
+ * <p/>
+ * @param adminPort Payara server administration port to be stored.
+ */
+ public void setAdminPort(int adminPort) {
+ properties.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(adminPort));
+ }
+
+ /**
+ * Get Payara server administration user name from stored properties.
+ * <p/>
+ * @return Payara server administration user name.
+ */
+ @Override
+ public String getAdminUser() {
+ return properties.get(PayaraModule.USERNAME_ATTR);
+ }
+
+ /**
+ * Get Payara server administration user's password from
+ * stored properties.
+ * <p/>
+ * @return Payara server administration user's password.
+ */
+ @Override
+ public String getAdminPassword() {
+ return properties.get(PayaraModule.PASSWORD_ATTR);
+ }
+
+ /**
+ * Get Payara server domains folder from stored properties.
+ * <p/>
+ * @return Payara server domains folder.
+ */
+ @Override
+ public String getDomainsFolder() {
+ return properties.get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ }
+
+ /**
+ * Set Payara server domains folder into stored properties.
+ * <p/>
+ * @param domainsFolder Payara server domains folder.
+ * @return Previous value of domains folder or <code>null</code> if there
+ * was no value of domains folder stored.
+ */
+ public String setDomainsFolder(String domainsFolder) {
+ return properties.put(PayaraModule.DOMAINS_FOLDER_ATTR,
+ domainsFolder);
+ }
+
+ /**
+ * Set Payara server domain name from stored properties.
+ * <p/>
+ * @param domainsFolder Payara server domain name.
+ */
+ @Override
+ public String getDomainName() {
+ return properties.get(PayaraModule.DOMAIN_NAME_ATTR);
+ }
+
+ /**
+ * Get Payara server target in domain (cluster or standalone
+ * server name).
+ * <p/>
+ * @return Payara server target in domain (cluster or standalone
+ * server name).
+ */
+ public String getTarget() {
+ return properties.get(PayaraModule.TARGET_ATTR);
+ }
+
+ /**
+ * Set Payara server target in domain (cluster or standalone
+ * server name).
+ * <p/>
+ * @param target Payara server target in domain (cluster or standalone
+ * server name).
+ * @return Previous value of target or <code>null</code> if there
+ * was no value of domains folder stored.
+ */
+ public String setTarget(final String target) {
+ return properties.put(PayaraModule.TARGET_ATTR, target);
+ }
+
+ /**
+ * Get Payara server URL from stored properties.
+ * <p/>
+ * @return Payara server URL.
+ */
+ @Override
+ public String getUrl() {
+ return properties.get(PayaraModule.URL_ATTR);
+ }
+
+ /**
+ * Get Payara server home.
+ * <p/>
+ * @return Server home.
+ */
+ @Override
+ public String getServerHome() {
+ return properties.get(PayaraModule.PAYARA_FOLDER_ATTR);
+ }
+
+ /**
+ * Get Payara server installation root.
+ * <p/>
+ * @return Server installation root.
+ */
+ @Override
+ public String getServerRoot() {
+ return properties.get(PayaraModule.INSTALL_FOLDER_ATTR);
+ }
+
+ /**
+ * Get Payara server version.
+ * <p/>
+ * This is always version of local Payara related to JavaEE platform,
+ * even when registered domain is remote.
+ * <p/>
+ * @return Payara server version or <code>null</code> when version is
+ * not known.
+ */
+ @Override
+ public PayaraVersion getVersion() {
+ return version;
+ }
+
+ /**
+ * Get Payara server administration interface type.
+ * <p/>
+ * @return Payara server administration interface type.
+ */
+ @Override
+ public PayaraAdminInterface getAdminInterface() {
+// if (version.ordinal() < PayaraVersion.PF_4.ordinal())
+ return PayaraAdminInterface.HTTP;
+// else
+// return PayaraAdminInterface.REST;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get information if this Payara server instance is local or remote.
+ * <p/>
+ * Local Payara server instance has domains folder attribute set while
+ * remote does not.
+ * <p/>
+ * @return Value of <code>true</code> when this Payara server instance
+ * is remote or <code>false</code> otherwise.
+ */
+ @Override
+ public boolean isRemote() {
+ return properties.get(PayaraModule.DOMAINS_FOLDER_ATTR) == null;
+ }
+
+ /**
+ * Returns property value to which the specified <code>key</code> is mapped,
+ * or <code>null</code> if this map contains no mapping for the
+ * <code>key</code>.
+ * <p/>
+ * @param key Payara property <code>key</code>.
+ * @return Payara property or <code>null</code> if no value with
+ * given <code>key</code> is stored.
+ */
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ /**
+ * Associates the specified <code>value</code> with the specified
+ * <code>key</code> in this map.
+ * <p/>
+ * If the map previously contained a mapping for the key, the old value
+ * is replaced by the specified value.
+ * <p/>
+ * @param key Payara property <code>key</code>.
+ * @param value Payara property <code>value</code>.
+ * @return Previous value associated with <code>key</code>, or
+ * <code>null</code> if there was no mapping for <code>key</code>.
+ */
+ public String putProperty(String key, String value) {
+ return properties.put(key, value);
+ }
+
+ /**
+ * Removes the mapping for a key from this map if it is present.
+ * <p/>
+ * @param key Payara property <code>key</code>.
+ * @return Previous value associated with <code>key</code>, or
+ * <code>null</code> if there was no mapping for <code>key</code>.
+ */
+ public String removeProperty(String key) {
+ return properties.remove(key);
+ }
+
+ /**
+ * Get Payara server port from stored properties.
+ * <p/>
+ * @return Payara server port as <code>String</code>.
+ */
+ public String getHttpPort() {
+ return properties.get(PayaraModule.HTTPPORT_ATTR);
+ }
+
+ /**
+ * Get Payara server administration port from stored properties.
+ * <p/>
+ * @return Payara server administration port as <code>String</code>.
+ */
+ public String getHttpAdminPort() {
+ return properties.get(PayaraModule.ADMINPORT_ATTR);
+ }
+
+ /**
+ * Set Payara server administration user name from stored properties.
+ * <p/>
+ * Method {@see #writeInstanceToFile(PayaraInstance)} must be called
+ * to persist value.
+ * <p/>
+ * @param usern Payara server administration user name.
+ */
+ public void setAdminUser(final String user) {
+ properties.put(PayaraModule.USERNAME_ATTR, user);
+ }
+
+ /**
+ * Store password attribute into Payara instance properties.
+ * <p/>
+ * Password is not stored in {@see Keyring}. Method
+ * {@see #writeInstanceToFile(PayaraInstance)} must be called to persist
+ * value.
+ * <p/>
+ * @param password Password attribute to store.
+ */
+ public void setAdminPassword(String password) {
+ properties.put(PayaraModule.PASSWORD_ATTR, password);
+ }
+
+ /**
+ * Retrieve password attribute from stored properties and NetBeans
+ * key store.
+ * <p/>
+ * @return Retrieved password attribute.
+ */
+ public String getPassword() {
+ return properties.get(PayaraModule.PASSWORD_ATTR);
+ }
+
+ public String getInstallRoot() {
+ return properties.get(PayaraModule.INSTALL_FOLDER_ATTR);
+ }
+
+ public String getPayaraRoot() {
+ return properties.get(PayaraModule.PAYARA_FOLDER_ATTR);
+ }
+
+ @Override
+ public String getDisplayName() {
+ return properties.get(PayaraModule.DISPLAY_NAME_ATTR);
+ }
+
+ public String getDeployerUri() {
+ return properties.get(PayaraModule.URL_ATTR);
+ }
+
+ public String getUserName() {
+ return properties.get(PayaraModule.USERNAME_ATTR);
+ }
+
+ /**
+ * Returns Java SE platform home configured for GlassFfish server.
+ * <p/>
+ * @return Java SE platform configured for GlassFfish server or null
+ * if no such platform was configured.
+ */
+ public String getJavaHome() {
+ return properties.get(PayaraModule.JAVA_PLATFORM_ATTR);
+ }
+
+ /**
+ * Sets Java SE platform home configured for GlassFfish server.
+ * <p/>
+ * Java SE platform home value is cleared when <code>javahome</code>
+ * is <code>null</code>.
+ * <p/>
+ * @param javahome Java SE platform home to be set for GlassFfish server.
+ */
+ public void setJavaHome(String javahome) {
+ if (javahome != null)
+ properties.put(PayaraModule.JAVA_PLATFORM_ATTR, javahome);
+ else
+ properties.remove(PayaraModule.JAVA_PLATFORM_ATTR);
+ }
+
+ /**
+ * Return server JVM mode as <code>String</code> value.
+ * <p/>
+ * @return Server JVM mode.
+ */
+ public String getJvmModeAsString() {
+ return properties.get(PayaraModule.JVM_MODE);
+ }
+
+ /**
+ * Return server JVM mode.
+ * <p/>
+ * @return Server JVM mode.
+ */
+ public PayaraJvmMode getJvmMode() {
+ return PayaraJvmMode.toValue(properties.get(PayaraModule.JVM_MODE));
+ }
+
+ /**
+ * Return server debug port to be used to attach debugger.
+ * <p/>
+ * Value of <code>PayaraModule.USE_SHARED_MEM_ATTR</code> is changed
+ * to false.
+ * <p/>
+ * @return Server debug port.
+ */
+ public int getDebugPort() {
+ int debugPort;
+ try {
+ debugPort = Integer.parseInt(getProperty(PayaraModule.DEBUG_PORT));
+ if (debugPort < LOWEST_USER_PORT || debugPort > 65535) {
+ putProperty(PayaraModule.DEBUG_PORT,
+ Integer.toString(DEFAULT_DEBUG_PORT));
+ debugPort = DEFAULT_DEBUG_PORT;
+ LOGGER.log(Level.INFO, "Converted debug port to {0} for {1}",
+ new String[] {Integer.toString(DEFAULT_DEBUG_PORT),
+ getDisplayName()});
+ }
+ } catch (NumberFormatException nfe) {
+ putProperty(PayaraModule.DEBUG_PORT,
+ Integer.toString(DEFAULT_DEBUG_PORT));
+ debugPort = DEFAULT_DEBUG_PORT;
+ LOGGER.log(Level.INFO, "Converted debug port to {0} for {1}",
+ new String[]{Integer.toString(DEFAULT_DEBUG_PORT),
+ getDisplayName()});
+ } finally {
+ putProperty(PayaraModule.USE_SHARED_MEM_ATTR,
+ Boolean.toString(false));
+ }
+ return debugPort;
+ }
+
+ /**
+ * Check if local running server started from IDE is still running.
+ * <p/>
+ * @returns Value of <code>true</code> when process information is stored
+ * and process is still running or <code>false</code> otherwise.
+ */
+ public boolean isProcessRunning() {
+ if (process == null) {
+ return false;
+ }
+ try {
+ process.exitValue();
+ } catch (IllegalThreadStateException itse) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns Java SE platform {@see JavaPlatform} object configured
+ * for GlassFfish server.
+ * <p/>
+ * Current code is not optimal. It does full scan of installed platforms
+ * to search for platform installation folder matching java home folder
+ * from GlassFfish server instance object.
+ * <p/>
+ * @return Returns Java SE platform {@see JavaPlatform} object configured
+ * for GlassFfish server or null if no such platform was configured.
+ */
+ public JavaPlatform getJavaPlatform() {
+ String javaHome = getJavaHome();
+ if (javaHome == null || javaHome.length() == 0) {
+ return null;
+ }
+ JavaPlatform[] platforms
+ = JavaPlatformManager.getDefault().getInstalledPlatforms();
+ File javaHomeFile = new File(javaHome);
+ JavaPlatform javaPlatform = null;
+ for (JavaPlatform platform : platforms) {
+ for (FileObject fo : platform.getInstallFolders()) {
+ if (javaHomeFile.equals(FileUtil.toFile(fo))) {
+ javaPlatform = platform;
+ break;
+ }
+ }
+ if (javaPlatform != null) {
+ break;
+ }
+ }
+ return javaPlatform;
+ }
+
+ /**
+ * Get domains root folder with write access.
+ * <p/>
+ * @return Domains root folder with write access.
+ */
+ public synchronized String getDomainsRoot() {
+ String retVal = getDomainsFolder();
+ if (null == retVal) {
+ return null;
+ }
+ File candidate = new File(retVal);
+ if (candidate.exists() && !Utils.canWrite(candidate)) {
+ // we need to do some surgury here...
+ String domainsFolder = org.netbeans.modules.payara.common.utils
+ .ServerUtils.getDomainsFolder(this);
+ String foldername = FileUtil.findFreeFolderName(
+ FileUtil.getConfigRoot(), domainsFolder);
+ FileObject destdir = null;
+ try {
+ destdir = FileUtil.createFolder(FileUtil.getConfigRoot(),foldername);
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO,"could not create a writable domain dir",ex); // NOI18N
+ }
+ if (null != destdir) {
+ candidate = new File(candidate, getDomainName());
+ FileObject source = FileUtil.toFileObject(FileUtil.normalizeFile(candidate));
+ try {
+ Utils.doCopy(source, destdir);
+
+ retVal = FileUtil.toFile(destdir).getAbsolutePath();
+ setDomainsFolder(retVal);
+ } catch (IOException ex) {
+ // need to try again... since the domain is probably unreadable.
+ foldername = FileUtil.findFreeFolderName(
+ FileUtil.getConfigRoot(), domainsFolder); // NOI18N
+ try {
+ destdir = FileUtil.createFolder(FileUtil.getConfigRoot(), foldername);
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,"could not create a writable second domain dir",ioe); // NOI18N
+ return retVal;
+ }
+ File destdirFile = FileUtil.toFile(destdir);
+ setDomainsFolder(destdirFile.getAbsolutePath());
+ retVal = destdirFile.getAbsolutePath();
+ // getProvider() eventually creates a call to getDomainsRoot()... which can lead to a deadlock
+ // forcing the call to happen after getDomainsRoot returns will
+ // prevent the deadlock.
+ RequestProcessor.getDefault().post(new Runnable() {
+
+ @Override
+ public void run() {
+ CreateDomain cd = new CreateDomain("anonymous", "", // NOI18N
+ new File(getServerHome()),
+ properties, PayaraInstanceProvider.getProvider(),
+ false, true, "INSTALL_ROOT_KEY"); // NOI18N
+ cd.start();
+ }
+ }, 100);
+ }
+ }
+ }
+ return retVal;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods dependent on linked CommonServerSupport instance //
+ ////////////////////////////////////////////////////////////////////////////
+ // It was too complicated to remove this dependency completely. All //
+ // methods that are dependent on CommonServerSupport instance were marked //
+ // as deprecated. //
+ // All of them should be moved to CommonServerSupport class itself and //
+ // used in context of this class in the future. //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>CommonServerSupport</code> instance associated with
+ * this object.
+ * <p/>
+ * @return <code>CommonServerSupport</code> instance associated with
+ * this object.
+ */
+ public final CommonServerSupport getCommonSupport() {
+ return commonSupport;
+ }
+
+ /**
+ * Get Payara server state.
+ * <p/>
+ * Server state is refreshed if actual state is unknown.
+ * <p/>
+ * @return Payara server state.
+ * @deprecated PayaraInstance class should not be dependent
+ * on CommonServerSupport.
+ */
+ @Deprecated
+ public final ServerState getServerState() {
+ return getCommonSupport().getServerState();
+ }
+
+ /**
+ * Stop Payara instance if it was started by IDE.
+ * <p/>
+ * @param timeout Time to wait for successful completion.
+ * @deprecated PayaraInstance class should not be dependent
+ * on CommonServerSupport.
+ */
+ @Deprecated
+ final void stopIfStartedByIde(long timeout) {
+ if(commonSupport.isStartedByIde()) {
+ ServerState state = commonSupport.getServerState();
+ if(state == ServerState.STARTING ||
+ (state == ServerState.RUNNING
+ && PayaraState.isOnline(this))) {
+ try {
+ Future<TaskState> stopServerTask = commonSupport.stopServer(null);
+ if(timeout > 0) {
+ TaskState opState = stopServerTask.get(timeout, TimeUnit.MILLISECONDS);
+ if(opState != TaskState.COMPLETED) {
+ Logger.getLogger("payara").info("Stop server failed..."); // NOI18N
+ }
+ }
+ } catch(TimeoutException ex) {
+ LOGGER.log(Level.FINE, "Server {0} timed out sending stop-domain command.", getDeployerUri()); // NOI18N
+ } catch(Exception ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ }
+ } else {
+ // prevent j2eeserver from stoping an authenticated server that
+ // it did not start.
+ commonSupport.disableStop();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build and update copy of Payara properties to be stored
+ * in <code>this</code> object.
+ * <p/>
+ * Constructor helper method.
+ * <p/>
+ * @param properties Source Payara properties.
+ * @return Updated copy of Payara properties to be stored.
+ */
+ private Map<String, String> prepareProperties(
+ Map<String, String> properties) {
+ boolean isRemote
+ = properties.get(PayaraModule.DOMAINS_FOLDER_ATTR) == null;
+ String deployerUri = properties.get(PayaraModule.URL_ATTR);
+ updateString(properties, PayaraModule.HOSTNAME_ATTR,
+ DEFAULT_HOST_NAME);
+ updateString(properties, PayaraModule.PAYARA_FOLDER_ATTR, "");
+ updateInt(properties, PayaraModule.HTTPPORT_ATTR,
+ DEFAULT_HTTP_PORT);
+ updateString(properties, PayaraModule.DISPLAY_NAME_ATTR,
+ "Bogus display name");
+ updateInt(properties, PayaraModule.ADMINPORT_ATTR,
+ DEFAULT_ADMIN_PORT);
+ updateString(properties, PayaraModule.SESSION_PRESERVATION_FLAG,
+ "true");
+ updateString(properties, PayaraModule.START_DERBY_FLAG, "false");
+ updateString(properties, PayaraModule.USE_IDE_PROXY_FLAG, "true");
+ updateString(properties, PayaraModule.DRIVER_DEPLOY_FLAG, "true");
+ updateString(properties, PayaraModule.HTTPHOST_ATTR, "localhost");
+ properties.put(PayaraModule.JVM_MODE,
+ isRemote && !deployerUri.contains("deployer:pfv3ee6wc")
+ ? PayaraModule.DEBUG_MODE : PayaraModule.NORMAL_MODE);
+ updateString(properties, PayaraModule.USERNAME_ATTR,
+ DEFAULT_ADMIN_NAME);
+ updateString(properties, PayaraModule.NB73_IMPORT_FIXED,
+ Boolean.toString(true));
+ Map<String, String> newProperties = new Props(properties);
+ // Asume a local instance is in NORMAL_MODE
+ // Assume remote Prelude and 3.0 instances are in DEBUG (we cannot change them)
+ // Assume a remote 3.1 instance is in NORMAL_MODE... we can restart it into debug mode
+ // XXX username/password handling at some point.
+ return newProperties;
+ }
+
+ /**
+ * Check if this instance is publicly accessible.
+ * <p/>
+ * @return <code>true</code> if this instance is publicly accessible
+ * or <code>false</code> otherwise.
+ */
+ private boolean isPublicAccess() {
+ return instanceProvider.getInternalInstance(getUrl()) != null;
+ }
+
+ /**
+ * Make this instance publicly accessible if it was not done yet.
+ * <p/>
+ * Used during initialization phase to register this object into
+ * <code>PayaraInstanceProvider</code>.
+ * <code>CommonServerSupport</code> instance related to this object must be
+ * also initialized.
+ */
+ private void allowPublicAccess() {
+ if (!isPublicAccess()) {
+ instanceProvider.addServerInstance(this);
+ }
+ }
+
+ /**
+ * Get property storedValue with given <code>name</code> as <code>int</code>
+ * storedValue.
+ * <p/>
+ * Works for positive values only because <code>-1</code> storedValue is reserved
+ * for error conditions.
+ * <p/>
+ * @param name Name of property to be retrieved.
+ * @return Property storedValue as <code>int</code> or <code>-1</code>
+ * if property cannot be converted to integer storedValue.
+ */
+ private int intProperty(String name) {
+ String property = properties.get(name);
+ if (property == null) {
+ LOGGER.log(Level.WARNING,
+ "Cannot convert null value to a number");
+ return -1;
+ }
+ try {
+ return Integer.parseInt(property);
+ } catch (NumberFormatException nfe) {
+ LOGGER.log(Level.WARNING, "Cannot convert "+
+ property +" to a number: ", nfe);
+ return -1;
+ }
+ }
+
+ private void updateFactories() {
+ // !PW FIXME should read asenv.bat on windows.
+ Properties asenvProps = new Properties();
+ String homeFolder = getPayaraRoot();
+ File asenvConf = new File(homeFolder, "config/asenv.conf"); // NOI18N
+ if(asenvConf.exists()) {
+ InputStream is = null;
+ try {
+ is = new BufferedInputStream(new FileInputStream(asenvConf));
+ asenvProps.load(is);
+ } catch(FileNotFoundException ex) {
+ LOGGER.log(Level.WARNING, null, ex); // NOI18N
+ } catch(IOException ex) {
+ LOGGER.log(Level.WARNING, null, ex); // NOI18N
+ asenvProps.clear();
+ } finally {
+ if(is != null) {
+ try { is.close(); } catch (IOException ex) { }
+ }
+ }
+ } else {
+ LOGGER.log(Level.WARNING, "{0} does not exist", asenvConf.getAbsolutePath()); // NOI18N
+ }
+ Set<PayaraModuleFactory> added = new HashSet<>();
+ //Set<PayaraModuleFactory> removed = new HashSet<PayaraModuleFactory>();
+ synchronized (lookupResult) {
+ Collection<? extends PayaraModuleFactory> factories = lookupResult.allInstances();
+ added.addAll(factories);
+ added.removeAll(currentFactories);
+ currentFactories = factories;
+
+ List<Lookup> proxies = new ArrayList<>();
+ proxies.add(localLookup);
+ for (PayaraModuleFactory moduleFactory : added) {
+ if(moduleFactory.isModuleSupported(homeFolder, asenvProps)) {
+ Object t = moduleFactory.createModule(localLookup);
+ if (null == t) {
+ LOGGER.log(Level.WARNING, "{0} created a null module", moduleFactory); // NOI18N
+ } else {
+ ic.add(t);
+ if (t instanceof Lookup.Provider) {
+ proxies.add(Lookups.proxy((Lookup.Provider) t));
+ }
+ }
+ }
+ }
+
+ if (!proxies.isEmpty()) {
+ full = new ProxyLookup(proxies.toArray(new Lookup[proxies.size()]));
+ }
+ }
+
+ }
+
+ @Override
+ public void resultChanged(LookupEvent ev) {
+ updateFactories();
+ }
+
+ public ServerInstance getCommonInstance() {
+ return commonInstance;
+ }
+
+ @Override
+ public Lookup getLookup() {
+ synchronized (lookupResult) {
+ return full;
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // ServerInstance interface implementation
+ // ------------------------------------------------------------------------
+
+ // TODO -- this should be done differently
+ @Override
+ public String getServerDisplayName() {
+ return NbBundle.getMessage(PayaraInstance.class, "STR_SERVER_NAME",
+ new Object[] {version != null ? version.toString() : ""});
+ }
+
+ @Override
+ public Node getFullNode() {
+ Logger.getLogger("payara").finer("Creating PF Instance node [FULL]"); // NOI18N
+ synchronized (lookupResult) {
+ if (fullNode == null) {
+ fullNode = new Hk2InstanceNode(this, true);
+ }
+ return fullNode;
+ }
+ }
+
+ @Override
+ public Node getBasicNode() {
+ Logger.getLogger("payara").finer("Creating GF Instance node [BASIC]"); // NOI18N
+ return new Hk2InstanceNode(this, false);
+ }
+
+ @Override
+ public JComponent getCustomizer() {
+ return new PayaraPropertiesCustomizer(this, localLookup);
+ }
+
+ @Override
+ public boolean isRemovable() {
+ return removable;
+ }
+
+ @Override
+ public void remove() {
+ // Just in case...
+ if(!removable) {
+ return;
+ }
+
+ // !PW FIXME Remove debugger hooks, if any
+// DebuggerManager.getDebuggerManager().removeDebuggerListener(debuggerStateListener);
+
+ stopIfStartedByIde(3000L);
+
+ // close the server io window
+ String uri = getDeployerUri();
+ InputOutput io = LogViewMgr.getServerIO(uri);
+ if(io != null && !io.isClosed()) {
+ io.closeInputOutput();
+ }
+
+ Collection<? extends RemoveCookie> lookupAll = localLookup.lookupAll(RemoveCookie.class);
+ for(RemoveCookie cookie: lookupAll) {
+ cookie.removeInstance(getDeployerUri());
+ }
+
+ instanceProvider.removeServerInstance(this);
+ ic.remove(this);
+ }
+
+ //
+ // watch out for the localhost alias.
+ //
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof PayaraInstance)) {
+ return false;
+ }
+ PayaraInstance other = (PayaraInstance) obj;
+ if (null == getDeployerUri()) {
+ return false;
+ }
+ if (null == other.getDeployerUri()) {
+ return false;
+ }
+ // Domain name can be null so we shall avoid NPE.
+ boolean domainName = Objects.equals(getDomainName(), other.getDomainName());
+ // Domains root can be null so we shall avoid NPE.
+ boolean domainsRoot = Objects.equals(getDomainsRoot(), other.getDomainsRoot());
+ return domainName && domainsRoot
+ && getDeployerUri().replace("127.0.0.1", "localhost")
+ .equals(other.getDeployerUri().replace("127.0.0.1", "localhost"))
+ && getHttpPort().equals(other.getHttpPort());
+ }
+
+ /**
+ * Generate hash code for Payara instance data object.
+ * <p/>
+ * Hash code is based on name attribute
+ * (<code>PayaraModule.DISPLAY_NAME_ATTR</code> property) which
+ * is unique.
+ * <p/>
+ * @return Hash code for Payara instance data object.
+ */
+ @Override
+ public int hashCode() {
+ return getName().hashCode();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstanceProvider.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstanceProvider.java
new file mode 100644
index 0000000..2c5fdff
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraInstanceProvider.java
@@ -0,0 +1,499 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.io.IOException;
+import java.util.*;
+import static java.util.Collections.synchronizedMap;
+import static java.util.Collections.synchronizedSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.prefs.BackingStoreException;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.parser.DomainXMLChangeListener;
+import org.netbeans.modules.payara.common.utils.ServerUtils;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.CommandFactory;
+import org.netbeans.modules.payara.spi.RegisteredDDCatalog;
+import org.netbeans.spi.server.ServerInstanceImplementation;
+import org.netbeans.spi.server.ServerInstanceProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.util.*;
+import org.openide.util.lookup.Lookups;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ * Payara server instances provider.
+ * <p/>
+ * Handles all registered Payara server instances. Implemented as singleton
+ * because NetBeans GUI components require singleton implementing
+ * {@link ServerInstanceProvider} interface.
+ * <p/>
+ * @author Peter Williams, Vince Kraemer, Tomas Kraus
+ */
+public final class PayaraInstanceProvider implements ServerInstanceProvider, LookupListener {
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraInstanceProvider.class);
+
+ public static final String PAYARA_AUTOREGISTERED_INSTANCE = "payara_autoregistered_instance";
+
+ private static final String AUTOINSTANCECOPIED = "autoinstance-copied"; // NOI18N
+
+ private volatile static PayaraInstanceProvider payaraProvider;
+
+ public static final String EE6_DEPLOYER_FRAGMENT = "deployer:pfv3ee6"; // NOI18N
+ public static final String EE6WC_DEPLOYER_FRAGMENT = "deployer:pfv3ee6wc"; // NOI18N
+ private static final String EE6_INSTANCES_PATH = "/PayaraEE6/Instances"; // NOI18N
+ private static final String EE6WC_INSTANCES_PATH = "/PayaraEE6WC/Instances"; // NOI18N
+
+ // Payara Tooling SDK configuration should be done before any server
+ // instance is created and used.
+ static {
+ PayaraSettings.toolingLibraryconfig();
+ }
+
+ public static PayaraInstanceProvider getProvider() {
+ if (payaraProvider != null) {
+ return payaraProvider;
+ }
+ else {
+ boolean runInit = false;
+ synchronized(PayaraInstanceProvider.class) {
+ if (payaraProvider == null) {
+ runInit = true;
+ payaraProvider = new PayaraInstanceProvider(
+ new String[]{EE6_DEPLOYER_FRAGMENT, EE6WC_DEPLOYER_FRAGMENT},
+ new String[]{EE6_INSTANCES_PATH, EE6WC_INSTANCES_PATH},
+ null,
+ true,
+ new String[]{"--nopassword"}, // NOI18N
+ (property, value) -> new CommandSetProperty(property, value, "DEFAULT={0}={1}"));
+ }
+ }
+ if (runInit) {
+ payaraProvider.init();
+ }
+ return payaraProvider;
+ }
+ }
+
+ public static final Set<String> activeRegistrationSet
+ = synchronizedSet(new HashSet<>());
+
+ private final Map<String, PayaraInstance> instanceMap
+ = synchronizedMap(new HashMap<>());
+
+ private static final Set<String> activeDisplayNames
+ = synchronizedSet(new HashSet<>());
+
+ private final ChangeSupport support = new ChangeSupport(this);
+
+ final private String[] instancesDirNames;
+ final private String displayName;
+ final private String[] uriFragments;
+ final private boolean needsJdk6;
+ final private List<String> noPasswordOptions;
+ final private CommandFactory cf;
+ final private Lookup.Result<RegisteredDDCatalog> lookupResult = Lookups.forPath(Util.PF_LOOKUP_PATH).lookupResult(RegisteredDDCatalog.class);
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ private PayaraInstanceProvider(
+ String[] uriFragments,
+ String[] instancesDirNames,
+ String displayName,
+ boolean needsJdk6,
+ String[] noPasswordOptionsArray,
+ CommandFactory cf) {
+ this.instancesDirNames = instancesDirNames;
+ this.displayName = displayName;
+ this.uriFragments = uriFragments;
+ this.needsJdk6 = needsJdk6;
+ this.noPasswordOptions = new ArrayList<>();
+ if (null != noPasswordOptionsArray) {
+ noPasswordOptions.addAll(Arrays.asList(noPasswordOptionsArray));
+ }
+ this.cf = cf;
+ lookupResult.allInstances();
+
+ lookupResult.addLookupListener(this);
+ }
+
+ @Override
+ public void resultChanged(LookupEvent ev) {
+ LOGGER.log(Level.FINE, "***** resultChanged fired ******** {0}", hashCode()); // NOI18N
+ RegisteredDDCatalog catalog = getDDCatalog();
+ if (null != catalog) {
+ catalog.registerRunTimeDDCatalog(this);
+ }
+ refreshCatalogFromFirstInstance(this, getDDCatalog());
+ }
+
+ /**
+ * Check providers initialization status.
+ * <p>
+ * @return <code>true</code> when at least one of the providers
+ * is initialized or <code>false</code> otherwise.
+ */
+ public static synchronized boolean initialized() {
+ return payaraProvider != null;
+ }
+
+ private static RegisteredDDCatalog getDDCatalog() {
+ return Lookups.forPath(Util.PF_LOOKUP_PATH).lookup(RegisteredDDCatalog.class);
+ }
+
+ private static void refreshCatalogFromFirstInstance(PayaraInstanceProvider pip, RegisteredDDCatalog catalog) {
+ PayaraInstance firstInstance = pip.getFirstServerInstance();
+ if (null != firstInstance) {
+ catalog.refreshRunTimeDDCatalog(pip, firstInstance.getPayaraRoot());
+ }
+ }
+
+ /**
+ * Get API representation of Payara server instance matching
+ * provided internal server URI.
+ * <p/>
+ * @param uri Internal server URI used as key to find
+ * {@link ServerInstance}.
+ * @return {@link ServerInstance} matching given URI.
+ */
+ public static ServerInstance getInstanceByUri(String uri) {
+ return getProvider().getInstance(uri);
+ }
+
+ /**
+ * Get {@link PayaraInstance} matching provided internal
+ * server URI.
+ * <p/>
+ * @param uri Internal server URI used as key to find
+ * {@link PayaraInstance}.
+ * @return {@link PayaraInstance} matching provided internal server URI
+ * or <code>null</code> when no matching object was found.
+ */
+ public static PayaraInstance getPayaraInstanceByUri(String uri) {
+ return getProvider().getPayaraInstance(uri);
+ }
+
+ private PayaraInstance getFirstServerInstance() {
+ if (!instanceMap.isEmpty()) {
+ return instanceMap.values().iterator().next();
+ }
+ return null;
+ }
+
+ /**
+ * Retrieve {@link PayaraInstance} matching provided
+ * internal server URI.
+ * <p/>
+ * @param uri Internal server URI used as key to find
+ * {@link PayaraInstance}.
+ * @return {@link PayaraInstance} matching provided internal server URI
+ * or <code>null</code> when no matching object was found.
+ */
+ public PayaraInstance getPayaraInstance(String uri) {
+ synchronized(instanceMap) {
+ return instanceMap.get(uri);
+ }
+ }
+
+ /**
+ * Add Payara server instance into this provider.
+ * <p/>
+ * @param si Payara server instance to be added.
+ */
+ public void addServerInstance(PayaraInstance si) {
+ synchronized(instanceMap) {
+ try {
+ instanceMap.put(si.getDeployerUri(), si);
+ activeDisplayNames.add(si.getDisplayName());
+ if (instanceMap.size() == 1) { // only need to do if this first of this type
+ RegisteredDDCatalog catalog = getDDCatalog();
+ if (null != catalog) {
+ catalog.refreshRunTimeDDCatalog(this, si.getPayaraRoot());
+ }
+ }
+ PayaraInstance.writeInstanceToFile(si);
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ }
+ if (!si.isRemote()) {
+ DomainXMLChangeListener.registerListener(si);
+ }
+ support.fireChange();
+ }
+
+ /**
+ * Remove Payara server instance from this provider.
+ * <p/>
+ * @param si Payara server instance to be removed.
+ */
+ public boolean removeServerInstance(PayaraInstance si) {
+ boolean result = false;
+ synchronized(instanceMap) {
+ if(instanceMap.remove(si.getDeployerUri()) != null) {
+ result = true;
+ removeInstanceFromFile(si.getDeployerUri());
+ activeDisplayNames.remove(si.getDisplayName());
+ // If this was the last of its type, need to remove the
+ // resolver catalog contents
+ if (instanceMap.isEmpty()) {
+ RegisteredDDCatalog catalog = getDDCatalog();
+ if (null != catalog) {
+ catalog.refreshRunTimeDDCatalog(this, null);
+ }
+ }
+ }
+ }
+ PayaraStatus.remove(si);
+ if (result) {
+ ConfigBuilderProvider.destroyBuilder(si);
+ if (!si.isRemote()) {
+ DomainXMLChangeListener.unregisterListener(si);
+ }
+ support.fireChange();
+ }
+ return result;
+ }
+
+ public Lookup getLookupFor(ServerInstance instance) {
+ synchronized (instanceMap) {
+ for (PayaraInstance gfInstance : instanceMap.values()) {
+ if (gfInstance.getCommonInstance().equals(instance)) {
+ return gfInstance.getLookup();
+ }
+ }
+ return null;
+ }
+ }
+
+ public ServerInstanceImplementation getInternalInstance(String uri) {
+ return instanceMap.get(uri);
+ }
+
+ public <T> T getInstanceByCapability(String uri, Class <T> serverFacadeClass) {
+ T result = null;
+ PayaraInstance instance = instanceMap.get(uri);
+ if(instance != null) {
+ result = instance.getLookup().lookup(serverFacadeClass);
+ }
+ return result;
+ }
+
+ public <T> List<T> getInstancesByCapability(Class<T> serverFacadeClass) {
+ List<T> result = new ArrayList<>();
+ synchronized (instanceMap) {
+ for (PayaraInstance instance : instanceMap.values()) {
+ T serverFacade = instance.getLookup().lookup(serverFacadeClass);
+ if(serverFacade != null) {
+ result.add(serverFacade);
+ }
+ }
+ }
+ return result;
+ }
+
+ // ------------------------------------------------------------------------
+ // ServerInstanceProvider interface implementation
+ // ------------------------------------------------------------------------
+ @Override
+ public List<ServerInstance> getInstances() {
+ List<ServerInstance> result = new ArrayList<>();
+ synchronized (instanceMap) {
+ for (PayaraInstance instance : instanceMap.values()) {
+ ServerInstance si = instance.getCommonInstance();
+ if (null != si) {
+ result.add(si);
+ } else {
+ String message = "invalid commonInstance for " + instance.getDeployerUri(); // NOI18N
+ LOGGER.log(Level.WARNING, message); // NOI18N
+ if (null != instance.getDeployerUri())
+ instanceMap.remove(instance.getDeployerUri());
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener listener) {
+ support.addChangeListener(listener);
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener listener) {
+ support.removeChangeListener(listener);
+ }
+
+ // Additional interesting API's
+ public boolean hasServer(String uri) {
+ return getInstance(uri) != null;
+ }
+
+ public ServerInstance getInstance(String uri) {
+ ServerInstance rv = null;
+ PayaraInstance instance = instanceMap.get(uri);
+ if (null != instance) {
+ rv = instance.getCommonInstance();
+ if (null == rv) {
+ String message = "invalid commonInstance for " + instance.getDeployerUri(); // NOI18N
+ LOGGER.log(Level.WARNING, message);
+ if (null != instance.getDeployerUri())
+ instanceMap.remove(instance.getDeployerUri());
+ }
+ }
+ return rv;
+ }
+
+ String getInstancesDirFirstName() {
+ return instancesDirNames[0];
+ }
+
+ // ------------------------------------------------------------------------
+ // Internal use only. Used by Installer.close() to quickly identify and
+ // shutdown any instances we started during this IDE session.
+ // ------------------------------------------------------------------------
+ Collection<PayaraInstance> getInternalInstances() {
+ return instanceMap.values();
+ }
+
+ boolean requiresJdk6OrHigher() {
+ return needsJdk6;
+ }
+
+ private void init() {
+ synchronized (instanceMap) {
+ try {
+ loadServerInstances();
+ } catch (RuntimeException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ RegisteredDDCatalog catalog = getDDCatalog();
+ if (null != catalog) {
+ catalog.registerRunTimeDDCatalog(this);
+ refreshCatalogFromFirstInstance(this, catalog);
+ }
+ }
+ for (PayaraInstance gi : instanceMap.values()) {
+ PayaraInstance.updateModuleSupport(gi);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Persistence for server instances.
+ // ------------------------------------------------------------------------
+ private void loadServerInstances() {
+ List<FileObject> installedInstances = new LinkedList<>();
+ for (int j = 0; j < instancesDirNames.length; j++) {
+ FileObject dir
+ = ServerUtils.getRepositoryDir(instancesDirNames[j], false);
+ if (dir != null) {
+ FileObject[] instanceFOs = dir.getChildren();
+ if (instanceFOs != null && instanceFOs.length > 0) {
+ for (int i = 0; i < instanceFOs.length; i++) {
+ try {
+ if (instanceFOs[i].getName().startsWith(PAYARA_AUTOREGISTERED_INSTANCE)) {
+ installedInstances.add(instanceFOs[i]);
+ continue;
+ }
+ PayaraInstance si = PayaraInstance
+ .readInstanceFromFile(instanceFOs[i], false);
+ if (si != null) {
+ activeDisplayNames.add(si.getDisplayName());
+ } else {
+ LOGGER.log(Level.FINER,
+ "Unable to create payara instance for {0}", // NOI18N
+ instanceFOs[i].getPath());
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ }
+ }
+ }
+ }
+ if (!installedInstances.isEmpty()
+ && null == NbPreferences.forModule(this.getClass())
+ .get(AUTOINSTANCECOPIED, null)) {
+ try {
+ for (FileObject installedInstance : installedInstances) {
+ PayaraInstance igi = PayaraInstance.
+ readInstanceFromFile(installedInstance, true);
+ activeDisplayNames.add(igi.getDisplayName());
+ }
+ try {
+ NbPreferences.forModule(this.getClass())
+ .put(AUTOINSTANCECOPIED, "true"); // NOI18N
+ NbPreferences.forModule(this.getClass()).flush();
+ } catch (BackingStoreException ex) {
+ LOGGER.log(Level.INFO,
+ "auto-registered instance may reappear", ex); // NOI18N
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ }
+ }
+
+ private void removeInstanceFromFile(String url) {
+ FileObject instanceFO = getInstanceFileObject(url);
+ if(instanceFO != null && instanceFO.isValid()) {
+ try {
+ instanceFO.delete();
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ }
+ }
+
+ private FileObject getInstanceFileObject(String url) {
+ for (String instancesDirName : instancesDirNames) {
+ FileObject dir = ServerUtils.getRepositoryDir(
+ instancesDirName, false);
+ if(dir != null) {
+ FileObject[] installedServers = dir.getChildren();
+ for(int i = 0; i < installedServers.length; i++) {
+ String val = ServerUtils.getStringAttribute(installedServers[i], PayaraModule.URL_ATTR);
+ if(val != null && val.equals(url) &&
+ !installedServers[i].getName().startsWith(PAYARA_AUTOREGISTERED_INSTANCE)) {
+ return installedServers[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ List<String> getNoPasswordOptions() {
+ return noPasswordOptions;
+ }
+
+ public CommandFactory getCommandFactory() {
+ return cf;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraJvmMode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraJvmMode.java
new file mode 100644
index 0000000..58b2b9f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraJvmMode.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author kratz
+ */
+public enum PayaraJvmMode {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Normal mode. */
+ NORMAL,
+
+ /** Debug mode. */
+ DEBUG,
+
+ /** Profiling mode. */
+ PROFILE;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraJvmMode.class);
+
+ /** Payara version enumeration length. */
+ public static final int length = PayaraJvmMode.values().length;
+
+ /** A <code>String</code> representation of NORMAL value. */
+ private static final String NORMAL_STR = "normalMode";
+
+ /** A <code>String</code> representation of DEBUG value. */
+ private static final String DEBUG_STR = "debugMode";
+
+ /** A <code>String</code> representation of PROFILE value. */
+ private static final String PROFILE_STR = "profileMode";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final Map<String, PayaraJvmMode> stringValuesMap
+ = new HashMap<String, PayaraJvmMode>(length);
+ static {
+ for (PayaraJvmMode mode : PayaraJvmMode.values()) {
+ stringValuesMap.put(mode.toString().toUpperCase(), mode);
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>PayaraJvmMode</code> with a value represented by the
+ * specified <code>String</code>. The <code>PayaraJvmMode</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param name Value containing <code>PayaraJvmMode</code>
+ * <code>toString</code> representation.
+ * @return <code>PayaraJvmMode</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static PayaraJvmMode toValue(final String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraJvmMode</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case NORMAL: return NORMAL_STR;
+ case DEBUG: return DEBUG_STR;
+ case PROFILE: return PROFILE_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new IllegalStateException(NbBundle.getMessage(PayaraJvmMode.class,
+ "PayaraJvmMode.toString.invalid"));
+ }
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraLogger.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraLogger.java
new file mode 100644
index 0000000..f5e17b3
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraLogger.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.logging.Logger;
+
+/**
+ * Payara module logger.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraLogger {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get logger for given class.
+ * <p/>
+ * @param c Target class for logger.
+ * @return Logger for given class.
+ */
+ public static Logger get(Class c) {
+ return Logger.getLogger("payara");
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraSettings.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraSettings.java
new file mode 100644
index 0000000..8291781
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraSettings.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.prefs.Preferences;
+import org.netbeans.modules.payara.tooling.PayaraToolsConfig;
+import org.openide.util.NbPreferences;
+
+/**
+ * Payara module settings.
+ * <p/>
+ * Handles persistent Payara module settings.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraSettings {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** NetBeans preferences node label. */
+ private static final String NB_PREFERENCES_NODE
+ = "org/netbeans/modules/payara/common";
+
+ /** Payara settings label: Payara 3.1.2 warning show again. */
+ private static final String LBL_GF312_WARNING_SHOW_AGAIN
+ = "Gf312WarningAgain";
+
+ /** Payara settings label: Payara 3.1.2 warning show again. */
+ private static final String LBL_PF_KILL_SHOW_AGAIN
+ = "GfKillWarningAgain";
+
+ /** Payara settings label: Show password text in properties form. */
+ private static final String LBL_PF_SHOW_PASSWORD_IN_PROPERTIES_FORM
+ = "GfShowPasswordInPropertiesForm";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize and configure Payara Tooling Library.
+ */
+ static void toolingLibraryconfig() {
+ PayaraToolsConfig.noProxyForLoopback();
+ }
+
+ /**
+ * Get NetBeans preferences node for Payara module settings.
+ * <p/>
+ * @return NetBeans preferences node for Payara module settings.
+ */
+ private static Preferences settings() {
+ return NbPreferences.root().node(NB_PREFERENCES_NODE);
+ }
+
+ /**
+ * Get Payara 3.1.2 warning show again property value.
+ * <p/>
+ * Default value is <code>true</code>.
+ * <p/>
+ * @return Payara 3.1.2 warning show again property value.
+ */
+ public static boolean getGf312WarningShowAgain() {
+ return settings().getBoolean(LBL_GF312_WARNING_SHOW_AGAIN, true);
+ }
+
+ /**
+ * Set Payara 3.1.2 warning show again property value.
+ * <p/>
+ * @param showAgain Payara 3.1.2 warning show again property value
+ * to be set.
+ */
+ public static void setGf312WarningShowAgain(final boolean showAgain) {
+ settings().putBoolean(LBL_GF312_WARNING_SHOW_AGAIN, showAgain);
+ }
+
+ /**
+ * Get Payara kill warning show again property value.
+ * <p/>
+ * Default value is <code>true</code>.
+ * <p/>
+ * @return Payara kill warning show again property value.
+ */
+ public static boolean getGfKillWarningShowAgain() {
+ return settings().getBoolean(LBL_PF_KILL_SHOW_AGAIN, true);
+ }
+
+ /**
+ * Set Payara kill warning show again property value.
+ * <p/>
+ * @param showAgain Payara kill warning show again property value
+ * to be set.
+ */
+ public static void setGfKillWarningShowAgain(final boolean showAgain) {
+ settings().putBoolean(LBL_PF_KILL_SHOW_AGAIN, showAgain);
+ }
+
+ /**
+ * Get Payara setting to show password text in properties form.
+ * <p/>
+ * @return Payara setting to show password text in properties form.
+ */
+ public static boolean getGfShowPasswordInPropertiesForm() {
+ return settings().getBoolean(
+ LBL_PF_SHOW_PASSWORD_IN_PROPERTIES_FORM, false);
+ }
+
+ /**
+ * Get Payara setting to show password text in properties form.
+ * <p/>
+ * @@param show Payara setting to show password text in properties form.
+ */
+ public static void setGfShowPasswordInPropertiesForm(final boolean show) {
+ settings().putBoolean(LBL_PF_SHOW_PASSWORD_IN_PROPERTIES_FORM, show);
+ }
+
+ /**
+ * Get system property do disable UI in NetBeans.
+ * <p/>
+ * Default value is <code>false</code>.
+ * <p/>
+ * @return Value of <code>true</code> when UI is enabled in NetBeans
+ * or <code>false</code> otherwise.
+ */
+ public static boolean showWindowSystem() {
+ String showProperty
+ = System.getProperty("org.netbeans.core.WindowSystem.show");
+ return showProperty == null
+ || !showProperty.toLowerCase().equals("false");
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraState.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraState.java
new file mode 100644
index 0000000..363a4ab
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PayaraState.java
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.common.status.AuthFailureStateListener;
+import org.netbeans.modules.payara.common.status.MonitoringInitStateListener;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Server state checks public module API.
+ * <p/>
+ * This API runs Payara server administration commands at the background
+ * and is accessing server properties including administrator password stored
+ * in <code>Keyring</code>.<br/>
+ * Do not use this class in NetBeans startup code to avoid <code>Keyring</code>
+ * access deadlocks.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraState {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check mode.
+ * <p/>
+ * Allows to select server state check mode.
+ */
+ public static enum Mode {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Default server state check mode. All special features
+ * are turned off. */
+ DEFAULT,
+ /** Startup mode. Sets longer administration commands timeout
+ * and displays Payara 3.1.2 WS bug warning. */
+ STARTUP,
+ /** Refresh mode. Displays enable-secure-admin warning
+ * for remote servers. */
+ REFRESH;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>Mode</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch(this) {
+ case DEFAULT: return "DEFAULT";
+ case STARTUP: return "STARTUP";
+ case REFRESH: return "REFRESH";
+ default: throw new IllegalStateException("Unknown Mode value");
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraState.class);
+
+ /** Initial server status check timeout [ms]. Maximum period of time to wait
+ * for status monitoring to settle down. */
+ private static final int INIT_MONITORING_TIMEOUT = 5000;
+
+ /**
+ * Start monitoring Payara server.
+ * <p/>
+ * This method may cause delay when server status was not monitored before
+ * to give status monitoring time to settle down.
+ * <p/>
+ * @param instance Payara server instance to be monitored.
+ */
+ public static boolean monitor(final PayaraServer instance) {
+ boolean added;
+ // Check if server is already being monitored.
+ PayaraServerStatus status = PayaraStatus.get(instance);
+ if (status == null) {
+ MonitoringInitStateListener listener
+ = new MonitoringInitStateListener();
+ // All state change events except UNKNOWN.
+ added = PayaraStatus.add(instance, listener, false,
+ PayaraStatus.OFFLINE, PayaraStatus.STARTUP,
+ PayaraStatus.ONLINE, PayaraStatus.SHUTDOWN);
+ if (added) {
+ if (instance.getVersion() != null) {
+ AuthFailureStateListener authListener
+ = new AuthFailureStateListener(
+ instance.getVersion().ordinal()
+ >= PayaraVersion.PF_4_1_144.ordinal());
+ PayaraStatus.addChangeListener(instance, authListener, PayaraStatus.STARTUP);
+ PayaraStatus.addErrorListener(instance, authListener);
+ }
+ try {
+ long startTime = System.currentTimeMillis();
+ long waitTime = INIT_MONITORING_TIMEOUT;
+ synchronized (listener) {
+ // Guard against spurious wakeup.
+ while (!listener.isWakeUp() && waitTime > 0) {
+ listener.wait(waitTime);
+ waitTime = INIT_MONITORING_TIMEOUT
+ + startTime - System.currentTimeMillis();
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.FINE,
+ "Interrupted while waiting on server monitoring");
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+ }
+ } else {
+ added = false;
+ }
+ return added;
+ }
+
+ /**
+ * Wait for status monitoring to resolve <code>UNKNOWN</code> state.
+ * <p/>
+ * Status monitoring listener will be removed when finished.
+ * <p/>
+ * @param instance Payara server instance.
+ * @param listener Already active status monitoring listener waiting
+ * for leaving <code>UNKNOWN</code> state.
+ * @param timeout How log to wait for <code>UNKNOWN</code> state
+ * to be resolved in ms.
+ */
+ private static void waitForKnownState(final PayaraServer instance,
+ final MonitoringInitStateListener listener, final long timeout) {
+ try {
+ long startTime = System.currentTimeMillis();
+ long waitTime = timeout;
+ synchronized (listener) {
+ // Guard against spurious wakeup.
+ while (!listener.isWakeUp() && waitTime > 0) {
+ listener.wait(waitTime);
+ waitTime = timeout
+ + startTime - System.currentTimeMillis();
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.FINE,
+ "Interrupted while waiting on server monitoring");
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+
+ }
+
+ /**
+ * Retrieve Payara server status object from status monitoring.
+ * <p/>
+ * Can block up to <code>timeout</code> ms when server monitoring
+ * was suspended to wait for new status check to finish. Do not use
+ * with non zero <code>timeout</code> in AWT event queue thread.
+ * <p/>
+ * @param instance Payara server instance.
+ * @param timeout How log to wait for <code>UNKNOWN</code> state
+ * to be resolved. Value of <code>0</code> turns blocking
+ * off.
+ * @return Payara server status object.
+ * @throws IllegalStateException when status object is null even after
+ * monitoring of this instance was explicitely started.
+ */
+ public static PayaraServerStatus getStatus(
+ final PayaraServer instance, final long timeout) {
+ MonitoringInitStateListener listener = timeout > 0
+ ? new MonitoringInitStateListener() : null;
+ PayaraServerStatus status = PayaraStatus.get(instance, listener);
+ if (status == null) {
+ monitor(instance);
+ status = PayaraStatus.get(instance);
+ if (status == null) {
+ throw new IllegalStateException(NbBundle.getMessage(PayaraState.class,
+ "PayaraState.getStatus.statusNull"));
+ }
+ } else {
+ if (listener != null && listener.isActive()) {
+ waitForKnownState(instance, listener, timeout);
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Retrieve Payara server status object from status monitoring.
+ * <p/>
+ * This call is always non blocking but it will return <code>UNKNOWN</code>
+ * state immediately when server state monitoring is suspended.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Payara server status object.
+ * @throws IllegalStateException when status object is null even after
+ * monitoring of this instance was explicitely started.
+ */
+ public static PayaraServerStatus getStatus(
+ final PayaraServer instance) {
+ return getStatus(instance, 0);
+ }
+
+ /**
+ * Check if Payara server is running in <code>DEFAULT</code> mode.
+ * <p/>
+ * Check may cause delay when server status was not monitored before
+ * to give status monitoring time to settle down.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Returns <code>true</code> when Payara server is online
+ * or <code>false</code> otherwise.
+ */
+ public static boolean isOnline(final PayaraServer instance) {
+ return getStatus(instance).getStatus() == PayaraStatus.ONLINE;
+ }
+
+ /**
+ * Check if Payara server is offline.
+ * <p/>
+ * Check may cause delay when server status was not monitored before
+ * to give status monitoring time to settle down.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Returns <code>true</code> when Payara server offline
+ * or <code>false</code> otherwise.
+ */
+ public static boolean isOffline(final PayaraServer instance) {
+ return getStatus(instance).getStatus() == PayaraStatus.OFFLINE;
+ }
+
+ /**
+ * Check if Payara server can be started;
+ * <p/>
+ * Server can be started only when
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Value of <code>true</code> when Payara server can be started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean canStart(final PayaraServer instance) {
+ PayaraServerStatus status = getStatus(instance);
+ switch(status.getStatus()) {
+ case UNKNOWN: case ONLINE: case SHUTDOWN: case STARTUP:
+ return false;
+ default:
+ // Allow start even with admin port occupied.
+ //return !ServerUtils.isDASRunning(instance);
+ return true;
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/PortCollection.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PortCollection.java
new file mode 100644
index 0000000..193e0ac
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/PortCollection.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class PortCollection {
+
+ private int adminPort;
+
+ public int getAdminPort() {
+ return adminPort;
+ }
+
+ public void setAdminPort(int adminPort) {
+ this.adminPort = adminPort;
+ }
+
+ public int getHttpPort() {
+ return httpPort;
+ }
+
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
+ }
+ private int httpPort;
+
+ public int getHttpsPort() {
+ return httpsPort;
+ }
+
+ public void setHttpsPort(int httpsPort) {
+ this.httpsPort = httpPort;
+ }
+ private int httpsPort;
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProcessCreationException.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProcessCreationException.java
new file mode 100644
index 0000000..2a3de35
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProcessCreationException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import org.openide.util.NbBundle;
+
+public class ProcessCreationException extends Exception {
+
+ private final String messageName;
+ private final String[] args;
+
+ ProcessCreationException(Exception cause, String messageName, String... args) {
+ super();
+ if (null != cause) {
+ initCause(cause);
+ }
+ this.messageName = messageName;
+ this.args = args;
+ }
+
+ @Override
+ public String getLocalizedMessage() {
+ return NbBundle.getMessage(StartTask.class, messageName, args);
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProxySettings.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProxySettings.java
new file mode 100644
index 0000000..0f983f2
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ProxySettings.java
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.prefs.PreferenceChangeListener;
+import java.util.prefs.Preferences;
+import org.openide.util.NbPreferences;
+import org.openide.util.Utilities;
+
+/**
+ * Stolen from core by vkraemer
+ *
+ * @author Jiri Rechtacek
+ */
+class ProxySettings {
+
+ public static final String PROXY_HTTP_HOST = "proxyHttpHost";
+ public static final String PROXY_HTTP_PORT = "proxyHttpPort";
+ public static final String PROXY_HTTPS_HOST = "proxyHttpsHost";
+ public static final String PROXY_HTTPS_PORT = "proxyHttpsPort";
+ public static final String PROXY_SOCKS_HOST = "proxySocksHost";
+ public static final String PROXY_SOCKS_PORT = "proxySocksPort";
+ public static final String NOT_PROXY_HOSTS = "proxyNonProxyHosts";
+ public static final String PROXY_TYPE = "proxyType";
+ public static final String USE_PROXY_AUTHENTICATION = "useProxyAuthentication";
+ public static final String PROXY_AUTHENTICATION_USERNAME = "proxyAuthenticationUsername";
+ public static final String PROXY_AUTHENTICATION_PASSWORD = "proxyAuthenticationPassword";
+ public static final String USE_PROXY_ALL_PROTOCOLS = "useProxyAllProtocols";
+ public static final String DIRECT = "DIRECT";
+
+ private static String presetNonProxyHosts;
+
+ /** No proxy is used to connect. */
+ public static final int DIRECT_CONNECTION = 0;
+
+ /** Proxy setting is automaticaly detect in OS. */
+ public static final int AUTO_DETECT_PROXY = 1; // as default
+
+ /** Manualy set proxy host and port. */
+ public static final int MANUAL_SET_PROXY = 2;
+
+ private static Preferences getPreferences() {
+ return NbPreferences.forModule (ProxySettings.class);
+ }
+
+ public static String getHttpHost () {
+ return normalizeProxyHost (getPreferences ().get (PROXY_HTTP_HOST, ""));
+ }
+
+ public static String getHttpPort () {
+ return getPreferences ().get (PROXY_HTTP_PORT, "");
+ }
+
+ public static String getHttpsHost () {
+ if (useProxyAllProtocols ()) {
+ return getHttpHost ();
+ } else {
+ return getPreferences ().get (PROXY_HTTPS_HOST, "");
+ }
+ }
+
+ public static String getHttpsPort () {
+ if (useProxyAllProtocols ()) {
+ return getHttpPort ();
+ } else {
+ return getPreferences ().get (PROXY_HTTPS_PORT, "");
+ }
+ }
+
+ public static String getSocksHost () {
+ if (useProxyAllProtocols ()) {
+ return getHttpHost ();
+ } else {
+ return getPreferences ().get (PROXY_SOCKS_HOST, "");
+ }
+ }
+
+ public static String getSocksPort () {
+ if (useProxyAllProtocols ()) {
+ return getHttpPort ();
+ } else {
+ return getPreferences ().get (PROXY_SOCKS_PORT, "");
+ }
+ }
+
+ public static String getNonProxyHosts () {
+ return getPreferences ().get (NOT_PROXY_HOSTS, getDefaultUserNonProxyHosts ());
+ }
+
+ public static int getProxyType () {
+ return getPreferences ().getInt (PROXY_TYPE, AUTO_DETECT_PROXY);
+ }
+
+ public static boolean useAuthentication () {
+ return getPreferences ().getBoolean (USE_PROXY_AUTHENTICATION, false);
+ }
+
+ public static boolean useProxyAllProtocols () {
+ return getPreferences ().getBoolean (USE_PROXY_ALL_PROTOCOLS, false);
+ }
+
+ public static String getAuthenticationUsername () {
+ return getPreferences ().get (PROXY_AUTHENTICATION_USERNAME, "");
+ }
+
+ public static char[] getAuthenticationPassword () {
+ return getPreferences ().get (PROXY_AUTHENTICATION_PASSWORD, "").toCharArray ();
+ }
+
+ static void addPreferenceChangeListener (PreferenceChangeListener l) {
+ getPreferences ().addPreferenceChangeListener (l);
+ }
+
+ static void removePreferenceChangeListener (PreferenceChangeListener l) {
+ getPreferences ().removePreferenceChangeListener (l);
+ }
+
+ private static String getSystemNonProxyHosts () {
+ String systemProxy = System.getProperty ("netbeans.system_http_non_proxy_hosts"); // NOI18N
+
+ return systemProxy == null ? "" : systemProxy;
+ }
+
+ private static String getPresetNonProxyHosts () {
+ if (presetNonProxyHosts == null) {
+ presetNonProxyHosts = System.getProperty ("http.nonProxyHosts", "");
+ }
+ return presetNonProxyHosts;
+ }
+
+ private static String getDefaultUserNonProxyHosts () {
+ return getModifiedNonProxyHosts (getSystemNonProxyHosts ());
+ }
+
+ private static String getModifiedNonProxyHosts (String systemPreset) {
+ String fromSystem = systemPreset.replaceAll (";", "|").replaceAll (",", "|"); //NOI18N
+ String fromUser = getPresetNonProxyHosts () == null ? "" : getPresetNonProxyHosts ().replaceAll (";", "|").replaceAll (",", "|"); //NOI18N
+ if (Utilities.isWindows ()) {
+ fromSystem = addReguralToNonProxyHosts (fromSystem);
+ }
+ String nonProxy = fromUser + (fromUser.length () == 0 ? "" : "|") + fromSystem + (fromSystem.length () == 0 ? "" : "|") + "localhost|127.0.0.1"; // NOI18N
+ String localhost = ""; // NOI18N
+ try {
+ localhost = InetAddress.getLocalHost().getHostName();
+ if (!"localhost".equals(localhost)) { // NOI18N
+ nonProxy = nonProxy + "|" + localhost; // NOI18N
+ } else {
+ // Avoid this error when hostname == localhost:
+ // Error in http.nonProxyHosts system property: sun.misc.REException: localhost is a duplicate
+ }
+ }
+ catch (UnknownHostException e) {
+ // OK. Sometimes a hostname is assigned by DNS, but a computer
+ // is later pulled off the network. It may then produce a bogus
+ // name for itself which can't actually be resolved. Normally
+ // "localhost" is aliased to 127.0.0.1 anyway.
+ }
+ /* per Milan's agreement it's removed. See issue #89868
+ try {
+ String localhost2 = InetAddress.getLocalHost().getCanonicalHostName();
+ if (!"localhost".equals(localhost2) && !localhost2.equals(localhost)) { // NOI18N
+ nonProxy = nonProxy + "|" + localhost2; // NOI18N
+ } else {
+ // Avoid this error when hostname == localhost:
+ // Error in http.nonProxyHosts system property: sun.misc.REException: localhost is a duplicate
+ }
+ }
+ catch (UnknownHostException e) {
+ // OK. Sometimes a hostname is assigned by DNS, but a computer
+ // is later pulled off the network. It may then produce a bogus
+ // name for itself which can't actually be resolved. Normally
+ // "localhost" is aliased to 127.0.0.1 anyway.
+ }
+ */
+ return compactNonProxyHosts (nonProxy);
+ }
+
+
+ // avoid duplicate hosts
+ private static String compactNonProxyHosts (String nonProxyHost) {
+ StringTokenizer st = new StringTokenizer (nonProxyHost, "|"); //NOI18N
+ Set<String> s = new HashSet<String> ();
+ StringBuilder compactedProxyHosts = new StringBuilder();
+ while (st.hasMoreTokens ()) {
+ String t = st.nextToken ();
+ if (s.add (t.toLowerCase (Locale.US))) {
+ if (compactedProxyHosts.length() > 0)
+ compactedProxyHosts.append('|');
+ compactedProxyHosts.append(t);
+ }
+ }
+ return compactedProxyHosts.toString();
+ }
+
+ private static String addReguralToNonProxyHosts (String nonProxyHost) {
+ StringTokenizer st = new StringTokenizer (nonProxyHost, "|");
+ StringBuilder reguralProxyHosts = new StringBuilder();
+ while (st.hasMoreTokens ()) {
+ String t = st.nextToken ();
+ if (t.indexOf ('*') == -1) { //NOI18N
+ t = t + '*'; //NOI18N
+ }
+ if (reguralProxyHosts.length() > 0)
+ reguralProxyHosts.append('|');
+ reguralProxyHosts.append(t);
+ }
+
+ return reguralProxyHosts.toString();
+ }
+
+ private static String normalizeProxyHost (String proxyHost) {
+ if (proxyHost.toLowerCase (Locale.US).startsWith ("http://")) { // NOI18N
+ return proxyHost.substring (7, proxyHost.length ());
+ } else {
+ return proxyHost;
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/RegisteredDerbyServerImpl.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/RegisteredDerbyServerImpl.java
new file mode 100644
index 0000000..9bbf830
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/RegisteredDerbyServerImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.spi.RegisterDatabase;
+import java.io.File;
+import org.netbeans.modules.derby.spi.support.DerbySupport;
+import org.netbeans.modules.payara.spi.RegisteredDerbyServer;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author vkraemer
+ */
+@ServiceProvider(service=RegisteredDerbyServer.class)
+public class RegisteredDerbyServerImpl implements RegisteredDerbyServer {
+
+ @Override
+ public void start() {
+ DerbySupport.ensureStarted();
+ }
+
+ @Override
+ public void initialize(String candidateLocation) {
+ String location = DerbySupport.getLocation();
+ if (null != location && location.trim().length() > 0) {
+ return;
+ }
+ DerbySupport.setLocation(candidateLocation);
+ location = DerbySupport.getSystemHome();
+ if (null != location && location.trim().length() > 0) {
+ return;
+ } else {
+ File dbdir = new File(DerbySupport.getDefaultSystemHome());
+ if (dbdir.exists() == false) {
+ dbdir.mkdirs();
+ }
+ }
+ DerbySupport.setSystemHome(DerbySupport.getDefaultSystemHome());
+ RegisterDatabase.getDefault().configureDatabase();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/RestartTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/RestartTask.java
new file mode 100644
index 0000000..74ededd
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/RestartTask.java
@@ -0,0 +1,544 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.util.Map;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.OFFLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.ONLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.STARTUP;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.UNKNOWN;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.CommandRestartDAS;
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.admin.CommandStopDAS;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import static org.netbeans.modules.payara.common.BasicTask.START_TIMEOUT;
+import static org.netbeans.modules.payara.common.BasicTask.STOP_TIMEOUT;
+import static org.netbeans.modules.payara.common.BasicTask.TIMEUNIT;
+import static org.netbeans.modules.payara.common.PayaraState.getStatus;
+import org.netbeans.modules.payara.spi.CommandFactory;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ *
+ * @author Peter Williams
+ * @author Vince Kraemer
+ */
+public class RestartTask extends BasicTask<TaskState> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER = PayaraLogger.get(RestartTask.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** How long to wait after stopping server to let OS clean up resources. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ private static final int RESTART_DELAY = 5000;
+
+ /** Common support object for the server instance being restarted. */
+ private final CommonServerSupport support;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of asynchronous Payara server restart command
+ * execution support object.
+ * <p/>
+ * @param support Common support object for the server instance being
+ * restarted
+ * @param stateListener State monitor to track restart progress.
+ */
+ public RestartTask(CommonServerSupport support, TaskStateListener... stateListener) {
+ super(support.getInstance(), stateListener);
+ this.support = support;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Start local server that is offline.
+ * <p/>
+ * @return State change request about offline remote server start request.
+ */
+ private StateChange localOfflineStart() {
+ Future<TaskState> startTask
+ = support.startServer(null, ServerState.RUNNING);
+ TaskState startResult = TaskState.FAILED;
+ try {
+ startResult = startTask.get(START_TIMEOUT, TIMEUNIT);
+ } catch (Exception ex) {
+ LOGGER.log(Level.FINER,
+ ex.getLocalizedMessage(), ex);
+ }
+ if (startResult == TaskState.FAILED) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "RestartTask.localOfflineStart.failed", instanceName);
+ }
+ return new StateChange(this,
+ TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ "RestartTask.localOfflineStart.completed", instanceName);
+ }
+
+ /**
+ * Start remote server that is offline.
+ * <p/>
+ * This operation is not possible and will always fail.
+ * <p/>
+ * @return State change request about offline remote server start request.
+ */
+ private StateChange remoteOfflineStart() {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.remoteOfflineStart.failed", instanceName);
+ }
+
+ /**
+ * Wait for local server currently shutting down and start it up.
+ * <p/>
+ * @return State change request about local server (that is shutting down)
+ * start request.
+ */
+ private StateChange localShutdownStart() {
+ StateChange stateChange = waitShutDown();
+ if (stateChange != null) {
+ return stateChange;
+ }
+ PayaraServerStatus status = getStatus(instance);
+ switch(status.getStatus()) {
+ case UNKNOWN: case ONLINE: case SHUTDOWN: case STARTUP:
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.localShutdownStart.notOffline",
+ instanceName);
+ default:
+ if (!ServerUtils.isAdminPortListening(
+ instance, NetUtils.PORT_CHECK_TIMEOUT)) {
+ return localOfflineStart();
+ } else {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.localShutdownStart.portOccupied",
+ instanceName);
+ }
+ }
+ }
+
+ /**
+ * Wait for remote server currently shutting down and start it up.
+ * <p/>
+ * This operation is not possible and will always fail.
+ * <p/>
+ * @return State change request about remote server (that is shutting down)
+ * start request.
+ */
+ private StateChange remoteShutdownStart() {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.remoteShutdownStart.failed", instanceName);
+ }
+
+ /**
+ * Wait for server to start up.
+ * <p/>
+ * @return State change request.
+ */
+ private StateChange startupWait() {
+ StartStateListener listener = prepareStartMonitoring(true);
+ if (listener == null) {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.startupWait.listenerError",
+ instanceName);
+ }
+ long start = System.currentTimeMillis();
+ try {
+ synchronized(listener) {
+ while (!listener.isWakeUp()
+ && (System.currentTimeMillis()
+ - start < START_TIMEOUT)) {
+ listener.wait(System.currentTimeMillis() - start);
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, NbBundle.getMessage(RestartTask.class,
+ "RestartTask.startupWait.interruptedException",
+ new String[] {
+ instance.getName(), ie.getLocalizedMessage()}));
+
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+ if (PayaraState.isOnline(instance)) {
+ return new StateChange(this,
+ TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ "RestartTask.startupWait.completed", instanceName);
+ } else {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.startupWait.failed", instanceName);
+ }
+ }
+
+ /**
+ * Full restart of local online server.
+ * <p/>
+ * @return State change request.
+ */
+ private StateChange localRestart() {
+ if (PayaraStatus.shutdown(instance)) {
+ ResultString result = CommandStopDAS.stopDAS(instance);
+ if (result.getState() == TaskState.COMPLETED) {
+ return localShutdownStart();
+ } else {
+ // TODO: Reset server status monitoring
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "RestartTask.localRestart.cmdFailed", instanceName);
+ }
+ } else {
+ return new StateChange(this,
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.localRestart.failed", instanceName);
+ }
+ }
+
+ /**
+ * Update server debug options before restart.
+ */
+ private boolean updateDebugOptions(final int debugPort) {
+ boolean updateResult = false;
+ try {
+ ResultMap<String, String> result
+ = CommandGetProperty.getProperties(instance,
+ "configs.config.server-config.java-config.debug-options");
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> values = result.getValue();
+ if (values != null && !values.isEmpty()) {
+ CommandFactory commandFactory =
+ instance.getInstanceProvider().getCommandFactory();
+ String oldValue = values.get(
+ "configs.config.server-config.java-config.debug-options");
+ CommandSetProperty setCmd =
+ commandFactory.getSetPropertyCommand(
+ "configs.config.server-config.java-config.debug-options",
+ oldValue.replace("transport=dt_shmem", "transport=dt_socket").
+ replace("address=[^,]+", "address=" + debugPort));
+ try {
+ CommandSetProperty.setProperty(instance, setCmd);
+ updateResult = true;
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO, debugPort + "", gfie);
+ }
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ LOGGER.log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ return updateResult;
+ }
+
+ /**
+ * Wait for debug port to become active.
+ * <p/>
+ * @return Value of <code>true</code> if port become active before timeout
+ * or <code>false</code> otherwise.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ private boolean vaitForDebugPort(final String host, final int port) {
+ boolean result = NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ if (!result) {
+ long tmStart = System.currentTimeMillis();
+ while (!result
+ && System.currentTimeMillis() - tmStart
+ < START_ADMIN_PORT_TIMEOUT) {
+ try {
+ Thread.sleep(PORT_CHECK_IDLE);
+ } catch (InterruptedException ex) {}
+ result = NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Full restart of remote online server.
+ * <p/>
+ * @return State change request.
+ */
+ private StateChange remoteRestart() {
+ boolean debugMode = instance.getJvmMode() == PayaraJvmMode.DEBUG;
+ // Wrong scenario as default.
+ boolean debugPortActive = true;
+ int debugPort = -1;
+ if (debugMode) {
+ debugPort = instance.getDebugPort();
+ debugMode = updateDebugOptions(debugPort);
+ debugPortActive = NetUtils.isPortListeningRemote(
+ instance.getHost(), debugPort, NetUtils.PORT_CHECK_TIMEOUT);
+ }
+ ResultString result
+ = CommandRestartDAS.restartDAS(instance, debugMode);
+ LogViewMgr.removeLog(instance);
+ LogViewMgr logger = LogViewMgr.getInstance(instance.getProperty(PayaraModule.URL_ATTR));
+ logger.stopReaders();
+ switch (result.getState()) {
+ case COMPLETED:
+ if (debugMode && !debugPortActive) {
+ vaitForDebugPort(instance.getHost(), debugPort);
+ waitStartUp(true, false);
+// This probably won't be needed.
+// } else {
+// try {
+// Thread.sleep(RESTART_DELAY);
+// } catch (InterruptedException ex) {}
+ }
+ return new StateChange(this,
+ result.getState(), TaskEvent.CMD_COMPLETED,
+ "RestartTask.remoteRestart.completed", instanceName);
+ default:
+ return new StateChange(this,
+ result.getState(), TaskEvent.CMD_COMPLETED,
+ "RestartTask.remoteRestart.failed", new String[] {
+ instanceName, result.getValue()});
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Restart Payara server.
+ * <p/>
+ * Possible states are <code>UNKNOWN</code>, <code>OFFLINE</code>,
+ * <code>STARTUP</code>, <code>ONLINE</code> and <code>SHUTDOWN</code>:
+ * <p/>
+ * <code>UNKNOWN</code>: Do nothing. UI shall not allow restarting while
+ * server status is unknown.
+ * <code>OFFLINE</code>: Server is already offline, let's start it
+ * if administrator port is not occupied.
+ * <code>STARTUP</code>: We are already in the middle of startup process.
+ * Let's just wait for sever to start.
+ * <code>ONLINE</code>: Full restart is needed.
+ * <code>SHUTDOWN</code>: Shutdown process has already started, let's wait
+ * for it to finish. Server will be started after
+ * that.
+ */
+ @Override
+ public TaskState call() {
+ PayaraStatus state = PayaraState.getStatus(instance).getStatus();
+ StateChange change;
+ switch (state) {
+ case UNKNOWN:
+ return fireOperationStateChanged(
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.call.unknownState", instanceName);
+ case OFFLINE:
+ change = instance.isRemote()
+ ? remoteOfflineStart() : localOfflineStart();
+ return change.fireOperationStateChanged();
+ case STARTUP:
+ change = startupWait();
+ return change.fireOperationStateChanged();
+ case ONLINE:
+ change = instance.isRemote()
+ ? remoteRestart() : localRestart();
+ return change.fireOperationStateChanged();
+ case SHUTDOWN:
+ change = instance.isRemote()
+ ? remoteShutdownStart() : localShutdownStart();
+ return change.fireOperationStateChanged();
+ // This shall be unrechable, all states should have
+ // own case handlers.
+ default:
+ return fireOperationStateChanged(
+ TaskState.FAILED, TaskEvent.ILLEGAL_STATE,
+ "RestartTask.call.unknownState", instanceName);
+ }
+ }
+
+ /**
+ * Restart operation:
+ *
+ * RUNNING -> stop server
+ * start server
+ *
+ * STARTING -> wait for state == STOPPED or RUNNING.
+ *
+ * STOPPED -> start server
+ *
+ * STOPPING -> wait for state == STOPPED
+ * start server
+ *
+ * For all of the above, command succeeds if state == RUNNING at the end.
+ *
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+// @Override
+ public TaskState call2() {
+ Logger.getLogger("payara").log(Level.FINEST,
+ "RestartTask.call() called on thread \"{0}\"",
+ Thread.currentThread().getName());
+ fireOperationStateChanged(TaskState.RUNNING, TaskEvent.CMD_RUNNING,
+ "MSG_RESTART_SERVER_IN_PROGRESS", instanceName);
+
+ //ServerState state = support.getServerState();
+ PayaraStatus state = PayaraState.getStatus(instance).getStatus();
+
+ if (state == PayaraStatus.STARTUP) {
+ // wait for start to finish, we are done.
+ PayaraStatus currentState = state;
+ int steps = (START_TIMEOUT / DELAY);
+ int count = 0;
+ while (currentState == PayaraStatus.STARTUP && count++ < steps) {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ex) {
+ Logger.getLogger("payara").log(Level.FINER,
+ ex.getLocalizedMessage(), ex);
+ }
+ currentState = PayaraState.getStatus(instance).getStatus();
+ }
+
+ if (!PayaraState.isOnline(instance)) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_RESTART_SERVER_FAILED_WONT_START", instanceName);
+ }
+ } else {
+ boolean postStopDelay = true;
+ if (state == PayaraStatus.ONLINE) {
+ Future<TaskState> stopTask = support.stopServer(null);
+ TaskState stopResult = TaskState.FAILED;
+ try {
+ stopResult = stopTask.get(STOP_TIMEOUT, TIMEUNIT);
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.FINER,
+ ex.getLocalizedMessage(), ex);
+ }
+
+ if (stopResult == TaskState.FAILED) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_RESTART_SERVER_FAILED_WONT_STOP",
+ instanceName);
+ }
+ } else if (state == PayaraStatus.SHUTDOWN) {
+ // wait for server to stop.
+ PayaraStatus currentState = state;
+ int steps = (STOP_TIMEOUT / DELAY);
+ int count = 0;
+ while (currentState == PayaraStatus.SHUTDOWN && count++ < steps) {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ex) {
+ Logger.getLogger("payara").log(Level.FINER,
+ ex.getLocalizedMessage(), ex);
+ }
+ currentState = PayaraState.getStatus(instance).getStatus();
+ }
+
+ if (!PayaraState.isOffline(instance)) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_RESTART_SERVER_FAILED_WONT_STOP",
+ instanceName);
+ }
+ } else {
+ postStopDelay = false;
+ }
+
+ if (postStopDelay) {
+ // If we stopped the server (or it was already stopping), delay
+ // start for a few seconds to let system clean up ports.
+ support.setServerState(ServerState.STARTING);
+ try {
+ Thread.sleep(RESTART_DELAY);
+ } catch (InterruptedException ex) {
+ // ignore
+ }
+ }
+
+ // Server should be stopped. Start it.
+ Object o = support.setEnvironmentProperty(PayaraModule.JVM_MODE,
+ PayaraModule.NORMAL_MODE, false);
+ if (PayaraModule.PROFILE_MODE.equals(o)) {
+ support.setEnvironmentProperty(PayaraModule.JVM_MODE,
+ PayaraModule.NORMAL_MODE, false);
+ }
+ Future<TaskState> startTask = support.startServer(null, ServerState.RUNNING);
+ TaskState startResult = TaskState.FAILED;
+ try {
+ startResult = startTask.get(START_TIMEOUT, TIMEUNIT);
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.FINER,
+ ex.getLocalizedMessage(), ex); // NOI18N
+ }
+
+ if (startResult == TaskState.FAILED) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_RESTART_SERVER_FAILED_WONT_START",
+ instanceName);
+ }
+
+ if (!support.isRemote()
+ && support.getServerState() != ServerState.RUNNING) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_RESTART_SERVER_FAILED_REASON_UNKNOWN",
+ instanceName);
+ }
+ }
+
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_RESTARTED", instanceName);
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ServerDetails.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ServerDetails.java
new file mode 100644
index 0000000..b36fbcf
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ServerDetails.java
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.modules.payara.common.parser.TreeParser;
+import org.netbeans.modules.payara.common.wizards.ServerWizardIterator;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.openide.WizardDescriptor;
+import org.openide.util.NbBundle;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author vkraemer
+ * @author Gaurav Gupta
+ */
+public enum ServerDetails {
+ //add new version
+ /**
+ * details for an instance of Payara Server 4.1.144
+ */
+ PAYARA_SERVER_4_1_144(NbBundle.getMessage(ServerDetails.class, "STR_41144_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 41144,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.144/payara.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.151
+ */
+ PAYARA_SERVER_4_1_151(NbBundle.getMessage(ServerDetails.class, "STR_41151_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 41151,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.151/payara-4.1.151.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.152
+ */
+ PAYARA_SERVER_4_1_152(NbBundle.getMessage(ServerDetails.class, "STR_41152_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 41152,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.152/payara-4.1.152.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.153
+ */
+ PAYARA_SERVER_4_1_153(NbBundle.getMessage(ServerDetails.class, "STR_41153_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 41153,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.153/payara-4.1.153.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.154
+ */
+ PAYARA_SERVER_4_1_1_154(NbBundle.getMessage(ServerDetails.class, "STR_411154_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411154,
+ "hhttps://github.com/payara/Payara/releases/download/payara-server-4.1.1.154/payara-4.1.1.154.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.161
+ */
+ PAYARA_SERVER_4_1_1_161(NbBundle.getMessage(ServerDetails.class, "STR_411161_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411161,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.1.161/payara-4.1.1.161.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.162
+ */
+ PAYARA_SERVER_4_1_1_162(NbBundle.getMessage(ServerDetails.class, "STR_411162_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411162,
+ "https://github.com/payara/Payara/releases/download/payara-server-4.1.1.162/payara-4.1.1.162.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.163
+ */
+ PAYARA_SERVER_4_1_1_163(NbBundle.getMessage(ServerDetails.class, "STR_411163_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411163,
+ "https://github.com/payara/Payara/releases/download/4.1.1.163/payara-4.1.1.163.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.164
+ */
+ PAYARA_SERVER_4_1_1_164(NbBundle.getMessage(ServerDetails.class, "STR_411164_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411164,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.1.164/payara-4.1.1.164.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.1.171
+ */
+ PAYARA_SERVER_4_1_1_171(NbBundle.getMessage(ServerDetails.class, "STR_411171_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 411171,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.1.171/payara-4.1.1.171.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.2.172
+ */
+ PAYARA_SERVER_4_1_2_172(NbBundle.getMessage(ServerDetails.class, "STR_412172_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 412172,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.2.172/payara-4.1.2.172.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.2.173
+ */
+ PAYARA_SERVER_4_1_2_173(NbBundle.getMessage(ServerDetails.class, "STR_412173_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 412173,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.2.173/payara-4.1.2.173.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.2.174
+ */
+ PAYARA_SERVER_4_1_2_174(NbBundle.getMessage(ServerDetails.class, "STR_412174_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 412174,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.2.174/payara-4.1.2.174.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 4.1.2.181
+ */
+ PAYARA_SERVER_4_1_2_181(NbBundle.getMessage(ServerDetails.class, "STR_412181_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv4ee7", // NOI18N
+ 412181,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/4.1.2.181/payara-4.1.2.181.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.181
+ */
+ PAYARA_SERVER_5_181(NbBundle.getMessage(ServerDetails.class, "STR_5181_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5181,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.181/payara-5.181.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.182
+ */
+ PAYARA_SERVER_5_182(NbBundle.getMessage(ServerDetails.class, "STR_5182_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5182,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.182/payara-5.182.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.183
+ */
+ PAYARA_SERVER_5_183(NbBundle.getMessage(ServerDetails.class, "STR_5183_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5183,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.183/payara-5.183.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.184
+ */
+ PAYARA_SERVER_5_184(NbBundle.getMessage(ServerDetails.class, "STR_5184_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5184,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.184/payara-5.184.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.191
+ */
+ PAYARA_SERVER_5_191(NbBundle.getMessage(ServerDetails.class, "STR_5191_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5191,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.191/payara-5.191.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ ),
+ /**
+ * details for an instance of Payara Server 5.192
+ */
+ PAYARA_SERVER_5_192(NbBundle.getMessage(ServerDetails.class, "STR_5192_SERVER_NAME", new Object[]{}), // NOI18N
+ "deployer:pfv5ee8", // NOI18N
+ 5192,
+ "https://oss.sonatype.org/service/local/repositories/releases/content/fish/payara/distributions/payara/5.192/payara-5.192.zip", // NOI18N
+ null,
+ "https://raw.githubusercontent.com/payara/Payara/master/LICENSE.txt"
+ );
+
+ /**
+ * Creates an iterator for a wizard to instantiate server objects.
+ * <p/>
+ * @return Server wizard iterator initialized with supported Payara
+ * server versions.
+ */
+ public static WizardDescriptor.InstantiatingIterator
+ getInstantiatingIterator() {
+ return new ServerWizardIterator(
+ //add new version
+ new ServerDetails[]{
+ PAYARA_SERVER_5_192,
+ PAYARA_SERVER_5_191,
+ PAYARA_SERVER_5_184,
+ PAYARA_SERVER_5_183,
+ PAYARA_SERVER_5_182,
+ PAYARA_SERVER_5_181,
+ PAYARA_SERVER_4_1_2_181,
+ PAYARA_SERVER_4_1_2_174,
+ PAYARA_SERVER_4_1_2_173,
+ PAYARA_SERVER_4_1_2_172,
+ PAYARA_SERVER_4_1_1_171,
+ PAYARA_SERVER_4_1_1_164,
+ PAYARA_SERVER_4_1_1_163,
+ PAYARA_SERVER_4_1_1_162,
+ PAYARA_SERVER_4_1_1_161,
+ PAYARA_SERVER_4_1_1_154,
+ PAYARA_SERVER_4_1_153,
+ PAYARA_SERVER_4_1_152,
+ PAYARA_SERVER_4_1_151,
+ PAYARA_SERVER_4_1_144
+ },
+ new ServerDetails[]{
+ PAYARA_SERVER_5_192,
+ PAYARA_SERVER_5_191,
+ PAYARA_SERVER_5_184,
+ PAYARA_SERVER_5_183,
+ PAYARA_SERVER_5_182,
+ PAYARA_SERVER_5_181,
+ PAYARA_SERVER_4_1_2_181,
+ PAYARA_SERVER_4_1_2_174,
+ PAYARA_SERVER_4_1_2_173,
+ PAYARA_SERVER_4_1_2_172,
+ PAYARA_SERVER_4_1_1_171,
+ PAYARA_SERVER_4_1_1_164,
+ PAYARA_SERVER_4_1_1_163,
+ PAYARA_SERVER_4_1_1_162,
+ PAYARA_SERVER_4_1_1_161
+ }
+ );
+
+ }
+
+ /**
+ * Determine the version of the Payara Server installed in a directory
+ * @param payaraDir the directory that holds a Payara installation
+ * @return -1 if the directory is not a Payara server install
+ */
+ public static int getVersionFromInstallDirectory(File payaraDir) {
+ if (payaraDir == null) {
+ return -1;
+ }
+
+ PayaraVersion version
+ = ServerUtils.getServerVersion(payaraDir.getAbsolutePath());
+ ServerDetails sd = null;
+ if (version != null) {
+ switch (version) {
+ //add new version
+ case PF_4_1_144:
+ return PAYARA_SERVER_4_1_144.getVersion();
+ case PF_4_1_151:
+ return PAYARA_SERVER_4_1_151.getVersion();
+ case PF_4_1_153:
+ return PAYARA_SERVER_4_1_153.getVersion();
+ case PF_4_1_1_154:
+ return PAYARA_SERVER_4_1_1_154.getVersion();
+ case PF_4_1_1_161:
+ return PAYARA_SERVER_4_1_1_161.getVersion();
+ case PF_4_1_1_162:
+ return PAYARA_SERVER_4_1_1_162.getVersion();
+ case PF_4_1_1_163:
+ return PAYARA_SERVER_4_1_1_163.getVersion();
+ case PF_4_1_1_171:
+ return PAYARA_SERVER_4_1_1_171.getVersion();
+ case PF_4_1_2_172:
+ return PAYARA_SERVER_4_1_2_172.getVersion();
+ case PF_4_1_2_173:
+ return PAYARA_SERVER_4_1_2_173.getVersion();
+ case PF_4_1_2_174:
+ return PAYARA_SERVER_4_1_2_174.getVersion();
+ case PF_4_1_2_181:
+ return PAYARA_SERVER_4_1_2_181.getVersion();
+ case PF_5_181:
+ return PAYARA_SERVER_5_181.getVersion();
+ case PF_5_182:
+ return PAYARA_SERVER_5_182.getVersion();
+ case PF_5_183:
+ return PAYARA_SERVER_5_183.getVersion();
+ case PF_5_184:
+ return PAYARA_SERVER_5_184.getVersion();
+ case PF_5_191:
+ return PAYARA_SERVER_5_191.getVersion();
+ case PF_5_192:
+ return PAYARA_SERVER_5_192.getVersion();
+ default:
+ return -1;
+ }
+ }
+ return null==sd?-1:sd.getVersion();
+ }
+
+ /**
+ * Determine the version of the Payara Server that wrote the domain.xml file
+ *
+ * @param domainXml the file to analyze
+ * @return -1 if domainXml is null, unreadable or not a directory
+ * @throws IllegalStateException if domainXml cannot be parsed
+ */
+ @Deprecated
+ public static int getVersionFromDomainXml(File domainXml) throws IllegalStateException {
+ if (null == domainXml || !domainXml.isFile() || !domainXml.canRead()) {
+ return -1;
+ }
+ return hasDefaultConfig(domainXml) ? PAYARA_SERVER_5_192.getVersion() : PAYARA_SERVER_5_181.getVersion();
+ }
+
+ private static boolean hasDefaultConfig(File domainXml) throws IllegalStateException {
+ DomainParser dp = new DomainParser();
+ List<TreeParser.Path> paths = new ArrayList<>();
+ paths.add(new TreeParser.Path("/domain/configs/config",dp)); // NOI18N
+ TreeParser.readXml(domainXml, paths);
+ return dp.hasDefaultConfig();
+ }
+
+ private final String displayName;
+ private final String uriFragment;
+ private final String indirectUrl;
+ private final String directUrl;
+ private final String licenseUrl;
+ private final int versionInt;
+
+
+ ServerDetails(String displayName, String uriFragment, int versionInt,
+ String directUrl, String indirectUrl, String licenseUrl) {
+ this.displayName = displayName;
+ this.uriFragment = uriFragment;
+ this.indirectUrl = indirectUrl;
+ this.directUrl = directUrl;
+ this.versionInt = versionInt;
+ this.licenseUrl = licenseUrl;
+ }
+
+ @Override
+ public String toString() {
+ return displayName;
+ }
+
+ public String getUriFragment() {
+ return uriFragment;
+ }
+
+ public int getVersion() {
+ return versionInt;
+ }
+
+ /**
+ * Determine if the glassfishDir holds a valid install of this release of
+ * Payara Server.
+ * @param payaraDir
+ * @return true if the glassfishDir holds this particular server version.
+ */
+ public boolean isInstalledInDirectory(File payaraDir) {
+ return getVersionFromInstallDirectory(payaraDir) == this.getVersion();
+ }
+
+ static class DomainParser extends TreeParser.NodeReader {
+
+ private boolean hasDefaultConfig = false;
+ private boolean hasDefaultConfig() {
+ return hasDefaultConfig;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String name = attributes.getValue("name"); // NOI18N
+ if ("default-config".equals(name)) { // NOI18N
+ hasDefaultConfig = true;
+ }
+ }
+
+ }
+
+ public String getDirectUrl() {
+ return directUrl;
+ }
+
+ public String getIndirectUrl() {
+ return indirectUrl;
+ }
+
+ public String getLicenseUrl() {
+ return licenseUrl;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/SimpleIO.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/SimpleIO.java
new file mode 100644
index 0000000..2df9222
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/SimpleIO.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.awt.event.ActionEvent;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.windows.IOProvider;
+import org.openide.windows.InputOutput;
+import org.openide.windows.OutputWriter;
+
+/**
+ * @author Peter Williams
+ */
+public class SimpleIO {
+
+ /**
+ * Time in milliseconds to wait between checks of the input stream.
+ */
+ private static final int DELAY = 1000;
+
+ private final String name;
+ private final InputOutput io;
+ private final CancelAction cancelAction;
+ private final AtomicReference<Process> process;
+
+ public SimpleIO(String displayName, Process task) {
+ name = displayName;
+ process = new AtomicReference<Process>(task);
+ cancelAction = new CancelAction();
+ io = IOProvider.getDefault().getIO(displayName, new Action [] {
+ cancelAction
+ });
+ io.select();
+ }
+
+ /**
+ * Reads a newly included InputSreams
+ *
+ * @param inputStreams InputStreams to read
+ */
+ public void readInputStreams(InputStream... inputStreams) {
+ RequestProcessor rp = RequestProcessor.getDefault();
+ for(InputStream inputStream : inputStreams){
+ rp.post(new IOReader(inputStream));
+ }
+ }
+
+ /**
+ * Writes a string to the output window
+ *
+ * @param s string to be written
+ */
+ public synchronized void write(String s) {
+ OutputWriter writer = io.getOut();
+ writer.print(s);
+ writer.flush();
+ }
+
+ /**
+ * Selects output panel
+ */
+ public synchronized void selectIO() {
+ io.select();
+ }
+
+ /**
+ * Closes the output panel
+ */
+ public synchronized void closeIO() {
+ // Don't close the window when finished -- in case of install or launching
+ // failures, it makes problems easiesr for the user to diagnose.
+ process.set(null);
+ cancelAction.updateEnabled();
+ }
+
+ /**
+ * Thread to read an I/O stream and write it to the output window managed
+ */
+ private class IOReader implements Runnable {
+
+ private InputStream inputStream;
+
+ public IOReader(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Implementation of the Runnable interface. Here all tailing is
+ * performed
+ */
+ public void run() {
+ final String originalName = Thread.currentThread().getName();
+
+ try {
+ Thread.currentThread().setName(this.getClass().getName() + " - " + inputStream); // NOI18N
+
+ // create a reader from the input stream
+ Reader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ // read from the input stream and put all the changes to the I/O window
+ char [] chars = new char[1024];
+ int len = 0;
+ while(len != -1) {
+ while((len = reader.read(chars)) != -1) {
+ write(new String(chars, 0, len));
+ selectIO();
+
+ if(!reader.ready()) {
+ break;
+ }
+ }
+
+ // sleep for a while when the stream is empty
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ } catch (IOException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ } finally {
+ try {
+ inputStream.close();
+ } catch (IOException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+
+ Thread.currentThread().setName(originalName);
+ }
+ }
+ }
+
+ /** This action will be displayed in the server output window */
+ public class CancelAction extends AbstractAction {
+
+ private static final String PROP_ENABLED = "enabled"; // NOI18N
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/stop.png"; // NOI18N
+
+ public CancelAction() {
+ super(NbBundle.getMessage(SimpleIO.class, "CTL_Cancel"),ImageUtilities.loadImageIcon(ICON, false)); // NOI18N
+ putValue(SHORT_DESCRIPTION, NbBundle.getMessage(SimpleIO.class, "LBL_CancelDesc")); // NOI18N
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if(process.get() != null) {
+ String message = NbBundle.getMessage(SimpleIO.class, "MSG_QueryCancel", name); // NOI18N
+ NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message,
+ NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
+ if(DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION) {
+ Process p = process.getAndSet(null);
+ if(p != null) {
+ p.destroy();
+ } else {
+ Logger.getLogger("payara").log(Level.FINEST, "Process handle unexpectedly null, cancel aborted."); // NOI18N
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return process.get() != null;
+ }
+
+ public void updateEnabled() {
+ Mutex.EVENT.readAccess(new Runnable() {
+ public void run() {
+ firePropertyChange(PROP_ENABLED, null, isEnabled() ? Boolean.TRUE : Boolean.FALSE);
+ }
+ });
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/StartTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StartTask.java
new file mode 100644
index 0000000..a672dde
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StartTask.java
@@ -0,0 +1,881 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.tooling.admin.ResultProcess;
+import org.netbeans.modules.payara.tooling.admin.CommandException;
+import org.netbeans.modules.payara.tooling.admin.CommandStartInstance;
+import org.netbeans.modules.payara.tooling.admin.CommandVersion;
+import org.netbeans.modules.payara.tooling.admin.CommandStartCluster;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.SwingUtilities;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.OFFLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.ONLINE;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.PayaraStatus.STARTUP;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.StartupArgs;
+import org.netbeans.modules.payara.tooling.data.StartupArgsEntity;
+import org.netbeans.modules.payara.tooling.server.FetchLogSimple;
+import org.netbeans.modules.payara.tooling.server.ServerTasks;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.api.extexecution.startup.StartupExtender;
+import static org.netbeans.modules.payara.common.BasicTask.START_TIMEOUT;
+import org.netbeans.modules.payara.common.ui.JavaSEPlatformPanel;
+import org.netbeans.modules.payara.common.utils.AdminKeyFile;
+import org.netbeans.modules.payara.common.utils.JavaUtils;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.netbeans.modules.payara.spi.Recognizer;
+import org.netbeans.modules.payara.spi.RegisteredDerbyServer;
+import org.netbeans.modules.payara.spi.VMIntrospector;
+import org.openide.execution.NbProcessDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+import org.openide.util.lookup.Lookups;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Asynchronous Payara server startup command execution.
+ * <p/>
+ * @author Ludovic Chamenois, Peter Williams, Tomas Kraus
+ */
+public class StartTask extends BasicTask<TaskState> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER = PayaraLogger.get(StartTask.class);
+
+ private static RequestProcessor NODE_REFRESHER
+ = new RequestProcessor("nodes to refresh");
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ private static String[] removeEscapes(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ args[i] = args[i].replace("\\\"", ""); // NOI18N
+ }
+ return args;
+ }
+
+ private static StartupExtender.StartMode getMode(String gfMode) {
+ if (PayaraModule.PROFILE_MODE.equals(gfMode)) {
+ return StartupExtender.StartMode.PROFILE;
+ } else if (PayaraModule.DEBUG_MODE.equals(gfMode)) {
+ return StartupExtender.StartMode.DEBUG;
+ } else {
+ return StartupExtender.StartMode.NORMAL;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ private final CommonServerSupport support;
+ private List<Recognizer> recognizers;
+ private List<String> jvmArgs = null;
+ private final VMIntrospector vmi;
+
+ /** internal Java SE platform home cache. */
+ private FileObject jdkHome;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of asynchronous Payara server startup command
+ * execution support object.
+ * <p/>
+ * @param support Common support object for the server instance being
+ * started.
+ * @param recognizers Output recognizers to pass to log processors, if any.
+ * @param stateListener State monitor to track start progress.
+ */
+ public StartTask(CommonServerSupport support, List<Recognizer> recognizers,
+ VMIntrospector vmi,
+ TaskStateListener... stateListener) {
+ this(support, recognizers, vmi, null, stateListener);
+ }
+
+ /**
+ * Constructs an instance of asynchronous Payara server startup command
+ * execution support object.
+ * <p/>
+ * @param support Common support object for the server instance being
+ * started.
+ * @param recognizers Output recognizers to pass to log processors, if any.
+ * @param jdkRoot Java SE Development Kit to start server in profiling
+ * mode.
+ * @param jvmArgs JVM arguments used to start server in profiling
+ * mode.
+ * @param stateListener State monitor to track start progress.
+ */
+ public StartTask(final CommonServerSupport support,
+ List<Recognizer> recognizers, VMIntrospector vmi, String[] jvmArgs,
+ TaskStateListener... stateListener) {
+ super(support.getInstance(), stateListener);
+ List<TaskStateListener> listeners = new ArrayList<>();
+ listeners.addAll(Arrays.asList(stateListener));
+ listeners.add(new TaskStateListener() {
+
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ if (TaskState.COMPLETED.equals(newState)) {
+ // attempt to sync the comet support
+ RequestProcessor.getDefault().post(
+ new EnableComet(support.getInstance()));
+ }
+ }
+ });
+ this.stateListener = listeners.toArray(new TaskStateListener[listeners.size()]);
+ this.support = support;
+ this.recognizers = recognizers;
+ this.jvmArgs = (jvmArgs != null) ? Arrays.asList(removeEscapes(jvmArgs)) : null;
+ this.vmi = vmi;
+ this.jdkHome = null;
+ LOGGER.log(Level.FINE, "VMI == {0}", vmi);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Asynchronous task method started by {@link Executors}.
+ * <p/>
+ * @return Task execution result.
+ */
+ @Override
+ public TaskState call() {
+ // Save the current time so that we can deduct that the startup
+ // Failed due to timeout
+ LOGGER.log(Level.FINEST, "StartTask.call() called on thread \"{0}\"",
+ Thread.currentThread().getName());
+ final long start = System.currentTimeMillis();
+
+ final String host = instance.getHost();
+ final int adminPort = instance.getAdminPort();
+ StateChange change;
+ if ((change = validateAdminHostAndPort(host, adminPort)) != null) {
+ return change.fireOperationStateChanged();
+ }
+ // Remote server.
+ if (support.isRemote()) {
+ if (PayaraState.isOnline(instance)) {
+ if (Util.isDefaultOrServerTarget(instance.getProperties())) {
+ return restartDAS(host, adminPort, start);
+ } else {
+ return startClusterOrInstance(host, adminPort);
+ }
+ } else {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_DASDOWN", instanceName);
+ }
+ // Local server.
+ } else
+ // Our server is offline.
+ if (PayaraState.isOffline(instance)) {
+ // But administrator port is occupied.
+ if (ServerUtils.isAdminPortListening(
+ instance, NetUtils.PORT_CHECK_TIMEOUT)) {
+ ResultString version;
+ try {
+ version = CommandVersion.getVersion(instance);
+ } catch (CommandException ce) {
+ version = null;
+ }
+ // Got version response from DAS.
+ if (version != null) {
+ // There is server with matching version.
+ if (CommandVersion.verifyResult(version, instance)) {
+ fireOperationStateChanged(TaskState.RUNNING,
+ TaskEvent.CMD_COMPLETED,
+ "StartTask.call.matchVersion",
+ version.getValue());
+ return startClusterOrInstance(host, adminPort);
+ // There is server with non matching version.
+ } else {
+ if (!version.isAuth()) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "StartTask.call.authFailed",
+ instanceName, version.getValue());
+ } else {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "StartTask.call.anotherVersion",
+ instanceName, version.getValue());
+ }
+ }
+ // Got no version response from DAS.
+ } else {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "StartTask.call.unknownVersion", instanceName);
+ }
+ } else {
+ return startDAS(host, adminPort);
+ }
+ // Our server is online.
+ } else {
+ return startClusterOrInstance(host, adminPort);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Validate <code>host</code> and <code>port</code> values
+ * for DAS listener.
+ * <p/>
+ * @return State change request data when server shall not be started
+ * and listeners should be notified about it or <code>null</code>
+ * otherwise.
+ */
+ private StateChange validateAdminHostAndPort(
+ final String host, final int adminPort) {
+ if (host == null || host.length() == 0) {
+ return new StateChange(this, TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_NOHOST", instanceName);
+ }
+ if (adminPort < 0 || adminPort > 65535) {
+ return new StateChange(this, TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_BADPORT", instanceName);
+ }
+ return null;
+ }
+
+ private TaskState restartDAS(String adminHost, int adminPort, final long start) {
+ // deal with the remote case here...
+ TaskStateListener[] listeners = {
+ new TaskStateListener() {
+ // if the http command is successful, we are not done yet...
+ // The server still has to stop. If we signal success to the 'stateListener'
+ // for the task, it may be premature.
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ if (newState == TaskState.RUNNING) {
+ support.setServerState(ServerState.STARTING);
+ }
+ if (newState == TaskState.FAILED) {
+ fireOperationStateChanged(newState, event,
+ instanceName, args);
+ support.setServerState(ServerState.STOPPED);
+ //support.refresh();
+ } else if (args != null && newState == TaskState.COMPLETED) {
+ for (String message : args) {
+ if (message.matches("[sg]et\\?.*\\=configs\\..*")) {
+ return;
+ }
+ }
+ long startTime = System.currentTimeMillis();
+ TaskState state = TaskState.RUNNING;
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // no op
+ }
+ while (TaskState.RUNNING == state && System.currentTimeMillis() - start < START_TIMEOUT) {
+ // Send the 'completed' event and return when the server is running
+ boolean httpLive = PayaraState.isOnline(instance); //CommonServerSupport.isRunning(host, port,instance.getProperty(PayaraModule.DISPLAY_NAME_ATTR));
+
+ // Sleep for a little so that we do not make our checks too often
+ //
+ // Doing this before we check httpAlive also prevents us from
+ // pinging the server too quickly after the ports go live.
+ //
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // no op
+ }
+
+ if (httpLive) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // no op
+ }
+ state = TaskState.COMPLETED;
+ }
+ }
+ if (state == TaskState.COMPLETED) { //support.isReady(false, 120, TimeUnit.SECONDS)) {
+ support.setServerState(ServerState.RUNNING);
+ } else {
+ support.setServerState(ServerState.STOPPED);
+ }
+ }
+ }
+ }};
+ int debugPort = -1;
+ if (PayaraModule.DEBUG_MODE.equals(instance.getProperty(PayaraModule.JVM_MODE))) {
+ debugPort = instance.getDebugPort();
+ }
+ support.restartServer(debugPort,
+ support.supportsRestartInDebug() && debugPort >= 0, listeners);
+ return fireOperationStateChanged(
+ TaskState.RUNNING, TaskEvent.CMD_FAILED,
+ "StartTask.restartDAS.inProgress", instanceName);
+
+ }
+
+ /**
+ * Reset administrator password when needed.
+ */
+ private void resetPassword() {
+ AdminKeyFile keyFile = new AdminKeyFile(instance);
+ keyFile.read();
+ if (keyFile.isReset()) {
+ String password = AdminKeyFile.randomPassword(
+ AdminKeyFile.RANDOM_PASSWORD_LENGTH);
+ instance.setAdminPassword(password);
+ keyFile.setPassword(password);
+ try {
+ PayaraInstance.writeInstanceToFile(instance);
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ keyFile.write();
+ }
+ }
+
+ /**
+ * Initialize JDK used to start Payara server.
+ * <p/>
+ * @return State change request data when JDK could not be initialized
+ * or <code>null</code> otherwise.
+ */
+ private StateChange initJDK() {
+ try {
+ if (null == jdkHome) {
+ jdkHome = getJavaPlatformRoot();
+ File jdkHomeFile = FileUtil.toFile(jdkHome);
+ if (!JavaUtils.isJavaPlatformSupported(instance, jdkHomeFile)) {
+ jdkHome = JavaSEPlatformPanel.selectServerSEPlatform(
+ instance, jdkHomeFile);
+ }
+ }
+ if (jdkHome == null) {
+ return new StateChange(this, TaskState.FAILED,
+ TaskEvent.CMD_FAILED, "StartTask.initJDK.null",
+ instanceName);
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, null, ex); // NOI18N
+ return new StateChange(this, TaskState.FAILED,
+ TaskEvent.CMD_FAILED, "StartTask.initJDK.exception",
+ new String[] {instanceName, ex.getLocalizedMessage()});
+ }
+ return null;
+ }
+
+ /**
+ * Verify Payara server status before starting it.
+ * <p/>
+ * @return State change request data when server shall not be started
+ * and listeners should be notified about it or <code>null</code>
+ * otherwise.
+ */
+ private StateChange checkBeforeStart() {
+ PayaraServerStatus status = PayaraState.getStatus(instance);
+ String msgKey = null;
+ switch (status.getStatus()) {
+ case ONLINE:
+ TaskState result;
+ TaskEvent event;
+ if (PayaraModule.PROFILE_MODE.equals(instance.getProperty(PayaraModule.JVM_MODE))) {
+ result = TaskState.FAILED;
+ event = TaskEvent.CMD_FAILED;
+ } else {
+ result = TaskState.COMPLETED;
+ event = TaskEvent.CMD_COMPLETED;
+ }
+ return new StateChange(this, result, event,
+ "StartTask.startDAS.alreadyRunning");
+ case OFFLINE:
+ if (ServerUtils.isAdminPortListening(
+ instance, NetUtils.PORT_CHECK_TIMEOUT)) {
+ msgKey = "StartTask.startDAS.adminPortOccupied";
+ } else {
+ final int httpPort = instance.getPort();
+ if (httpPort >= 0 && httpPort <= 65535
+ && NetUtils.isPortListeningLocal(
+ instance.getHost(), httpPort)) {
+ msgKey = "StartTask.startDAS.httpPortOccupied";
+ }
+ }
+ break;
+ case SHUTDOWN:
+ msgKey = "StartTask.startDAS.shutdown";
+ break;
+ case STARTUP:
+ msgKey = "StartTask.startDAS.startup";
+ }
+ return msgKey != null
+ ? new StateChange(this, TaskState.FAILED,
+ TaskEvent.CMD_FAILED, msgKey, this.instance.getDisplayName())
+ : null;
+ }
+
+ /**
+ * Check for server status in profiling mode during startup.
+ * <p/>
+ * @return State change request about server startup success.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ private StateChange profilingServerStatus() {
+ LOGGER.log(Level.FINE,
+ "Profiling mode status hack for {0}",
+ new Object[]{instance.getName()});
+ // Save process to be able to stop process waiting for profiler
+ // to attach.
+ support.setLocalStartProcess(instance.getProcess());
+ // Try to sync the states after the profiler attaches.
+ NODE_REFRESHER.post(new Runnable() {
+ @Override
+ public void run() {
+ while (!PayaraState.isOnline(instance)) {
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException ex) {
+ }
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ support.refresh();
+ }
+ });
+ }
+ });
+ return new StateChange(this, TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_STARTED", instanceName);
+ }
+
+ private TaskState startDAS(String adminHost, int adminPort) {
+ StateChange change;
+ resetPassword();
+ if ((change = initJDK()) != null) {
+ return change.fireOperationStateChanged();
+ }
+ // Time must be measured after Java SE platform selection is done.
+ long start = System.currentTimeMillis();
+ StartStateListener listener;
+ try {
+ // lookup the javadb start service and use it here.
+ RegisteredDerbyServer db
+ = Lookup.getDefault().lookup(RegisteredDerbyServer.class);
+ if (null != db && "true".equals(instance.getProperty(PayaraModule.START_DERBY_FLAG))) { // NOI18N
+ db.start();
+ }
+ // This may be an autheticated server... so we will say it is
+ // started. Other operations will fail if the process on the port
+ // is not a GF v3 server.
+ LOGGER.log(Level.FINEST,
+ "Checking if Payara {0} is running.",
+ instance.getName());
+ if ((change = checkBeforeStart()) != null) {
+ return change.fireOperationStateChanged();
+ } else if (upgradeFailed()) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "StartTask.startDAS.domainUpgrade", instanceName);
+ }
+ // We should be listening for reaching ONLINE state before process
+ // is started.
+ listener = prepareStartMonitoring(
+ instance.getJvmMode() == PayaraJvmMode.PROFILE);
+ if (listener == null) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "StartTask.startDAS.startupMonitoring", instanceName);
+ }
+ Process process = createProcess();
+ instance.setProcess(process);
+ listener.setProcess(process);
+ } catch (ProcessCreationException ex) {
+ Logger.getLogger("payara").log(Level.INFO,
+ "Could not start process for " + instanceName, ex);
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED, "MSG_PASS_THROUGH",
+ ex.getLocalizedMessage());
+ }
+
+ fireOperationStateChanged(TaskState.RUNNING, TaskEvent.CMD_RUNNING,
+ "StartTask.startDAS.inProgress", instanceName);
+ // create a logger to the server's output stream so that a user
+ // can observe the progress
+ LogViewMgr logger = LogViewMgr.getInstance(instance.getProperty(PayaraModule.URL_ATTR));
+ logger.readInputStreams(recognizers, false, null,
+ new FetchLogSimple(instance.getProcess().getInputStream()),
+ new FetchLogSimple(instance.getProcess().getErrorStream()));
+
+ // Waiting for server to start
+ LOGGER.log(Level.FINER, "Waiting for server to start for {0} ms",
+ new Object[] {Integer.toString(START_TIMEOUT)});
+ try {
+ synchronized(listener) {
+ while (!listener.isWakeUp()
+ && (System.currentTimeMillis()
+ - start < START_TIMEOUT)) {
+ listener.wait(System.currentTimeMillis() - start);
+ }
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO,
+ "Caught InterruptedException while waiting for {0} to start: {1}",
+ new Object[] {instance.getName(), ie.getLocalizedMessage()});
+ } finally {
+ PayaraStatus.removeListener(instance, listener);
+ }
+ // We need to lie about server status in profiling mode.
+ if (null != jvmArgs && (change = profilingServerStatus()) != null) {
+ return change.fireOperationStateChanged();
+ }
+ if (!PayaraState.isOnline(instance)) {
+ return fireOperationStateChanged(
+ TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "StartTask.startDAS.startFailed", instanceName);
+ } else {
+ return startClusterOrInstance(adminHost, adminPort);
+ }
+ }
+
+ private TaskState startClusterOrInstance(String adminHost, int adminPort) {
+ String target = Util.computeTarget(instance.getProperties());
+ if (Util.isDefaultOrServerTarget(instance.getProperties())) {
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_STARTED", instanceName);
+ } else {
+ TaskState state;
+ try {
+ ResultString result
+ = CommandStartCluster.startCluster(instance, target);
+ state = result.getState();
+ } catch (PayaraIdeException gfie) {
+ state = TaskState.FAILED;
+ LOGGER.log(Level.INFO, gfie.getMessage(), gfie);
+ }
+ if (state == TaskState.FAILED) {
+ try {
+ ResultString result
+ = CommandStartInstance.startInstance(instance, target);
+ state = result.getState();
+ } catch (PayaraIdeException gfie) {
+ state = TaskState.FAILED;
+ LOGGER.log(Level.INFO, gfie.getMessage(), gfie);
+ }
+ if (state == TaskState.FAILED) {
+ // if start instance not suscessful fail
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_START_TARGET_FAILED", instanceName, target);
+ }
+ }
+ support.updateHttpPort();
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_STARTED", instanceName);
+ }
+ }
+
+ /**
+ * Search for Java SE platform to be used for running Payara server.
+ * <p/>
+ * Payara instance Java SE platform property is checked first
+ * and Java SE platform used to run NetBeans as a fallback option.
+ * <p/>
+ * @return Java SE platform to be used for running Payara server.
+ * @throws IOException when Payara instance Java SE platform property
+ * does not point to existing directory.
+ */
+ private FileObject getJavaPlatformRoot() throws IOException {
+ FileObject retVal;
+ String javaHome = instance.getJavaHome();
+ if (null == javaHome || javaHome.trim().length() < 1) {
+ File dir = new File(getJdkHome());
+ retVal = FileUtil.createFolder(FileUtil.normalizeFile(dir));
+ } else {
+ File f = new File(javaHome);
+ if (f.exists()) {
+ retVal = FileUtil.createFolder(FileUtil.normalizeFile(f));
+ } else {
+ throw new FileNotFoundException(
+ NbBundle.getMessage(StartTask.class,
+ "MSG_INVALID_JAVA", instanceName, javaHome));
+ }
+ }
+ return retVal;
+ }
+
+ /**
+ * Get Java SE platform used to run NetBeans.
+ * <p/>
+ * @return Java SE platform used to run NetBeans.
+ */
+ private String getJdkHome() {
+ String result;
+ result = System.getProperty("java.home");
+ if (result.endsWith(File.separatorChar + "jre")) {
+ result = result.substring(0, result.length() - 4);
+ }
+ return result;
+ }
+
+ private StartupArgs createProcessDescriptor() throws ProcessCreationException {
+ List<String> payaraArgs = new ArrayList<>(2);
+ String domainDir = Util.quote(getDomainFolder().getAbsolutePath());
+ payaraArgs.add(ServerUtils.cmdLineArgument(
+ ServerUtils.PF_DOMAIN_ARG, getDomainName()));
+ payaraArgs.add(ServerUtils.cmdLineArgument(
+ ServerUtils.PF_DOMAIN_DIR_ARG, domainDir));
+
+ ArrayList<String> optList = new ArrayList<>();
+ // append debug options
+ if (PayaraModule.DEBUG_MODE.equals(instance.getProperty(PayaraModule.JVM_MODE))) {
+ appendDebugOptions(optList);
+ }
+
+ // append other options from startup extenders, e.g. for profiling
+ appendStartupExtenderParams(optList);
+
+ return new StartupArgsEntity(
+ payaraArgs,
+ optList,
+ (Map<String, String>) null,
+ FileUtil.toFile(jdkHome).getAbsolutePath());
+ }
+
+ /**
+ * Appends debug options for server start.
+ * If the port read from instance properties is not valid (null or out of the range),
+ * it offers to the user a different free port.
+ *
+ * @param optList
+ * @throws ProcessCreationException
+ */
+ private void appendDebugOptions(List<String> optList) throws ProcessCreationException {
+ String debugPortString = instance.getProperty(PayaraModule.DEBUG_PORT);
+ String debugTransport = "dt_socket"; // NOI18N
+ if ("true".equals(instance.getProperty(PayaraModule.USE_SHARED_MEM_ATTR))) { // NOI18N
+ debugTransport = "dt_shmem"; // NOI18N
+ } else {
+ if (null != debugPortString && debugPortString.trim().length() > 0) {
+ int t = Integer.parseInt(debugPortString);
+ if (t != 0 && (t < PayaraInstance.LOWEST_USER_PORT
+ || t > 65535)) {
+ throw new NumberFormatException();
+ }
+ }
+ }
+ if (null == debugPortString
+ || "0".equals(debugPortString) || "".equals(debugPortString)) {
+ if ("true".equals(instance.getProperty(PayaraModule.USE_SHARED_MEM_ATTR))) { // NOI18N
+ debugPortString = Integer.toString(Math.abs((instance.getProperty(PayaraModule.PAYARA_FOLDER_ATTR)
+ + instance.getDomainsRoot()
+ + instance.getProperty(PayaraModule.DOMAIN_NAME_ATTR)).hashCode() + 1));
+ } else {
+ try {
+ debugPortString = selectDebugPort();
+ } catch (IOException ioe) {
+ throw new ProcessCreationException(ioe,
+ "MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
+ }
+ }
+ }
+ support.setEnvironmentProperty(PayaraModule.DEBUG_PORT, debugPortString, true);
+ StringBuilder opt = new StringBuilder();
+ opt.append("-agentlib:jdwp=transport="); // NOI18N
+ opt.append(debugTransport);
+ opt.append(",address="); // NOI18N
+ opt.append(debugPortString);
+ opt.append(",server=y,suspend=n"); // NOI18N
+ optList.add(opt.toString());
+ }
+
+ private void appendStartupExtenderParams(List<String> optList) {
+ for (StartupExtender args : StartupExtender.getExtenders(
+ Lookups.singleton(support.getInstanceProvider().getInstance(instance.getProperty("url"))),
+ getMode(instance.getProperty(PayaraModule.JVM_MODE)))) {
+ for (String arg : args.getArguments()) {
+ String[] argSplitted = arg.trim().split("\\s+(?=-)");
+ optList.addAll(Arrays.asList(argSplitted));
+ }
+ }
+ }
+
+ private String selectDebugPort() throws IOException {
+ int debugPort = 9009;
+ ServerSocket t = null;
+ try {
+ // try to use the 'standard port'
+ t = new ServerSocket(debugPort);
+ return Integer.toString(debugPort);
+ } catch (IOException ex) {
+ // log this... but don't panic
+ Logger.getLogger("payara").fine("9009 is in use... going random");
+ } finally {
+ if (null != t) {
+ try {
+ t.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
+ try {
+ // try to find a different port... if this fails,
+ // it is a great time to panic.
+ t = new ServerSocket(0);
+ debugPort = t.getLocalPort();
+ return Integer.toString(debugPort);
+ } finally {
+ if (null != t) {
+ try {
+ t.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
+ }
+
+ private Process createProcess() throws ProcessCreationException {
+ StartupArgs args = createProcessDescriptor();
+ // JDK checks and Java VM process startup were moved to GF Tooling SDK.
+ ResultProcess process = ServerTasks.startServer(instance, args);
+ if (process.getState() != TaskState.COMPLETED) {
+ throw new ProcessCreationException(null, "MSG_START_SERVER_FAILED_PD", instanceName);
+ }
+ return process.getValue().getProcess();
+ }
+
+ private File getDomainFolder() {
+ return new File(instance.getDomainsRoot() + File.separatorChar + getDomainName());
+ }
+
+ private String getDomainName() {
+ return instance.getProperty(PayaraModule.DOMAIN_NAME_ATTR);
+ }
+
+ private boolean upgradeFailed() {
+ // get server install version
+ File payaraDir = new File(instance.getPayaraRoot());
+ int installVersion = ServerDetails.getVersionFromInstallDirectory(payaraDir);
+
+ if (installVersion < 0) {
+ return false; // no upgrade attempted, so it DID NOT fail.
+ }
+ // get domain.xml 'version'
+ File domainXmlFile = new File(getDomainFolder(), "config" + File.separator + "domain.xml"); // NOI18N
+ int domainVersion = ServerDetails.getVersionFromDomainXml(domainXmlFile);
+
+ if (domainVersion < 0) {
+ return false; // no upgrade attempted, so it DID NOT fail.
+ }
+ if (domainVersion / 10 < installVersion / 10 && domainVersion < 310) {
+ return executeUpgradeProcess() != 0;
+ }
+ return false;
+ }
+
+ private int executeUpgradeProcess() {
+ int retVal = -1;
+ File asadmin = findFirstExecutableFile(new File(instance.getPayaraRoot()), "asadmin", "bin");
+ if (null == asadmin) {
+ return retVal;
+ }
+ NbProcessDescriptor upgrader = new NbProcessDescriptor(asadmin.getAbsolutePath(),
+ "start-domain --upgrade --domaindir " + Util.quote(instance.getDomainsRoot()) + " " + // NOI18N
+ instance.getDomainName());
+ try {
+ Process p = upgrader.exec();
+ p.waitFor();
+ retVal = p.exitValue();
+ } catch (InterruptedException | IOException ex) {
+ LOGGER.log(Level.INFO, upgrader.toString(), ex); // NOI18N
+ }
+ // NOI18N
+ return retVal;
+ }
+
+ // TODO : refactor and remove 'similar' methods post 7.0
+ private File findFirstExecutableFile(File installRoot, String executableName, String... directories) {
+ File result = null;
+ if (installRoot != null && installRoot.exists()) {
+ for (String dir : directories) {
+ File bin = new File(installRoot, dir); // NOI18N
+ if (bin.exists()) {
+ if (Utilities.isWindows()) {
+ File launcherPath = new File(bin, executableName + ".exe"); // NOI18N
+ if (launcherPath.exists()) {
+ result = launcherPath;
+ } else {
+ launcherPath = new File(bin, executableName + ".bat"); // NOI18N
+ result = (launcherPath.exists()) ? launcherPath : null;
+ }
+ } else {
+ File launcherPath = new File(bin, executableName); // NOI18N
+ result = (launcherPath.exists()) ? launcherPath : null;
+ }
+ if (null != result) {
+ break;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopProfilingTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopProfilingTask.java
new file mode 100644
index 0000000..32396df
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopProfilingTask.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ * Task for stopping server that was started in profile mode.
+ *
+ * @author Peter Benedikovic
+ */
+public class StopProfilingTask extends BasicTask<TaskState> {
+
+ private final CommonServerSupport support;
+
+ /**
+ *
+ * @param support common support object for the server instance being stopped
+ * @param stateListener state monitor to track start progress
+ */
+ public StopProfilingTask(final CommonServerSupport support, TaskStateListener stateListener) {
+ super(support.getInstance(), stateListener, new TaskStateListener() {
+
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ if(newState == TaskState.COMPLETED) {
+ support.setServerState(PayaraModule.ServerState.STOPPED);
+ } else if(newState == TaskState.FAILED) {
+ support.setServerState(PayaraModule.ServerState.STOPPED_JVM_PROFILER);
+ }
+ }
+ });
+ this.support = support;
+ }
+
+ @Override
+ public TaskState call() {
+ Logger.getLogger("payara").log(Level.FINEST, "StopLocalTask.call() called on thread {0}", Thread.currentThread().getName()); // NOI18N
+
+ if (support.getLocalStartProcess() != null) {
+ LogViewMgr logger = LogViewMgr.getInstance(instance.getProperty(PayaraModule.URL_ATTR));
+ String msg = NbBundle.getMessage(BasicTask.class, "MSG_SERVER_PROFILING_STOPPED", instanceName);
+ logger.write(msg, false);
+ logger.stopReaders();
+ support.stopLocalStartProcess();
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_PROFILING_STOPPED", instanceName);
+ } else {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_STOP_SERVER_FAILED", instanceName);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopTask.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopTask.java
new file mode 100644
index 0000000..f942b99
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/StopTask.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import org.netbeans.modules.payara.tooling.admin.CommandStopDAS;
+import org.netbeans.modules.payara.tooling.admin.CommandStopCluster;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.CommandStopInstance;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ * @author Ludovic Chamenois
+ * @author Peter Williams
+ */
+public class StopTask extends BasicTask<TaskState> {
+
+ private final CommonServerSupport support;
+
+ /**
+ *
+ * @param support common support object for the server instance being stopped
+ * @param stateListener state monitor to track start progress
+ */
+ public StopTask(CommonServerSupport support,
+ TaskStateListener... stateListener) {
+ super(support.getInstance(), stateListener);
+ this.support = support;
+ }
+
+ /**
+ *
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public TaskState call() {
+ // save the current time so that we can deduct that the startup
+ // failed due to timeout
+ Logger.getLogger("payara").log(Level.FINEST,
+ "StopTask.call() called on thread \"{0}\"",
+ Thread.currentThread().getName()); // NOI18N
+ long start = System.currentTimeMillis();
+
+ String host; // = null;
+ int port;
+
+ host = instance.getProperty(PayaraModule.HOSTNAME_ATTR);
+ if(host == null || host.length() == 0) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_NOHOST", instanceName);
+ }
+
+ try {
+ port = Integer.valueOf(instance.getProperty(PayaraModule.ADMINPORT_ATTR));
+ if(port < 0 || port > 65535) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_BADPORT", instanceName);
+ }
+ } catch(NumberFormatException ex) {
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_START_SERVER_FAILED_BADPORT", instanceName);
+ }
+
+ String target = Util.computeTarget(instance.getProperties());
+
+ if (!Util.isDefaultOrServerTarget(instance.getProperties())) {
+ // stop an instance/cluster
+ return stopClusterOrInstance(target);
+ }
+
+ // stop a domain
+
+ // !PW Can we have a single manager instance per instance, available on
+ // demand through lookup?
+ // !PW FIXME this uses doubly nested runnables. Can we fix?
+ ResultString result = CommandStopDAS.stopDAS(instance);
+ if (TaskState.FAILED.equals(result.getState())) {
+ fireOperationStateChanged(TaskState.FAILED, TaskEvent.CMD_FAILED,
+ "MSG_STOP_SERVER_FAILED", instanceName);
+ }
+
+ fireOperationStateChanged(TaskState.RUNNING, TaskEvent.CMD_RUNNING,
+ "MSG_STOP_SERVER_IN_PROGRESS", instanceName); // NOI18N
+
+ StateChange stateChange = waitShutDown();
+ if (stateChange != null) {
+ return stateChange.fireOperationStateChanged();
+ }
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_STOPPED", instanceName);
+ }
+
+ private TaskState stopClusterOrInstance(String target) {
+ ResultString result = CommandStopCluster.stopCluster(instance, target);
+
+ if (TaskState.FAILED.equals(result.getState())) {
+ // if start-cluster not successful, try start-instance
+ result = CommandStopInstance.stopInstance(instance, target);
+ if (TaskState.FAILED.equals(result.getState())) {
+ // if start instance not suscessful fail
+ return fireOperationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED,
+ "MSG_STOP_TARGET_FAILED", instanceName, target);
+ }
+ }
+
+ return fireOperationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "MSG_SERVER_STOPPED", instanceName);
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/AbstractOutputAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/AbstractOutputAction.java
new file mode 100644
index 0000000..5ba0937
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/AbstractOutputAction.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Mutex;
+import org.openide.util.WeakListeners;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public abstract class AbstractOutputAction extends AbstractAction implements ChangeListener {
+
+ private static final String PROP_ENABLED = "enabled"; // NOI18N
+
+ protected final PayaraModule commonSupport;
+
+ public AbstractOutputAction(final PayaraModule commonSupport,
+ String localizedName, String localizedShortDesc, String iconBase) {
+ super(localizedName, ImageUtilities.loadImageIcon(iconBase, false));
+ putValue(SHORT_DESCRIPTION, localizedShortDesc);
+ this.commonSupport = commonSupport;
+
+ // listen for server state changes
+ commonSupport.addChangeListener(WeakListeners.change(this, commonSupport));
+ }
+
+ public abstract void actionPerformed(ActionEvent e);
+
+ @Override
+ public abstract boolean isEnabled();
+
+ // --------------------------------------------------------------------
+ // ChangeListener interface implementation
+ // --------------------------------------------------------------------
+ public void stateChanged(ChangeEvent evt) {
+ Mutex.EVENT.readAccess(new Runnable() {
+ public void run() {
+ firePropertyChange(PROP_ENABLED, null, isEnabled() ? Boolean.TRUE : Boolean.FALSE);
+ }
+ });
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/Bundle.properties
new file mode 100644
index 0000000..b7654e5
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/Bundle.properties
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# remove server action
+CTL_RemoveServerAction=Re&move
+MSG_RemoveServerTitle=Remove Server Instance
+MSG_RemoveServerMessage=Do you really want to remove {0} from the IDE?
+
+# start server action
+CTL_StartServerAction=&Start
+LBL_StartOutput=Start
+LBL_StartOutputDesc=Start the Server
+LBL_Starting=Starting {0}
+
+# stop server action
+CTL_StopServerAction=St&op
+LBL_StopOutput=Stop
+LBL_StopOutputDesc=Stop the Server
+LBL_Stopping=Stopping {0}
+
+# refresh instance action
+CTL_RefreshAction=Re&fresh
+LBL_RefreshOutput=Refresh
+LBL_RefreshOutputDesc=Refresh the Server Status
+
+# restart server action
+CTL_RestartAction=&Restart
+LBL_RestartOutput=Restart
+LBL_RestartOutputDesc=Restart the Server
+LBL_Restarting=Restarting {0}
+
+# debug action
+CTL_DebugAction=Start in &Debug Mode
+LBL_DebugOutput=Start in Debug Mode
+LBL_DebugOutputDesc=Start the Server in Debug Mode
+LBL_Debugging=Starting {0} in Debug Mode
+
+# profile action
+CTL_Profile=Start in Prof&ile Mode
+
+# View admin console action
+CTL_ViewAdminConsoleAction=View Domain &Admin Console
+MSG_ServerMustBeRunning=The server must be running for this action to succeed.
+
+# View server log action
+CTL_ViewServerLogAction=View Domain Server &Log
+
+# Properties action
+CTL_Properties=&Properties
+
+# debug action
+CTL_ProfileAction=Start in &Profile Mode
+LBL_ProfileOutput=Start in Profile Mode
+LBL_ProfileOutputDesc=Start the Server in Profile Mode
+LBL_Profiling=Starting {0} in Profile Mode
+
+WARN_ELEVATE=You need to run the IDE as administrator to perform this operation.
+
+# KillServerAction class messages
+KillServerAction.label=&Terminate
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/DebugAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/DebugAction.java
new file mode 100644
index 0000000..aebe9b1
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/DebugAction.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ * Debug server action starts the server in the debug mode.
+ *
+ * @author Peter Williams
+ */
+public class DebugAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport =
+ node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ performActionImpl(commonSupport);
+ }
+ }
+ }
+
+ private static void performActionImpl(final PayaraModule commonSupport) {
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.DEBUG_MODE, true);
+ commonSupport.startServer(null, ServerState.RUNNING);
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(PayaraModule commonSupport) {
+ return PayaraState.canStart(commonSupport.getInstance()) &&
+ null != commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR) &&
+ Util.isDefaultOrServerTarget(commonSupport.getInstanceProperties());
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(DebugAction.class, "CTL_DebugAction");
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ /** This action will be displayed in the server output window */
+ public static class OutputAction extends AbstractOutputAction {
+
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/debug.png"; // NOI18N
+
+ public OutputAction(final PayaraModule commonSupport) {
+ super(commonSupport, NbBundle.getMessage(DebugAction.class, "LBL_DebugOutput"), // NOI18N
+ NbBundle.getMessage(DebugAction.class, "LBL_DebugOutputDesc"), // NOI18N
+ ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ performActionImpl(commonSupport);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enableImpl(commonSupport);
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/KillServerAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/KillServerAction.java
new file mode 100644
index 0000000..0dd9c70
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/KillServerAction.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.actions;
+
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.ui.WarnPanel;
+import org.netbeans.modules.payara.common.utils.ServerUtils;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Kill running local server process.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class KillServerAction extends NodeAction {
+
+ /**
+ * Retrieve Payara support instance from nodes.
+ * <p/>
+ * @param nodes Current activated nodes, may be empty but
+ * not <code>null</code>.
+ * @return First Payara instance found in nodes or <code>null</code>
+ * when no Payara instance was found.
+ */
+ private PayaraModule getPayaraModuleFromNodes(final Node[] nodes) {
+ for (Node node : nodes) {
+ PayaraModule commonSupport
+ = node.getLookup().lookup(PayaraModule.class);
+ if (commonSupport != null) {
+ return commonSupport;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Retrieve Payara instance from nodes.
+ * <p/>
+ * @param nodes Current activated nodes, may be empty but
+ * not <code>null</code>.
+ * @return First Payara instance found in nodes or <code>null</code>
+ * when no Payara instance was found.
+ */
+ private PayaraInstance getInstanceFromNodes(final Node[] nodes) {
+ PayaraModule commonSupport = getPayaraModuleFromNodes(nodes);
+ return commonSupport != null
+ ? (PayaraInstance)commonSupport.getInstance() : null;
+ }
+
+ /**
+ * Get a human presentable name of kill server action.
+ * <p/>
+ * This will be presented as an item in a menu.
+ * @return The name of kill server action.
+ */
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(
+ KillServerAction.class, "KillServerAction.label");
+ }
+
+ /**
+ * Perform the action based on the currently activated nodes.
+ * <p/>
+ * Note that if the source of the event triggering this action was itself
+ * a node, that node will be the sole argument to this method, rather
+ * than the activated nodes.
+ * <p/>
+ * @param activatedNodes Current activated nodes, may be empty but
+ * not <code>null</code>
+ */
+ @Override
+ protected void performAction(final Node[] activatedNodes) {
+ PayaraModule commonSupport
+ = getPayaraModuleFromNodes(activatedNodes);
+ if (commonSupport != null) {
+ performActionImpl(commonSupport);
+ }
+ }
+
+ /**
+ * Action implementation code.
+ * <p/>
+ * @param commonSupport Interface implemented by common server support.
+ */
+ private static void performActionImpl(PayaraModule commonSupport) {
+ if (WarnPanel.gfKillWarning(commonSupport.getInstance().getName())) {
+ commonSupport.killServer(null);
+ }
+ }
+
+ /**
+ * Test whether the action should be enabled based on the currently
+ * activated nodes.
+ * <p/>
+ * @param activatedNodes Current activated nodes, may be empty but
+ * not <code>null</code>.
+ * @return <code>true</code> to be enabled, <code>false</code> to be disabled
+ */
+ @Override
+ protected boolean enable(final Node[] activatedNodes) {
+ PayaraInstance instance = getInstanceFromNodes(activatedNodes);
+ Process process = instance != null ? instance.getProcess() : null;
+ if (process == null) {
+ return false;
+ }
+ return ServerUtils.isProcessRunning(process);
+ }
+
+ /**
+ * Get help context for kill server action.
+ * <p/>
+ * @return Help context for kill server action.
+ */
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ /**
+ * Action will be performed synchronously as called in the event thread.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ProfileAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ProfileAction.java
new file mode 100644
index 0000000..1df1c05
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ProfileAction.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Profile server action starts the server in the profile mode.
+ *
+ */
+public class ProfileAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport =
+ node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ performActionImpl(commonSupport,node);
+ break;
+ }
+ }
+ }
+
+ private static void performActionImpl(final PayaraModule commonSupport, Node node) {
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.PROFILE_MODE, true);
+
+ commonSupport.startServer(null, ServerState.STOPPED_JVM_PROFILER);
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport,node);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(PayaraModule commonSupport, Node node) {
+ return PayaraState.canStart(commonSupport.getInstance()) &&
+ null != commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR) &&
+ Util.isDefaultOrServerTarget(commonSupport.getInstanceProperties());
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(ProfileAction.class, "CTL_ProfileAction");
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/PropertiesAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/PropertiesAction.java
new file mode 100644
index 0000000..95a6e12
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/PropertiesAction.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import org.netbeans.api.server.CommonServerUIs;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Displays server manager with selected server instance focused.
+ *
+ * @author Peter Williams
+ */
+public class PropertiesAction extends NodeAction {
+
+ public void performAction(Node[] nodes) {
+ ServerInstance instance = getServerInstance(nodes[0]);
+ CommonServerUIs.showCustomizer(instance);
+ }
+
+ private ServerInstance getServerInstance(Node node) {
+ // !PW FIXME should the server instance be in the node lookup?
+ ServerInstance si = null;
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ String uri = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ PayaraInstanceProvider pip = commonSupport.getInstanceProvider();
+ si = pip.getInstance(uri);
+ }
+ return si;
+ }
+
+ protected boolean enable(Node[] nodes) {
+ return nodes != null && nodes.length > 0;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(PropertiesAction.class, "CTL_Properties"); // NOI18N
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RefreshAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RefreshAction.java
new file mode 100644
index 0000000..be8bb3c
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RefreshAction.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import java.util.Collection;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Resfresh action refreshes the server state.
+ *
+ * @author Peter Williams
+ */
+public class RefreshAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ Collection<? extends RefreshModulesCookie> cookies =
+ node.getLookup().lookupAll(RefreshModulesCookie.class);
+ for(RefreshModulesCookie cookie: cookies) {
+ cookie.refresh();
+ }
+ }
+ }
+
+ private static void performActionImpl(PayaraModule commonSupport) {
+ // Tell the server instance to refresh it's status.
+ if(commonSupport instanceof RefreshModulesCookie) {
+ ((RefreshModulesCookie) commonSupport).refresh();
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(PayaraModule commonSupport) {
+ // XXX can do it this way for now I think.
+ return commonSupport instanceof RefreshModulesCookie;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(RefreshAction.class, "LBL_Refresh"); // NOI18N
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+
+ /** This action will be displayed in the server output window */
+ public static class OutputAction extends AbstractOutputAction {
+
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/refresh.png"; // NOI18N
+
+ public OutputAction(final PayaraModule commonSupport) {
+ super(commonSupport, NbBundle.getMessage(RefreshAction.class, "LBL_RefreshOutput"), // NOI18N
+ NbBundle.getMessage(RefreshAction.class, "LBL_RefreshOutputDesc"), // NOI18N
+ ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ performActionImpl(commonSupport);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enableImpl(commonSupport);
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RemoveServerAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RemoveServerAction.java
new file mode 100644
index 0000000..d443456
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RemoveServerAction.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class RemoveServerAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ for (int i = 0; i < nodes.length; i++) {
+ ServerInstance si = getServerInstance(nodes[i]);
+ if(si == null || !si.isRemovable()) {
+ continue;
+ }
+
+ String title = NbBundle.getMessage(RemoveServerAction.class,
+ "MSG_RemoveServerTitle", si.getDisplayName());
+ String msg = NbBundle.getMessage(RemoveServerAction.class,
+ "MSG_RemoveServerMessage", si.getDisplayName());
+ NotifyDescriptor d = new NotifyDescriptor.Confirmation(msg, title,
+ NotifyDescriptor.YES_NO_OPTION);
+ if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION) {
+ si.remove();
+ }
+ }
+ }
+
+ private ServerInstance getServerInstance(Node node) {
+ // !PW FIXME should the server instance be in the node lookup?
+ ServerInstance si = null;
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ String uri = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ PayaraInstanceProvider pip = commonSupport.getInstanceProvider();
+ si = pip.getInstance(uri);
+ }
+ return si;
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = true;
+ for (int i = 0; i < activatedNodes.length; i++) {
+ ServerInstance si = getServerInstance(activatedNodes[i]);
+ if(si == null || !si.isRemovable()
+ // !PW FIXME is this a state we need to handle?
+// || si.getServerState() == ServerInstance.STATE_WAITING
+ ) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(RemoveServerAction.class, "CTL_RemoveServerAction");
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RestartAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RestartAction.java
new file mode 100644
index 0000000..96c16ac
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/RestartAction.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+
+/**
+ * Restart action stops the server and then starts it again in the mode it
+ * was running in before (normal or debug).
+ *
+ * @author sherold
+ */
+public class RestartAction extends NodeAction {
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(RestartAction.class, "CTL_RestartAction");
+ }
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport =
+ node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ if (commonSupport.isRemote()) {
+ // always restart remote instances in NORMAL mode
+ if (commonSupport.supportsRestartInDebug())
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.NORMAL_MODE, true);
+ }
+ performActionImpl(commonSupport);
+ }
+ }
+ }
+
+ private static void performActionImpl(final PayaraModule commonSupport) {
+ commonSupport.restartServer(null);
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(final PayaraModule commonSupport) {
+ return PayaraState.isOnline(commonSupport.getInstance());
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ /** This action will be displayed in the server output window */
+ public static class OutputAction extends AbstractOutputAction {
+
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/restart.png"; // NOI18N
+
+ public OutputAction(final PayaraModule commonSupport) {
+ super(commonSupport, NbBundle.getMessage(RestartAction.class, "LBL_RestartOutput"), // NOI18N
+ NbBundle.getMessage(RestartAction.class, "LBL_RestartOutputDesc"), // NOI18N
+ ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ performActionImpl(commonSupport);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enableImpl(commonSupport);
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StartServerAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StartServerAction.java
new file mode 100644
index 0000000..5b3d784
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StartServerAction.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class StartServerAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport =
+ node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ performActionImpl(commonSupport);
+ }
+ }
+ }
+
+ private static void performActionImpl(PayaraModule commonSupport) {
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.NORMAL_MODE, true);
+ commonSupport.startServer(null, ServerState.RUNNING);
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(PayaraModule commonSupport) {
+ PayaraServer server = commonSupport.getInstance();
+ return PayaraState.canStart(server) && !server.isRemote();
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(StartServerAction.class, "CTL_StartServerAction"); // NOI18N
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+
+ /** This action will be displayed in the server output window */
+ public static class OutputAction extends AbstractOutputAction {
+
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/start.png"; // NOI18N
+
+ public OutputAction(final PayaraModule commonSupport) {
+ super(commonSupport, NbBundle.getMessage(StartServerAction.class, "LBL_StartOutput"), // NOI18N
+ NbBundle.getMessage(StartServerAction.class, "LBL_StartOutputDesc"), // NOI18N
+ ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ performActionImpl(commonSupport);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enableImpl(commonSupport);
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StopServerAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StopServerAction.java
new file mode 100644
index 0000000..fd3ff4a
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StopServerAction.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.awt.event.ActionEvent;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class StopServerAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport =
+ node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ performActionImpl(commonSupport);
+ }
+ }
+ }
+
+ private static void performActionImpl(PayaraModule commonSupport) {
+ commonSupport.stopServer(null);
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ boolean result = false;
+ if(activatedNodes != null && activatedNodes.length > 0) {
+ for(Node node : activatedNodes) {
+ PayaraModule commonSupport = node.getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ result = enableImpl(commonSupport);
+ } else {
+ // No server instance found for this node.
+ result = false;
+ }
+ if(!result) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static boolean enableImpl(PayaraModule commonSupport) {
+ boolean online = PayaraState.isOnline(commonSupport.getInstance());
+ return (online
+ || commonSupport.getServerState() == ServerState.STOPPED_JVM_PROFILER)
+ && (null != commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR)
+ // there is a target part of this server's url AND the das is running
+ || (!Util.isDefaultOrServerTarget(commonSupport.getInstanceProperties())
+ && online));
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(StopServerAction.class, "CTL_StopServerAction"); // NOI18N
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ /** This action will be displayed in the server output window */
+ public static class OutputAction extends AbstractOutputAction {
+
+ private static final String ICON =
+ "org/netbeans/modules/payara/common/resources/stop.png"; // NOI18N
+
+ public OutputAction(final PayaraModule commonSupport) {
+ super(commonSupport, NbBundle.getMessage(StopServerAction.class, "LBL_StopOutput"), // NOI18N
+ NbBundle.getMessage(StopServerAction.class, "LBL_StopOutputDesc"), // NOI18N
+ ICON);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ performActionImpl(commonSupport);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enableImpl(commonSupport);
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewAdminConsoleAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewAdminConsoleAction.java
new file mode 100644
index 0000000..0ed66f7
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewAdminConsoleAction.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionRegistration;
+import org.openide.awt.HtmlBrowser.URLDisplayer;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+@ActionID(id = "org.netbeans.modules.payara.common.actions.ViewAdminConsoleAction", category = "Payara")
+@ActionRegistration(displayName = "#CTL_ViewAdminConsoleAction", lazy = false)
+public class ViewAdminConsoleAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] activatedNodes) {
+ CommonServerSupport commonSupport
+ = (CommonServerSupport)activatedNodes[0]
+ .getLookup().lookup(PayaraModule.class);
+ if(commonSupport != null) {
+ if (PayaraState.isOnline(commonSupport.getInstance())) {
+ try {
+ Map<String, String> ip = commonSupport.getInstanceProperties();
+ StringBuilder urlBuilder = new StringBuilder(128);
+ String port = !("false".equals(System.getProperty("payara.useadminport"))) ?
+ ip.get(PayaraModule.ADMINPORT_ATTR) : ip.get(PayaraModule.HTTPPORT_ATTR);
+ String host = ip.get(PayaraModule.HOSTNAME_ATTR);
+ String uri = ip.get(PayaraModule.URL_ATTR);
+ if (uri == null || !uri.contains("ee6wc")) {
+ urlBuilder.append(Utils.getHttpListenerProtocol(host, port));
+ } else {
+ urlBuilder.append("http");
+ }
+ urlBuilder.append("://"); // NOI18N
+ urlBuilder.append(ip.get(PayaraModule.HOSTNAME_ATTR));
+ urlBuilder.append(":");
+ urlBuilder.append(port);
+ if("false".equals(System.getProperty("payara.useadminport"))) {
+ // url for admin gui when on http port (8080)
+ urlBuilder.append("/admin");
+ }
+ URL url = new URL(urlBuilder.toString());
+ URLDisplayer.getDefault().showURL(url);
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ } else {
+ String message = NbBundle.getMessage(ViewAdminConsoleAction.class,
+ "MSG_ServerMustBeRunning"); // NOI18N
+ NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message,
+ NotifyDescriptor.DEFAULT_OPTION);
+ DialogDisplayer.getDefault().notify(nd);
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] activatedNodes) {
+ return activatedNodes != null && activatedNodes.length == 1;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(ViewAdminConsoleAction.class, "CTL_ViewAdminConsoleAction"); // NOI18N
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewServerLogAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewServerLogAction.java
new file mode 100644
index 0000000..2d907fe
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/ViewServerLogAction.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.actions;
+
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.LogViewMgr;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionRegistration;
+import org.openide.util.Lookup;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * This action will open or focus the server log window for the selected server
+ * instance.
+ *
+ * @author Peter Williams
+ */
+@ActionID(id = "org.netbeans.modules.payara.common.actions.ViewServerLogAction", category = "Payara")
+@ActionRegistration(displayName = "#CTL_ViewServerLogAction", lazy = false)
+public class ViewServerLogAction extends NodeAction {
+
+ private static final String SHOW_SERVER_LOG_ICONBASE =
+ "org/netbeans/modules/payara/common/resources/serverlog.gif"; // NOI18N
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ Lookup lookup = nodes[0].getLookup();
+ CommonServerSupport commonSupport = lookup.lookup(CommonServerSupport.class);
+ if(commonSupport != null) {
+ LogViewMgr.displayOutput(commonSupport.getInstance(), lookup);
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ if (nodes == null || nodes.length < 1 || nodes[0] == null) {
+ return false;
+ }
+ PayaraModule commonSupport = nodes[0].getLookup().lookup(PayaraModule.class);
+ if (commonSupport == null || !(commonSupport.getInstance() instanceof PayaraInstance)) {
+ return false;
+ }
+ PayaraInstance server = (PayaraInstance) commonSupport.getInstance();
+ String uri = server.getUrl();
+ return uri != null && uri.length() > 0
+ && ((!server.isRemote()
+ && ServerUtils.getServerLogFile(server).canRead())
+ || (commonSupport.isRestfulLogAccessSupported()
+ && server.isRemote() && isRunning(commonSupport)));
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(ViewServerLogAction.class, "CTL_ViewServerLogAction");
+ }
+
+ @Override
+ protected String iconResource() {
+ return SHOW_SERVER_LOG_ICONBASE;
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ private boolean isRunning(PayaraModule commonSupport) {
+ ServerState ss = commonSupport.getServerState();
+ return ss == ServerState.RUNNING || ss == ServerState.RUNNING_JVM_DEBUG || ss == ServerState.RUNNING_JVM_PROFILER;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/layer.xml b/enterprise/payara.common/src/org/netbeans/modules/payara/common/layer.xml
new file mode 100644
index 0000000..43e9d67
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/layer.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
+<filesystem>
+ <folder name="Servers">
+ <file name="PayaraInstanceProvider.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.common.PayaraInstanceProvider.getProvider"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.common.PayaraInstanceProvider"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.spi.server.ServerInstanceProvider"/>
+ </file>
+ <file name="org-netbeans-modules-payara-common-wizards-PayaraWizardProvider.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.common.wizards.PayaraWizardProvider.createEe8"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.common.wizards.PayaraWizardProvider"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.spi.server.ServerWizardProvider"/>
+ <attr name="displayName" bundlevalue="org.netbeans.modules.payara.common.wizards.Bundle#STR_PF_FAMILY_NAME"/>
+ </file>
+ </folder>
+</filesystem>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Bundle.properties
new file mode 100644
index 0000000..c76b275
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Bundle.properties
@@ -0,0 +1,53 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+TXT_PayaraPreludeInstanceNode=Payara Prelude
+TXT_PayaraPreludeTargetNode=Payara Prelude Target
+LBL_ServerInstanceNodeDesc={0} on {1}
+
+LBL_WaitNode_DisplayName=Please wait ...
+LBL_Apps=Applications
+LBL_Resources=Resources
+LBL_WS=Web Services
+LBL_NativeDataSources=Native Data Sources
+LBL_ManagedDataSources=Managed Data Sources
+TXT_ConnectionPool=Connection Pool:
+LBL_UndeployProgress=Undeploying {0}
+LBL_EnableProgress=Enabling {0}
+LBL_DisableProgress=Disabling {0}
+LBL_DeployProgress=Deploying {0}
+
+LBL_JDBC=JDBC
+LBL_jdbc-resource=JDBC Resources
+LBL_jdbc-connection-pool=Connection Pools
+LBL_CONNECTORS=Connectors
+LBL_connector-resource=Connector Resources
+LBL_connector-connection-pool=Connector Connection Pools
+LBL_admin-object=Admin Object Resources
+LBL_JAVAMAIL=JavaMail Sessions
+LBL_javamail-resource=JavaMail Sessions
+
+LBL_ChooseButton=Choose Directory to Deploy
+
+TITLE_RESOURCE_EDIT={0} : Editable Properties
+TITLE_CONNECTION_POOL_ADVANCED_ATTRIBUTES={0} : Advanced Setting
+
+WARN_BOGUS_GET_EXTENSION_NODE_IMPL=Ignoring buggy PluggableNodeProvider implementation: {0}
+
+WS_NODE_DESC=<html>name: {0}<br>path: {1}</html>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/DecoratorManager.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/DecoratorManager.java
new file mode 100644
index 0000000..a1e6b59
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/DecoratorManager.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.HashMap;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.DecoratorFactory;
+import org.openide.util.lookup.Lookups;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public final class DecoratorManager {
+
+ private static volatile java.util.Map<String, Decorator> decoratorMap;
+
+ private DecoratorManager() {
+ }
+
+ private static synchronized void initDecorators() {
+ if(decoratorMap != null) {
+ return;
+ }
+
+ // Find all decorator support, categorize by type.
+ decoratorMap = new HashMap<String, Decorator>();
+ for (DecoratorFactory decoratorFactory :
+ Lookups.forPath(Util.PF_LOOKUP_PATH).lookupAll(DecoratorFactory.class)) {
+ java.util.Map<String, Decorator> map = decoratorFactory.getAllDecorators();
+ decoratorMap.putAll(map);
+ }
+ }
+
+
+ public static Decorator findDecorator(String type, Decorator defaultDecorator,boolean enabled) {
+ if(decoratorMap == null) {
+ initDecorators();
+ }
+
+ if (!enabled) {
+ type = Decorator.DISABLED+type;
+ }
+ Decorator d = decoratorMap.get(type);
+ return d != null ? d : defaultDecorator;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationNode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationNode.java
new file mode 100644
index 0000000..a085971
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationNode.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.Map;
+import org.netbeans.modules.payara.common.nodes.actions.OpenURLActionCookie;
+import org.netbeans.modules.payara.spi.AppDesc;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.nodes.Children;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2ApplicationNode extends Hk2ItemNode {
+
+ public Hk2ApplicationNode(final Lookup lookup, final AppDesc app, final Decorator decorator) {
+ super(Children.LEAF, lookup, app.getName(), decorator);
+ setDisplayName(app.getName());
+ setShortDescription("<html>name: " + app.getName() + "<br>path: " + app.getPath() + "<br>enabled: " + app.getEnabled() + "</html>");
+
+ // !PW FIXME should method of retrieving context root be controlled by decorator?
+ if(decorator.canShowBrowser()) {
+ getCookieSet().add(new OpenURLActionCookie() {
+ public String getWebURL() {
+ String result = null;
+ PayaraModule commonModule = lookup.lookup(PayaraModule.class);
+ if(commonModule != null) {
+ Map<String, String> ip = commonModule.getInstanceProperties();
+ String host = ip.get(PayaraModule.HTTPHOST_ATTR);
+ if (null == host) {
+ host = ip.get(PayaraModule.HOSTNAME_ATTR);
+ }
+ String httpPort = ip.get(PayaraModule.HTTPPORT_ATTR);
+ String url = ip.get(PayaraModule.URL_ATTR);
+ if (url == null || !url.contains("ee6wc")) {
+ result = Utils.getHttpListenerProtocol(host, httpPort) +
+ "://" + host + ":" + httpPort + "/" + app.getContextRoot();
+ } else {
+ result = "http" +
+ "://" + host + ":" + httpPort + "/" + app.getContextRoot();
+ }
+ if(result.endsWith("//")) {
+ result = result.substring(0, result.length()-1);
+ }
+ }
+ return result;
+ }
+ });
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationsChildren.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationsChildren.java
new file mode 100644
index 0000000..ee18ad4
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ApplicationsChildren.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.spi.AppDesc;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class Hk2ApplicationsChildren extends Children.Keys<Object> implements Refreshable {
+
+ private Lookup lookup;
+ private final static Node WAIT_NODE = Hk2ItemNode.createWaitNode();
+
+ Hk2ApplicationsChildren(Lookup lookup) {
+ this.lookup = lookup;
+ }
+
+ @Override
+ public void updateKeys(){
+ setKeys(new Object[] { WAIT_NODE });
+
+ RequestProcessor t = new RequestProcessor("app-child-updater");
+ t.post(new Runnable() {
+ Vector<Object> keys = new Vector<Object>();
+
+ @Override
+ public void run() {
+ CommonServerSupport commonSupport = lookup.lookup(
+ CommonServerSupport.class);
+ if(commonSupport != null) {
+ try {
+ java.util.Map<String, List<AppDesc>> appMap
+ = commonSupport.getApplications(null);
+ for(Entry<String, List<AppDesc>> entry: appMap.entrySet()) {
+ List<AppDesc> apps = entry.getValue();
+ for(AppDesc app: apps) {
+ keys.add(new Hk2ApplicationNode(lookup, app, DecoratorManager.findDecorator(entry.getKey(), Hk2ItemNode.J2EE_APPLICATION, app.getEnabled())));
+ }
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ setKeys(keys);
+ }
+ }
+ }, 0);
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys((Set<? extends Object>) java.util.Collections.EMPTY_SET);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof Hk2ItemNode){
+ return new Node [] { (Hk2ItemNode) key };
+ }
+
+ if (key instanceof String && key.equals(WAIT_NODE)){
+ return new Node [] { WAIT_NODE };
+ }
+
+ return null;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2Cookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2Cookie.java
new file mode 100644
index 0000000..a711485
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2Cookie.java
@@ -0,0 +1,716 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes;
+
+import org.netbeans.modules.payara.tooling.admin.CommandUndeploy;
+import org.netbeans.modules.payara.tooling.admin.CommandDisable;
+import org.netbeans.modules.payara.tooling.admin.CommandDeploy;
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.CommandEnable;
+import org.netbeans.modules.payara.tooling.admin.CommandDeleteResource;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import java.awt.Dialog;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JFileChooser;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PartialCompletionException;
+import org.netbeans.modules.payara.common.nodes.actions.DeployDirectoryCookie;
+import org.netbeans.modules.payara.common.nodes.actions.DisableModulesCookie;
+import org.netbeans.modules.payara.common.nodes.actions.EditDetailsCookie;
+import org.netbeans.modules.payara.common.nodes.actions.DisableCDIProbeModeCookie;
+import org.netbeans.modules.payara.common.nodes.actions.EnableCDIProbeModeCookie;
+import org.netbeans.modules.payara.common.nodes.actions.EnableModulesCookie;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie;
+import org.netbeans.modules.payara.common.nodes.actions.UndeployModuleCookie;
+import org.netbeans.modules.payara.common.nodes.actions.UnregisterResourceCookie;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.netbeans.modules.payara.common.ui.BasePanel;
+import org.netbeans.modules.payara.common.nodes.actions.ConnectionPoolAdvancedAttributesCookie;
+import org.netbeans.modules.payara.common.ui.ConnectionPoolAdvancedAttributesCustomizer;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.windows.WindowManager;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ * HK2 nodes cookies.
+ * <p/>
+ * @author Tomas Kraus
+ * @author Gaurav Gupta
+ */
+public class Hk2Cookie {
+
+ private static final String CDI_PROBE_MODE_PROP = "applications.application.%s.property.cdiDevModeEnabled";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Common node cookie.
+ */
+ protected static abstract class Cookie {
+
+ /** Task status. */
+ protected volatile WeakReference<Future<ResultString>> status;
+
+ /** Payara server instance. */
+ protected final PayaraInstance instance;
+
+ /** Resource name. */
+ protected final String name;
+
+ /**
+ * Creates an instance of cookie.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to be enabled.
+ */
+ protected Cookie(final Lookup lookup, final String name) {
+ this.instance = getPayaraInstance(lookup);
+ this.name = name;
+ }
+
+ /**
+ * Returns <code>true</code> if this task is still running.
+ * <p/>
+ * @return Value of <code>true</code> if this task is still running
+ * or <code>false</code> otherwise.
+ */
+ public boolean isRunning() {
+ WeakReference<Future<ResultString>> localref = status;
+ if (localref == null) {
+ return false;
+ }
+ Future<ResultString> future = localref.get();
+ return future != null && !future.isDone();
+ }
+ }
+
+ /**
+ * Enable node cookie.
+ */
+ static class Enable
+ extends Cookie implements EnableModulesCookie {
+
+ /**
+ * Creates an instance of cookie for enabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to be enabled.
+ */
+ Enable(final Lookup lookup, final String name) {
+ super(lookup, name);
+ }
+
+ /**
+ * Enable module on Payara server.
+ * <p/>
+ * @return Result of enable task execution.
+ */
+ @Override
+ public Future<ResultString> enableModule() {
+ if (instance != null) {
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandEnable(name, Util.computeTarget(
+ instance.getProperties())));
+ status = new WeakReference<Future<ResultString>>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Disable node cookie.
+ */
+ static class Disable
+ extends Cookie implements DisableModulesCookie {
+
+ /**
+ * Creates an instance of cookie for disabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to be disabled.
+ */
+ Disable(final Lookup lookup, final String name) {
+ super(lookup, name);
+ }
+
+ /**
+ * Disable module on Payara server.
+ * <p/>
+ * @return Result of disable task execution.
+ */
+ @Override
+ public Future<ResultString> disableModule() {
+ if (instance != null) {
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandDisable(name, Util.computeTarget(
+ instance.getProperties())));
+ status = new WeakReference<Future<ResultString>>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Enable CDI probe mode cookie.
+ */
+ static class EnableCDIProbeMode
+ extends Cookie implements EnableCDIProbeModeCookie {
+
+
+ /**
+ * Creates an instance of cookie for enabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to be enabled in probe mode.
+ */
+ EnableCDIProbeMode(final Lookup lookup, final String name) {
+ super(lookup, name);
+ }
+
+ /**
+ * Enable application CDI probe mode on Payara server.
+ * <p/>
+ * @return Result of enable task execution.
+ */
+ @Override
+ public Future<ResultString> enableCDIProbeMode() {
+ if (instance != null) {
+ String key = String.format(CDI_PROBE_MODE_PROP, name);
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandSetProperty(key, Boolean.TRUE.toString()));
+ status = new WeakReference<>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Disable node cookie.
+ */
+ static class DisableCDIProbeMode
+ extends Cookie implements DisableCDIProbeModeCookie {
+
+ /**
+ * Creates an instance of cookie for disabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to be disabled in probe mode.
+ */
+ DisableCDIProbeMode(final Lookup lookup, final String name) {
+ super(lookup, name);
+ }
+
+ /**
+ * Disable application CDI probe mode on Payara server.
+ * <p/>
+ * @return Result of disable task execution.
+ */
+ @Override
+ public Future<ResultString> disableCDIProbeMode() {
+ if (instance != null) {
+ String key = String.format(CDI_PROBE_MODE_PROP, name);
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandSetProperty(key, Boolean.FALSE.toString()));
+ status = new WeakReference<>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Connection Pool advanced attributes cookie.
+ */
+ static class ConnectionPoolAdvancedAttributes
+ extends Hk2Cookie.Cookie implements ConnectionPoolAdvancedAttributesCookie {
+
+ /** Resources properties query prefix */
+ private static final String QUERY_PREFIX = "resources.*";
+
+ /** Properties query common item element. */
+ private static final String QUERY_ITEM = ".*";
+
+ /** Properties query common item separator. */
+ private static final String QUERY_SEPARATOR = ".";
+
+ /** Resource properties query. */
+ private final String query;
+
+ /** Properties customizer. */
+ final Class customizer;
+
+ /**
+ * Creates an instance of cookie for editing details of module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to undeploy.
+ * @param cmdSuffix Resource related command suffix.
+ */
+ ConnectionPoolAdvancedAttributes(final Lookup lookup, final String name,
+ final String cmdSuffix, final Class customizer) {
+ super(lookup, name);
+ final int nameLen = name != null ? name.length() : 0;
+ StringBuilder sb = new StringBuilder(QUERY_PREFIX.length()
+ + QUERY_SEPARATOR.length() + nameLen + QUERY_ITEM.length());
+ sb.append(QUERY_PREFIX);
+ if (nameLen > 0
+ && !PayaraModule.JDBC_RESOURCE.equals(cmdSuffix)) {
+ sb.append(QUERY_SEPARATOR);
+ sb.append(name);
+ sb.append(QUERY_ITEM);
+ }
+ query = sb.toString();
+ this.customizer = customizer;
+ }
+
+ @Override
+ public void openCustomizer() {
+ final BasePanel retVal = new ConnectionPoolAdvancedAttributesCustomizer();
+ retVal.initializeUI();
+ RequestProcessor.getDefault().post(new Runnable() {
+
+ // fetch the data for the BasePanel
+ @Override
+ public void run() {
+ if (instance != null) {
+ Future<ResultMap> future = ServerAdmin.<ResultMap>exec(
+ instance, new CommandGetProperty(query));
+ Map<String, String> value;
+ try {
+ ResultMap result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ Logger.getLogger("payara")
+ .log(Level.INFO, ie.getMessage(), ie);
+ value = new HashMap<String, String>();
+ }
+ retVal.initializeData(name, value);
+ }
+ }
+ });
+ DialogDescriptor dd = new DialogDescriptor(retVal,
+ NbBundle.getMessage(this.getClass(), "TITLE_CONNECTION_POOL_ADVANCED_ATTRIBUTES", name),
+ false,
+ new ActionListener() {
+
+ private void appendErrorReport(StringBuilder sb, final String key, final String value) {
+ if (sb.length() > 0) {
+ sb.append(", ");
+ }
+ sb.append(key);
+ sb.append("=");
+ sb.append(value != null ? value : "<null>");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ if (event.getSource().equals(NotifyDescriptor.OK_OPTION)) {
+ if (instance != null) {
+ Map<String, String> properties = retVal.getData();
+ Set<String> keys = properties.keySet();
+ StringBuilder sb = new StringBuilder();
+ for (String key : keys) {
+ String value = properties.get(key);
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandSetProperty(key, value));
+ try {
+ ResultString result = future.get();
+ } catch (InterruptedException | ExecutionException ie) {
+ appendErrorReport(sb, key, value);
+ }
+ }
+ if (sb.length() > 0) {
+ Exceptions.printStackTrace(new PartialCompletionException(sb.toString()));
+ }
+ }
+ }
+ }
+ });
+ Dialog d = DialogDisplayer.getDefault().createDialog(dd);
+ d.setVisible(true);
+ }
+
+ }
+
+ /**
+ * Undeploy node cookie.
+ */
+ static class Undeploy
+ extends Cookie implements UndeployModuleCookie {
+
+ /**
+ * Creates an instance of cookie for disabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to undeploy.
+ */
+ Undeploy(final Lookup lookup, final String name) {
+ super(lookup, name);
+ }
+
+ /**
+ * Undeploy module on Payara server.
+ * <p/>
+ * @return Result of undeploy task execution.
+ */
+ @Override
+ public Future<ResultString> undeploy() {
+ if (instance != null) {
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandUndeploy(name, Util.computeTarget(
+ instance.getProperties())));
+ status = new WeakReference<Future<ResultString>>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Deploy node cookie.
+ */
+ static class Deploy
+ extends Cookie implements DeployDirectoryCookie {
+
+ /**
+ * Creates an instance of cookie for disabling module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ */
+ Deploy(final Lookup lookup) {
+ super(lookup, null);
+ }
+
+ /**
+ * Deploy module from directory on Payara server.
+ * <p/>
+ * @return Result of undeploy task execution.
+ */
+ @Override
+ public Future<ResultString> deployDirectory() {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setDialogTitle(NbBundle.getMessage(Hk2ItemNode.class,
+ "LBL_ChooseButton"));
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ chooser.setMultiSelectionEnabled(false);
+
+ int returnValue = chooser.showDialog(WindowManager.getDefault()
+ .getMainWindow(), NbBundle.getMessage(
+ Hk2ItemNode.class, "LBL_ChooseButton"));
+ if (instance != null
+ || returnValue != JFileChooser.APPROVE_OPTION) {
+ return null;
+ }
+
+ final File dir
+ = new File(chooser.getSelectedFile().getAbsolutePath());
+
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandDeploy(dir.getParentFile().getName(),
+ Util.computeTarget(instance.getProperties()),
+ dir, null, null, null));
+ status = new WeakReference<Future<ResultString>>(future);
+ return future;
+ }
+ }
+
+ /**
+ * Unregister node cookie.
+ */
+ static class Unregister
+ extends Cookie implements UnregisterResourceCookie {
+
+ /** Command suffix. */
+ final String cmdSuffix;
+
+ /** Name of query property which contains resource name. */
+ final String cmdPropertyName;
+
+ /** Delete also dependent resources when <code>true</code>. */
+ final boolean cascadeDelete;
+
+ /**
+ * Creates an instance of cookie for unregistering module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to unregister.
+ * @param cmdSuffix Resource related command suffix.
+ * @param cmdPropertyName Name of query property which contains
+ * resource name.
+ * @param cascadeDelete Delete also dependent resources
+ * when <code>true</code>.
+ */
+ Unregister(final Lookup lookup, final String name,
+ final String cmdSuffix, final String cmdPropertyName,
+ final boolean cascadeDelete) {
+ super(lookup, name);
+ this.cmdSuffix = cmdSuffix;
+ this.cmdPropertyName = cmdPropertyName;
+ this.cascadeDelete = cascadeDelete;
+ }
+
+ @Override
+ public Future<ResultString> unregister() {
+ if (instance != null) {
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandDeleteResource(
+ name, cmdSuffix, cmdPropertyName, cascadeDelete));
+ status = new WeakReference<Future<ResultString>>(future);
+ return future;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Refresh node cookie.
+ */
+ static class Refresh implements RefreshModulesCookie {
+
+ /** Child nodes to be refreshed. */
+ private final Children children;
+
+ /**
+ * Creates an instance of cookie for refreshing nodes.
+ * <p/>
+ * @param children Child nodes to be refreshed.
+ */
+ Refresh(Children children) {
+ this.children = children;
+ }
+
+ /**
+ * Refresh child nodes.
+ */
+ @Override
+ public RequestProcessor.Task refresh() {
+ return refresh(null, null);
+ }
+
+ /**
+ * Refresh child nodes.
+ * <p/>
+ * @param expected Expected node display name.
+ * @param unexpected Unexpected node display name.
+ */
+ @Override
+ public RequestProcessor.Task refresh(String expected, String unexpected) {
+ if (children instanceof Refreshable) {
+ ((Refreshable) children).updateKeys();
+ boolean foundExpected = expected == null;
+ boolean foundUnexpected = false;
+ for (Node node : children.getNodes()) {
+ if (!foundExpected
+ && node.getDisplayName().equals(expected)) {
+ foundExpected = true;
+ }
+ if (!foundUnexpected
+ && node.getDisplayName().equals(unexpected)) {
+ foundUnexpected = true;
+ }
+ }
+ if (!foundExpected) {
+ Logger.getLogger("payara").log(Level.WARNING, null,
+ new IllegalStateException(
+ "did not find a child node, named " + expected));
+ }
+ if (foundUnexpected) {
+ Logger.getLogger("payara").log(Level.WARNING, null,
+ new IllegalStateException(
+ "found unexpected child node, named "
+ + unexpected));
+ }
+ }
+ return null;
+ }
+ }
+
+ static class EditDetails
+ extends Cookie implements EditDetailsCookie {
+
+ /** Resources properties query prefix */
+ private static final String QUERY_PREFIX = "resources.*";
+
+ /** Properties query common item element. */
+ private static final String QUERY_ITEM = ".*";
+
+ /** Properties query common item separator. */
+ private static final String QUERY_SEPARATOR = ".";
+
+ /** Resource properties query. */
+ private final String query;
+
+ /** Properties customizer. */
+ final Class customizer;
+
+ /**
+ * Creates an instance of cookie for editing details of module.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Name of resource to undeploy.
+ * @param cmdSuffix Resource related command suffix.
+ */
+ EditDetails(final Lookup lookup, final String name,
+ final String cmdSuffix, final Class customizer) {
+ super(lookup, name);
+ final int nameLen = name != null ? name.length() : 0;
+ StringBuilder sb = new StringBuilder(QUERY_PREFIX.length()
+ + QUERY_SEPARATOR.length() + nameLen + QUERY_ITEM.length());
+ sb.append(QUERY_PREFIX);
+ if (nameLen > 0
+ && !PayaraModule.JDBC_RESOURCE.equals(cmdSuffix)) {
+ sb.append(QUERY_SEPARATOR);
+ sb.append(name);
+ sb.append(QUERY_ITEM);
+ }
+ query = sb.toString();
+ this.customizer = customizer;
+ }
+
+ @Override
+ public void openCustomizer() {
+ final BasePanel retVal = getBasePanel();
+ retVal.initializeUI();
+ RequestProcessor.getDefault().post(new Runnable() {
+
+ // fetch the data for the BasePanel
+ @Override
+ public void run() {
+ if (instance != null) {
+ Future<ResultMap> future = ServerAdmin.<ResultMap>exec(
+ instance, new CommandGetProperty(query));
+ Map<String, String> value;
+ try {
+ ResultMap result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ Logger.getLogger("payara")
+ .log(Level.INFO, ie.getMessage(), ie);
+ value = new HashMap<String, String>();
+ }
+ retVal.initializeData(name, value);
+ }
+ }
+ });
+ DialogDescriptor dd = new DialogDescriptor(retVal,
+ NbBundle.getMessage(this.getClass(), "TITLE_RESOURCE_EDIT", name),
+ false,
+ new ActionListener() {
+
+ private void appendErrorReport(StringBuilder sb, final String key, final String value) {
+ if (sb.length() > 0) {
+ sb.append(", ");
+ }
+ sb.append(key);
+ sb.append("=");
+ sb.append(value != null ? value : "<null>");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ if (event.getSource().equals(NotifyDescriptor.OK_OPTION)) {
+ if (instance != null) {
+ Map<String, String> properties = retVal.getData();
+ Set<String> keys = properties.keySet();
+ StringBuilder sb = new StringBuilder();
+ for (String key : keys) {
+ String value = properties.get(key);
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ instance, new CommandSetProperty(key, value));
+ try {
+ ResultString result = future.get();
+ } catch (InterruptedException | ExecutionException ie) {
+ appendErrorReport(sb, key, value);
+ }
+ }
+ if (sb.length() > 0) {
+ Exceptions.printStackTrace(new PartialCompletionException(sb.toString()));
+ }
+ }
+ }
+ }
+ });
+ Dialog d = DialogDisplayer.getDefault().createDialog(dd);
+ d.setVisible(true);
+ }
+
+ private BasePanel getBasePanel() {
+ BasePanel temp;
+ try {
+ temp = (BasePanel) customizer.getConstructor().newInstance();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex) {
+ temp = new BasePanel.Error();
+ Exceptions.printStackTrace(ex);
+ }
+ return temp;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve Payara instance from {@see Lookup} object.
+ * <p/>
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @return Payara instance retrieved from lookup object.
+ */
+ private static PayaraInstance getPayaraInstance(final Lookup lookup) {
+ CommonServerSupport commonModule = lookup.lookup(
+ CommonServerSupport.class);
+ return commonModule != null ? commonModule.getInstance() : null;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceChildren.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceChildren.java
new file mode 100644
index 0000000..47ba4fa
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceChildren.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.netbeans.modules.payara.spi.PluggableNodeProvider;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.WeakListeners;
+
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2InstanceChildren extends Children.Keys<Node> implements Refreshable, ChangeListener {
+
+ private PayaraInstance serverInstance;
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ Hk2InstanceChildren(PayaraInstance instance) {
+ serverInstance = instance;
+ serverInstance.getCommonSupport().addChangeListener(
+ WeakListeners.change(this, serverInstance));
+ }
+
+ @Override
+ public void updateKeys(){
+ List<Node> keys = new LinkedList<Node>();
+ serverInstance.getCommonSupport().refresh();
+ if(serverInstance.getServerState() == ServerState.RUNNING) {
+ keys.add(new Hk2ItemNode(serverInstance.getLookup(),
+ new Hk2ApplicationsChildren(serverInstance.getLookup()),
+ NbBundle.getMessage(Hk2InstanceNode.class, "LBL_Apps"),
+ Hk2ItemNode.J2EE_APPLICATION_FOLDER));
+ keys.add(new Hk2ItemNode(serverInstance.getLookup(),
+ new Hk2ResourceContainers(serverInstance.getLookup()),
+ NbBundle.getMessage(Hk2InstanceNode.class, "LBL_Resources"),
+ Hk2ItemNode.RESOURCES_FOLDER));
+ String iid = serverInstance.getDeployerUri();
+ if (null != iid && iid.contains("pfv3ee6wc")) {
+ keys.add(new Hk2ItemNode(serverInstance.getLookup(),
+ new Hk2WSChildren(serverInstance.getLookup()),
+ NbBundle.getMessage(Hk2InstanceNode.class, "LBL_WS"),
+ Hk2ItemNode.WS_FOLDER));
+ }
+ List<Node> pluggableNodes = getExtensionNodes();
+ for (Iterator itr = pluggableNodes.iterator(); itr.hasNext();) {
+ keys.add((Node)itr.next());
+ }
+ }
+ setKeys(keys);
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ Collection<Node> noKeys = java.util.Collections.emptySet();
+ setKeys(noKeys);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Node key) {
+ return new Node [] { key };
+ }
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ Mutex.EVENT.readAccess(new Runnable() {
+ @Override
+ public void run() {
+ updateKeys();
+ }
+ });
+ }
+
+ List<Node> getExtensionNodes() {
+ List<Node> nodesList = new ArrayList<Node>();
+ for (PluggableNodeProvider nep
+ : Lookup.getDefault().lookupAll(PluggableNodeProvider.class)) {
+ if (nep != null) {
+ try {
+ Node node = nep.getPluggableNode(
+ serverInstance.getProperties());
+ if (node != null) {
+ nodesList.add(node);
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara-common").log(Level.SEVERE,
+ NbBundle.getMessage(Hk2InstanceChildren.class,
+ "WARN_BOGUS_GET_EXTENSION_NODE_IMPL", // NOI18N
+ nep.getClass().getName()));
+ Logger.getLogger("payara-common").log(Level.FINER,
+ NbBundle.getMessage(Hk2InstanceChildren.class,
+ "WARN_BOGUS_GET_EXTENSION_NODE_IMPL", // NOI18N
+ nep.getClass().getName()), ex);
+ } catch (AssertionError ae) {
+ Logger.getLogger("payara-common").log(Level.SEVERE,
+ NbBundle.getMessage(Hk2InstanceChildren.class,
+ "WARN_BOGUS_GET_EXTENSION_NODE_IMPL", // NOI18N
+ nep.getClass().getName()+".")); // NOI18N
+ Logger.getLogger("payara-common").log(Level.FINER,
+ NbBundle.getMessage(Hk2InstanceChildren.class,
+ "WARN_BOGUS_GET_EXTENSION_NODE_IMPL", // NOI18N
+ nep.getClass().getName()), ae);
+ }
+ }
+ }
+ return nodesList;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceNode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceNode.java
new file mode 100644
index 0000000..a72604a
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2InstanceNode.java
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.awt.Component;
+import java.awt.Image;
+import javax.swing.Action;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.actions.DebugAction;
+import org.netbeans.modules.payara.common.actions.KillServerAction;
+import org.netbeans.modules.payara.common.actions.ProfileAction;
+import org.netbeans.modules.payara.common.actions.PropertiesAction;
+import org.netbeans.modules.payara.common.actions.RemoveServerAction;
+import org.netbeans.modules.payara.common.actions.RestartAction;
+import org.netbeans.modules.payara.common.actions.StartServerAction;
+import org.netbeans.modules.payara.common.actions.StopServerAction;
+import org.netbeans.modules.payara.common.actions.ViewAdminConsoleAction;
+import org.netbeans.modules.payara.common.actions.ViewServerLogAction;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesAction;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesCookie;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.WeakListeners;
+import org.openide.util.actions.SystemAction;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+import org.openide.util.lookup.ProxyLookup;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class Hk2InstanceNode extends AbstractNode implements ChangeListener { //Node.Cookie {
+
+ // Server instance icon
+ private static final String ICON_BASE =
+ "org/netbeans/modules/payara/common/resources/server.png"; // NOI18N
+
+ // Icon badges for current server state
+ private static final String WAITING_ICON
+ = "org/netbeans/modules/payara/common/resources/waiting.png"; // NOI18N
+ private static final String RUNNING_ICON
+ = "org/netbeans/modules/payara/common/resources/running.png"; // NOI18N
+ private static final String DEBUGGING_ICON
+ = "org/netbeans/modules/payara/common/resources/debugging.png"; // NOI18N
+ private static final String SUSPENDED_ICON
+ = "org/netbeans/modules/payara/common/resources/suspended.png"; // NOI18N
+ private static final String PROFILING_ICON
+ = "org/netbeans/modules/payara/common/resources/profiling.png"; // NOI18N
+ private static final String PROFILER_BLOCKING_ICON
+ = "org/netbeans/modules/payara/common/resources/profilerblocking.png"; // NOI18N
+
+
+ private final PayaraInstance serverInstance;
+ private final InstanceContent instanceContent;
+ private final boolean isFullNode;
+ private volatile String displayName = null;
+ private volatile String shortDesc = null;
+
+ public Hk2InstanceNode(final PayaraInstance instance, boolean isFullNode) {
+ this(instance, new InstanceContent(), isFullNode);
+ if (isFullNode) {
+ instance.getCommonSupport().refresh();
+ }
+ }
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ private Hk2InstanceNode(final PayaraInstance instance, final InstanceContent ic, boolean isFullNode) {
+ super(isFullNode ? new Hk2InstanceChildren(instance) : Children.LEAF,
+ new ProxyLookup(new AbstractLookup(ic), instance.getLookup()));
+ serverInstance = instance;
+ instanceContent = ic;
+ this.isFullNode = isFullNode;
+ setIconBaseWithExtension(ICON_BASE);
+
+ if(isFullNode) {
+ serverInstance.getCommonSupport().addChangeListener(
+ WeakListeners.change(this, serverInstance));
+ instanceContent.add(new RefreshModulesCookie() {
+ @Override
+ public RequestProcessor.Task refresh() {
+ return refresh(null, null);
+ }
+
+ @Override
+ public RequestProcessor.Task refresh(String expected, String unexpected) {
+ Children children = getChildren();
+ if(children instanceof Refreshable) {
+ ((Refreshable) children).updateKeys();
+ }
+ return null;
+ }
+ });
+ }
+ }
+
+ @Override
+ public String getDisplayName() {
+ if(displayName == null) {
+ displayName = buildDisplayName();
+ }
+ return displayName;
+ }
+
+ @Override
+ public String getShortDescription() {
+ if(shortDesc == null) {
+ shortDesc = NbBundle.getMessage(Hk2InstanceNode.class, "LBL_ServerInstanceNodeDesc",
+ serverInstance.getServerDisplayName(),
+ getAdminUrl());
+ }
+ return shortDesc;
+ }
+
+ /** Get the set of actions that are associated with this node.
+ * <p/>
+ * This set is used to construct the context menu for the node.
+ * <p/>
+ * @param context Whether to find actions for context meaning or for the
+ * node itself.
+ * @return A list of actions (you may include nulls for separators).
+ */
+ @Override
+ public Action[] getActions(boolean context) {
+ if (!isFullNode) {
+ return new Action[]{};
+ }
+
+ return serverInstance.isRemote()
+ ? getRemoteActions() : getLocalActions();
+ }
+
+ /**
+ * Node actions for local server instance.
+ * <p/>
+ * @return A list of actions for local server instance.
+ */
+ public Action[] getLocalActions() {
+ return new Action[] {
+ SystemAction.get(StartServerAction.class),
+ SystemAction.get(DebugAction.class),
+ SystemAction.get(ProfileAction.class),
+ SystemAction.get(RestartAction.class),
+ SystemAction.get(StopServerAction.class),
+ SystemAction.get(RefreshModulesAction.class),
+ null,
+ SystemAction.get(RemoveServerAction.class),
+ null,
+ SystemAction.get(KillServerAction.class),
+ null,
+ SystemAction.get(ViewAdminConsoleAction.class),
+ SystemAction.get(ViewServerLogAction.class),
+ null,
+ SystemAction.get(PropertiesAction.class)
+ };
+ }
+
+ /**
+ * Node actions for local server instance.
+ * <p/>
+ * @return A list of actions for local server instance.
+ */
+ public Action[] getRemoteActions() {
+ return new Action[] {
+ SystemAction.get(StartServerAction.class),
+ SystemAction.get(DebugAction.class),
+ SystemAction.get(ProfileAction.class),
+ SystemAction.get(RestartAction.class),
+ SystemAction.get(StopServerAction.class),
+ SystemAction.get(RefreshModulesAction.class),
+ null,
+ SystemAction.get(RemoveServerAction.class),
+ null,
+ SystemAction.get(ViewAdminConsoleAction.class),
+ SystemAction.get(ViewServerLogAction.class),
+ null,
+ SystemAction.get(PropertiesAction.class)
+ };
+ }
+
+ @Override
+ public boolean hasCustomizer() {
+ return true;
+ }
+
+ @Override
+ public Component getCustomizer() {
+ // CustomizerDataSupport dataSup = new CustomizerDataSupport(getDeploymentManager());
+ // return new Customizer(dataSup, new Hk2J2eePlatformFactory().getJ2eePlatformImpl(getDeploymentManager()));
+ return new javax.swing.JPanel();
+ }
+
+ @Override
+ public Image getIcon(int type) {
+ return badgeIcon(super.getIcon(type));
+ }
+
+ @Override
+ public Image getOpenedIcon(int type) {
+ return badgeIcon(super.getOpenedIcon(type));
+ }
+
+ /**
+ * Copied along with icons from InstanceNodeDecorator in j2eeserver module.
+ *
+ * @todo Could this be put in common server SPI to make it sharable?
+ *
+ * @param origImg
+ * @return
+ */
+ private Image badgeIcon(Image origImg) {
+ Image badge = null;
+ switch (serverInstance.getServerState()) {
+ case RUNNING:
+ if(isDebug()) {
+ badge = ImageUtilities.loadImage(DEBUGGING_ICON);
+ } else if (isProfile()) {
+ badge = ImageUtilities.loadImage(PROFILING_ICON);
+ } else {
+ badge = ImageUtilities.loadImage(RUNNING_ICON);
+ }
+ break;
+// case RUNNING_JVM_DEBUG:
+// badge = ImageUtilities.loadImage(DEBUGGING_ICON);
+// break;
+ case STARTING:
+ badge = ImageUtilities.loadImage(WAITING_ICON);
+ break;
+ case STOPPED:
+// badge = ImageUtilities.loadImage(SUSPENDED_ICON);
+ break;
+ case STOPPED_JVM_BP:
+ case STOPPED_JVM_PROFILER:
+ badge = ImageUtilities.loadImage(SUSPENDED_ICON);
+ break;
+ case STOPPING:
+ badge = ImageUtilities.loadImage(WAITING_ICON);
+ break;
+ // TODO profiler states
+// case PROFILING:
+// badge = ImageUtilities.loadImage(PROFILING_ICON);
+// break;
+// case PROFILER_BLOCKING:
+// badge = ImageUtilities.loadImage(PROFILER_BLOCKING_ICON);
+// break;
+// case PROFILER_STARTING:
+// badge = ImageUtilities.loadImage(WAITING_ICON);
+// break;
+ }
+ return badge != null ? ImageUtilities.mergeImages(origImg, badge, 15, 8) : origImg;
+ }
+
+ private boolean isDebug() {
+ return PayaraModule.DEBUG_MODE.equals(serverInstance.getProperty(PayaraModule.JVM_MODE));
+ }
+
+ private boolean isProfile() {
+ return PayaraModule.PROFILE_MODE.equals(serverInstance.getProperty(PayaraModule.JVM_MODE));
+ }
+
+/* private Map<String, String> getInstanceProperties() {
+ Map<String, String> ip = serverInstance.getProperties();
+// PayaraModule commonSupport = getLookup().lookup(PayaraModule.class);
+ if(ip == null) {
+ ip = Collections.emptyMap();
+ }
+ return ip;
+ }
+*/
+ private String buildDisplayName() {
+ String dn = serverInstance.getProperty(PayaraModule.DISPLAY_NAME_ATTR);
+ return dn != null ? dn : "Bogus display name"; // NOI18N NbBundle.getMessage(Hk2InstanceNode.class, "TXT_PayaraPreludeInstanceNode");
+ }
+
+ private String getAdminUrl() {
+ String result = null;
+ String host = serverInstance.getProperty(PayaraModule.HOSTNAME_ATTR);
+ String adminPort = !"false".equals(System.getProperty("payara.useadminport"))
+ ? serverInstance.getProperty(PayaraModule.ADMINPORT_ATTR)
+ : serverInstance.getProperty(PayaraModule.HTTPPORT_ATTR);
+ if(host != null && host.length() > 0) {
+ result = "http://" + host + ":" + adminPort; // this is just a display string...
+ }
+
+ return result;
+ }
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ Mutex.EVENT.readAccess(new Runnable() {
+ @Override
+ public void run() {
+ fireIconChange();
+ }
+ });
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ItemNode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ItemNode.java
new file mode 100644
index 0000000..7ae60a2
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ItemNode.java
@@ -0,0 +1,387 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.awt.Image;
+import java.beans.BeanInfo;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.Action;
+import org.netbeans.modules.payara.common.nodes.actions.DisableModulesAction;
+import org.netbeans.modules.payara.common.nodes.actions.EditDetailsAction;
+import org.netbeans.modules.payara.common.nodes.actions.EnableCDIProbeModeAction;
+import org.netbeans.modules.payara.common.nodes.actions.DisableCDIProbeModeAction;
+import org.netbeans.modules.payara.common.nodes.actions.EnableModulesAction;
+import org.netbeans.modules.payara.common.nodes.actions.OpenTestURLAction;
+import org.netbeans.modules.payara.common.nodes.actions.OpenURLAction;
+import org.netbeans.modules.payara.common.nodes.actions.RefreshModulesAction;
+import org.netbeans.modules.payara.common.nodes.actions.UndeployModuleAction;
+import org.netbeans.modules.payara.common.nodes.actions.UnregisterResourceAction;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.ResourceDecorator;
+import org.openide.actions.CopyAction;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataFolder;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.SystemAction;
+
+/**
+ * Extensible node.
+ * <p/>
+ * @author Ludovic Champenois, Peter Williams, Tomas Kraus
+ * @author Gaurav Gupta
+ */
+public class Hk2ItemNode extends AbstractNode {
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Resources icon. */
+ private static final String RESOURCES_ICON =
+ "org/netbeans/modules/payara/common/resources/resources.gif";
+
+ /** Web services icon. */
+ private static final String WS_ICON =
+ "org/netbeans/modules/payara/common/resources/webservice.png";
+
+ /** Java EE applications folder. */
+ public static final Decorator J2EE_APPLICATION_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() {
+ return true;
+ }
+ @Override public boolean canDeployTo() {
+ return true;
+ }
+ };
+
+ /** Resources folder. */
+ public static final Decorator RESOURCES_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() {
+ return true;
+ }
+ @Override public Image getIcon(int type) {
+ return ImageUtilities.loadImage(RESOURCES_ICON);
+ }
+ @Override public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+ };
+
+ /** Web services folder. */
+ public static final Decorator WS_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() {
+ return true;
+ }
+ };
+
+ /** Web service. */
+ public static final Decorator WS_ENDPOINT = new Decorator() {
+ @Override public boolean canTest() {
+ return true;
+ }
+ @Override public boolean canCopy() {
+ return true;
+ }
+ @Override public Image getIcon(int type) {
+ return ImageUtilities.loadImage(WS_ICON);
+ }
+ @Override public Image getOpenedIcon(int type) {
+ return getIcon(type);
+ }
+ };
+
+ /** Java EE application. */
+ public static final Decorator J2EE_APPLICATION = new Decorator() {
+ @Override public boolean canUndeploy() {
+ return true;
+ }
+ @Override public boolean canEnable() {
+ return true;
+ }
+ @Override public boolean canDisable() {
+ return true;
+ }
+ @Override public boolean canShowBrowser() {
+ return true;
+ }
+ };
+
+ /** Refreshable folder. */
+ public static final Decorator REFRESHABLE_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() {
+ return true;
+ }
+ @Override public boolean canDeployTo() {
+ return true;
+ }
+ };
+
+ /** JDBC managed data sources. */
+ public static final Decorator JDBC_MANAGED_DATASOURCES
+ = new ResourceDecorator() {
+ @Override public boolean canUnregister() {
+ return true;
+ }
+ @Override public Image getIcon(int type) {
+ return ImageUtilities.loadImage(RESOURCES_ICON);
+ }
+ @Override public String getCmdPropertyName() {
+ return "jdbc_resource_name";
+ }
+ };
+
+ /** Connection pools. */
+ public static final Decorator CONNECTION_POOLS = new ResourceDecorator() {
+ @Override public boolean canUnregister() {
+ return true;
+ }
+ @Override public Image getIcon(int type) {
+ return ImageUtilities.loadImage(RESOURCES_ICON);
+ }
+ @Override public String getCmdPropertyName() {
+ return "jdbc_connection_pool_id";
+ }
+ @Override public boolean isCascadeDelete() {
+ return true;
+ }
+ };
+
+
+ /** Node decorator. */
+ protected final Decorator decorator;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of extensible node without setting node display name.
+ * <p/>
+ * @param children Child nodes.
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Node name.
+ * @param decorator Node decorator.
+ */
+ protected Hk2ItemNode(Children children, final Lookup lookup,
+ final String name, final Decorator decorator) {
+ super(children);
+ this.decorator = decorator;
+
+ if(decorator.isRefreshable()) {
+ getCookieSet().add(new Hk2Cookie.Refresh(children));
+ }
+ if(decorator.canDeployTo()) {
+ getCookieSet().add(new Hk2Cookie.Deploy(lookup));
+ }
+ if(decorator.canUndeploy()) {
+ getCookieSet().add(new Hk2Cookie.Undeploy(lookup, name));
+ }
+ if(decorator.canEnable()) {
+ getCookieSet().add(new Hk2Cookie.Enable(lookup, name));
+ }
+ if(decorator.canDisable()) {
+ getCookieSet().add(new Hk2Cookie.Disable(lookup, name));
+ }
+ if(decorator.canCDIProbeEnable()) {
+ getCookieSet().add(new Hk2Cookie.EnableCDIProbeMode(lookup, name));
+ }
+ if(decorator.canCDIProbeDisable()) {
+ getCookieSet().add(new Hk2Cookie.DisableCDIProbeMode(lookup, name));
+ }
+ }
+
+ /**
+ * Creates an instance of extensible node and sets node display name.
+ * <p/>
+ * @param children Child nodes.
+ * @param lookup Lookup containing {@see CommonServerSupport}.
+ * @param name Node name.
+ * @param decorator Node decorator.
+ */
+ public Hk2ItemNode(final Lookup lookup,
+ Children children, final String name, final Decorator decorator) {
+ this(children, lookup, name, decorator);
+ setDisplayName(name);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Find an icon for this node (in the closed state).
+ * <p/>
+ * @param type Constant from {@link java.beans.BeanInfo}.
+ * @return Icon to use to represent this node.
+ */
+ @Override
+ public Image getIcon(int type) {
+ Image image;
+ Image badge = decorator.getIconBadge();
+ if(badge != null) {
+ if (null == decorator.getIcon(type)) {
+ image = badgeFolder(badge, false);
+ } else {
+ image = badgeIcon(badge,decorator.getIcon(type));
+ }
+ } else {
+ image = decorator.getIcon(type);
+ }
+ return image != null ? image : getIconDelegate().getIcon(type);
+ }
+
+ /**
+ * Find an icon for this node (in the open state).
+ * <p/>
+ * This icon is used when the node may have children and is expanded.
+ * <p/>
+ * @param type Constant from {@link java.beans.BeanInfo}.
+ * @return Icon to use to represent this node when open.
+ */
+ @Override
+ public Image getOpenedIcon(int type) {
+ Image image;
+ Image badge = decorator.getIconBadge();
+ if(badge != null) {
+ image = badgeFolder(badge, true);
+ } else {
+ image = decorator.getOpenedIcon(type);
+ }
+ return image != null ? image : getIconDelegate().getOpenedIcon(type);
+ }
+
+ /** Get the set of actions that are associated with this node.
+ * <p/>
+ * This set is used to construct the context menu for the node.
+ * By default this method delegates to the deprecated getActions
+ * or getContextActions method depending on the value of supplied argument.
+ * It is supposed to be overridden by subclasses accordingly.
+ * <p/>
+ * @param context Whether to find actions for context meaning or for
+ * the node itself.
+ * @return {@see List} of actions (you may include nulls for separators).
+ */
+ @Override
+ public Action[] getActions(boolean context) {
+ List<Action> actions = new ArrayList<Action>();
+ if(decorator.isRefreshable()) {
+ actions.add(SystemAction.get(RefreshModulesAction.class));
+ }
+ if(decorator.canDeployTo()) {
+// actions.add(SystemAction.get(DeployDirectoryAction.class));
+ }
+ if(decorator.canUndeploy()) {
+ actions.add(SystemAction.get(UndeployModuleAction.class));
+ }
+ if(decorator.canEnable()) {
+ actions.add(SystemAction.get(EnableModulesAction.class));
+ }
+ if(decorator.canDisable()) {
+ actions.add(SystemAction.get(DisableModulesAction.class));
+ }
+ if(decorator.canCDIProbeEnable()) {
+ actions.add(SystemAction.get(EnableCDIProbeModeAction.class));
+ }
+ if(decorator.canCDIProbeDisable()) {
+ actions.add(SystemAction.get(DisableCDIProbeModeAction.class));
+ }
+ if(decorator.canUnregister()) {
+ actions.add(SystemAction.get(UnregisterResourceAction.class));
+ }
+ if(decorator.canShowBrowser()) {
+ actions.add(SystemAction.get(OpenURLAction.class));
+ }
+ if(decorator.canTest()) {
+ actions.add(SystemAction.get(OpenTestURLAction.class));
+ }
+ if(decorator.canCopy()) {
+ actions.add(SystemAction.get(CopyAction.class));
+ }
+ if (decorator.canEditDetails()) {
+ actions.add(SystemAction.get(EditDetailsAction.class));
+ }
+ return actions.toArray(new Action[actions.size()]);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates and returns the instance of the node representing the status
+ * 'WAIT' of the node.
+ * <p/>
+ * It is used when it spent more time to create elements hierarchy.
+ * <p/>
+ * @return The wait node.
+ */
+ public static Node createWaitNode() {
+ AbstractNode node = new AbstractNode(Children.LEAF);
+ node.setName(NbBundle.getMessage(Hk2ItemNode.class,
+ "LBL_WaitNode_DisplayName"));
+ node.setIconBaseWithExtension("org/openide/src/resources/wait.gif");
+ return node;
+ }
+
+ /**
+ * Applies a badge to an open or closed folder icon.
+ * <p/>
+ * @param badge Badge image for folder.
+ * @param opened Use open or closed folder.
+ * @return An image of the badged folder.
+ */
+ public static Image badgeFolder(Image badge, boolean opened) {
+ Node folderNode = getIconDelegate();
+ Image folder = opened
+ ? folderNode.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)
+ : folderNode.getIcon(BeanInfo.ICON_COLOR_16x16);
+ return ImageUtilities.mergeImages(folder, badge, 7, 7);
+ }
+
+ /**
+ * Applies a badge to an icon.
+ * <p/>
+ * @param badge Badge image for folder.
+ * @param icon Tthe image to be badged.
+ * @return An image of the badged folder.
+ */
+ public static Image badgeIcon(Image badge, Image icon) {
+ return ImageUtilities.mergeImages(icon, badge, 7, 7);
+ }
+
+ /**
+ * Retrieves the IDE's standard folder node, so we can access the default
+ * open/closed folder icons.
+ * <p/>
+ * @return Standard folder node.
+ */
+ private static Node getIconDelegate() {
+ return DataFolder.findFolder(
+ FileUtil.getConfigRoot()).getNodeDelegate();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceContainers.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceContainers.java
new file mode 100644
index 0000000..58a6e1d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceContainers.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.Set;
+import java.util.Vector;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2ResourceContainers extends Children.Keys<Object> implements Refreshable {
+
+ private Lookup lookup;
+ private final static Node WAIT_NODE = Hk2ItemNode.createWaitNode();
+
+ Hk2ResourceContainers(Lookup lookup) {
+ this.lookup = lookup;
+ }
+
+ @Override
+ public void updateKeys() {
+ Vector<Hk2ItemNode> keys = new Vector<Hk2ItemNode>();
+ PayaraModule commonSupport = lookup.lookup(PayaraModule.class);
+ if ((commonSupport != null)
+ && (commonSupport.getInstanceProvider().equals(PayaraInstanceProvider.getProvider()))) {
+ String[] childTypes = NodeTypes.getChildTypes(NodeTypes.RESOURCES);
+ if (childTypes != null) {
+ for (int i = 0; i < childTypes.length; i++) {
+ String type = childTypes[i];
+ keys.add(new Hk2ItemNode(lookup,
+ new Hk2ResourcesChildren(lookup, type),
+ NbBundle.getMessage(Hk2ResourceContainers.class, "LBL_" + type), // NOI18N
+ DecoratorManager.findDecorator(type, Hk2ItemNode.REFRESHABLE_FOLDER, true)));
+ }
+ }
+ } else {
+ String type = PayaraModule.JDBC;
+ keys.add(new Hk2ItemNode(lookup,
+ new Hk2ResourcesChildren(lookup, type),
+ NbBundle.getMessage(Hk2ResourceContainers.class, "LBL_" + type), // NOI18N
+ DecoratorManager.findDecorator(type, Hk2ItemNode.REFRESHABLE_FOLDER, true)));
+ }
+ setKeys(keys);
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys((Set<? extends Object>) java.util.Collections.EMPTY_SET);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof Hk2ItemNode){
+ return new Node [] { (Hk2ItemNode) key };
+ }
+
+ if (key instanceof String && key.equals(WAIT_NODE)){
+ return new Node [] { WAIT_NODE };
+ }
+
+ return null;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceNode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceNode.java
new file mode 100644
index 0000000..2a8c5ac
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourceNode.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.Action;
+import org.netbeans.modules.payara.common.ui.ConnectionPoolCustomizer;
+import org.netbeans.modules.payara.common.nodes.actions.ConnectionPoolAdvancedAttributesAction;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.ResourceDecorator;
+import org.netbeans.modules.payara.spi.ResourceDesc;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.nodes.Children;
+import org.openide.util.Lookup;
+import org.openide.util.actions.SystemAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2ResourceNode extends Hk2ItemNode {
+
+ private final Class customizer;
+
+ public Hk2ResourceNode(final Lookup lookup, final ResourceDesc resource,
+ final ResourceDecorator decorator, final Class customizer) {
+ super(Children.LEAF, lookup, resource.getName(), decorator);
+ this.customizer = customizer;
+ setDisplayName(resource.getName());
+ setShortDescription("<html>name: " + resource.getName() + "</html>");
+
+ if (decorator.canUnregister()) {
+ getCookieSet().add(new Hk2Cookie.Unregister(lookup,
+ resource.getName(), resource.getCommandType(),
+ decorator.getCmdPropertyName(),
+ decorator.isCascadeDelete()));
+ }
+
+ if (decorator.canEditDetails()) {
+ PayaraModule m = lookup.lookup(PayaraModule.class);
+ if (null != m) {
+ String rootDir = m.getInstanceProperties().get(PayaraModule.PAYARA_FOLDER_ATTR);
+ if (ServerUtilities.isTP2(rootDir)) {
+ // don't add the edit details cookie
+ } else {
+ // add the editor cookie
+ getCookieSet().add(new Hk2Cookie.EditDetails(
+ lookup, getDisplayName(),
+ resource.getCommandType(), customizer));
+ }
+
+ }
+
+ }
+ if (customizer == ConnectionPoolCustomizer.class) {
+ // add the ConnectionPoolAdvancedAttributes cookie
+ getCookieSet().add(new Hk2Cookie.ConnectionPoolAdvancedAttributes(
+ lookup, getDisplayName(),
+ resource.getCommandType(), customizer));
+ }
+ }
+
+ @Override
+ public Action[] getActions(boolean context) {
+ List<Action> actions = new ArrayList<>(Arrays.asList(super.getActions(context)));
+ if (customizer == ConnectionPoolCustomizer.class) {
+ actions.add(SystemAction.get(ConnectionPoolAdvancedAttributesAction.class));
+ }
+ return actions.toArray(new Action[actions.size()]);
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourcesChildren.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourcesChildren.java
new file mode 100644
index 0000000..08a0e7e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2ResourcesChildren.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.common.ui.AdminObjectCustomizer;
+import org.netbeans.modules.payara.common.ui.ConnectionPoolCustomizer;
+import org.netbeans.modules.payara.common.ui.ConnectorConnectionPoolCustomizer;
+import org.netbeans.modules.payara.common.ui.ConnectorCustomizer;
+import org.netbeans.modules.payara.common.ui.JavaMailCustomizer;
+import org.netbeans.modules.payara.common.ui.JdbcResourceCustomizer;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.ResourceDecorator;
+import org.netbeans.modules.payara.spi.ResourceDesc;
+import org.openide.nodes.AbstractNode;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2ResourcesChildren extends Children.Keys<Object> implements Refreshable {
+
+ private Lookup lookup;
+ private String type;
+ private final static Node WAIT_NODE = Hk2ItemNode.createWaitNode();
+
+ Hk2ResourcesChildren(Lookup lookup, String type) {
+ this.lookup = lookup;
+ this.type = type;
+ }
+
+ @Override
+ public void updateKeys() {
+ List<AbstractNode> keys = Collections.synchronizedList(new ArrayList<AbstractNode>());
+ String[] childTypes = NodeTypes.getChildTypes(type);
+ if ((childTypes != null)) {
+ if (childTypes.length > 1) {
+ for (int i = 0; i < childTypes.length; i++) {
+ String childtype = childTypes[i];
+ Class customizer = getCustomizer(childtype);
+ keys.add(new Hk2ItemNode(lookup,
+ new Hk2Resources(lookup, childtype, customizer),
+ NbBundle.getMessage(Hk2ResourceContainers.class, "LBL_" + childtype), //TODO
+ Hk2ItemNode.REFRESHABLE_FOLDER));
+ }
+ } else {
+ String childtype = childTypes[0];
+ CommonServerSupport commonSupport = lookup.lookup(
+ CommonServerSupport.class);
+ if (commonSupport != null) {
+ try {
+ Decorator decorator = DecoratorManager.findDecorator(childtype, null, true);
+ List<ResourceDesc> reslourcesList
+ = ResourceDesc.getResources(commonSupport.getInstance(), childtype);
+ for (ResourceDesc resource : reslourcesList) {
+ keys.add(new Hk2ResourceNode(lookup, resource, (ResourceDecorator) decorator, getCustomizer(childtype)));
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ }
+ setKeys(keys);
+
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys((Set<? extends Object>) java.util.Collections.EMPTY_SET);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof Hk2ItemNode){
+ return new Node [] { (Hk2ItemNode) key };
+ }
+
+ if (key instanceof String && key.equals(WAIT_NODE)){
+ return new Node [] { WAIT_NODE };
+ }
+
+ return null;
+ }
+
+ class Hk2Resources extends Children.Keys<Object> implements Refreshable {
+
+ private Lookup lookup;
+ private String type;
+ private Class customizer;
+ private final Node WAIT_NODE = Hk2ItemNode.createWaitNode();
+
+ Hk2Resources(Lookup lookup, String type, Class customizer) {
+ this.lookup = lookup;
+ this.type = type;
+ this.customizer = customizer;
+ }
+
+ @Override
+ public void updateKeys() {
+ RequestProcessor t = new RequestProcessor("resource-child-updater");
+ t.post(new Runnable() {
+
+ List<AbstractNode> keys = Collections.synchronizedList(new ArrayList<AbstractNode>());
+
+ @Override
+ public void run() {
+ CommonServerSupport commonSupport = lookup.lookup(
+ CommonServerSupport.class);
+ if (commonSupport != null) {
+ try {
+ Decorator decorator = DecoratorManager.findDecorator(type, null,true);
+ if (decorator == null) {
+ if (type.equals(PayaraModule.JDBC_RESOURCE)) {
+ decorator = Hk2ItemNode.JDBC_MANAGED_DATASOURCES;
+ } else if (type.equals(PayaraModule.JDBC_CONNECTION_POOL)) {
+ decorator = Hk2ItemNode.CONNECTION_POOLS;
+ }
+ }
+ if (decorator != null) {
+ List<ResourceDesc> reslourcesList
+ = ResourceDesc.getResources(commonSupport.getInstance(), type);
+ for (ResourceDesc resource : reslourcesList) {
+ keys.add(new Hk2ResourceNode(lookup, resource, (ResourceDecorator) decorator, customizer));
+ }
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ setKeys(keys);
+ }
+ }
+ }, 0);
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys((Set<? extends Object>) java.util.Collections.EMPTY_SET);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof Hk2ItemNode) {
+ return new Node[]{(Hk2ItemNode) key};
+ }
+
+ if (key instanceof String && key.equals(WAIT_NODE)) {
+ return new Node[]{WAIT_NODE};
+ }
+
+ return null;
+ }
+ }
+
+ private Class getCustomizer(String type) {
+ Class customizer = null;
+ if (type.equals(PayaraModule.JDBC_CONNECTION_POOL)) {
+ customizer = ConnectionPoolCustomizer.class;
+ } else if (type.equals(PayaraModule.JDBC_RESOURCE)) {
+ customizer = JdbcResourceCustomizer.class;
+ } else if (type.equals(PayaraModule.CONN_RESOURCE)) {
+ customizer = ConnectorCustomizer.class;
+ } else if (type.equals(PayaraModule.CONN_CONNECTION_POOL)) {
+ customizer = ConnectorConnectionPoolCustomizer.class;
+ } else if (type.equals(PayaraModule.ADMINOBJECT_RESOURCE)) {
+ customizer = AdminObjectCustomizer.class;
+ } else if (type.equals(PayaraModule.JAVAMAIL_RESOURCE)) {
+ customizer = JavaMailCustomizer.class;
+ }
+ return customizer;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSChildren.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSChildren.java
new file mode 100644
index 0000000..85320c1
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSChildren.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.CommonServerSupport;
+import org.netbeans.modules.payara.spi.WSDesc;
+import org.openide.nodes.Children;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class Hk2WSChildren extends Children.Keys<Object> implements Refreshable {
+
+ private Lookup lookup;
+ private final static Node WAIT_NODE = Hk2ItemNode.createWaitNode();
+
+ Hk2WSChildren(Lookup lookup) {
+ this.lookup = lookup;
+ }
+
+ @Override
+ public void updateKeys(){
+ setKeys(new Object[] { WAIT_NODE });
+
+ RequestProcessor t = new RequestProcessor("ws-child-updater"); // NOI18N
+ t.post(new Runnable() {
+ Vector<Object> keys = new Vector<Object>();
+
+ @Override
+ public void run() {
+ CommonServerSupport commonSupport = lookup.lookup(
+ CommonServerSupport.class);
+ if(commonSupport != null) {
+ try {
+ List<WSDesc> wsList
+ = WSDesc.getWebServices(commonSupport.getInstance());
+ for(WSDesc ws: wsList) {
+ keys.add(new Hk2WSNode(lookup, ws, Hk2ItemNode.WS_ENDPOINT));
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+
+ setKeys(keys);
+ }
+ }
+ }, 0);
+ }
+
+ @Override
+ protected void addNotify() {
+ updateKeys();
+ }
+
+ @Override
+ protected void removeNotify() {
+ setKeys((Set<? extends Object>) java.util.Collections.EMPTY_SET);
+ }
+
+ @Override
+ protected org.openide.nodes.Node[] createNodes(Object key) {
+ if (key instanceof Hk2ItemNode){
+ return new Node [] { (Hk2ItemNode) key };
+ }
+
+ if (key instanceof String && key.equals(WAIT_NODE)){
+ return new Node [] { WAIT_NODE };
+ }
+
+ return null;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSNode.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSNode.java
new file mode 100644
index 0000000..93ef1a8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Hk2WSNode.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes;
+
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.util.Map;
+import org.netbeans.modules.payara.common.nodes.actions.OpenURLActionCookie;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.Utils;
+import org.netbeans.modules.payara.spi.WSDesc;
+import org.openide.nodes.Children;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2WSNode extends Hk2ItemNode {
+
+ private final WSDesc ws;
+ private final Lookup lu;
+
+ public Hk2WSNode(final Lookup lookup, final WSDesc ws, final Decorator decorator) {
+ super(Children.LEAF, lookup, ws.getName(), decorator);
+ setDisplayName(ws.getName());
+ setShortDescription(NbBundle.getMessage(Hk2WSNode.class, "WS_NODE_DESC", ws.getName(), ws.getWsdlUrl())); // "<html>name: " + ws.getName() + "<br>path: " + ws.getWsdlUrl() + "</html>"); // NOI18N
+ this.ws = ws;
+ this.lu = lookup;
+
+ getCookieSet().add(new OpenURLActionCookie() {
+
+ @Override
+ public String getWebURL() {
+ String result = null;
+ PayaraModule commonModule = lookup.lookup(PayaraModule.class);
+ if (commonModule != null) {
+ Map<String, String> ip = commonModule.getInstanceProperties();
+ String host = ip.get(PayaraModule.HTTPHOST_ATTR);
+ if (null == host) {
+ host = ip.get(PayaraModule.HOSTNAME_ATTR);
+ }
+ String httpPort = ip.get(PayaraModule.HTTPPORT_ATTR);
+ String url = ip.get(PayaraModule.URL_ATTR);
+ if (url == null || !url.contains("ee6wc")) {
+ result = Utils.getHttpListenerProtocol(host, httpPort)
+ + "://" + host + ":" + httpPort + "/" + ws.getTestURL();
+ } else {
+ result = "http"
+ + "://" + host + ":" + httpPort + "/" + ws.getTestURL();
+ }
+ if (result.endsWith("//")) {
+ result = result.substring(0, result.length() - 1);
+ }
+ }
+ return result;
+ }
+ });
+ }
+
+ @Override
+ public boolean canCopy() {
+ return true;
+ }
+
+ @Override
+ public Transferable clipboardCopy() {
+ String result = "";
+ PayaraModule commonModule = lu.lookup(PayaraModule.class);
+ if (commonModule != null) {
+ Map<String, String> ip = commonModule.getInstanceProperties();
+ String host = ip.get(PayaraModule.HTTPHOST_ATTR);
+ if (null == host) {
+ host = ip.get(PayaraModule.HOSTNAME_ATTR);
+ }
+ String httpPort = ip.get(PayaraModule.HTTPPORT_ATTR);
+ String url = ip.get(PayaraModule.URL_ATTR);
+ if (url == null || !url.contains("ee6wc")) {
+ result = Utils.getHttpListenerProtocol(host, httpPort)
+ + "://" + host + ":" + httpPort + "/" + ws.getTestURL();
+ } else {
+ result = "http"
+ + "://" + host + ":" + httpPort + "/" + ws.getTestURL();
+ }
+ if (result.endsWith("//")) {
+ result = result.substring(0, result.length() - 1);
+ }
+ }
+ return new StringSelection(result);
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/NodeTypes.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/NodeTypes.java
new file mode 100644
index 0000000..8c01981
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/NodeTypes.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes;
+
+import java.util.HashMap;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+public class NodeTypes {
+
+ private static HashMap<String, String[]> nodeTree;
+
+ public static final String APPLICATIONS = "APPLICATIONS";
+ public static final String EARS = "EARS";
+ public static final String WEBAPPS = "WEBAPPS";
+ public static final String EJBS = "EJBS";
+ public static final String APPCLIENTS = "APPCLIENTS";
+
+ public static final String RESOURCES = "RESOURCES";
+
+ private static final String[] APPLICATIONS_TREE = {
+ EARS, WEBAPPS, EJBS, APPCLIENTS };
+ private static final String[] RESOURCES_TREE = {
+ PayaraModule.JDBC, PayaraModule.CONNECTORS, PayaraModule.JAVAMAIL };
+ private static final String[] JDBC_TREE = {
+ PayaraModule.JDBC_RESOURCE, PayaraModule.JDBC_CONNECTION_POOL };
+ private static final String[] CONNECTORS_TREE = {
+ PayaraModule.CONN_RESOURCE, PayaraModule.CONN_CONNECTION_POOL, PayaraModule.ADMINOBJECT_RESOURCE };
+ private static final String[] JAVAMAIL_TREE = {
+ PayaraModule.JAVAMAIL_RESOURCE };
+
+ static {
+ nodeTree = new HashMap<String, String[]>();
+ nodeTree.put(APPLICATIONS, APPLICATIONS_TREE);
+ nodeTree.put(RESOURCES, RESOURCES_TREE);
+ nodeTree.put(PayaraModule.JDBC, JDBC_TREE);
+ nodeTree.put(PayaraModule.CONNECTORS, CONNECTORS_TREE);
+ nodeTree.put(PayaraModule.JAVAMAIL, JAVAMAIL_TREE);
+ }
+
+ private NodeTypes() { }
+
+ /**
+ * Returns an array of tree children as strings given a particular
+ * parent name.
+ *
+ * @param type The node from which children types are derived.
+ *
+ * @return All the children types for the node name passed.
+ */
+ static String[] getChildTypes(String type){
+ return nodeTree.get(type);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Refreshable.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Refreshable.java
new file mode 100644
index 0000000..960fa1e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/Refreshable.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes;
+
+/**
+ *
+ * @author Michal Mocnak
+ */
+public interface Refreshable {
+
+ public void updateKeys();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/Bundle.properties
new file mode 100644
index 0000000..cfc5840
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/Bundle.properties
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+LBL_UndeployAction=&Undeploy
+LBL_UnregisterAction=&Unregister
+LBL_OpenInBrowserAction=&Open in Browser
+LBL_RefreshModulesAction=Re&fresh
+LBL_DeployDirAction=Deploy a Directory...
+
+CTL_EditDetailsAction=&Properties
+CTL_ConnectionPoolAdvancedAttributesAction=&Advanced
+
+LBL_EnableAction=&Enable
+LBL_DisableAction=&Disable
+LBL_EnableCDIProbeModeAction=&Enable CDI Probe
+LBL_DisableCDIProbeModeAction=&Disable CDI Probe
+
+ERR_HAS_DUPS=<html>You are attempting to enable multiple versions of {0}.<br><br>That is not permitted.</html>
+
+LBL_OpenTestUrlAction=&Test
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesAction.java
new file mode 100644
index 0000000..f45fc03
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesAction.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+public final class ConnectionPoolAdvancedAttributesAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ for(Node node : nodes) {
+ ConnectionPoolAdvancedAttributesCookie uCookie = node.getCookie(ConnectionPoolAdvancedAttributesCookie.class);
+
+ if(uCookie != null) {
+ uCookie.openCustomizer();
+ }
+ }
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(ConnectionPoolAdvancedAttributesAction.class, "CTL_ConnectionPoolAdvancedAttributesAction");
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ putValue("noIconInMenu", Boolean.TRUE);
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ ConnectionPoolAdvancedAttributesCookie cookie = node.getCookie(ConnectionPoolAdvancedAttributesCookie.class);
+ if(cookie == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesCookie.java
new file mode 100644
index 0000000..c4600ea
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/ConnectionPoolAdvancedAttributesCookie.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+
+public interface ConnectionPoolAdvancedAttributesCookie extends Node.Cookie {
+ public void openCustomizer();
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryAction.java
new file mode 100644
index 0000000..a41729d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryAction.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class DeployDirectoryAction extends NodeAction {
+
+ public DeployDirectoryAction() {
+ }
+
+ protected boolean enable(Node[] nodes) {
+ for(Node node: nodes) {
+ DeployDirectoryCookie cookie = node.getCookie(DeployDirectoryCookie.class);
+ if (cookie == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(DeployDirectoryAction.class, "LBL_DeployDirAction"); // NOI18N
+ }
+
+ protected void performAction(Node[] nodes) {
+ if(nodes != null && nodes.length > 0) {
+ DeployDirectoryCookie deployCookie =
+ nodes[0].getCookie(DeployDirectoryCookie.class);
+ if(deployCookie != null) {
+ deployCookie.deployDirectory();
+ }
+
+ RefreshModulesCookie refreshCookie =
+ nodes[0].getCookie(RefreshModulesCookie.class);
+ if(refreshCookie != null) {
+ refreshCookie.refresh();
+ }
+ }
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryCookie.java
new file mode 100644
index 0000000..2ef4658
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DeployDirectoryCookie.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+/**
+ *
+ * @author Ludo
+ */
+public interface DeployDirectoryCookie extends Node.Cookie {
+
+ public Future<ResultString> deployDirectory();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeAction.java
new file mode 100644
index 0000000..ace221c
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeAction.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * @author Gaurav Gupta
+ */
+public class DisableCDIProbeModeAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ RequestProcessor enabler = new RequestProcessor("pf-disable-cdi-probe-mode");
+
+ for(Node node : nodes) {
+ DisableCDIProbeModeCookie uCookie = node.getCookie(DisableCDIProbeModeCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.disableCDIProbeMode();
+ final Node pNode = node.getParentNode().getParentNode();
+ final Node fnode = node;
+
+ enabler.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Disable CDI probe mode action timed out for {0}", fnode.getDisplayName());
+ } catch (InterruptedException ie) {
+ // we can ignore this
+ }catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ DisableCDIProbeModeCookie cookie = node.getCookie(DisableCDIProbeModeCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(DisableCDIProbeModeAction.class, "LBL_DisableCDIProbeModeAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeCookie.java
new file mode 100644
index 0000000..73c3b9a
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableCDIProbeModeCookie.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ * @author Gaurav Gupta
+ */
+public interface DisableCDIProbeModeCookie extends Node.Cookie {
+
+ public Future<ResultString> disableCDIProbeMode();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesAction.java
new file mode 100644
index 0000000..c4ae5db
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesAction.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * @author vince kraemer
+ *
+ * Based on UndeployModuleAction
+ * @author Michal Mocnak
+ * @author Peter Williams
+ */
+public class DisableModulesAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ RequestProcessor enabler = new RequestProcessor("pf-disable-module");
+
+ for(Node node : nodes) {
+ DisableModulesCookie uCookie = node.getCookie(DisableModulesCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.disableModule();
+ final Node pNode = node.getParentNode().getParentNode();
+ final Node fnode = node;
+
+ enabler.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Disable action timed out for " + fnode.getDisplayName());
+ } catch (InterruptedException ie) {
+ // we can ignore this
+ }catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ if(pNode != null) {
+ Node[] nodes = pNode.getChildren().getNodes();
+ for(Node node : nodes) {
+ RefreshModulesCookie cookie = node.getCookie(RefreshModulesCookie.class);
+ if(cookie != null) {
+ cookie.refresh(null, fnode.getDisplayName());
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ DisableModulesCookie cookie = node.getCookie(DisableModulesCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(DisableModulesAction.class, "LBL_DisableAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesCookie.java
new file mode 100644
index 0000000..902baf4
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/DisableModulesCookie.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ * @author vince kraemer
+ *
+ * based on UndeployModuleCookie
+ * @author Michal Mocnak
+ * @auther Peter Williams
+ */
+public interface DisableModulesCookie extends Node.Cookie {
+
+ public Future<ResultString> disableModule();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsAction.java
new file mode 100644
index 0000000..faa8754
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsAction.java
@@ -0,0 +1,77 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+public final class EditDetailsAction extends NodeAction {
+
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ for(Node node : nodes) {
+ EditDetailsCookie uCookie = node.getCookie(EditDetailsCookie.class);
+
+ if(uCookie != null) {
+ uCookie.openCustomizer();
+ }
+ }
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(EditDetailsAction.class, "CTL_EditDetailsAction");
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ // see org.openide.util.actions.SystemAction.iconResource() Javadoc for more details
+ putValue("noIconInMenu", Boolean.TRUE);
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ EditDetailsCookie cookie = node.getCookie(EditDetailsCookie.class);
+ if(cookie == null) { // || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsCookie.java
new file mode 100644
index 0000000..6fd1f26
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EditDetailsCookie.java
@@ -0,0 +1,28 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+
+public interface EditDetailsCookie extends Node.Cookie {
+ public void openCustomizer();
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeAction.java
new file mode 100644
index 0000000..a3ed576
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeAction.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.awt.HtmlBrowser;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * @author Gaurav Gupta
+ */
+public class EnableCDIProbeModeAction extends NodeAction {
+
+ private static final String WELD_PROBE_URL = "/weld-probe";
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ targets.clear();
+ for (Node n : nodes) {
+ targets.add(n.getDisplayName());
+ }
+ String aDup = getDup(targets);
+ if (null != aDup) {
+ // open dialog
+ NotifyDescriptor m = new NotifyDescriptor.Message(NbBundle.getMessage(EnableCDIProbeModeAction.class, "ERR_HAS_DUPS", aDup),
+ NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(m);
+ return;
+ }
+
+ RequestProcessor enabler = new RequestProcessor("pf-enable-cdi-probe-mode");
+
+ for(Node node : nodes) {
+ EnableCDIProbeModeCookie uCookie = node.getCookie(EnableCDIProbeModeCookie.class);
+ final OpenURLActionCookie oCookie = node.getCookie(OpenURLActionCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.enableCDIProbeMode();
+ final Node pNode = node.getParentNode().getParentNode();
+ final Node fnode = node;
+
+ enabler.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ if (oCookie != null) {
+ try {
+ HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(oCookie.getWebURL() + WELD_PROBE_URL));
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Enable CDI probe mode action timed out for {0}", fnode.getDisplayName());
+ } catch (InterruptedException ie) {
+ // we can ignore this
+ }catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private List<String> targets = new ArrayList<String>();
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ EnableCDIProbeModeCookie cookie = node.getCookie(EnableCDIProbeModeCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(EnableCDIProbeModeAction.class, "LBL_EnableCDIProbeModeAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ static String getDup(List<String> targets) {
+ Map<String,String> uniqTargets = new HashMap<>();
+ if (null == targets) {
+ return null;
+ }
+ for (String target : targets) {
+ int colon = target.indexOf(":");
+ if (-1 == colon) {
+ colon = target.length();
+ }
+ String shortName = target.substring(0,colon);
+ if (uniqTargets.containsKey(shortName)) {
+ return shortName;
+ } else {
+ uniqTargets.put(shortName,shortName);
+ }
+ }
+ return null;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeCookie.java
new file mode 100644
index 0000000..1d58c93
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableCDIProbeModeCookie.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ * @author Gaurav Gupta
+ */
+public interface EnableCDIProbeModeCookie extends Node.Cookie {
+
+ public Future<ResultString> enableCDIProbeMode();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesAction.java
new file mode 100644
index 0000000..0ddead4
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesAction.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * @author vince kraemer
+ *
+ * Based on UndeployModuleAction
+ * @author Michal Mocnak
+ * @author Peter Williams
+ */
+public class EnableModulesAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ targets.clear();
+ for (Node n : nodes) {
+ targets.add(n.getDisplayName());
+ }
+ String aDup = getDup(targets);
+ if (null != aDup) {
+ // open dialog
+ NotifyDescriptor m = new NotifyDescriptor.Message(NbBundle.getMessage(EnableModulesAction.class, "ERR_HAS_DUPS", aDup),
+ NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(m);
+ return;
+ }
+
+ RequestProcessor enabler = new RequestProcessor("pf-enable-module");
+
+ for(Node node : nodes) {
+ EnableModulesCookie uCookie = node.getCookie(EnableModulesCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.enableModule();
+ final Node pNode = node.getParentNode().getParentNode();
+ final Node fnode = node;
+
+ enabler.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Enable action timed out for " + fnode.getDisplayName());
+ } catch (InterruptedException ie) {
+ // we can ignore this
+ }catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ if(pNode != null) {
+ Node[] nodes = pNode.getChildren().getNodes();
+ for(Node node : nodes) {
+ RefreshModulesCookie cookie = node.getCookie(RefreshModulesCookie.class);
+ if(cookie != null) {
+ cookie.refresh(null, fnode.getDisplayName());
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+
+ private List<String> targets = new ArrayList<String>();
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ EnableModulesCookie cookie = node.getCookie(EnableModulesCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(EnableModulesAction.class, "LBL_EnableAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ static String getDup(List<String> targets) {
+ Map<String,String> uniqTargets = new HashMap<String,String>();
+ if (null == targets) {
+ return null;
+ }
+ for (String target : targets) {
+ int colon = target.indexOf(":");
+ if (-1 == colon) {
+ colon = target.length();
+ }
+ String shortName = target.substring(0,colon);
+ if (uniqTargets.containsKey(shortName)) {
+ return shortName;
+ } else {
+ uniqTargets.put(shortName,shortName);
+ }
+ }
+ return null;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesCookie.java
new file mode 100644
index 0000000..39355d3
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesCookie.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ * @author vince kraemer
+ *
+ * based on UndeployModuleCookie
+ * @author Michal Mocnak
+ * @auther Peter Williams
+ */
+public interface EnableModulesCookie extends Node.Cookie {
+
+ public Future<ResultString> enableModule();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenTestURLAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenTestURLAction.java
new file mode 100644
index 0000000..e4302f8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenTestURLAction.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.awt.HtmlBrowser.URLDisplayer;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Action which displays selected web module in browser.
+ *
+ * @author vince kraemer
+ * @author Michal Mocnak
+ */
+public class OpenTestURLAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ for(Node node : nodes) {
+ OpenURLActionCookie oCookie = node.getCookie(OpenURLActionCookie.class);
+
+ if(oCookie != null) {
+ try {
+ URLDisplayer.getDefault().showURL(new URL(oCookie.getWebURL()));
+ } catch(MalformedURLException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ OpenURLActionCookie oCookie = node.getCookie(OpenURLActionCookie.class);
+
+ if(oCookie != null && oCookie.getWebURL() != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(OpenTestURLAction.class, "LBL_OpenTestUrlAction"); // NOI18N
+
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLAction.java
new file mode 100644
index 0000000..1d765c6
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLAction.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.awt.HtmlBrowser.URLDisplayer;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ * Action which displays selected web module in browser.
+ *
+ * @author Michal Mocnak
+ */
+public class OpenURLAction extends NodeAction {
+
+ protected void performAction(Node[] nodes) {
+ for(Node node : nodes) {
+ OpenURLActionCookie oCookie = node.getCookie(OpenURLActionCookie.class);
+
+ if(oCookie != null) {
+ try {
+ URLDisplayer.getDefault().showURL(new URL(oCookie.getWebURL()));
+ } catch(MalformedURLException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ }
+
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ OpenURLActionCookie oCookie = node.getCookie(OpenURLActionCookie.class);
+ UndeployModuleCookie uCookie = node.getCookie(UndeployModuleCookie.class);
+
+ if(uCookie != null) {
+ if(uCookie.isRunning()) {
+ return false;
+ }
+ }
+ if(oCookie != null && oCookie.getWebURL() != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(OpenURLAction.class, "LBL_OpenInBrowserAction"); // NOI18N
+
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLActionCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLActionCookie.java
new file mode 100644
index 0000000..bdd5dbd
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/OpenURLActionCookie.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+
+/**
+ *
+ * @author Michal Mocnak
+ */
+public interface OpenURLActionCookie extends Node.Cookie {
+
+ public String getWebURL();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesAction.java
new file mode 100644
index 0000000..081366d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesAction.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.Collection;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Michal Mocnak
+ * @author Peter Williams
+ */
+public class RefreshModulesAction extends NodeAction {
+
+ public RefreshModulesAction() {
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node:nodes) {
+ RefreshModulesCookie cookie = node.getCookie(RefreshModulesCookie.class);
+ if (cookie == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(RefreshModulesAction.class, "LBL_RefreshModulesAction"); // NOI18N
+ }
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ for(Node node:nodes) {
+ Collection<? extends RefreshModulesCookie> cookies =
+ node.getLookup().lookupAll(RefreshModulesCookie.class);
+ for(RefreshModulesCookie cookie: cookies) {
+ cookie.refresh();
+ }
+ }
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesCookie.java
new file mode 100644
index 0000000..9c8447e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/RefreshModulesCookie.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import org.openide.nodes.Node;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author Michal Mocnak
+ */
+public interface RefreshModulesCookie extends Node.Cookie {
+
+ /**
+ * Requests the refresh of the server state.
+ * <p/>
+ * @return Task handler when refresh is executed as asynchronous thread
+ * or <code>null</code> otherwise.
+ */
+ public RequestProcessor.Task refresh();
+
+ /**
+ * Requests the refresh of the server state.
+ * <p/>
+ * @return Task handler when refresh is executed as asynchronous thread
+ * or <code>null</code> otherwise.
+ */
+ public RequestProcessor.Task refresh(String expectedChild, String unexpectedChild);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleAction.java
new file mode 100644
index 0000000..9e3b53f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleAction.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Michal Mocnak
+ * @author Peter Williams
+ */
+public class UndeployModuleAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ RequestProcessor undeployer = new RequestProcessor("pf-undeployer");
+
+ for(Node node : nodes) {
+ UndeployModuleCookie uCookie = node.getCookie(UndeployModuleCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.undeploy();
+ Node pNode = node.getParentNode();
+ final Node gpNode = null != pNode ? pNode.getParentNode() : null;
+ final Node fnode = node;
+
+ undeployer.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Undeploy action timed out for " + fnode.getDisplayName());
+ } catch (InterruptedException ie) {
+ // we can ignore this
+ }catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ if(gpNode != null) {
+ Node[] nodes = gpNode.getChildren().getNodes();
+ for(Node node : nodes) {
+ RefreshModulesCookie cookie = node.getCookie(RefreshModulesCookie.class);
+ if(cookie != null) {
+ cookie.refresh(null, fnode.getDisplayName());
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ UndeployModuleCookie cookie = node.getCookie(UndeployModuleCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(UndeployModuleAction.class, "LBL_UndeployAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleCookie.java
new file mode 100644
index 0000000..148677c
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UndeployModuleCookie.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ *
+ * @author Michal Mocnak
+ * @auther Peter Williams
+ */
+public interface UndeployModuleCookie extends Node.Cookie {
+
+ public Future<ResultString> undeploy();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceAction.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceAction.java
new file mode 100644
index 0000000..8c9eec7
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceAction.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.actions.NodeAction;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class UnregisterResourceAction extends NodeAction {
+
+ @Override
+ protected void performAction(Node[] nodes) {
+ if((nodes == null) || (nodes.length < 1)) {
+ return;
+ }
+
+ for(Node node : nodes) {
+ UnregisterResourceCookie uCookie = node.getCookie(UnregisterResourceCookie.class);
+
+ if(uCookie != null) {
+ final Future<ResultString> result = uCookie.unregister();
+ final Node pNode = node.getParentNode().getParentNode();
+
+ RequestProcessor.getDefault().post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ result.get(ServerUtilities.ACTION_TIMEOUT, ServerUtilities.ACTION_TIMEOUT_UNIT);
+ if(pNode != null) {
+ Node[] nodes = pNode.getChildren().getNodes();
+ for(Node node : nodes) {
+ RefreshModulesCookie cookie = node.getCookie(RefreshModulesCookie.class);
+ if(cookie != null) {
+ cookie.refresh();
+ }
+ }
+ }
+ } catch(TimeoutException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "Timeout waiting on unregister.", ex);
+ } catch(Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected boolean enable(Node[] nodes) {
+ for(Node node : nodes) {
+ UnregisterResourceCookie cookie = node.getCookie(UnregisterResourceCookie.class);
+ if(cookie == null || cookie.isRunning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(UnregisterResourceAction.class, "LBL_UnregisterAction");
+ }
+
+ @Override
+ protected boolean asynchronous() {
+ return false;
+ }
+
+ @Override
+ public org.openide.util.HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceCookie.java
new file mode 100644
index 0000000..101d55b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/nodes/actions/UnregisterResourceCookie.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.openide.nodes.Node;
+
+
+/**
+ *
+ * @auther Peter Williams
+ */
+public interface UnregisterResourceCookie extends Node.Cookie {
+
+ public Future<ResultString> unregister();
+
+ public boolean isRunning();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/DomainXMLChangeListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/DomainXMLChangeListener.java
new file mode 100644
index 0000000..f7dd064
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/DomainXMLChangeListener.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.parser;
+
+import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PortCollection;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.openide.filesystems.FileAttributeEvent;
+import org.openide.filesystems.FileChangeListener;
+import org.openide.filesystems.FileEvent;
+import org.openide.filesystems.FileRenameEvent;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Listens for changes in Payara configuration file <code>domain.xml</code>.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class DomainXMLChangeListener implements FileChangeListener {
+
+ /**
+ * Register this listener for Payara instance configuration file
+ * <code>domain.xml</code> changes.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Payara configuration file <code>domain.xml</code> changes
+ * listener created and registered.
+ */
+ public static void registerListener(
+ PayaraInstance instance) {
+ String domainDirPath = instance.getDomainsFolder();
+ String domainName = instance.getDomainName();
+ String domainXMLName = org.netbeans.modules.payara.tooling.utils.ServerUtils
+ .getDomainConfigFile(domainDirPath, domainName);
+ File configPAth = FileUtil.normalizeFile(new File(domainXMLName));
+ FileUtil.addFileChangeListener(
+ instance.getDomainXMLChangeListener(), configPAth);
+ }
+
+ /**
+ * Register this listener for Payara instance configuration file
+ * <code>domain.xml</code> changes.
+ * <p/>
+ * @param instance Payara server instance.
+ */
+ public static void unregisterListener(PayaraInstance instance) {
+ String domainDirPath = instance.getDomainsFolder();
+ String domainName = instance.getDomainName();
+ String domainXMLName = org.netbeans.modules.payara.tooling.utils.ServerUtils
+ .getDomainConfigFile(domainDirPath, domainName);
+ File configPAth = FileUtil.normalizeFile(new File(domainXMLName));
+ FileUtil.removeFileChangeListener(
+ instance.getDomainXMLChangeListener(), configPAth);
+ }
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(DomainXMLChangeListener.class);
+
+ /** Payara server instance. */
+ private final PayaraInstance instance;
+
+ /** Payara configuration file <code>domain.xml</code> full path. */
+ private final String path;
+
+ /**
+ * Constructs an instance of Payara configuration file
+ * <code>domain.xml</code> changes listener.
+ * <p/>
+ * This is being called from Payara server instance constructor.
+ * Content of <code>instance</code> may not be fully initialized yet.
+ * <p/>
+ * @param instance Payara server instance.
+ * @param domainXML Payara configuration file <code>domain.xml</code>
+ * full path.
+ */
+ public DomainXMLChangeListener(final PayaraInstance instance,
+ final String domainXML) {
+ this.instance = instance;
+ this.path = domainXML;
+ }
+
+ /**
+ * Fired when a new folder is created.
+ * <p/>
+ * Shall not happen.
+ * <p/>
+ * @param fe The event describing context where action has taken place.
+ */
+ @Override
+ public void fileFolderCreated(FileEvent fe) {
+ LOGGER.log(Level.WARNING,
+ "Payara configuration file {0} seems to be a folder!", path);
+ }
+
+ /**
+ * Fired when a new file is created.
+ * <p/>
+ * Shall not happen.
+ * <p/>
+ * @param fe The event describing context where action has taken place.
+ */
+ @Override
+ public void fileDataCreated(FileEvent fe) {
+ LOGGER.log(Level.WARNING,
+ "Payara configuration file {0} seems to be a folder!", path);
+ }
+
+ /**
+ * Fired when <code>domain.xml</code> file is changed.
+ * <p/>
+ * Notification about Payara configuration change.
+ * <p/>
+ * @param fe The event describing context where action has taken place.
+ */
+ @Override
+ public void fileChanged(FileEvent fe) {
+ File domainDir = new File(
+ instance.getDomainsFolder(), instance.getDomainName());
+ PortCollection pc = new PortCollection();
+ if (Util.readServerConfiguration(domainDir, pc)) {
+ LOGGER.log(Level.INFO,
+ "Payara configuration file {0} was modified, "
+ + "updating server configuration.", path);
+ instance.setHttpPort(pc.getHttpPort());
+ instance.setAdminPort(pc.getAdminPort());
+ } else {
+ LOGGER.log(Level.INFO,
+ "Payara configuration file {0} was modified "
+ +"but configuration update failed.", path);
+ }
+ }
+
+ /**
+ * Fired when <code>domain.xml</code> file is deleted.
+ * <p/>
+ * Notification about Payara configuration file removal.
+ * <p/>
+ * @param fe The event describing context where action has taken place.
+ */
+ @Override
+ public void fileDeleted(FileEvent fe) {
+ LOGGER.log(Level.FINE,
+ "Payara configuration file {0} was deleted.", path);
+ }
+
+ /**
+ * Fired when <code>domain.xml</code> file is renamed.
+ * <p/>
+ * Notification about Payara configuration file name change.
+ * <p/>
+ * @param fe The event describing context where action has taken place
+ * and the original name and extension.
+ */
+ @Override
+ public void fileRenamed(FileRenameEvent fe) {
+ LOGGER.log(Level.FINE,
+ "Payara configuration file {0} was renamed.", path);
+ }
+
+ /**
+ * Fired when <code>domain.xml</code> attribute is changed.
+ * <p/>
+ * Notification about Payara configuration file attribute change.
+ * <p/>
+ * @param fe The event describing context where action has taken place,
+ * the name of attribute and the old and new values.
+ */
+ @Override
+ public void fileAttributeChanged(FileAttributeEvent fe) {
+ LOGGER.log(Level.FINE,
+ "Payara configuration file {0} attributes were changed.",
+ path);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/JvmConfigReader.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/JvmConfigReader.java
new file mode 100644
index 0000000..9118007
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/JvmConfigReader.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.parser;
+
+import org.netbeans.modules.payara.common.utils.Util;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.spi.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reader for the jvm-config fields of domain.xml. Uses simulated stream
+ * reader based on SAX model since XPP is not universally available.
+ *
+ * @author Peter Williams
+ */
+public class JvmConfigReader extends TreeParser.NodeReader {
+
+ private static final String SERVER_NAME = "server"; // NOI18N
+
+ private final Map<String, String> argMap;
+ private final Map<String, String> varMap;
+ private final Map<String, String> propMap;
+ private final List<String> optList;
+ private String serverConfigName;
+ private boolean readJvmConfig = false;
+
+ public JvmConfigReader(List<String> optList, Map<String, String> argMap,
+ Map<String, String> varMap, Map<String, String> propMap) {
+ this.optList = optList;
+ this.argMap = argMap;
+ this.varMap = varMap;
+ this.propMap = propMap;
+ }
+
+ public TreeParser.NodeReader getServerFinder() {
+ return new TreeParser.NodeReader() {
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <server lb-weight="100" name="server" config-ref="server-config">
+ if (serverConfigName == null || serverConfigName.length() == 0) {
+ if (SERVER_NAME.equals(attributes.getValue("name"))) { // NOI18N
+ serverConfigName = attributes.getValue("config-ref"); // NOI18N
+ Logger.getLogger("payara").finer("DOMAIN.XML: Server profile defined by " + serverConfigName); // NOI18N
+ }
+ }
+ }
+ };
+ }
+
+ public TreeParser.NodeReader getConfigFinder() {
+ return new TreeParser.NodeReader() {
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <config name="server-config" dynamic-reconfiguration-enabled="true">
+ if (serverConfigName != null && serverConfigName.equals(attributes.getValue("name"))) { // NOI18N
+ readJvmConfig = true;
+ Logger.getLogger("payara").finer("DOMAIN.XML: Reading JVM options from server profile " + serverConfigName); // NOI18N
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ readJvmConfig = false;
+ }
+ };
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <java-config
+// classpath-prefix="CP-PREFIX"
+// classpath-suffix="CP-SUFFIX"
+// debug-enabled="false"
+// debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009"
+// env-classpath-ignored="false"
+// java-home="${com.sun.aas.javaRoot}"
+// javac-options="-g"
+// native-library-path-prefix="NATIVE-LIB-PREFIX"
+// native-library-path-suffix="NATIVE-LIB-SUFFIX"
+// rmic-options="-iiop -poa -alwaysgenerate -keepgenerated -g"
+// server-classpath="SERVER-CLASSPATH"
+// system-classpath="SYSTEM-CLASSPATH">
+ if (readJvmConfig) {
+ int attrLen = attributes.getLength();
+ for (int i = 0; i < attrLen; i++) {
+ String name = attributes.getLocalName(i);
+ String value = attributes.getValue(i);
+ if (name != null && name.length() > 0 && value != null && value.length() > 0) {
+ propMap.put(name, value);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void readCData(String qname, char[] ch, int start, int length) throws SAXException {
+// <jvm-options>-client</jvm-options>
+// <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
+ if (readJvmConfig) {
+ String option = new String(ch, start, length);
+ if (option.startsWith("-D")) { // NOI18N
+ int splitIndex = option.indexOf('=');
+ if (splitIndex != -1) {
+ String name = option.substring(2, splitIndex);
+ String value = doSub(option.substring(splitIndex + 1));
+ if (name.length() > 0) {
+ Logger.getLogger("payara").finer("DOMAIN.XML: argument name = " + name + ", value = " + value); // NOI18N
+ argMap.put(name, value);
+ }
+ }
+ } else if (option.startsWith("-X")) { // NOI18N
+ option = doSub(option);
+ int splitIndex = option.indexOf('=');
+ if (splitIndex != -1) {
+ String name = option.substring(0, splitIndex);
+ String value = option.substring(splitIndex + 1);
+ Logger.getLogger("payara").finer("DOMAIN.XML: jvm option: " + name + " = " + value); // NOI18N
+ optList.add(name + '=' + Util.quote(value));
+ } else {
+ Logger.getLogger("payara").finer("DOMAIN.XML: jvm option: " + option); // NOI18N
+ optList.add(option);
+ }
+ } else if (option.startsWith("-")) {
+ Logger.getLogger("payara").finer("DOMAIN.XML: jvm option: " + option); // NOI18N
+ optList.add(option);
+ }
+ }
+ }
+ private Pattern pattern = Pattern.compile("\\$\\{([^}]+)\\}"); // NOI18N
+
+ private String doSub(String value) {
+ try {
+ Matcher matcher = pattern.matcher(value);
+ boolean result = matcher.find();
+ if (result) {
+ StringBuffer sb = new StringBuffer(value.length() * 2);
+ do {
+ String key = matcher.group(1);
+ String replacement = varMap.get(key);
+ if (replacement == null) {
+ replacement = System.getProperty(key);
+ if (replacement != null) {
+ replacement = Utils.escapePath(replacement);
+ } else {
+ replacement = "\\$\\{" + key + "\\}"; // NOI18N
+ }
+ }
+ matcher.appendReplacement(sb, replacement);
+ result = matcher.find();
+ } while (result);
+ matcher.appendTail(sb);
+ value = sb.toString();
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ return value;
+ }
+
+ public TreeParser.NodeReader getMonitoringFinder(final File btraceJar) {
+ return new TreeParser.NodeReader() {
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <monitoring-service [monitoring-enabled="false"]
+ if (readJvmConfig) {
+ if (!"false".equals(attributes.getValue("monitoring-enabled"))) { // NOI18N
+ optList.add("-javaagent:"+Util.quote(btraceJar.getAbsolutePath())+"=unsafe=true,noServer=true"); // NOI18N
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/TreeParser.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/TreeParser.java
new file mode 100644
index 0000000..b67c931
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/parser/TreeParser.java
@@ -0,0 +1,376 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.parser;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * SAX parser that invokes a user defined node reader(s) on a list of xpath
+ * designated nodes.
+ *
+ * @author Peter Williams
+ */
+public final class TreeParser extends DefaultHandler {
+
+ private static final Logger LOGGER = Logger.getLogger("payara");
+ private static final boolean isFinestLoggable = LOGGER.isLoggable(Level.FINEST);
+ private static final boolean isFinerLoggable = LOGGER.isLoggable(Level.FINER);
+
+ public static boolean readXml(File xmlFile, List<Path> pathList) throws IllegalStateException {
+ boolean result = false;
+ InputStreamReader reader = null;
+ try {
+ // !PW FIXME what to do about entity resolvers? Timed out when
+ // looking up doctype for sun-resources.xml earlier today (Jul 10)
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ // !PW If namespace-aware is enabled, make sure localpart and
+ // qname are treated correctly in the handler code.
+ //
+ factory.setNamespaceAware(false);
+ SAXParser saxParser = factory.newSAXParser();
+ DefaultHandler handler = new TreeParser(pathList);
+ reader = new FileReader(xmlFile);
+ InputSource source = new InputSource(reader);
+ saxParser.parse(source, handler);
+ result = true;
+ } catch (ParserConfigurationException | SAXException | IOException ex) {
+ throw new IllegalStateException(ex);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ return result;
+ }
+
+ // Parser internal state
+ private final Node root;
+ private Node rover;
+
+ // For skipping node blocks
+ private String skipping;
+ private int depth;
+ private NodeReader childNodeReader;
+
+
+ private TreeParser(List<Path> pathList) {
+ root = buildTree(pathList);
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if(childNodeReader != null) {
+ childNodeReader.readCData(skipping, ch, start, length);
+ }
+ }
+
+ @Override
+ public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException {
+ if(skipping != null) {
+ depth++;
+ if(childNodeReader != null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Skip: reading {0}", qname);
+ childNodeReader.readChildren(qname, attributes);
+ }
+ if(isFinestLoggable) LOGGER.log(Level.FINEST, "Skip: descend, depth is {0}, qn is {1}", new Object[]{depth, qname});
+ } else {
+ Node child = rover.findChild(qname);
+ if(child != null) {
+ rover = child;
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Rover descend to {0}", rover);
+
+ NodeReader reader = rover.getReader();
+ if(reader != null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Rover enter & read node {0}", qname);
+ reader.readAttributes(qname, attributes);
+ }
+ } else {
+ skipping = qname;
+ depth = 1;
+ childNodeReader = rover.getReader();
+ if(childNodeReader != null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Skip: reading {0}", qname);
+ childNodeReader.readChildren(qname, attributes);
+ }
+ if(isFinestLoggable) LOGGER.log(Level.FINEST, "Skip: start, depth is {0}, qn is {1}", new Object[]{depth, qname});
+ }
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localname, String qname) throws SAXException {
+ if(skipping != null) {
+ if(--depth == 0) {
+ if(!skipping.equals(qname)) {
+ LOGGER.log(Level.WARNING, "Skip: {0} does not match {1} at depth {2}", new Object[]{skipping, qname, depth});
+ }
+ if(isFinestLoggable) LOGGER.log(Level.FINEST, "Skip: ascend, depth is {0}", depth);
+ skipping = null;
+ childNodeReader = null;
+ } else {
+ if(isFinestLoggable) LOGGER.log(Level.FINEST, "Skip: ascend, depth is {0}", depth);
+ }
+ } else {
+ NodeReader reader = rover.getReader();
+ if(reader != null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Rover exit & read node {0}", qname);
+ reader.endNode(qname);
+ }
+ rover = rover.getParent();
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Rover ascend to {0}", rover);
+ }
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ rover = root;
+ skipping = null;
+ depth = 0;
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
+ LOGGER.log(Level.INFO, "Requested Entity: public id = {0}, system id = {1}", new Object[]{publicId, systemId});
+
+ // We only expect a few entries here so use linear search directly. If
+ // this changes, considering caching using HashMap<String, String>
+ //
+ InputSource source = null;
+ FileObject folder = FileUtil.getConfigFile("DTDs/Payara");
+ if(folder != null) {
+ for(FileObject fo: folder.getChildren()) {
+ Object attr;
+ if((attr = fo.getAttribute("publicId")) instanceof String && attr.equals(publicId)) {
+ source = new InputSource(fo.getInputStream());
+ break;
+ } else if((attr = fo.getAttribute("systemId")) instanceof String && attr.equals(systemId)) {
+ source = new InputSource(fo.getInputStream());
+ break;
+ }
+ }
+ }
+
+ return source;
+ }
+
+ public static abstract class NodeReader {
+
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ }
+
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ }
+
+ public void readCData(String qname, char [] ch, int start, int length) throws SAXException {
+ }
+
+ public void endNode(String qname) throws SAXException {
+ }
+
+ }
+
+ public static class Path {
+
+ private final String path;
+ private final NodeReader reader;
+
+ public Path(String path) {
+ this(path, null);
+ }
+
+ public Path(String path, NodeReader reader) {
+ this.path = path;
+ this.reader = reader;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public NodeReader getReader() {
+ return reader;
+ }
+
+ @Override
+ public String toString() {
+ return path;
+ }
+
+ }
+
+ private static Node buildTree(List<Path> paths) {
+ Node root = null;
+ for(Path path: paths) {
+ String [] parts = path.getPath().split("/");
+ if(parts == null || parts.length == 0) {
+ LOGGER.log(Level.WARNING, "Invalid entry, no parts, skipping: {0}", path);
+ continue;
+ }
+ if(parts[0] == null) {
+ LOGGER.log(Level.WARNING, "Invalid entry, null root, skipping: {0}", path);
+ continue;
+ }
+ if(root == null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Root node created: {0}", parts[0]);
+ root = new Node(parts[0]);
+ }
+ Node rover = root;
+ for(int i = 1; i < parts.length; i++) {
+ if(parts[i] != null && parts[i].length() > 0) {
+ Node existing = rover.findChild(parts[i]);
+ if(existing != null) {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Existing node {0} at level {1}", new Object[]{parts[i], i});
+ rover = existing;
+ } else {
+ if(isFinerLoggable) LOGGER.log(Level.FINER, "Adding node {0} at level {1}", new Object[]{parts[i], i});
+ rover = rover.addChild(parts[i]);
+ }
+ } else {
+ LOGGER.log(Level.WARNING, "Broken parts found in {0} at level {1}", new Object[]{path, i});
+ }
+ }
+ if(rover != null) {
+ rover.setReader(path.getReader());
+ }
+ }
+ return root;
+ }
+
+ private static class Node implements Comparable<Node> {
+
+ private final String element;
+ private final Map<String, Node> children;
+ private Node parent;
+ private NodeReader reader;
+
+ public Node(String element) {
+ this(element, null);
+ }
+
+ private Node(String element, Node parent) {
+ this.element = element;
+ this.children = new HashMap<String, Node>();
+ this.parent = parent;
+ }
+
+ public Node addChild(String tag) {
+ Node child = new Node(tag, this);
+ children.put(tag, child);
+ return child;
+ }
+
+ public Node findChild(String tag) {
+ return children.get(tag);
+ }
+
+ public Node getParent() {
+ return parent;
+ }
+
+ public NodeReader getReader() {
+ return reader;
+ }
+
+ public void setReader(NodeReader reader) {
+ this.reader = reader;
+ }
+
+ @Override
+ public int compareTo(Node o) {
+ return element.compareTo(o.element);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Node other = (Node) obj;
+ if (this.element != other.element &&
+ (this.element == null || !this.element.equals(other.element))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 41 * hash + (this.element != null ? this.element.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ boolean comma = false;
+ StringBuilder buf = new StringBuilder(500);
+ buf.append("{ ");
+ if(element != null && element.length() > 0) {
+ buf.append(element);
+ comma = true;
+ }
+ if(parent == null) {
+ if(comma) {
+ buf.append(", ");
+ }
+ buf.append("root");
+ comma = true;
+ }
+ if(children.size() > 0) {
+ if(comma) {
+ buf.append(", ");
+ }
+ buf.append(children.size());
+ buf.append(" sub(s)");
+ }
+ buf.append(" }");
+ return buf.toString();
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/registration/AutomaticRegistration.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/registration/AutomaticRegistration.java
new file mode 100644
index 0000000..1c362c9
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/registration/AutomaticRegistration.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.registration;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ * Registers a Payara instance by creating instance file in cluster
+ * configuration directory.
+ * <p/>
+ * Designed to be called from installer.
+ * <p/>
+ * Sample command line<br/>
+ * java -cp ./platform/core/core.jar:./platform/core/core-base.jar:./platform/lib/boot.jar:./platform/lib/org-openide-modules.jar:./platform/core/org-openide-filesystems.jar:./platform/lib/org-openide-util.jar:./platform/lib/org-openide-util-lookup.jar:./platform/lib/org-openide-util-ui.jar:./enterprise/modules/org-netbeans-modules-j2eeapis.jar:./enterprise/modules/org-netbeans-modules-j2eeserver.jar:./enterprise/modules/org-netbeans-modules-payara-common.jar:./enterprise/modules/org-netbeans-modules-payara-tooling.jar org.netbeans.modules.payara.common.registration.AutomaticRegistration %lt;clusterDir> <glassfishDir>
+ * <p/>
+ * @author Vince Kraemer, Petr Hejl Tomas Kraus
+ * @see #main(args)
+ */
+public class AutomaticRegistration {
+
+ private static final Logger LOGGER = Logger.getLogger(AutomaticRegistration.class.getName());
+
+ /**
+ * Performs registration.
+ * <p/>
+ * Exit codes:<p>
+ * <ul>
+ * <li> 2: could not find/create config/J2EE/InstalledServers folder
+ * <li> 3: could not find Payara home
+ * <li> 4: could not recognize Payara version
+ * <li> 5: unsupported version of Payara
+ * <li> 6: could not write registration FileObject
+ * </ul>
+ * @param args command line arguments - cluster path and Payara home expected
+ */
+ public static void main(String[] args) throws IOException {
+ if (args.length < 2) {
+ System.out.println("Parameters: <ide clusterDir> <PayaraHome> <Java 7 or later home>");
+ System.exit(-1);
+ }
+
+ String javaExe = args.length == 3 ? args[2] : "";
+ int status = autoregisterPayaraInstance(args[0], args[1], javaExe);
+ System.exit(status);
+ }
+
+ private static int autoregisterPayaraInstance(String clusterDirValue, String payaraRoot, String jdk7orLaterPath) throws IOException {
+ // tell the infrastructure that the userdir is cluster dir
+ System.setProperty("netbeans.user", clusterDirValue); // NOI18N
+
+ File payaraHome = new File(payaraRoot);
+ if (!payaraHome.exists()) {
+ LOGGER.log(Level.INFO, "Cannot register the default Payara server. " // NOI18N
+ + "The Payara Root directory {0} does not exist.", payaraRoot); // NOI18N
+ return 3;
+ }
+ String config = "PayaraEE6/Instances";
+ String deployer = "deployer:pfv3ee6";
+ String defaultDisplayNamePrefix = "Payara Server ";
+ PayaraVersion version = ServerUtils.getServerVersion(payaraRoot);
+ if (PayaraVersion.ge(version, PayaraVersion.PF_4_1_144)) {
+ deployer = "deployer:pfv4ee7";
+ }
+ if (PayaraVersion.ge(version, PayaraVersion.PF_5_181)) {
+ deployer = "deployer:pfv5ee8";
+ }
+
+ StringBuilder sb = new StringBuilder(
+ defaultDisplayNamePrefix.length() + 12);
+ if (version != null) {
+ sb.append(defaultDisplayNamePrefix);
+ sb.append(version.toString());
+ } else {
+ LOGGER.log(Level.INFO, "Cannot register the default Payara server. " // NOI18N
+ + "The Payara Root directory {0} is of unknown version.", payaraRoot); // NOI18N
+ return 4;
+ }
+ String defaultDisplayName = sb.toString();
+ FileObject serverInstanceDir = FileUtil.getConfigFile(config); // NOI18N
+
+ if (serverInstanceDir == null) {
+ serverInstanceDir = FileUtil.createFolder(FileUtil.getConfigRoot(), config);
+ if (serverInstanceDir == null) {
+ LOGGER.log(Level.INFO, "Cannot register the default Payara"
+ + " server. The config/{0} folder cannot be created.", config); // NOI18N
+ return 2;
+ }
+ }
+
+ // beware of trailling File.separator
+ //
+ payaraRoot = new File(payaraRoot).getAbsolutePath();
+
+ final String url = "[" + payaraRoot + File.pathSeparator +
+ payaraRoot + File.separator + "domains" + File.separator
+ + "domain1]" + deployer + ":localhost:4848"; // NOI18N
+
+ // make sure the server is not registered yet
+ for (FileObject fo : serverInstanceDir.getChildren()) {
+ if (url.equals(fo.getAttribute(PayaraModule.URL_ATTR))) {
+ // the server is already registered, do nothing
+ return 0;
+ }
+ }
+
+ File jdk7orLaterExecutable = new File(jdk7orLaterPath);
+ if (!jdk7orLaterExecutable.exists()) {
+ jdk7orLaterExecutable = null;
+ }
+ String displayName = generateUniqueDisplayName(serverInstanceDir, defaultDisplayName);
+ boolean ok = registerServerInstanceFO(serverInstanceDir, url, displayName, payaraHome, jdk7orLaterExecutable);
+ if (ok) {
+ return 0;
+ } else {
+ return 6;
+ }
+ }
+
+ /**
+ * Generates a unique display name for the specified version of Payara
+ *
+ * @param serverInstanceDir /J2EE/InstalledServers folder
+ * @param version Payara version
+ *
+ * @return a unique display name for the specified version of Payara
+ */
+ private static String generateUniqueDisplayName(FileObject serverInstanceDir, String defaultDisplayName) {
+ // find a unique display name
+ String displayName = defaultDisplayName; // NOI18N
+ boolean unique = true;
+ int i = 1;
+ while (true) {
+ for (FileObject fo : serverInstanceDir.getChildren()) {
+ if (displayName.equals(fo.getAttribute(PayaraModule.DISPLAY_NAME_ATTR))) {
+ // there is already some server of the same name
+ unique = false;
+ break;
+ }
+ }
+ if (unique) {
+ break;
+ }
+ displayName = defaultDisplayName + " "+i++;
+ unique = true;
+ }
+ return displayName;
+ }
+
+ /**
+ * Registers the server instance file object and set the default properties.
+ *
+ * @param serverInstanceDir /J2EE/InstalledServers folder
+ * @param url server instance url/ID
+ * @param displayName display name
+ */
+ private static boolean registerServerInstanceFO(FileObject serverInstanceDir, String url, String displayName, File payaraRoot, File java7orLaterExecutable) {
+ String name = FileUtil.findFreeFileName(serverInstanceDir,
+ PayaraInstanceProvider.PAYARA_AUTOREGISTERED_INSTANCE, null);
+ FileObject instanceFO;
+ try {
+ instanceFO = serverInstanceDir.createData(name);
+ instanceFO.setAttribute(PayaraModule.URL_ATTR, url);
+ instanceFO.setAttribute(PayaraModule.USERNAME_ATTR, "admin"); // NOI18N
+ //String password = Utils.generatePassword(8);
+ instanceFO.setAttribute(PayaraModule.PASSWORD_ATTR, "");
+ instanceFO.setAttribute(PayaraModule.DISPLAY_NAME_ATTR, displayName);
+ instanceFO.setAttribute(PayaraModule.ADMINPORT_ATTR, "4848"); // NOI18N
+ instanceFO.setAttribute(PayaraModule.INSTALL_FOLDER_ATTR, payaraRoot.getParent());
+ instanceFO.setAttribute(PayaraModule.DEBUG_PORT, ""); // NOI18N
+ instanceFO.setAttribute(PayaraModule.DOMAIN_NAME_ATTR, "domain1"); // NOI18N
+ instanceFO.setAttribute(PayaraModule.DOMAINS_FOLDER_ATTR, (new File(payaraRoot, "domains")).getAbsolutePath());
+ instanceFO.setAttribute(PayaraModule.DRIVER_DEPLOY_FLAG, "true");
+ instanceFO.setAttribute(PayaraModule.INSTALL_FOLDER_ATTR, payaraRoot.getParent());
+ instanceFO.setAttribute(PayaraModule.HOSTNAME_ATTR, "localhost"); // NOI18N
+ instanceFO.setAttribute(PayaraModule.PAYARA_FOLDER_ATTR, payaraRoot.getAbsolutePath());
+ instanceFO.setAttribute(PayaraModule.JAVA_PLATFORM_ATTR, java7orLaterExecutable == null ? "" : java7orLaterExecutable.getAbsolutePath()); // NOI18N
+ instanceFO.setAttribute(PayaraModule.HTTPPORT_ATTR, "8080"); // NOI18N
+ instanceFO.setAttribute(PayaraModule.HTTPHOST_ATTR, "localhost"); // NOI18N
+ instanceFO.setAttribute(PayaraModule.JVM_MODE, PayaraModule.NORMAL_MODE);
+ instanceFO.setAttribute(PayaraModule.SESSION_PRESERVATION_FLAG, true);
+ instanceFO.setAttribute(PayaraModule.START_DERBY_FLAG, false);
+ instanceFO.setAttribute(PayaraModule.USE_IDE_PROXY_FLAG, true);
+ instanceFO.setAttribute(PayaraModule.USE_SHARED_MEM_ATTR, false);
+
+ return true;
+ } catch (IOException e) {
+ LOGGER.log(Level.INFO, "Cannot register the default Payara server."); // NOI18N
+ LOGGER.log(Level.INFO, null, e);
+ }
+ return false;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debug.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debug.png
new file mode 100644
index 0000000..6557a51
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debug.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debugging.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debugging.png
new file mode 100644
index 0000000..17c7e09
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/debugging.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/disabled-badge.gif b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/disabled-badge.gif
new file mode 100644
index 0000000..a572d28
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/disabled-badge.gif
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profilerblocking.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profilerblocking.png
new file mode 100644
index 0000000..e3dbe39
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profilerblocking.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profiling.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profiling.png
new file mode 100644
index 0000000..1f1758b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/profiling.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/refresh.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/refresh.png
new file mode 100644
index 0000000..fe01346
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/refresh.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/resources.gif b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/resources.gif
new file mode 100644
index 0000000..4874aa8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/resources.gif
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/restart.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/restart.png
new file mode 100644
index 0000000..b2036fb
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/restart.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/running.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/running.png
new file mode 100644
index 0000000..27f56c8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/running.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/server.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/server.png
new file mode 100644
index 0000000..e7b14f2
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/server.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/start.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/start.png
new file mode 100644
index 0000000..57b3c06
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/start.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/stop.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/stop.png
new file mode 100644
index 0000000..b74098c
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/stop.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/suspended.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/suspended.png
new file mode 100644
index 0000000..fd816db
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/suspended.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/waiting.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/waiting.png
new file mode 100644
index 0000000..ef8945e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/waiting.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/webservice.png b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/webservice.png
new file mode 100644
index 0000000..05ad731
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/resources/webservice.png
Binary files differ
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/AuthFailureStateListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/AuthFailureStateListener.java
new file mode 100644
index 0000000..d5e18c4
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/AuthFailureStateListener.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.status;
+
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck.LOCATIONS;
+import static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck.VERSION;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.ui.PayaraCredentials;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+
+/**
+ * Handle authorization failures in administration command calls during server
+ * status monitoring.
+ * <p/>
+ * Will ask user to supply valid username and password for server instance
+ * being monitored. For every Payara server instance being monitored there
+ * must be its own <code>AuthFailureStateListener</code> instance because of
+ * pop up window locking. Opening password pop up window may temporary suspend
+ * server status checking threads.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class AuthFailureStateListener extends BasicStateListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Minimal delay between displaying pop up windows [ms].
+ * <p/>
+ * Currently it shall not open pop up again sooner than after
+ * 30 seconds. */
+ private static final long POPUP_DELAY = 30000;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Pop up processing lock to avoid displaying pop up window more
+ * than once.
+ * <p/>
+ * Used in double checked pattern so it is <code>volatile</code>.
+ */
+ private volatile boolean popUpLock;
+
+ /** Timestamp of last pop up window. */
+ private long lastTm;
+
+ /** Allow to display pop up window for GF v4. */
+ private final boolean allowPopup;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command calls authorization
+ * failures handler.
+ */
+ public AuthFailureStateListener(final boolean allowPopup) {
+ super();
+ this.popUpLock = false;
+ this.lastTm = 0;
+ this.allowPopup = allowPopup;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Callback to notify about current server status after every check
+ * when enabled.
+ * <p/>
+ * Current server status notification is not registered.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void currentState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ // Not used yet.
+ }
+
+ /**
+ * Callback to notify about server status change when enabled.
+ * <p/>
+ * Listens on <code>STARTUP</code> state changes to clean up pop up window
+ * cancel button effect and allow it to display again.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void newState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ if (popUpLock) {
+ synchronized (this) {
+ if (popUpLock) {
+ popUpLock = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * Callback to notify about server status check failures.
+ * <p/>
+ * Handle authorization failures to ask for new username and password.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param task Payara server status check task details.
+ */
+ @Override
+ public void error(final PayaraServer server,
+ final PayaraStatusTask task) {
+ switch (task.getType()) {
+ case LOCATIONS: case VERSION:
+ switch (task.getEvent()) {
+ case AUTH_FAILED_HTTP:
+ PayaraStatus.suspend(server);
+ break;
+ case AUTH_FAILED:
+ // NetBeans credentiuals pop up window
+ if (allowPopup) {
+ // Double checked pattern on popUpLock
+ // to avoid locking.
+ if (!popUpLock) {
+ updateCredentials(server);
+ }
+ // java.net.Authenticator pop up window
+ } else {
+ PayaraStatus.suspend(server);
+ }
+ break;
+ }
+ break;
+ }
+ }
+
+ /**
+ * Display pop up window and update Payara credentials.
+ * <p/>
+ * Locks this object instance while GUI pop up window is shown so it may
+ * take long time and block other status checking threads on this lock.
+ * <p/>
+ * @param server Payara server instance to update credentials.
+ */
+ private void updateCredentials(final PayaraServer server) {
+ boolean update = true;
+ synchronized (this) {
+ if (!popUpLock
+ && lastTm + POPUP_DELAY < System.currentTimeMillis()) {
+ popUpLock = true;
+ if (server instanceof PayaraInstance) {
+ try {
+ PayaraInstance instance = (PayaraInstance) server;
+ String message = NbBundle.getMessage(
+ AuthFailureStateListener.class,
+ "AuthFailureStateListener.message",
+ instance.getDisplayName());
+ update = PayaraCredentials
+ .setCredentials(instance, message);
+ } finally {
+ // Cancel will block pop up window until next start.
+ popUpLock = !update;
+ lastTm = System.currentTimeMillis();
+ }
+ }
+ }
+ }
+ if (!update) {
+ PayaraStatus.suspend(server);
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/BasicStateListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/BasicStateListener.java
new file mode 100644
index 0000000..40da120
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/BasicStateListener.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.status;
+
+import org.netbeans.modules.payara.tooling.PayaraStatusListener;
+
+/**
+ * Notification about server state check results containing common attribute
+ * and methods related to listener registration.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class BasicStateListener implements PayaraStatusListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Informs whether this listener is registered. */
+ private boolean active;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state check results notification.
+ */
+ public BasicStateListener() {
+ active = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get an information whether this listener is registered.
+ * <p/>
+ * @return Value of <code>true</code> when this listener is registered
+ * or <code>false</code> otherwise.
+ */
+ public boolean isActive() {
+ return active;
+ }
+
+ /**
+ * Monitoring framework calls this method after listener was registered for
+ * at least one event set.
+ * <p/>
+ * May be called multiple times for individual event sets during
+ * registration phase.
+ */
+ @Override
+ public void added() {
+ active = true;
+ }
+
+ /**
+ * Monitoring framework calls this method after listener was unregistered.
+ * <p/>
+ * Will be called once during listener removal phase when was found
+ * registered for at least one event set.
+ */
+ @Override
+ public void removed() {
+ active = false;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/Bundle.properties
new file mode 100644
index 0000000..f000c7b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/Bundle.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+AuthFailureStateListener.message=<html>Authorization failed while checking {0} \
+status. Please provide valid administrator credentials.</html>
+AuthFailureStateListener.error.exception=Exception was thrown in server status \
+check.
+
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/MonitoringInitStateListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/MonitoringInitStateListener.java
new file mode 100644
index 0000000..0ff4651
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/MonitoringInitStateListener.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.status;
+
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+
+/**
+ * Notification about server state check results.
+ * <p/>
+ * Handles initial period of time after adding new server into status
+ * monitoring.
+ * <p/>
+ * Should receive all state change events except <code>UNKNOWN</code>.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class MonitoringInitStateListener extends WakeUpStateListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state check results notification.
+ */
+ public MonitoringInitStateListener() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Callback to notify about current server status after every check
+ * when enabled.
+ * <p/>
+ * Wait for more checking cycles to make sure server status monitoring
+ * has settled down.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void currentState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ // Not used yet.
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/WakeUpStateListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/WakeUpStateListener.java
new file mode 100644
index 0000000..8d3d2d8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/status/WakeUpStateListener.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.status;
+
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+
+/**
+ * Notification about server state check results that will wake up waiting
+ * thread to pass notification.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class WakeUpStateListener extends BasicStateListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Requested wake up of checking thread. */
+ private volatile boolean wakeUp;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state check results notification.
+ */
+ public WakeUpStateListener() {
+ super();
+ wakeUp = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Wake up checking thread.
+ */
+ protected void wakeUp() {
+ if (!wakeUp) synchronized(this) {
+ wakeUp = true;
+ this.notify();
+ }
+ }
+
+ /**
+ * Get status of wake up request of checking thread.
+ * <p/>
+ * @return Status of wake up request of checking thread.
+ */
+ public boolean isWakeUp() {
+ return wakeUp;
+ }
+
+ /**
+ * Wake up waiting thread immediately on registered state changes.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ @Override
+ public void newState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task) {
+ wakeUp();
+ }
+
+ /**
+ * Do nothing.
+ * <p/>
+ * Error callback is expected to be unused.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param task Payara server status check task details.
+ */
+ @Override
+ public void error(final PayaraServer server,
+ final PayaraStatusTask task) {
+ // Not used yet.
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.form
new file mode 100644
index 0000000..7e5ff55
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.form
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="resourceEnabledCB" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="resourceTypeLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="resourceTypeField" pref="236" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="resourceTypeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="resourceTypeField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="resourceEnabledCB" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="resourceTypeLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="AdminObjectCustomizer.resourceTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="resourceEnabledCB">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JdbcResourceCustomizer.enabled.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="enabled" noResource="true"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="resourceTypeField">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="res-type" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.java
new file mode 100644
index 0000000..463cacd
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/AdminObjectCustomizer.java
@@ -0,0 +1,97 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+
+public class AdminObjectCustomizer extends BasePanel {
+
+ /** Creates new form AdminObjectCustomizer */
+ public AdminObjectCustomizer() {
+ initComponents();
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ resourceTypeLabel = new javax.swing.JLabel();
+ resourceEnabledCB = new javax.swing.JCheckBox();
+ resourceTypeField = new javax.swing.JTextField();
+
+ org.openide.awt.Mnemonics.setLocalizedText(resourceTypeLabel, org.openide.util.NbBundle.getMessage(AdminObjectCustomizer.class, "AdminObjectCustomizer.resourceTypeLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(resourceEnabledCB, org.openide.util.NbBundle.getMessage(AdminObjectCustomizer.class, "JdbcResourceCustomizer.enabled.text")); // NOI18N
+ resourceEnabledCB.setName("enabled"); // NOI18N
+
+ resourceTypeField.setName("res-type"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(resourceEnabledCB)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(resourceTypeLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(resourceTypeField, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(resourceTypeLabel)
+ .addComponent(resourceTypeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(resourceEnabledCB)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox resourceEnabledCB;
+ private javax.swing.JTextField resourceTypeField;
+ private javax.swing.JLabel resourceTypeLabel;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.admin-object-resource."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {resourceTypeField,resourceEnabledCB});
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/BasePanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/BasePanel.java
new file mode 100644
index 0000000..d775f5f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/BasePanel.java
@@ -0,0 +1,378 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.swing.AbstractButton;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.text.JTextComponent;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+
+public abstract class BasePanel extends JPanel {
+
+ protected abstract String getPrefix();
+
+ protected abstract List<Component> getDataComponents();
+
+ public final void initializeUI() {
+ for (Component c : getDataComponents()) {
+ c.setEnabled(false);
+ }
+ }
+
+ /** this is likely to be called off the awt thread
+ *
+ * @param name
+ * @param data
+ */
+ public void initializeData(final String name, final Map<String, String> data) {
+ Mutex.EVENT.readAccess(new Runnable(){
+
+ @Override
+ public void run() {
+ for (Component c : getDataComponents()) {
+ c.setEnabled(true);
+ // fill in the blanks...
+ String compName = c.getName();
+ if (compName != null) {
+ // construct the key
+ String key = getPrefix() + name + "." + compName;
+ String value = data.get(key);
+ if (null == value) {
+ value = NbBundle.getMessage(this.getClass(), "ERR_DATA_NOT_FOUND", key);
+ } else {
+ c.setName(key); // for writing the field value back to the server
+ }
+ if (c instanceof JComboBox) {
+ final JComboBox jcb = (JComboBox) c;
+ new ComboBoxSetter(jcb, value, data).run();
+ } else if (c instanceof JTextComponent) {
+ final JTextComponent jtc = (JTextComponent) c;
+ new TextFieldSetter(jtc, value).run();
+ } else if (c instanceof AbstractButton) {
+ AbstractButton ab = (AbstractButton) c;
+ new ButtonSetter(ab, value).run();
+ } else if (c instanceof JTable) {
+ JTable table = (JTable) c;
+ new TableSetter(name, table, data).run();
+ }
+ }
+ }
+ }
+ });
+
+ }
+
+ public final Map<String,String> getData() {
+ Map<String,String> retVal = new HashMap<String,String>(getDataComponents().size());
+ for (Component c : getDataComponents()) {
+ // fill in the blanks...
+ String compName = c.getName();
+ if (compName != null) {
+ // construct the key
+ String key = compName;
+ if (c instanceof JComboBox) {
+ final JComboBox jcb = (JComboBox) c;
+ retVal.put(key, (String) jcb.getSelectedItem());
+ } else if (c instanceof JTextComponent) {
+ final JTextComponent jtc = (JTextComponent) c;
+ retVal.put(key, jtc.getText());
+ } else if (c instanceof AbstractButton) {
+ AbstractButton ab = (AbstractButton) c;
+ retVal.put(key, Boolean.toString(ab.isSelected()));
+ } else if (c instanceof JTable) {
+ JTable table = (JTable) c;
+ TableCellEditor tce = table.getCellEditor();
+ if (null != tce) {
+ tce.stopCellEditing();
+ }
+ Object tm = table.getModel();
+ if (tm instanceof DataTableModel) {
+ DataTableModel model = (DataTableModel) tm;
+ retVal.putAll(model.getData());
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+
+ static class ComboBoxSetter implements Runnable {
+ private JComboBox jcb;
+ private Map<String,String> data;
+ private String value;
+
+ private ComboBoxSetter(JComboBox jcb, String value, Map<String, String> data) {
+ this.jcb = jcb;
+ this.data = data;
+ this.value = value;
+ }
+
+ public void run() {
+ // build the allowed values
+ String allowedRegEx = jcb.getActionCommand();
+ DefaultComboBoxModel dcbm = new DefaultComboBoxModel();
+ Pattern p = Pattern.compile(allowedRegEx);
+ Set<String> keys = data.keySet();
+ //String pushPrefix = null;
+ for (String k : keys) {
+ Matcher test = p.matcher(k);
+ if (test.matches()) {
+ dcbm.addElement(data.get(k));
+ }
+ }
+ jcb.setModel(dcbm);
+ jcb.setSelectedItem(value);
+ }
+
+ }
+
+ static class TextFieldSetter implements Runnable {
+ private JTextComponent jtc;
+ private String value;
+
+ TextFieldSetter(JTextComponent jtc, String value) {
+ this.jtc = jtc;
+ this.value = value;
+ }
+ public void run() {
+ jtc.setText(value);
+ }
+ }
+
+ static class ButtonSetter implements Runnable {
+ private AbstractButton button;
+ private String value;
+ ButtonSetter(AbstractButton button, String value) {
+ this.button = button;
+ this.value = value;
+ }
+
+ public void run() {
+ button.setSelected(Boolean.parseBoolean(value));
+ }
+ }
+
+ static class TableSetter implements Runnable {
+ private JTable table;
+ private Map<String, String> data;
+ private String name;
+ TableSetter(String name, JTable table, Map<String,String> data) {
+ this.table = table;
+ this.data = data;
+ this.name = name;
+ }
+
+ public void run() {
+ // build the row data
+ String[] specComp = table.getName().split("\\.");
+ int colCount = specComp.length - 1;
+ if (0 >= colCount) {
+ // probably should log something here, too...
+ return;
+ }
+ List<String[]> l = new ArrayList<String[]>();
+ // old style
+ Pattern pattern = Pattern.compile(".*\\."+name+"\\."+specComp[0]+"\\..*\\."+specComp[1]);
+ Set<String> keys = data.keySet();
+ String pushPrefix = null;
+ for (String k : keys) {
+ Matcher test = pattern.matcher(k);
+ if (test.matches()) {
+ if (null == pushPrefix) {
+ int dex = k.lastIndexOf(specComp[0]);
+ pushPrefix = k.substring(0,dex);
+ }
+ String[] aRow = new String[colCount];
+ int dex = k.lastIndexOf(".");
+ String partialKey = k.substring(0, dex);
+ aRow[0] = data.get(k);
+ for (int i = 2 ; i < colCount+1; i++) {
+ aRow[i-1] = data.get(partialKey+"."+specComp[i]);
+ if (null == aRow[i-1]) aRow[i-1] = "";
+ }
+ l.add(aRow);
+ }
+ }
+ if (l.size() > 0) {
+ table.setModel(new AttributedPropertyTableModel(l.toArray(new String[l.size()][]), specComp, pushPrefix));
+ } else {
+ // this data is from a post beta build...
+ pattern = Pattern.compile(".*\\." + name + "\\." + specComp[0] + "\\..*");
+ pushPrefix = null;
+ for (String k : keys) {
+ Matcher test = pattern.matcher(k);
+ if (test.matches()) {
+ if (null == pushPrefix) {
+ int dex = k.lastIndexOf(specComp[0]);
+ pushPrefix = k.substring(0, dex);
+ }
+ String[] aRow = new String[colCount];
+ int dex = k.lastIndexOf(".");
+ String propName = k.substring(dex + 1);
+ aRow[0] = propName;
+ aRow[1] = data.get(k);
+ l.add(aRow);
+ }
+ }
+ if (l.size() > 0) {
+ table.setModel(new NameValueTableModel(l.toArray(new String[l.size()][]), specComp, pushPrefix));
+ }
+ }
+ }
+ }
+
+ static abstract class DataTableModel extends AbstractTableModel {
+
+ abstract public Map<String, String> getData();
+
+ private String[][] rowData;
+ private String pushPrefix;
+ private String[] names;
+ private String[] specComp;
+
+ DataTableModel(String[][] rowData, String[] specComp, String pushPrefix) {
+ this.rowData = rowData;
+ this.specComp = specComp;
+ this.pushPrefix = pushPrefix;
+ if (rowData.length > 0) {
+ int colCount = rowData[0].length;
+ names = new String[colCount];
+ for (int i = 0; i < colCount; i++) {
+ try {
+ names[i] = NbBundle.getMessage(this.getClass(),
+ "column-title." + specComp[0] + "." + specComp[i + 1]);
+ } catch (MissingResourceException mre) {
+ // TODO -- log the MRE
+ names[i] = specComp[i + 1];
+ }
+ }
+ }
+ }
+
+ public int getRowCount() {
+ return rowData.length;
+ }
+
+ public int getColumnCount() {
+ return rowData.length == 0 ? 0 : rowData[0].length;
+ }
+
+ @Override
+ public String getColumnName(int i) {
+ if (i > -1 && i < getColumnCount())
+ return names[i];
+ return "";
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ return rowData[rowIndex][columnIndex];
+ }
+
+ @Override
+ public void setValueAt(Object arg0, int arg1, int arg2) {
+ super.setValueAt(arg0, arg1, arg2);
+ rowData[arg1][arg2] = (String) arg0;
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int col) {
+ return col != 0;
+ }
+
+ public String getPushPrefix() {
+ return pushPrefix;
+ }
+
+ public String getSpecComp(int i) {
+ return specComp[i];
+ }
+ }
+
+ static class AttributedPropertyTableModel extends DataTableModel {
+ AttributedPropertyTableModel(String[][] rowData, String[] specComp, String pushPrefix) {
+ super(rowData,specComp,pushPrefix);
+ }
+
+ public Map<String,String> getData() {
+ Map<String,String> retVal = new HashMap<String,String>(getRowCount()*(getColumnCount()-1));
+ for (int i = 0; i < getRowCount(); i++) {
+ String key = getPushPrefix() + getSpecComp(0)+"."+
+ getValueAt(i,0)+".";
+ for (int j = 1; j < getColumnCount(); j++) {
+ key += getSpecComp(j+1);
+ retVal.put(key, (String) getValueAt(i,j));
+ }
+ }
+ return retVal;
+ }
+ }
+
+ static class NameValueTableModel extends DataTableModel {
+
+ NameValueTableModel(String[][] rowData, String[] specComp, String pushPrefix) {
+ super(rowData,specComp,pushPrefix);
+ }
+
+ public Map<String, String> getData() {
+ Map<String, String> retVal = new HashMap<String, String>(getRowCount() * (getColumnCount() - 1));
+ for (int i = 0; i < getRowCount(); i++) {
+ String key = getPushPrefix() + getSpecComp(0) + "." +
+ getValueAt(i, 0); //+".";
+ retVal.put(key, (String) getValueAt(i, 1));
+ }
+ return retVal;
+ }
+ }
+
+ public static class Error extends BasePanel {
+ public Error() {
+ }
+ protected String getPrefix() {
+ return "";
+ }
+ protected List<Component> getDataComponents() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public void initializeData(String name, Map<String, String> data) {
+ return;
+ }
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Bundle.properties
new file mode 100644
index 0000000..3b89885
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Bundle.properties
@@ -0,0 +1,169 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+LBL_Common=Common
+LBL_EnableCometSupport=&Enable Comet Support
+LBL_DomainsFolder=Doma&ins folder:
+LBL_DomainName=&Domain Name:
+LBL_HttpMonitorOn=Enable HTTP &Monitor
+LBL_JDBCDiverDeployOn=Enable JDBC &Driver Deployment
+LBL_EnableHttpMonitor=Enable HTTP &Monitor
+LBL_EnableJDBCDiverDeployment=Enable JDBC &Driver Deployment
+LBL_START_DERBY=Start Re&gistered Derby Server
+LBL_PreserverSessions=&Preserve Sessions Across Redeployment
+JdbcResourceCustomizer.poolNameLabel.text=&Pool Name:
+JdbcResourceCustomizer.enabled.text=&Enabled
+
+TXT_WARNING_HTTP_MONITOR_OFF=<html>To completely disable HTTP monitoring, you may need to undeploy all web application that have been deployed since it was enabled.</html>
+TITLE_WARNING_HTTP_MONITOR_OFF=Disabling HTTP Monitor
+TXT_WARNING_HTTP_MONITOR_ON=<html>Deploying apps with HTTP monitoring enabled eliminates the ability to cache static content for those web application.</html>
+TITLE_WARNING_HTTP_MONITOR_ON=HTTP Monitor Effects
+
+MSG_FETCHING_DATA=Fetching data....
+ERR_DATA_NOT_FOUND=No data for key: {0}
+
+column-title.property.name=Name
+column-title.property.value=Value
+column-title.property.description=Description
+
+BasicPicker.javaInstallLabel.text=&Java Installation:
+BasicPicker.javaInstallField.text=
+BasicPicker.openDirectoryBrowser.text=&Browse...
+
+ConnectorCustomizer.poolNameLabel.text=&Pool Name:
+AdminObjectCustomizer.resourceTypeLabel.text=&Resource Type:
+
+JavaMailCustomizer.mailHostLabel.text=&Mail Host:
+JavaMailCustomizer.userLabel.text=&Default Return Address:
+JavaMailCustomizer.returnLabel.text=Default &User:
+
+VmCustomizer.useIDEProxyInfo.text=Use IDE's &proxy settings
+VmCustomizer.useUserDefinedAddress.text=&Use
+VmCustomizer.javaInstallLabel.text=&Java Platform:
+VmCustomizer.filechooser.description=Select a Java Executable to run the server.
+VmCustomizer.useSharedMemRB.text=Shared &Memory
+VmCustomizer.useSocketRB.text=Soc&ket
+VmCustomizer.debugSettingsPanel.border.title.text=Debug Settings
+VmCustomizer.name=Java
+VmCustomizer.addressValue=Debugger Address
+VmCustomizer.javaExecutableField.accessiblename=Java Executable Location
+VmCustomizer.jLabel1.text=A&ddress:
+VmCustomizer.platformButton=Manage Platforms
+
+InstanceCustomizer.targetValueLabel=&Target:
+InstanceCustomizer.userNameLabel=&User Name:
+InstanceCustomizer.passwordLabel=Pass&word:
+InstanceCustomizer.buttonPwShow=Show
+InstanceCustomizer.buttonPwHide=Hide
+
+WRN_CouldNotWrite=Could not save property change to file.
+A11Y_DESC_CometSupport=Enable comet support
+A11Y_DESC_HttpMonitor=Enable http monitoring
+A11Y_DESC_DriverDeployment=Deploy JDBC Driver onto server
+A11Y_DESC_SessionPreservation=Preserve sessions across redeployments
+A11Y_DESC_StartDerby=Start bundled Derby Server when the server starts
+A11Y_DESC_InstanceLocation=Host and port for server instance
+A11Y_DESC_DomainFolder=folder that hold the domain on local filesystem
+A11Y_DESC_DomainName=Name of the domain. A directory in the domain folder.
+A11Y_DESC_CommonPanel=Payara 3 Configurable Settings
+A11Y_DESC_Browse=Select java executable with a file chooser
+A11Y_DESC_UseSelectedAddress=Debug using the specified port
+A11Y_DESC_UseIdeProxySettings=Use IDE proxy settings
+A11Y_DESC_SharedMem=Use shared memory as the debug transport
+A11Y_DESC_UseSockets=Use sockets for the debug transport
+A11Y_DESC_JavaPanel=Java Settings for server startup
+A11Y_DESC_JavaLabel=Label for Java text field
+A11Y_DESC_JavaField=path to the java executable used to start the server
+A11Y_DESC_DebugerAddress=address for debugging
+A11Y_DESC_AddressLabel=label for address text field
+
+WarnPanel.showAgain.text=&Show this warning next time
+WarnPanel.GfKillTitle=Terminate Payara Server
+WarnPanel.GfKillWarning=<html>Are you sure that you want to force termination \
+of {0} process?</html>
+WarnPanel.pfUnknownVersionWarning=<html>Unable to retrieve version of {0} \
+instance installed in {1}.<br/>Please make sure that this server is \
+Payara 4.1.144 or later and that server is registered properly in NetBeans.<html>
+
+JavaSEPlatformPanel.title=Java SE Platform
+JavaSEPlatformPanel.warning=<html>Payara server could not be started with \
+<i>{0}</i>. Please select another Java SE Platform.</html>
+JavaSEPlatformPanel.javaLabel=Java Platform:
+JavaSEPlatformPanel.platformButton=Manage Platforms
+JavaSEPlatformPanel.propertiesLabel=Update properties:
+JavaPlatformsComboBox.emptyDisplayName=NetBeans default JDK
+
+CommonPasswordPanel.userLabel=User
+CommonPasswordPanel.passwordLabel=Password
+
+PayaraPassword.title=Change Payara Password
+PayaraPassword.message=<html>Change Payara administrator password for \
+{0}</html>
+PayaraPassword.passwordVerifyLabel=Password verification
+
+PayaraCredentials.title=Payara Administrator Credentials
+PayaraCredentials.message=<html>Provide Payara administrator username \
+and password for {0}</html>
+
+# InstanceLocalPanel errors log
+InstanceLocalPanel.initHost.unknownHost=Could not retrieve IP address for \
+host name {0}
+InstanceLocalPanel.storePorts.dasPortRange=DAS port value {0} out of range.
+InstanceLocalPanel.storePorts.dasPortInvalid=Could not parse DAS port value \
+{0} as integer.
+InstanceLocalPanel.storePorts.httpPortRange=HTTP port value {0} out of range.
+InstanceLocalPanel.storePorts.httpPortInvalid=Could not parse HTTP port value \
+{0} as integer.
+# InstanceLocalPanel UI elements
+InstanceLocalPanel.displayName=Common
+InstanceLocalPanel.InstallationlocationLabel=Installation Location:
+InstanceLocalPanel.domainsFolderLabel=Domains Folder:
+InstanceLocalPanel.hostLabel=Host:
+InstancePanel.hostRemoteLabel.text=Host:
+InstanceLocalPanel.localIpCB=Loopback
+InstanceLocalPanel.dasPortLabel=DAS Port:
+InstanceLocalPanel.httpPortLabel=HTTP Port:
+InstanceLocalPanel.domainLabel=Domain:
+InstanceLocalPanel.targetLabel=Target:
+InstanceLocalPanel.userNameLabel=User Name:
+InstanceLocalPanel.passwordLabel=Password:
+InstanceLocalPanel.passwordLabel=Password:
+InstanceLocalPanel.commetSupport=Enable Comet Support
+InstanceLocalPanel.showPassword=Show Password in this Form
+InstanceLocalPanel.preserveSessions=Preserve Sessions Across Redeployment
+InstanceLocalPanel.httpMonitor=Enable HTTP Monitor
+InstanceLocalPanel.startDerby=Start Registered Derby Server
+InstanceLocalPanel.jdbcDriverDeployment=Enable JDBC Driver Deployment
+InstancePanel.httpPortField.text=
+InstancePanel.dasPortField.text=
+InstancePanel.domainField.text=
+InstancePanel.passwordField.text=
+InstancePanel.targetField.text=
+InstancePanel.installationLocationField.text=
+InstancePanel.domainsFolderField.text=
+InstancePanel.userNameField.text=
+InstancePanel.hostRemoteField.text=
+ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsCheckbox.text=Enable
+ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLabel.text=Log JDBC Calls:
+ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLayeredPane.toolTipText=When set to true, all JDBC calls will be logged allowing tracing of all JDBC interactions including SQL
+ConnectionPoolAdvancedAttributesCustomizer.secondUnitLabel.text=Seconds
+ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdTextField.text=
+ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLabel.text=Slow Query Log Threshold:
+ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLayeredPane.toolTipText=SQL queries that exceed this time in seconds will be logged. Any value <= 0 disables Slow Query Logging
+ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersTextField.text=
+ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLabel.text=SQL Trace Listeners:
+ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLayeredPane.toolTipText=Comma-separated list of classes that implement the org.glassfish.api.jdbc.SQLTraceListener interface
\ No newline at end of file
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/CommonPasswordPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/CommonPasswordPanel.java
new file mode 100644
index 0000000..9d34393
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/CommonPasswordPanel.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.openide.NotifyDescriptor;
+import static org.openide.NotifyDescriptor.CANCEL_OPTION;
+import static org.openide.NotifyDescriptor.OK_OPTION;
+import org.openide.util.NbBundle;
+
+/**
+ * Common panel for password/credentials panels.
+ * <p/>
+ * @author Tomas Kraus
+ */
+abstract class CommonPasswordPanel extends javax.swing.JPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(CommonPasswordPanel.class);
+
+ /** Buttons for valid values. */
+ static final Object[] validButtons
+ = new Object[] {OK_OPTION, CANCEL_OPTION};
+
+ /** Buttons for invalid values. */
+ static final Object[] invalidButtons
+ = new Object[] {CANCEL_OPTION};
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set buttons in user notification descriptor depending on form validity.
+ * <p/>
+ * This method is used in constructor so it's better to be static.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param javaPlatforms Java SE JDK selection content.
+ */
+ void setDescriptorButtons(
+ NotifyDescriptor descriptor, boolean valid) {
+ if (valid)
+ descriptor.setOptions(validButtons);
+ else
+ descriptor.setOptions(invalidButtons);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server instance used to search for supported platforms. */
+ final PayaraInstance instance;
+
+ /** Message to be shown in the panel. */
+ final String message;
+
+ /** Username label. */
+ final String userLabelText;
+
+ /** Password label. */
+ final String passwordLabelText;
+
+ /** Validity of form fields. */
+ boolean valid;
+
+ /** User notification descriptor. */
+ final NotifyDescriptor descriptor;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates new Payara password panel.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param instance Payara server instance used to search
+ * for supported platforms.
+ * @param message Message text.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ public CommonPasswordPanel(final NotifyDescriptor descriptor,
+ final PayaraInstance instance, final String message) {
+ this.descriptor = descriptor;
+ this.instance = instance;
+ this.message = message;
+ this.userLabelText = NbBundle.getMessage(
+ CommonPasswordPanel.class, "CommonPasswordPanel.userLabel");
+ this.passwordLabelText = NbBundle.getMessage(
+ CommonPasswordPanel.class, "CommonPasswordPanel.passwordLabel");
+ this.instance.getAdminUser();
+ this.instance.getAdminPassword();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor helper method to finish form initialization after
+ * <code>initComponents()</code> was called.
+ */
+ void initFileds(final boolean valid) {
+ this.valid = valid;
+ descriptor.setMessage(this);
+ setDescriptorButtons(descriptor, valid);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ComponentFieldListener.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ComponentFieldListener.java
new file mode 100644
index 0000000..1f5fda0
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ComponentFieldListener.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+// This is copy-paste from Payara cloud module. It should be moved
+// to some common place later.
+// Source: org.netbeans.modules.payara.cloud.wizards.PayaraWizardComponent
+/**
+ * Event listener to validate component field on the fly.
+ * <p/>
+ * @author Tomas Kraus
+ */
+abstract class ComponentFieldListener implements DocumentListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process received notification from all notification types.
+ */
+ abstract void processEvent();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Interface Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Gives notification that there was an insert into component field.
+ * <p/>
+ * @param event Change event object.
+ */
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ processEvent();
+ }
+
+ /**
+ * Gives notification that a portion of component field has been removed.
+ * <p/>
+ * @param event Change event object.
+ */
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ processEvent();
+ }
+
+ /**
+ * Gives notification that an attribute or set of attributes changed.
+ * <p/>
+ * @param event Change event object.
+ */
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ processEvent();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.form
new file mode 100644
index 0000000..393e944
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.form
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="rootPanel" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="rootPanel" pref="107" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="rootPanel">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
+ <Property name="columns" type="int" value="1"/>
+ <Property name="rows" type="int" value="3"/>
+ <Property name="verticalGap" type="int" value="5"/>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="slowQueryLogThresholdLayeredPane">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="slowQueryLogThresholdLabel" min="-2" pref="200" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="slowQueryLogThresholdLayeredPane2" pref="366" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
+ <Component id="slowQueryLogThresholdLayeredPane2" alignment="0" pref="25" max="32767" attributes="0"/>
+ <Component id="slowQueryLogThresholdLabel" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="slowQueryLogThresholdLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Container class="javax.swing.JLayeredPane" name="slowQueryLogThresholdLayeredPane2">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextField" name="slowQueryLogThresholdTextField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/extended/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="slow-query-threshold-in-seconds" noResource="true"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="secondsLabel">
+ <Properties>
+ <Property name="horizontalAlignment" type="int" value="4"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.secondUnitLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="horizontalTextPosition" type="int" value="10"/>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[65, 14]"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="After"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="logJDBCCallsLayeredPane">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="logJDBCCallsLabel" min="-2" pref="200" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="logJDBCCallsCheckBox" min="-2" pref="103" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="logJDBCCallsLabel" alignment="3" min="-2" pref="25" max="-2" attributes="0"/>
+ <Component id="logJDBCCallsCheckBox" alignment="3" min="-2" pref="25" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="logJDBCCallsLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="logJDBCCallsCheckBox">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/extended/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="log-jdbc-calls" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="sqlTraceListenersLayeredPane">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="sqlTraceListenersLabel" min="-2" pref="200" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="sqlTraceListenersLayeredPane2" pref="366" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
+ <Component id="sqlTraceListenersLayeredPane2" alignment="0" pref="25" max="32767" attributes="0"/>
+ <Component id="sqlTraceListenersLabel" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="sqlTraceListenersLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Container class="javax.swing.JLayeredPane" name="sqlTraceListenersLayeredPane2">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextField" name="sqlTraceListenersTextField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/common/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/payara/extended/ui/Bundle.properties" key="ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLayeredPane.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="sql-trace-listeners" noResource="true"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.java
new file mode 100644
index 0000000..e5c8b32
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolAdvancedAttributesCustomizer.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+import org.netbeans.modules.payara.common.ui.BasePanel;
+
+public class ConnectionPoolAdvancedAttributesCustomizer extends BasePanel {
+
+ /**
+ * Creates new form ConnectionPoolAdvancedAttributesCustomizer
+ */
+ public ConnectionPoolAdvancedAttributesCustomizer() {
+ initComponents();
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ rootPanel = new javax.swing.JPanel();
+ slowQueryLogThresholdLayeredPane = new javax.swing.JPanel();
+ slowQueryLogThresholdLabel = new javax.swing.JLabel();
+ slowQueryLogThresholdLayeredPane2 = new javax.swing.JLayeredPane();
+ slowQueryLogThresholdTextField = new javax.swing.JTextField();
+ secondsLabel = new javax.swing.JLabel();
+ logJDBCCallsLayeredPane = new javax.swing.JPanel();
+ logJDBCCallsLabel = new javax.swing.JLabel();
+ logJDBCCallsCheckBox = new javax.swing.JCheckBox();
+ sqlTraceListenersLayeredPane = new javax.swing.JPanel();
+ sqlTraceListenersLabel = new javax.swing.JLabel();
+ sqlTraceListenersLayeredPane2 = new javax.swing.JLayeredPane();
+ sqlTraceListenersTextField = new javax.swing.JTextField();
+
+ rootPanel.setLayout(new java.awt.GridLayout(3, 1, 0, 5));
+
+ slowQueryLogThresholdLayeredPane.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLayeredPane.toolTipText")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(slowQueryLogThresholdLabel, org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLabel.text")); // NOI18N
+
+ slowQueryLogThresholdLayeredPane2.setLayout(new java.awt.BorderLayout());
+
+ slowQueryLogThresholdTextField.setText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdTextField.text")); // NOI18N
+ slowQueryLogThresholdTextField.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.slowQueryLogThresholdLayeredPane.toolTipText")); // NOI18N
+ slowQueryLogThresholdTextField.setName("slow-query-threshold-in-seconds"); // NOI18N
+ slowQueryLogThresholdLayeredPane2.add(slowQueryLogThresholdTextField, java.awt.BorderLayout.CENTER);
+
+ secondsLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
+ secondsLabel.setText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.secondUnitLabel.text")); // NOI18N
+ secondsLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
+ secondsLabel.setPreferredSize(new java.awt.Dimension(65, 14));
+ slowQueryLogThresholdLayeredPane2.add(secondsLabel, java.awt.BorderLayout.LINE_END);
+
+ javax.swing.GroupLayout slowQueryLogThresholdLayeredPaneLayout = new javax.swing.GroupLayout(slowQueryLogThresholdLayeredPane);
+ slowQueryLogThresholdLayeredPane.setLayout(slowQueryLogThresholdLayeredPaneLayout);
+ slowQueryLogThresholdLayeredPaneLayout.setHorizontalGroup(
+ slowQueryLogThresholdLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(slowQueryLogThresholdLayeredPaneLayout.createSequentialGroup()
+ .addComponent(slowQueryLogThresholdLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(slowQueryLogThresholdLayeredPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ slowQueryLogThresholdLayeredPaneLayout.setVerticalGroup(
+ slowQueryLogThresholdLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(slowQueryLogThresholdLayeredPaneLayout.createSequentialGroup()
+ .addGroup(slowQueryLogThresholdLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(slowQueryLogThresholdLayeredPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE)
+ .addComponent(slowQueryLogThresholdLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ rootPanel.add(slowQueryLogThresholdLayeredPane);
+
+ logJDBCCallsLayeredPane.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLayeredPane.toolTipText")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(logJDBCCallsLabel, org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLabel.text")); // NOI18N
+
+ logJDBCCallsCheckBox.setText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsCheckbox.text")); // NOI18N
+ logJDBCCallsCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.logJDBCCallsLayeredPane.toolTipText")); // NOI18N
+ logJDBCCallsCheckBox.setName("log-jdbc-calls"); // NOI18N
+
+ javax.swing.GroupLayout logJDBCCallsLayeredPaneLayout = new javax.swing.GroupLayout(logJDBCCallsLayeredPane);
+ logJDBCCallsLayeredPane.setLayout(logJDBCCallsLayeredPaneLayout);
+ logJDBCCallsLayeredPaneLayout.setHorizontalGroup(
+ logJDBCCallsLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(logJDBCCallsLayeredPaneLayout.createSequentialGroup()
+ .addComponent(logJDBCCallsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(logJDBCCallsCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ logJDBCCallsLayeredPaneLayout.setVerticalGroup(
+ logJDBCCallsLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(logJDBCCallsLayeredPaneLayout.createSequentialGroup()
+ .addGroup(logJDBCCallsLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(logJDBCCallsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(logJDBCCallsCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ rootPanel.add(logJDBCCallsLayeredPane);
+
+ sqlTraceListenersLayeredPane.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLayeredPane.toolTipText")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(sqlTraceListenersLabel, org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLabel.text")); // NOI18N
+
+ sqlTraceListenersLayeredPane2.setLayout(new java.awt.BorderLayout());
+
+ sqlTraceListenersTextField.setText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersTextField.text")); // NOI18N
+ sqlTraceListenersTextField.setToolTipText(org.openide.util.NbBundle.getMessage(ConnectionPoolAdvancedAttributesCustomizer.class, "ConnectionPoolAdvancedAttributesCustomizer.sqlTraceListenersLayeredPane.toolTipText")); // NOI18N
+ sqlTraceListenersTextField.setName("sql-trace-listeners"); // NOI18N
+ sqlTraceListenersLayeredPane2.add(sqlTraceListenersTextField, java.awt.BorderLayout.CENTER);
+
+ javax.swing.GroupLayout sqlTraceListenersLayeredPaneLayout = new javax.swing.GroupLayout(sqlTraceListenersLayeredPane);
+ sqlTraceListenersLayeredPane.setLayout(sqlTraceListenersLayeredPaneLayout);
+ sqlTraceListenersLayeredPaneLayout.setHorizontalGroup(
+ sqlTraceListenersLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(sqlTraceListenersLayeredPaneLayout.createSequentialGroup()
+ .addComponent(sqlTraceListenersLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(sqlTraceListenersLayeredPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ sqlTraceListenersLayeredPaneLayout.setVerticalGroup(
+ sqlTraceListenersLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(sqlTraceListenersLayeredPaneLayout.createSequentialGroup()
+ .addGroup(sqlTraceListenersLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(sqlTraceListenersLayeredPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE)
+ .addComponent(sqlTraceListenersLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ rootPanel.add(sqlTraceListenersLayeredPane);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rootPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rootPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 107, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox logJDBCCallsCheckBox;
+ private javax.swing.JLabel logJDBCCallsLabel;
+ private javax.swing.JPanel logJDBCCallsLayeredPane;
+ private javax.swing.JPanel rootPanel;
+ private javax.swing.JLabel secondsLabel;
+ private javax.swing.JLabel slowQueryLogThresholdLabel;
+ private javax.swing.JPanel slowQueryLogThresholdLayeredPane;
+ private javax.swing.JLayeredPane slowQueryLogThresholdLayeredPane2;
+ private javax.swing.JTextField slowQueryLogThresholdTextField;
+ private javax.swing.JLabel sqlTraceListenersLabel;
+ private javax.swing.JPanel sqlTraceListenersLayeredPane;
+ private javax.swing.JLayeredPane sqlTraceListenersLayeredPane2;
+ private javax.swing.JTextField sqlTraceListenersTextField;
+ // End of variables declaration//GEN-END:variables
+
+ @Override
+ protected String getPrefix() {
+ return "resources.jdbc-connection-pool."; // NOI18N
+ }
+
+ @Override
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {slowQueryLogThresholdTextField, logJDBCCallsCheckBox, sqlTraceListenersTextField});
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.form
new file mode 100644
index 0000000..8d4f23e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.form
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="373" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="1" pref="177" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTable" name="connectionPropertiesTable">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="property.name.value" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.java
new file mode 100644
index 0000000..7d65b7c
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectionPoolCustomizer.java
@@ -0,0 +1,75 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+
+public class ConnectionPoolCustomizer extends BasePanel {
+
+ /** Creates new form ConnectionPoolCustomizer */
+ public ConnectionPoolCustomizer() {
+ initComponents();
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ connectionPropertiesTable = new javax.swing.JTable();
+
+ connectionPropertiesTable.setName("property.name.value"); // NOI18N
+ jScrollPane1.setViewportView(connectionPropertiesTable);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTable connectionPropertiesTable;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.jdbc-connection-pool."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {connectionPropertiesTable});
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.form
new file mode 100644
index 0000000..c208a5d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.form
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="373" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="1" pref="175" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTable" name="connectionPropertiesTable">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="property.name.value" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.java
new file mode 100644
index 0000000..6af12cb
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorConnectionPoolCustomizer.java
@@ -0,0 +1,75 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+
+public class ConnectorConnectionPoolCustomizer extends BasePanel {
+
+ /** Creates new form ConnectorConnectionPoolCustomizer */
+ public ConnectorConnectionPoolCustomizer() {
+ initComponents();
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ connectionPropertiesTable = new javax.swing.JTable();
+
+ connectionPropertiesTable.setName("property.name.value"); // NOI18N
+ jScrollPane1.setViewportView(connectionPropertiesTable);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTable connectionPropertiesTable;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.connector-connection-pool."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {connectionPropertiesTable});
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.form
new file mode 100644
index 0000000..0375527
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.form
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="poolNameLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
+ <Component id="poolNameCombo" pref="260" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="poolNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="poolNameCombo" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="40" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="poolNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="poolNameCombo"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="ConnectorCustomizer.poolNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="poolNameCombo">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="1">
+ <StringItem index="0" value="fetching data...."/>
+ </StringArray>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="resources\.connector-connection-pool\..*\.name" noResource="true"/>
+ <Property name="name" type="java.lang.String" value="pool-name" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.java
new file mode 100644
index 0000000..409d488
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/ConnectorCustomizer.java
@@ -0,0 +1,93 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+import org.openide.util.NbBundle;
+
+public class ConnectorCustomizer extends BasePanel {
+
+ /** Creates new form ConnectorCustomizer */
+ public ConnectorCustomizer() {
+ initComponents();
+ String val = NbBundle.getMessage(ConnectorCustomizer.class, "MSG_FETCHING_DATA");
+ poolNameCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { val }));
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ poolNameLabel = new javax.swing.JLabel();
+ poolNameCombo = new javax.swing.JComboBox();
+
+ poolNameLabel.setLabelFor(poolNameCombo);
+ org.openide.awt.Mnemonics.setLocalizedText(poolNameLabel, org.openide.util.NbBundle.getMessage(ConnectorCustomizer.class, "ConnectorCustomizer.poolNameLabel.text")); // NOI18N
+
+ poolNameCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "fetching data...." }));
+ poolNameCombo.setActionCommand("resources\\.connector-connection-pool\\..*\\.name"); // NOI18N
+ poolNameCombo.setName("pool-name"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(poolNameLabel)
+ .addGap(2, 2, 2)
+ .addComponent(poolNameCombo, 0, 260, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(poolNameLabel)
+ .addComponent(poolNameCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(40, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JComboBox poolNameCombo;
+ private javax.swing.JLabel poolNameLabel;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.connector-resource."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {poolNameCombo});
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Filter.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Filter.java
new file mode 100644
index 0000000..c38c935
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/Filter.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DocumentFilter;
+
+/**
+ * Document filters for Payara instance forms.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class Filter {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Filter out characters that are not valid for network port numbers.
+ */
+ public static class PortNumber extends DocumentFilter {
+
+ /**
+ * Copy valid characters (decimal number digits) from {@link String}
+ * into {@link StringBuilder}.
+ * <p/>
+ * @param src Source {@link String}.
+ * @param dst Destination {@link StringBuilder}.
+ * @return Destination {@link StringBuilder}.
+ */
+ private static StringBuilder copyValidChars(final String src,
+ final StringBuilder dst) {
+ for (int n = 0; n < src.length(); n++) {
+ if (Character.isDigit(src.charAt(n))) {
+ dst.append(src.charAt(n));
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * Invoked prior to insertion of text into the specified Document.
+ * <p/>
+ * @param fb FilterBypass that can be used to mutate Document.
+ * @param offset The offset into the document to insert
+ * the content >= 0.
+ * @param string The string to insert.
+ * @param attr The attributes to associate with the inserted content.
+ * This may be <code>null</code> if there are
+ * no attributes.
+ * @exception BadLocationException The given insert position is not a
+ * valid position within the document.
+ */
+ @Override
+ public void insertString(final FilterBypass fb, final int offset,
+ final String string, final AttributeSet attr)
+ throws BadLocationException {
+ if (string.length() > 0) {
+ StringBuilder sb = copyValidChars(
+ string, new StringBuilder(string.length()));
+ if (sb.length() > 0) {
+ super.insertString(fb, offset, sb.toString(), attr);
+ }
+ }
+ }
+
+ /**
+ * Invoked prior to replacing a region of text in the specified
+ * Document.
+ * <p/>
+ * @param fb FilterBypass that can be used to mutate Document.
+ * @param offset The offset into the document to replace
+ * the content >= 0.
+ * @param length Length of text to delete
+ * @param string Text to insert, <code>null</code> indicates no text
+ * to insert
+ * @param attrs The attributes to associate with the inserted content.
+ * This may be <code>null</code> if there are
+ * no attributes.
+ * @exception BadLocationException The given insert position is not a
+ * valid position within the document.
+ */
+ @Override
+ public void replace(final FilterBypass fb, final int offset,
+ final int length, final String string, final AttributeSet attr)
+ throws BadLocationException {
+ if (string.length() > 0) {
+ StringBuilder sb = copyValidChars(
+ string, new StringBuilder(string.length()));
+ if (sb.length() > 0) {
+ super.replace(fb, offset, length, sb.toString(), attr);
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceLocalPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceLocalPanel.java
new file mode 100644
index 0000000..5214c47
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceLocalPanel.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PortCollection;
+import org.netbeans.modules.payara.common.utils.Util;
+import org.openide.util.NbBundle;
+
+/**
+ * Local instance properties editor.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class InstanceLocalPanel extends InstancePanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(InstanceLocalPanel.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of local Payara server properties editor.
+ * <p/>
+ * @param instance Local Payara server instance to be modified.
+ */
+ public InstanceLocalPanel(final PayaraInstance instance) {
+ super(instance);
+ hostRemoteLabel.setVisible(false);
+ hostRemoteField.setVisible(false);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Local host field initialization.
+ * <p/>
+ * Attempts to initialize host combo box to existing IP address. Host name
+ * string is used as a fallback.
+ */
+ @Override
+ protected void initHost() {
+ String hostProperty = instance.getHost();
+ InetAddress addr;
+ try {
+ addr = InetAddress.getByName(hostProperty);
+ localIpCB.setSelected(addr.isLoopbackAddress());
+ } catch (UnknownHostException uhe) {
+ addr = null;
+ localIpCB.setSelected(true);
+ LOGGER.log(Level.INFO,
+ NbBundle.getMessage(InstancePanel.class,
+ "InstanceLocalPanel.initHost.unknownHost", hostProperty));
+ }
+ ((IpComboBox)hostLocalField).updateModel(ips, localIpCB.isSelected());
+ if (addr != null && ips.contains(addr)) {
+ ((IpComboBox)hostLocalField).setSelectedItem(addr);
+ } else {
+ ((IpComboBox)hostLocalField).getEditor().setItem(hostProperty);
+ }
+ }
+
+ /**
+ * Port fields initialization.
+ * <p/>
+ * Reads port values from server configuration in <code>domain.xml</code>
+ * if exists and updates corresponding fields. Port fields values can't
+ * be changed when values are coming from server's <code>domain.xml</code>
+ * file.
+ * Ports values are initialized with values stored in Payara instance
+ * object and can be changed when values from server configuration file
+ * are not available.
+ */
+ @Override
+ protected void initPorts() {
+ PortCollection ports = new PortCollection();
+ String domainPath = ServerUtils.getDomainPath(instance);
+ if (configFileParsed
+ = Util.readServerConfiguration(new File(domainPath), ports)) {
+ dasPortField.setText(Integer.toString(ports.getAdminPort()));
+ httpPortField.setText(Integer.toString(ports.getHttpPort()));
+ } else {
+ dasPortField.setText(Integer.toString(instance.getAdminPort()));
+ httpPortField.setText(Integer.toString(instance.getPort()));
+ }
+ }
+
+ /**
+ * Get local host field value to be stored into local Payara server
+ * instance object properties.
+ * <p/>
+ * @return Local host field value converted to {@link String}.
+ */
+ @Override
+ protected String getHost() {
+ Object hostValue = hostLocalField.getEditor().getItem();
+ if (hostValue instanceof IpComboBox.InetAddr) {
+ return ((IpComboBox.InetAddr)hostValue).toString();
+ } else if (hostValue instanceof String) {
+ return (String)hostValue;
+ } else {
+ return IpComboBox.IP_4_127_0_0_1_NAME;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Enable form fields that can be modified by user.
+ * <p/>
+ * Set those form fields that can be modified by user as enabled. This
+ * is usually done after form has been initialized when all form fields
+ * are currently disabled.
+ */
+ @Override
+ protected void enableFields() {
+ super.enableFields();
+ hostLocalField.setEnabled(true);
+ localIpCB.setEnabled(true);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.form
new file mode 100644
index 0000000..9c51fe1
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.form
@@ -0,0 +1,428 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.displayName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[602, 304]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="4"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="installationLocationLabel" linkSize="5" max="32767" attributes="0"/>
+ <Component id="domainsFolderLabel" linkSize="5" max="32767" attributes="0"/>
+ <Component id="hostRemoteLabel" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="domainsFolderField" max="32767" attributes="0"/>
+ <Component id="installationLocationField" max="32767" attributes="0"/>
+ <Component id="hostRemoteField" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="hostLocalLabel" linkSize="1" alignment="0" min="-2" pref="59" max="-2" attributes="0"/>
+ <Component id="domainLabel" linkSize="1" alignment="0" min="-2" pref="59" max="-2" attributes="0"/>
+ <Component id="dasPortLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="userNameLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="hostLocalField" max="32767" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="localIpCB" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="domainField" alignment="0" max="32767" attributes="0"/>
+ <Component id="dasPortField" alignment="0" max="32767" attributes="0"/>
+ <Component id="userNameField" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="httpPortLabel" linkSize="1" max="32767" attributes="0"/>
+ <Component id="targetLabel" linkSize="1" max="32767" attributes="0"/>
+ <Component id="passwordLabel" linkSize="1" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="httpPortField" max="32767" attributes="0"/>
+ <Component id="targetField" max="32767" attributes="0"/>
+ <Component id="passwordField" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jdbcDriverDeployment" alignment="0" pref="265" max="32767" attributes="0"/>
+ <Component id="httpMonitor" alignment="0" max="32767" attributes="0"/>
+ <Component id="commetSupport" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="preserveSessions" pref="319" max="32767" attributes="0"/>
+ <Component id="startDerby" max="32767" attributes="0"/>
+ <Component id="showPassword" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="installationLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="installationLocationField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="domainsFolderLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="domainsFolderField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="hostRemoteLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="hostRemoteField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="hostLocalLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="hostLocalField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="localIpCB" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="dasPortLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="dasPortField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="domainLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="domainField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="targetLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="targetField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" max="-2" attributes="0">
+ <Component id="userNameField" max="32767" attributes="0"/>
+ <Component id="passwordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="userNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="passwordField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="commetSupport" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="showPassword" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="httpMonitor" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="preserveSessions" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jdbcDriverDeployment" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="startDerby" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="hostLocalLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="hostLocalField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.hostLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="localIpCB">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.localIpCB" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="localIpCBActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="hostLocalField">
+ <Properties>
+ <Property name="editable" type="boolean" value="true"/>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="0"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new IpComboBox(ips, localIpCB.isSelected())"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JLabel" name="dasPortLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="dasPortField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.dasPortLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="dasPortField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.dasPortField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="httpPortLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="httpPortField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.httpPortLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="httpPortField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.httpPortField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="domainLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="domainField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.domainLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="domainField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.domainField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="targetLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="targetField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.targetLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="targetField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.targetField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="installationLocationLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="installationLocationField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.InstallationlocationLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="installationLocationField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.installationLocationField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="domainsFolderLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="domainsFolderField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.domainsFolderLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="domainsFolderField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.domainsFolderField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="userNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="userNameField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.userNameLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userNameField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.userNameField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="passwordLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="passwordField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.passwordLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="commetSupport">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.commetSupport" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="commetSupportActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="preserveSessions">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.preserveSessions" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="preserveSessionsActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="httpMonitor">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.httpMonitor" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="httpMonitorActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="startDerby">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.startDerby" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="startDerbyActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="jdbcDriverDeployment">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.jdbcDriverDeployment" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jdbcDriverDeploymentActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="showPassword">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstanceLocalPanel.showPassword" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showPasswordActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="passwordField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.passwordField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="hostRemoteLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="domainsFolderField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.hostRemoteLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="hostRemoteField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="InstancePanel.hostRemoteField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.java
new file mode 100644
index 0000000..15ce397
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstancePanel.java
@@ -0,0 +1,927 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.net.InetAddress;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.text.AbstractDocument;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraSettings;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ * Common instance properties editor.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class InstancePanel extends javax.swing.JPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Properties for check box fields.
+ */
+ protected static class CheckBoxProperties {
+
+ /** Comet support property. */
+ final String cometSupportProperty;
+
+ /** HTTP monitor property. */
+ final String httpMonitorProperty;
+
+ /** JDBC driver deployment property. */
+ final String jdbcDriverDeploymentProperty;
+
+ /** Preserve sessions property. */
+ final String preserveSessionsProperty;
+
+ /** Start Derby property. */
+ final String startDerbyProperty;
+
+ /** Loopback property. */
+ final String loopbackProperty;
+
+ /**
+ * Creates an instance of check box fields properties by retrieving them
+ * from Payara instance object.
+ * <p/>
+ * @param instance Payara instance object containing check box
+ * fields properties.
+ */
+ protected CheckBoxProperties(final PayaraInstance instance) {
+ String cometSupportPropertyTmp
+ = instance.getProperty(PayaraModule.COMET_FLAG);
+ cometSupportProperty = cometSupportPropertyTmp != null
+ ? cometSupportPropertyTmp
+ : System.getProperty(PayaraModule.COMET_FLAG);
+ httpMonitorProperty
+ = instance.getProperty(PayaraModule.HTTP_MONITOR_FLAG);
+ jdbcDriverDeploymentProperty
+ = instance.getProperty(PayaraModule.DRIVER_DEPLOY_FLAG);
+ preserveSessionsProperty
+ = instance.getProperty(PayaraModule.SESSION_PRESERVATION_FLAG);
+ startDerbyProperty
+ = instance.getProperty(PayaraModule.START_DERBY_FLAG);
+ loopbackProperty
+ = instance.getProperty(PayaraModule.LOOPBACK_FLAG);
+ }
+
+ /**
+ * Store given <code>boolean</code> property into Payara instance
+ * object properties.
+ * <p/>
+ * @param key Payara instance object property key.
+ * @param value Payara instance object property value.
+ * @param instance Payara instance object to store properties.
+ */
+ protected void storeBooleanProperty(final String key, final boolean value,
+ final PayaraInstance instance) {
+ // Store true value as String property.
+ if (value) {
+ instance.putProperty(key, Boolean.toString(value));
+ // Store false valye by removal of property.
+ } else {
+ instance.removeProperty(key);
+ }
+ }
+
+ /**
+ * Store check box fields flags by setting them as Payara instance
+ * object properties.
+ * <p/>
+ * @param cometSupportFlag Comet support flag.
+ * @param httpMonitorFlag HTTP monitor flag.
+ * @param jdbcDriverDeploymentFlag JDBC driver deployment flag.
+ * @param preserveSessionsFlag Preserve sessions flag.
+ * @param startDerbyFlag Start Derby flag.
+ * @param instance Payara instance object to store
+ * check box fields properties.
+ */
+ protected void store(final boolean cometSupportFlag,
+ final boolean httpMonitorFlag,
+ final boolean jdbcDriverDeploymentFlag,
+ final boolean preserveSessionsFlag,
+ final boolean startDerbyFlag,
+ final boolean loopbackFlag,
+ final PayaraInstance instance) {
+ // Update properties only when stored value differs.
+ if (cometSupportFlag != getCommetSupportProperty()) {
+ // Comet support is always stored into instance when differs.
+ instance.putProperty(PayaraModule.COMET_FLAG,
+ Boolean.toString(cometSupportFlag));
+ }
+ if (httpMonitorFlag != getHttpMonitorProperty()) {
+ storeBooleanProperty(PayaraModule.HTTP_MONITOR_FLAG,
+ httpMonitorFlag, instance);
+ }
+ if (jdbcDriverDeploymentFlag != getJdbcDriverDeploymentProperty()) {
+ storeBooleanProperty(PayaraModule.DRIVER_DEPLOY_FLAG,
+ jdbcDriverDeploymentFlag, instance);
+ }
+ if (preserveSessionsFlag != getPreserveSessionsProperty()) {
+ storeBooleanProperty(PayaraModule.SESSION_PRESERVATION_FLAG,
+ preserveSessionsFlag, instance);
+ }
+ if (startDerbyFlag != getStartDerbyProperty()) {
+ storeBooleanProperty(PayaraModule.START_DERBY_FLAG,
+ startDerbyFlag, instance);
+ }
+ if (loopbackFlag != getLoopbackProperty()) {
+ storeBooleanProperty(PayaraModule.LOOPBACK_FLAG,
+ loopbackFlag, instance);
+ }
+ }
+
+ /**
+ * Get Comet support property
+ * <p/>
+ * @return Comet support property.
+ */
+ protected boolean getCommetSupportProperty() {
+ return Boolean.parseBoolean(cometSupportProperty);
+ }
+
+ /**
+ * Get HTTP monitor property.
+ * <p/>
+ * @return HTTP monitor property.
+ */
+ protected boolean getHttpMonitorProperty() {
+ return Boolean.parseBoolean(httpMonitorProperty);
+ }
+
+ /**
+ * Get JDBC driver deployment property.
+ * <p/>
+ * @return JDBC driver deployment property.
+ */
+ protected boolean getJdbcDriverDeploymentProperty() {
+ return Boolean.parseBoolean(jdbcDriverDeploymentProperty);
+ }
+
+ /**
+ * Get preserve sessions property.
+ * <p/>
+ * @return Preserve sessions property.
+ */
+ protected boolean getPreserveSessionsProperty() {
+ return Boolean.parseBoolean(preserveSessionsProperty);
+ }
+
+ /**
+ * Get start Derby property.
+ * <p/>
+ * @return Start Derby property.
+ */
+ protected boolean getStartDerbyProperty() {
+ return Boolean.parseBoolean(startDerbyProperty);
+ }
+
+ protected boolean getLoopbackProperty() {
+ return Boolean.parseBoolean(loopbackProperty);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(InstancePanel.class);
+
+ /** Maximum port number value. */
+ private static final int MAX_PORT_VALUE = 0x10000 - 0x01;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server instance to be modified. */
+ protected final PayaraInstance instance;
+
+ /** IP addresses selection content. */
+ protected Set<? extends InetAddress> ips;
+
+ /** Comet support flag. */
+ protected boolean cometSupportFlag;
+
+ /** HTTP monitor flag. */
+ protected boolean httpMonitorFlag;
+
+ /** JDBC driver deployment flag. */
+ protected boolean jdbcDriverDeploymentFlag;
+
+ /** Show password text in this form flag. */
+ protected boolean showPasswordFlag;
+
+ /** Preserve sessions flag. */
+ protected boolean preserverSessionsFlag;
+
+ /** Start Derby flag. */
+ protected boolean startDerbyFlag;
+
+ protected boolean loopbackFlag;
+
+ /** Configuration file <code>domain.xml</code> was parsed successfully. */
+ protected boolean configFileParsed;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Host field initialization.
+ * <p/>
+ * Initialize proper host fields in child class.
+ */
+ protected abstract void initHost();
+
+ /**
+ * Port fields initialization.
+ * <p/>
+ * Initialize proper port fields in child class.
+ */
+ protected abstract void initPorts();
+
+ /**
+ * Get host field value to be stored into local Payara server instance
+ * object properties.
+ * <p/>
+ * @return Host field value converted to {@link String}.
+ */
+ protected abstract String getHost();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of common Payara server properties editor.
+ * <p/>
+ * @param instance Payara server instance to be modified.
+ */
+ protected InstancePanel(final PayaraInstance instance) {
+ this.instance = instance;
+ ips = NetUtils.getHostIP4s();
+ initComponents();
+ ((AbstractDocument)dasPortField.getDocument())
+ .setDocumentFilter(new Filter.PortNumber());
+ ((AbstractDocument)httpPortField.getDocument())
+ .setDocumentFilter(new Filter.PortNumber());
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Installation and domain directories fields initialization.
+ * <p/>
+ * Initialize installation root and domains directory fields with values
+ * stored in Payara instance object. This code can be part of common
+ * initialization because for remote server domains folder is initialized
+ * as empty <code>String</code> and child class makes it just invisible.
+ */
+ protected void initDirectoriesFields() {
+ String installationRoot = instance.getPayaraRoot();
+ String domainsFolder = instance.getDomainsFolder();
+ installationLocationField.setText(
+ installationRoot != null ? installationRoot : "");
+ domainsFolderField.setText(domainsFolder != null ? domainsFolder : "");
+ }
+
+ /**
+ * Domain name and target fields initialization.
+ * <p/>
+ * Initialize domain name and target fields with values stored in Payara
+ * instance object.
+ */
+ protected void initDomainAndTarget() {
+ String target = instance.getTarget();
+ String domainName = instance.getDomainName();
+ domainField.setText(domainName != null ? domainName : "");
+ targetField.setText(target != null ? target : "");
+ }
+
+ /**
+ * Credential fields initialization.
+ * <p/>
+ * Initialize user name and password fields with values stored in Payara
+ * instance object.
+ */
+ protected void initCredentials() {
+ userNameField.setText(instance.getUserName());
+ passwordField.setText(instance.getPassword());
+ }
+
+ /**
+ * Initialize internal properties storage from Payara instance object
+ * properties.
+ * <p/>
+ * @param properties Payara instance object properties for check boxes.
+ */
+ protected void initFlagsFromProperties(final CheckBoxProperties properties) {
+ cometSupportFlag = properties.getCommetSupportProperty();
+ httpMonitorFlag = properties.getHttpMonitorProperty();
+ jdbcDriverDeploymentFlag= properties.getJdbcDriverDeploymentProperty();
+ preserverSessionsFlag = properties.getPreserveSessionsProperty();
+ startDerbyFlag = properties.getStartDerbyProperty();
+ loopbackFlag = properties.getLoopbackProperty();
+ }
+
+ /**
+ * Check box fields initialization.
+ * <p/>
+ * Initialize check box fields to allow Payara instance flags
+ * modification and allowing user to display password text in password
+ * field.
+ */
+ protected void initCheckBoxes() {
+ // Retrieve properties from Payara instance object.
+ initFlagsFromProperties(new CheckBoxProperties(instance));
+ // Initialize internal properties storage.
+ showPasswordFlag
+ = PayaraSettings.getGfShowPasswordInPropertiesForm();
+ // Set form fields values.
+ commetSupport.setSelected(cometSupportFlag);
+ httpMonitor.setSelected(httpMonitorFlag);
+ jdbcDriverDeployment.setSelected(jdbcDriverDeploymentFlag);
+ showPassword.setSelected(showPasswordFlag);
+ preserveSessions.setSelected(preserverSessionsFlag);
+ startDerby.setSelected(startDerbyFlag);
+ localIpCB.setSelected(loopbackFlag);
+ }
+
+ /**
+ * Host name field storage.
+ * <p/>
+ * Store host field content when form fields value differs from Payara
+ * instance property.
+ */
+ protected void storeHost() {
+ String host = getHost();
+ if (!host.equals(instance.getHost())) {
+ instance.setHost(host);
+ }
+ }
+
+ /**
+ * Check box fields storage.
+ * <p/>
+ * Store check box fields after Payara instance flags modification
+ * and store current status of allowing user to display password text
+ * in password field.
+ */
+ protected void storeCheckBoxes() {
+ CheckBoxProperties properties = new CheckBoxProperties(instance);
+ properties.store(cometSupportFlag, httpMonitorFlag,
+ jdbcDriverDeploymentFlag, preserverSessionsFlag,
+ startDerbyFlag, loopbackFlag, instance);
+ PayaraSettings.setGfShowPasswordInPropertiesForm(showPasswordFlag);
+ }
+
+ /**
+ * DAS and HTTP ports fields storage.
+ * <p/>
+ * Validate and store DAS and HTTP ports fields when form fields values
+ * differs from Payara instance properties.
+ */
+ protected void storePorts() {
+ final String dasPortStr = dasPortField.getText().trim();
+ final String httpPortStr = httpPortField.getText().trim();
+ try {
+ int dasPort = Integer.parseInt(dasPortStr);
+ if (0 <= dasPort && dasPort < MAX_PORT_VALUE) {
+ // Update value only when values differs.
+ if (instance.getAdminPort() != dasPort) {
+ instance.setAdminPort(dasPort);
+ }
+ } else {
+ LOGGER.log(Level.INFO,
+ NbBundle.getMessage(InstancePanel.class,
+ "InstanceLocalPanel.storePorts.dasPortRange",
+ dasPortStr));
+ }
+ } catch (NumberFormatException nfe) {
+ LOGGER.log(Level.INFO, NbBundle.getMessage(InstancePanel.class,
+ "InstanceLocalPanel.storePorts.dasPortInvalid",
+ dasPortStr));
+ }
+ try {
+ int httpPort = Integer.parseInt(httpPortStr);
+ if (0 <= httpPort && httpPort < MAX_PORT_VALUE) {
+ if (instance.getPort() != httpPort) {
+ instance.setHttpPort(httpPort);
+ }
+ } else {
+ LOGGER.log(Level.INFO,
+ NbBundle.getMessage(InstancePanel.class,
+ "InstanceLocalPanel.storePorts.httpPortRange",
+ dasPortStr));
+ }
+ } catch (NumberFormatException nfe) {
+ LOGGER.log(Level.INFO, NbBundle.getMessage(InstancePanel.class,
+ "InstanceLocalPanel.storePorts.httpPortInvalid",
+ httpPortStr));
+ }
+ }
+
+ /**
+ * Target field storage.
+ * <p/>
+ * Store target when form field value differs from Payara instance
+ * property.
+ */
+ protected void storeTarget() {
+ String target = targetField.getText().trim();
+ if (!target.equals(instance.getTarget())) {
+ instance.setTarget(target);
+ }
+ }
+
+ /**
+ * Administrator user credentials storage.
+ * <p/>
+ * Store administrator user name and password when form fields values
+ * differs from Payara instance properties.
+ */
+ protected void storeCredentials() {
+ final String userName = userNameField.getText().trim();
+ final String password = new String(passwordField.getPassword());
+ if (!userName.equals(instance.getAdminUser())) {
+ instance.setAdminUser(userName);
+ }
+ if (!password.equals(instance.getAdminPassword())) {
+ instance.setAdminPassword(password);
+ }
+ }
+
+ /**
+ * Enable form fields that can be modified by user.
+ * <p/>
+ * Set those form fields that can be modified by user as enabled. This
+ * is usually done after form has been initialized when all form fields
+ * are currently disabled.
+ */
+ protected void enableFields() {
+ if (!configFileParsed) {
+ dasPortField.setEnabled(true);
+ httpPortField.setEnabled(true);
+ }
+ targetField.setEnabled(true);
+ userNameField.setEnabled(true);
+ passwordField.setEnabled(true);
+ commetSupport.setEnabled(true);
+ httpMonitor.setEnabled(true);
+ jdbcDriverDeployment.setEnabled(true);
+ showPassword.setEnabled(true);
+ preserveSessions.setEnabled(true);
+ startDerby.setEnabled(true);
+ }
+
+ /**
+ * Disable all form fields.
+ * <p/>
+ * Set all form fields as disabled. This is usually done when form is being
+ * initialized or stored.
+ */
+ protected void disableAllFields() {
+ installationLocationField.setEnabled(false);
+ domainsFolderField.setEnabled(false);
+ hostLocalField.setEnabled(false);
+ localIpCB.setEnabled(false);
+ hostRemoteField.setEnabled(false);
+ dasPortField.setEnabled(false);
+ httpPortField.setEnabled(false);
+ domainField.setEnabled(false);
+ targetField.setEnabled(false);
+ userNameField.setEnabled(false);
+ passwordField.setEnabled(false);
+ commetSupport.setEnabled(false);
+ httpMonitor.setEnabled(false);
+ jdbcDriverDeployment.setEnabled(false);
+ showPassword.setEnabled(false);
+ preserveSessions.setEnabled(false);
+ startDerby.setEnabled(false);
+ }
+
+ /**
+ * Initialize form field values from Payara server entity object.
+ * <p/>
+ * This is top level initialization method used when entering form.
+ */
+ protected void initFormFields() {
+ initDirectoriesFields();
+ initPorts();
+ initHost();
+ initDomainAndTarget();
+ initCredentials();
+ initCheckBoxes();
+ updatePasswordVisibility();
+ // do the magic according to loopback checkbox
+ localIpCBActionPerformed(null);
+ }
+
+ /**
+ * Store form field values into Payara server entity object.
+ * <p/>
+ * This is top level storage method used when leaving form.
+ */
+ protected void storeFormFields() {
+ storeHost();
+ storePorts();
+ storeTarget();
+ storeCredentials();
+ storeCheckBoxes();
+ }
+
+ /**
+ * Called when entering this panel.
+ * <p/>
+ * Initialize all panel form fields.
+ */
+ @Override
+ public void addNotify() {
+ super.addNotify();
+ disableAllFields();
+ initFormFields();
+ enableFields();
+ }
+
+ /**
+ * Called when leaving this panel.
+ * <p/>
+ * Store all form fields from panel.
+ */
+ @Override
+ public void removeNotify() {
+ super.removeNotify();
+ disableAllFields();
+ storeFormFields();
+ }
+
+ /**
+ * Show and hide password text depending on related check box.
+ */
+ protected void updatePasswordVisibility() {
+ showPasswordFlag = showPassword.isSelected();
+ passwordField.setEchoChar(showPasswordFlag ? '\0' : '*');
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Generated GUI code //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ hostLocalLabel = new javax.swing.JLabel();
+ localIpCB = new javax.swing.JCheckBox();
+ hostLocalField = new IpComboBox(ips, localIpCB.isSelected());
+ dasPortLabel = new javax.swing.JLabel();
+ dasPortField = new javax.swing.JTextField();
+ httpPortLabel = new javax.swing.JLabel();
+ httpPortField = new javax.swing.JTextField();
+ domainLabel = new javax.swing.JLabel();
+ domainField = new javax.swing.JTextField();
+ targetLabel = new javax.swing.JLabel();
+ targetField = new javax.swing.JTextField();
+ installationLocationLabel = new javax.swing.JLabel();
+ installationLocationField = new javax.swing.JTextField();
+ domainsFolderLabel = new javax.swing.JLabel();
+ domainsFolderField = new javax.swing.JTextField();
+ userNameLabel = new javax.swing.JLabel();
+ userNameField = new javax.swing.JTextField();
+ passwordLabel = new javax.swing.JLabel();
+ commetSupport = new javax.swing.JCheckBox();
+ preserveSessions = new javax.swing.JCheckBox();
+ httpMonitor = new javax.swing.JCheckBox();
+ startDerby = new javax.swing.JCheckBox();
+ jdbcDriverDeployment = new javax.swing.JCheckBox();
+ showPassword = new javax.swing.JCheckBox();
+ passwordField = new javax.swing.JPasswordField();
+ hostRemoteLabel = new javax.swing.JLabel();
+ hostRemoteField = new javax.swing.JTextField();
+
+ setName(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.displayName")); // NOI18N
+ setPreferredSize(new java.awt.Dimension(602, 304));
+
+ hostLocalLabel.setLabelFor(hostLocalField);
+ org.openide.awt.Mnemonics.setLocalizedText(hostLocalLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.hostLabel")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(localIpCB, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.localIpCB")); // NOI18N
+ localIpCB.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ localIpCBActionPerformed(evt);
+ }
+ });
+
+ hostLocalField.setEditable(true);
+
+ dasPortLabel.setLabelFor(dasPortField);
+ org.openide.awt.Mnemonics.setLocalizedText(dasPortLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.dasPortLabel")); // NOI18N
+
+ dasPortField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.dasPortField.text")); // NOI18N
+
+ httpPortLabel.setLabelFor(httpPortField);
+ org.openide.awt.Mnemonics.setLocalizedText(httpPortLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.httpPortLabel")); // NOI18N
+
+ httpPortField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.httpPortField.text")); // NOI18N
+
+ domainLabel.setLabelFor(domainField);
+ org.openide.awt.Mnemonics.setLocalizedText(domainLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.domainLabel")); // NOI18N
+
+ domainField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.domainField.text")); // NOI18N
+
+ targetLabel.setLabelFor(targetField);
+ org.openide.awt.Mnemonics.setLocalizedText(targetLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.targetLabel")); // NOI18N
+
+ targetField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.targetField.text")); // NOI18N
+
+ installationLocationLabel.setLabelFor(installationLocationField);
+ org.openide.awt.Mnemonics.setLocalizedText(installationLocationLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.InstallationlocationLabel")); // NOI18N
+
+ installationLocationField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.installationLocationField.text")); // NOI18N
+
+ domainsFolderLabel.setLabelFor(domainsFolderField);
+ org.openide.awt.Mnemonics.setLocalizedText(domainsFolderLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.domainsFolderLabel")); // NOI18N
+
+ domainsFolderField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.domainsFolderField.text")); // NOI18N
+
+ userNameLabel.setLabelFor(userNameField);
+ org.openide.awt.Mnemonics.setLocalizedText(userNameLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.userNameLabel")); // NOI18N
+
+ userNameField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.userNameField.text")); // NOI18N
+
+ passwordLabel.setLabelFor(passwordField);
+ org.openide.awt.Mnemonics.setLocalizedText(passwordLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.passwordLabel")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(commetSupport, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.commetSupport")); // NOI18N
+ commetSupport.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ commetSupportActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(preserveSessions, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.preserveSessions")); // NOI18N
+ preserveSessions.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ preserveSessionsActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(httpMonitor, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.httpMonitor")); // NOI18N
+ httpMonitor.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ httpMonitorActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(startDerby, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.startDerby")); // NOI18N
+ startDerby.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ startDerbyActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(jdbcDriverDeployment, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.jdbcDriverDeployment")); // NOI18N
+ jdbcDriverDeployment.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jdbcDriverDeploymentActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(showPassword, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstanceLocalPanel.showPassword")); // NOI18N
+ showPassword.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ showPasswordActionPerformed(evt);
+ }
+ });
+
+ passwordField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.passwordField.text")); // NOI18N
+
+ hostRemoteLabel.setLabelFor(domainsFolderField);
+ org.openide.awt.Mnemonics.setLocalizedText(hostRemoteLabel, org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.hostRemoteLabel.text")); // NOI18N
+
+ hostRemoteField.setText(org.openide.util.NbBundle.getMessage(InstancePanel.class, "InstancePanel.hostRemoteField.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(installationLocationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(domainsFolderLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(hostRemoteLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(domainsFolderField)
+ .addComponent(installationLocationField)
+ .addComponent(hostRemoteField)))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(hostLocalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(domainLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(dasPortLabel)
+ .addComponent(userNameLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(hostLocalField, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(localIpCB))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(domainField, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(dasPortField, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(userNameField, javax.swing.GroupLayout.Alignment.LEADING))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(httpPortLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(targetLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(passwordLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(httpPortField)
+ .addComponent(targetField)
+ .addComponent(passwordField)))))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jdbcDriverDeployment, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
+ .addComponent(httpMonitor, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(commetSupport, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(preserveSessions, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
+ .addComponent(startDerby, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(showPassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
+ .addContainerGap())
+ );
+
+ layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {dasPortLabel, domainLabel, hostLocalLabel, httpPortLabel, passwordLabel, targetLabel, userNameLabel});
+
+ layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {domainsFolderLabel, installationLocationLabel});
+
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(installationLocationLabel)
+ .addComponent(installationLocationField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(domainsFolderLabel)
+ .addComponent(domainsFolderField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(hostRemoteLabel)
+ .addComponent(hostRemoteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(hostLocalLabel)
+ .addComponent(hostLocalField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(localIpCB))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(dasPortLabel)
+ .addComponent(dasPortField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(httpPortLabel)
+ .addComponent(httpPortField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(domainLabel)
+ .addComponent(domainField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(targetLabel)
+ .addComponent(targetField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
+ .addComponent(userNameField)
+ .addComponent(passwordLabel)
+ .addComponent(userNameLabel)
+ .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(commetSupport)
+ .addComponent(showPassword))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(httpMonitor)
+ .addComponent(preserveSessions))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jdbcDriverDeployment)
+ .addComponent(startDerby))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void commetSupportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_commetSupportActionPerformed
+ cometSupportFlag = commetSupport.isSelected();
+ }//GEN-LAST:event_commetSupportActionPerformed
+
+ private void preserveSessionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_preserveSessionsActionPerformed
+ preserverSessionsFlag = preserveSessions.isSelected();
+ }//GEN-LAST:event_preserveSessionsActionPerformed
+
+ private void showPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showPasswordActionPerformed
+ updatePasswordVisibility();
+ }//GEN-LAST:event_showPasswordActionPerformed
+
+ private void httpMonitorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_httpMonitorActionPerformed
+ httpMonitorFlag = httpMonitor.isSelected();
+ }//GEN-LAST:event_httpMonitorActionPerformed
+
+ private void jdbcDriverDeploymentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jdbcDriverDeploymentActionPerformed
+ jdbcDriverDeploymentFlag = jdbcDriverDeployment.isSelected();
+ }//GEN-LAST:event_jdbcDriverDeploymentActionPerformed
+
+ private void startDerbyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startDerbyActionPerformed
+ startDerbyFlag = startDerby.isSelected();
+ }//GEN-LAST:event_startDerbyActionPerformed
+
+ private void localIpCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localIpCBActionPerformed
+ loopbackFlag = localIpCB.isSelected();
+ Object hostValue = hostLocalField.getEditor().getItem();
+ hostLocalField.setEnabled(false);
+ ((IpComboBox)hostLocalField).updateModel(ips, localIpCB.isSelected());
+ if (hostValue instanceof IpComboBox.InetAddr) {
+ ((IpComboBox)hostLocalField).setSelectedIp(
+ ((IpComboBox.InetAddr)hostValue).getIp());
+ } else if (hostValue instanceof String) {
+ ((IpComboBox)hostLocalField).getEditor().setItem((String)hostValue);
+ } else {
+ ((IpComboBox)hostLocalField).setSelectedItem(null);
+ }
+ hostLocalField.setEnabled(true);
+ }//GEN-LAST:event_localIpCBActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ protected javax.swing.JCheckBox commetSupport;
+ protected javax.swing.JTextField dasPortField;
+ protected javax.swing.JLabel dasPortLabel;
+ protected javax.swing.JTextField domainField;
+ protected javax.swing.JLabel domainLabel;
+ protected javax.swing.JTextField domainsFolderField;
+ protected javax.swing.JLabel domainsFolderLabel;
+ protected javax.swing.JComboBox hostLocalField;
+ protected javax.swing.JLabel hostLocalLabel;
+ protected javax.swing.JTextField hostRemoteField;
+ protected javax.swing.JLabel hostRemoteLabel;
+ protected javax.swing.JCheckBox httpMonitor;
+ protected javax.swing.JTextField httpPortField;
+ protected javax.swing.JLabel httpPortLabel;
+ protected javax.swing.JTextField installationLocationField;
+ protected javax.swing.JLabel installationLocationLabel;
+ protected javax.swing.JCheckBox jdbcDriverDeployment;
+ protected javax.swing.JCheckBox localIpCB;
+ protected javax.swing.JPasswordField passwordField;
+ protected javax.swing.JLabel passwordLabel;
+ protected javax.swing.JCheckBox preserveSessions;
+ protected javax.swing.JCheckBox showPassword;
+ protected javax.swing.JCheckBox startDerby;
+ protected javax.swing.JTextField targetField;
+ protected javax.swing.JLabel targetLabel;
+ protected javax.swing.JTextField userNameField;
+ protected javax.swing.JLabel userNameLabel;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceRemotePanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceRemotePanel.java
new file mode 100644
index 0000000..b863e74
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/InstanceRemotePanel.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+
+/**
+ * Remote instance properties editor.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class InstanceRemotePanel extends InstancePanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(InstanceRemotePanel.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of remote Payara server properties editor.
+ * <p/>
+ * @param instance Remote Payara server instance to be modified.
+ */
+ public InstanceRemotePanel(final PayaraInstance instance) {
+ super(instance);
+ domainsFolderLabel.setVisible(false);
+ domainsFolderField.setVisible(false);
+ hostLocalLabel.setVisible(false);
+ hostLocalField.setVisible(false);
+ localIpCB.setVisible(false);
+ domainLabel.setVisible(true);
+ domainField.setVisible(true);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Remote host field initialization.
+ * <p/>
+ * Initialize remote host name field with values stored in Payara
+ * instance object.
+ */
+ @Override
+ protected void initHost() {
+ String hostProperty = instance.getHost();
+ hostRemoteField.setText(hostProperty != null ? hostProperty : "");
+ }
+
+ /**
+ * Port fields initialization.
+ * <p/>
+ * Initialize port fields with values stored in Payara instance object.
+ */
+ @Override
+ protected void initPorts() {
+ dasPortField.setText(Integer.toString(instance.getAdminPort()));
+ httpPortField.setText(Integer.toString(instance.getPort()));
+ }
+
+ /**
+ * Get remote host field value to be stored into local Payara server
+ * instance object properties.
+ * <p/>
+ * @return Remote host field value converted to {@link String}.
+ */
+ @Override
+ protected String getHost() {
+ return hostRemoteField.getText().trim();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Enable form fields that can be modified by user.
+ * <p/>
+ * Set those form fields that can be modified by user as enabled. This
+ * is usually done after form has been initialized when all form fields
+ * are currently disabled.
+ */
+ @Override
+ protected void enableFields() {
+ super.enableFields();
+ hostRemoteField.setEnabled(true);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/IpComboBox.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/IpComboBox.java
new file mode 100644
index 0000000..5cb5d84
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/IpComboBox.java
@@ -0,0 +1,449 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.*;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+
+/**
+ * Combo box to select IP address.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class IpComboBox extends JComboBox<IpComboBox.InetAddr> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>127.0.0.1</code> host name. */
+ public static final String IP_4_127_0_0_1_NAME = "localhost";
+
+ /** RAW byte sequence for <code>127.0.0.1</code>. */
+ private static final byte[] IP_4_127_0_0_1 = initIp127_0_0_1();
+
+ /** Comparator for <code>InetAddr</code> instances to be sorted
+ * in combo box. */
+ private static final IpComboBox.InetAddrComparator ipComparator
+ = new IpComboBox.InetAddrComparator();
+
+ /** Exception message for disabled constructors. */
+ private static final String CONSTRUCTOR_EXCEPTION_MSG =
+ "Data model for a combo box shall not be supplied in constructor.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * RAW byte sequence for <code>127.0.0.1</code> address initializer.
+ * <p/>
+ * Helper method used to initialize {@link IP_4_127_0_0_1} constant value.
+ * <p/>
+ * @return RAW byte sequence for <code>127.0.0.1</code> address
+ */
+ private static byte[] initIp127_0_0_1() {
+ try {
+ return InetAddress.getByName("127.0.0.1").getAddress();
+ // This shall be unreachable.
+ } catch (UnknownHostException uhe) {
+ throw new IllegalStateException(
+ "Could not initialize raw byte sequence for 127.0.0.1");
+ }
+ }
+
+ /**
+ * Verify if provided IP address represents <code>127.0.0.1</code>.
+ * <p/>
+ * @returns Value of <code>true</code> when provided IP address represents
+ * <code>127.0.0.1</code> or <code>false</code> otherwise.
+ */
+ public static boolean isLocalhost(InetAddress ip) {
+ byte[] ipBytes = ip.getAddress();
+ boolean result = IP_4_127_0_0_1.length == ipBytes.length;
+ for (byte i = 0; result && i < ip.getAddress().length; i++)
+ result = IP_4_127_0_0_1[i] == ipBytes[i];
+ return result;
+ }
+ /**
+ * Count number of loop back IP addresses in provided (@link Set).
+ * <p/>
+ * @param ips (@link Set) of IP addresses to analyze. Shall not be null.
+ * @return Number of loop back IP addresses in provided (@link Set).
+ */
+ private static int loopBackCount(final Set<? extends InetAddress> ips) {
+ int count = 0;
+ for (InetAddress ip : ips) {
+ if (ip.isLoopbackAddress()) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ // TODO: Currently default selection is marked in returned array only and
+ // component does not know about index id this default value. Setting
+ // default value as selected requires to iterate over model array.
+ /**
+ * Convert array of {@see InetAddress} objects to array of {@see InetAddr}
+ * objects.
+ * <p/>
+ * @param ipsIn An array of {@see InetAddress} objects to be converted.
+ * @param lopbackOnly Convert loop back addresses only when
+ * <code>true</code>.
+ * @return An array of {@see InetAddr} objects containing
+ * <code>ipsIn</code>.
+ */
+ private static IpComboBox.InetAddr[] toInetAddr(
+ final Set<? extends InetAddress> ipsIn, final boolean lopbackOnly) {
+ int size = ipsIn == null ? 0
+ : lopbackOnly ? loopBackCount(ipsIn) : ipsIn.size();
+ IpComboBox.InetAddr[] ipsOut = new IpComboBox.InetAddr[size];
+ int i = 0;
+ for (InetAddress ip : ipsIn) {
+ if (!lopbackOnly || ip.isLoopbackAddress()) {
+ ipsOut[i++] = new IpComboBox.InetAddr(ip, false);
+ }
+ }
+ Arrays.sort(ipsOut, ipComparator);
+ // Set default IP to 1st loopback address available.
+ boolean gotDefault = false;
+ for (int j = 0; j < ipsOut.length; j++) {
+ if (ipsOut[j].getIp().isLoopbackAddress()) {
+ ipsOut[j].def = true;
+ gotDefault = true;
+ break;
+ }
+ }
+ // Set default IP to 1st address in the list when no loopback address
+ // was fiound.
+ if (!gotDefault && ipsOut.length > 0) {
+ ipsOut[0].def = true;
+ }
+ return ipsOut;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see InetAddr}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(InetAddr[])} instead.
+ * @param comboBoxModel Data model for this combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public IpComboBox(final ComboBoxModel comboBoxModel)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see InetAddr}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(InetAddr[])} instead.
+ * @param items An array of objects to insert into the combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public IpComboBox(final Object items[])
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see InetAddr}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(InetAddr[])} instead.
+ * @param items {@see Vector} of objects to insert into the combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public IpComboBox(final Vector<?> items)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Creates an instance of <code>IpComboBox</code> that contains
+ * all IP addresses of this host.
+ * <p/>
+ * @param lopbackOnly Convert loop back addresses only when
+ * <code>true</code>.
+ */
+ public IpComboBox(final boolean lopbackOnly) {
+ super(new DefaultComboBoxModel(
+ toInetAddr(NetUtils.getHostIP4s(), lopbackOnly)));
+ }
+
+ /**
+ * Creates an instance of <code>IpComboBox</code> that contains
+ * supplied list of IP addresses.
+ * <p/>
+ * @param ips IP addresses to be set as data model for combo box.
+ * @param lopbackOnly Convert loop back addresses only when
+ * <code>true</code>.
+ */
+ public IpComboBox(final Set<? extends InetAddress> ips,
+ final boolean lopbackOnly) {
+ super(new DefaultComboBoxModel(toInetAddr(ips, lopbackOnly)));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Update content of data model to contain all IP addresses of this host.
+ * <p/>
+ * @param lopbackOnly Convert loop back addresses only when
+ * <code>true</code>.
+ */
+ public void updateModel(final boolean lopbackOnly) {
+ setModel(new DefaultComboBoxModel(
+ toInetAddr(NetUtils.getHostIP4s(), lopbackOnly)));
+ }
+
+ /**
+ * Update content of data model to contain supplied list
+ * of IP addresses.
+ * <p/>
+ * @param ips IP addresses to be set as data model for combo box.
+ * @param lopbackOnly Convert loop back addresses only when
+ * <code>true</code>.
+ */
+ public void updateModel(final Set<? extends InetAddress> ips,
+ final boolean lopbackOnly) {
+ setModel(new DefaultComboBoxModel(toInetAddr(ips, lopbackOnly)));
+ }
+
+ /**
+ * Get selected item from the combo box display area as IP address.
+ * <p/>
+ * User modified content
+ * <p/>
+ * @return Selected item from the combo box display area as IP address
+ * or <code>null</code> when there is no selected IP address.
+ */
+ public InetAddress getSelectedIp() {
+ Object item = getSelectedItem();
+ if (item instanceof InetAddr) {
+ return ((InetAddr)item).getIp();
+ } else if (item instanceof String) {
+ InetAddress ip;
+ try {
+ ip = InetAddress.getByName(((String)item).trim());
+ } catch (UnknownHostException | SecurityException ex) {
+ ip = null;
+ }
+ return ip;
+ }
+ return null;
+ }
+
+ /**
+ * Get selected item from the combo box display area.
+ * <p/>
+ * @return Selected item from the combo box display area.
+ */
+ @Override
+ public Object getSelectedItem() {
+ Object item = super.getSelectedItem();
+ if ((item instanceof InetAddr)
+ || (item instanceof String) || item == null) {
+ return item;
+ } else {
+ throw new IllegalStateException("Selected item is not IP adress");
+ }
+ }
+
+ /**
+ * Set selected item in the combo box display area to the provided
+ * IP address.
+ * <p/>
+ * @param ip IP address to be set as selected. Default IP address
+ * will be used when provided address is not found.
+ */
+ public void setSelectedIp(final InetAddress ip) {
+ int i, count = dataModel.getSize();
+ int defaultIndex = -1;
+ boolean isSelectedSet = false;
+ for (i = 0; i < count; i++) {
+ InetAddr element = dataModel.getElementAt(i);
+ // Passed IP address has highest priority.
+ if (((InetAddress) ip).equals(
+ element.getIp())) {
+ super.setSelectedItem(element);
+ isSelectedSet = true;
+ break;
+ // Searching for default item in parallel.
+ } else if (element.isDefault()) {
+ defaultIndex = i;
+ }
+ }
+ // Set default or first available when passed IP was noit found.
+ if (!isSelectedSet && count > 0) {
+ super.setSelectedItem(dataModel.getElementAt(
+ defaultIndex >= 0 ? defaultIndex : 0));
+ }
+ }
+
+ /**
+ * Set selected item in the combo box display area to the provided
+ * IP address.
+ * <p/>
+ * Expecting values from previous states of combo box which can be<ul>
+ * <li><code>null</code> to select default value</li>
+ * <li>or <code>String</code> when combo box content was modified
+ * by user</li>
+ * <li>or <code>InetAddr</code> and <code>InetAddress</code> values
+ * containing previous selections.</li></ul>
+ * <p/>
+ * @param ip IP address to be set as selected. Default IP address
+ * will be used when <code>null</code> value is supplied.
+ */
+ @Override
+ public void setSelectedItem(Object ip) {
+ // String means user modified value. Do not rewrite editor content.
+ if (ip instanceof String) {
+ return;
+ }
+ // Select default value for null.
+ if (ip == null) {
+ int i, count = dataModel.getSize();
+ for (i = 0; i < count; i++) {
+ if (dataModel.getElementAt(i).isDefault()) {
+ super.setSelectedItem(dataModel.getElementAt(i));
+ break;
+ }
+ }
+ }
+ // Select IP address from list .
+ if (ip instanceof InetAddr) {
+ setSelectedIp(((InetAddr)ip).getIp());
+ }
+ // Select IP address from list.
+ if (ip instanceof InetAddress) {
+ setSelectedIp((InetAddress)ip);
+ // Pass unknown instance to parrent method.
+ } else {
+ super.setSelectedItem(ip);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Encapsulate {@see InetAddress} object and provide human readable
+ * <code>toString()</code> output for combo box.
+ */
+ public static class InetAddr {
+
+ /** IP address reference. */
+ private final InetAddress ip;
+
+ /** Mark default IP address. */
+ private boolean def;
+
+ /**
+ * Creates an instance of <code>InetAddr</code> object and sets provided
+ * {@see InetAddress} reference.
+ * <p/>
+ * @param addr IP address reference.
+ */
+ InetAddr(final InetAddress ip, final boolean def) {
+ this.ip = ip;
+ this.def = def;
+ }
+
+ /**
+ * Get IP address reference.
+ * <p/>
+ * @return IP address reference.
+ */
+ public InetAddress getIp() {
+ return ip;
+ }
+
+ /**
+ * Get {@see String} representation of this object.
+ * <p/>
+ * @return {@see String} representation of this object.
+ */
+ @Override
+ public String toString() {
+ return isLocalhost(ip) ? IP_4_127_0_0_1_NAME : ip.getHostAddress();
+ }
+
+ /**
+ * Check if this platform is the default platform.
+ * <p/>
+ * @return Value of <code>true</code> if this platform is the default
+ * platform or <code>false</code> otherwise.
+ */
+ public boolean isDefault() {
+ return def;
+ }
+
+ }
+
+ /**
+ * Comparator for <code>InetAddr</code> instances to be sorted in combo box.
+ */
+ public static class InetAddrComparator implements Comparator<InetAddr> {
+
+ /** Comparator for {@link InetAddress} instances to be sorted. */
+ private static final NetUtils.InetAddressComparator
+ INET_ADDRESS_COMPARATOR = new NetUtils.InetAddressComparator();
+
+ /**
+ * Compares values of <code>InetAddr</code> instances.
+ * <p/>
+ * @param ip1 First <code>InetAddr</code> instance to be compared.
+ * @param ip2 Second <code>InetAddr</code> instance to be compared.
+ * @return A negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ */
+ @Override
+ public int compare(final InetAddr ip1, final InetAddr ip2) {
+ return INET_ADDRESS_COMPARATOR.compare(ip1.getIp(), ip2.getIp());
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.form
new file mode 100644
index 0000000..bde3738
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.form
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="resourceEnabledCB" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="userLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="mailHostLabel" alignment="0" min="-2" pref="124" max="-2" attributes="0"/>
+ <Component id="returnLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="mailHostField" alignment="1" pref="188" max="32767" attributes="0"/>
+ <Component id="userField" alignment="1" pref="188" max="32767" attributes="0"/>
+ <Component id="returnField" alignment="0" pref="188" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="mailHostField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="userField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="returnLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="returnField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="userLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Component id="mailHostLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="resourceEnabledCB" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="mailHostLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JavaMailCustomizer.mailHostLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="mailHostField">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="host" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="userLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JavaMailCustomizer.userLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JLabel" name="returnLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JavaMailCustomizer.returnLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="returnField">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="from" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userField">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="user" noResource="true"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="resourceEnabledCB">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JdbcResourceCustomizer.enabled.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="enabled" noResource="true"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.java
new file mode 100644
index 0000000..507c4b6
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaMailCustomizer.java
@@ -0,0 +1,128 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+
+public class JavaMailCustomizer extends BasePanel {
+
+ /** Creates new form JavaMailCustomizer */
+ public JavaMailCustomizer() {
+ initComponents();
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ mailHostLabel = new javax.swing.JLabel();
+ mailHostField = new javax.swing.JTextField();
+ userLabel = new javax.swing.JLabel();
+ returnLabel = new javax.swing.JLabel();
+ returnField = new javax.swing.JTextField();
+ userField = new javax.swing.JTextField();
+ resourceEnabledCB = new javax.swing.JCheckBox();
+
+ org.openide.awt.Mnemonics.setLocalizedText(mailHostLabel, org.openide.util.NbBundle.getMessage(JavaMailCustomizer.class, "JavaMailCustomizer.mailHostLabel.text")); // NOI18N
+
+ mailHostField.setName("host"); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(userLabel, org.openide.util.NbBundle.getMessage(JavaMailCustomizer.class, "JavaMailCustomizer.userLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(returnLabel, org.openide.util.NbBundle.getMessage(JavaMailCustomizer.class, "JavaMailCustomizer.returnLabel.text")); // NOI18N
+
+ returnField.setName("from"); // NOI18N
+
+ userField.setName("user"); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(resourceEnabledCB, org.openide.util.NbBundle.getMessage(JavaMailCustomizer.class, "JdbcResourceCustomizer.enabled.text")); // NOI18N
+ resourceEnabledCB.setName("enabled"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(resourceEnabledCB)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(userLabel)
+ .addComponent(mailHostLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(returnLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(mailHostField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
+ .addComponent(userField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
+ .addComponent(returnField, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(mailHostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(returnLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(returnField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(userLabel)))
+ .addComponent(mailHostLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(resourceEnabledCB)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField mailHostField;
+ private javax.swing.JLabel mailHostLabel;
+ private javax.swing.JCheckBox resourceEnabledCB;
+ private javax.swing.JTextField returnField;
+ private javax.swing.JLabel returnLabel;
+ private javax.swing.JTextField userField;
+ private javax.swing.JLabel userLabel;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.mail-resource."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {mailHostField,userField,returnField,resourceEnabledCB});
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaPlatformsComboBox.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaPlatformsComboBox.java
new file mode 100644
index 0000000..840112e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaPlatformsComboBox.java
@@ -0,0 +1,280 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Vector;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.openide.util.NbBundle;
+
+/**
+ * Combo box containing all Java SE platforms registered in NetBeans
+ * or subset of them.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JavaPlatformsComboBox
+ extends JComboBox<JavaPlatformsComboBox.Platform> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Encapsulate {@see JavaPlatform} object and provide human readable
+ * <code>toString()</code> output for combo box.
+ */
+ public static class Platform {
+
+ /** Java SE platform reference. */
+ private final JavaPlatform platform;
+
+ /**
+ * Creates an instance of <code>Platform</code> object and sets provided
+ * {@see JavaPlatform} reference.
+ * <p/>
+ * @param platform Java SE platform reference.
+ */
+ Platform(final JavaPlatform platform) {
+ this.platform = platform;
+ }
+
+ /**
+ * Get Java SE platform reference.
+ * <p/>
+ * @return Java SE platform reference.
+ */
+ public JavaPlatform getPlatform() {
+ return platform;
+ }
+
+ /**
+ * Get {@see String} representation of this object.
+ * <p/>
+ * @return {@see String} representation of this object.
+ */
+ @Override
+ public String toString() {
+ return platform.getDisplayName();
+ }
+
+ /**
+ * Check if this platform is the default platform.
+ * <p/>
+ * @return Value of <code>true</code> if this platform is the default
+ * platform or <code>false</code> otherwise.
+ */
+ public boolean isDefault() {
+ return platform.equals(JavaPlatform.getDefault());
+ }
+
+ }
+
+ /**
+ * Comparator for <code>Platform</code> instances to be sorted in combo box.
+ */
+ public static class PlatformComparator implements Comparator<Platform> {
+
+ /**
+ * Compares display name values of <code>Platform</code> instances.
+ * <p/>
+ * @param p1 First <code>Platform</code> instance to be compared.
+ * @param p2 Second <code>Platform</code> instance to be compared.
+ * @return A negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ */
+ @Override
+ public int compare(final Platform p1, final Platform p2) {
+ String d1 = p1 != null ? p1.toString() : null;
+ String d2 = p2 != null ? p2.toString() : null;
+ return d1 != null
+ ? (d2 != null ? d1.compareTo(d2) : 1)
+ : (d2 != null ? -1 : 0);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Exception message for disabled constructors. */
+ private static final String CONSTRUCTOR_EXCEPTION_MSG =
+ "Data model for a combo box shall not be supplied in constructor.";
+
+ /** Empty platform display name from properties. */
+ public static final String EMPTY_DISPLAY_NAME = NbBundle.getMessage(
+ JavaPlatformsComboBox.class,
+ "JavaPlatformsComboBox.emptyDisplayName");
+
+ /** Comparator for <code>Platform</code> instances to be sorted
+ * in combo box. */
+ private static final PlatformComparator platformComparator
+ = new PlatformComparator();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert array of {@see JavaPlatform} objects to array of {@see Platform}
+ * objects.
+ * <p/>
+ * @param platformsIn An array of {@see JavaPlatform} objects
+ * to be converted.
+ * @return An array of {@see Platform} objects containing
+ * <code>platformsIn</code>.
+ */
+ private static Platform[] toPlatform(JavaPlatform[] platformsIn) {
+ int size = platformsIn != null ? platformsIn.length : 0;
+ Platform[] platformsOut = new Platform[size];
+ for(int i = 0; i < size; i++)
+ platformsOut[i] = new Platform(platformsIn[i]);
+ Arrays.sort(platformsOut, platformComparator);
+ return platformsOut;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see JavaPlatform}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(JavaPlatform[])} instead.
+ * @param comboBoxModel Data model for this combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public JavaPlatformsComboBox(final ComboBoxModel comboBoxModel)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see JavaPlatform}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(JavaPlatform[])} instead.
+ * @param items An array of objects to insert into the combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public JavaPlatformsComboBox(final Object items[])
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Default {@see JComboBox} constructor is disabled because it's content
+ * is retrieved from an array of {@see JavaPlatform}.
+ * <p/>
+ * @deprecated Use {@see #JavaPlatformsComboBox()}
+ * or {@see #JavaPlatformsComboBox(JavaPlatform[])} instead.
+ * @param items {@see Vector} of objects to insert into the combo box.
+ * @throws UnsupportedOperationException is thrown any time
+ * this constructor is called.
+ */
+ public JavaPlatformsComboBox(final Vector<?> items)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(CONSTRUCTOR_EXCEPTION_MSG);
+ }
+
+ /**
+ * Creates an instance of <code>JavaPlatformsComboBox</code> that contains
+ * all Java SE platforms registered in NetBeans.
+ */
+ public JavaPlatformsComboBox() {
+ super(new DefaultComboBoxModel(toPlatform(
+ JavaPlatformManager.getDefault().getInstalledPlatforms())));
+ }
+
+ /**
+ * Creates an instance of <code>JavaPlatformsComboBox</code> that contains
+ * supplied list of Java SE platforms.
+ * <p/>
+ * @param platforms Java SE platforms to be set as data model for combo box.
+ */
+ public JavaPlatformsComboBox(final JavaPlatform[] platforms) {
+ super(new DefaultComboBoxModel(toPlatform(platforms)));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Update content of data model to contain all Java SE platforms currently
+ * registered in NetBeans
+ */
+ public void updateModel() {
+ setModel(new DefaultComboBoxModel(toPlatform(
+ JavaPlatformManager.getDefault().getInstalledPlatforms())));
+ }
+
+ /**
+ * Update content of data model to contain supplied list
+ * of Java SE platforms.
+ * <p/>
+ * @param platforms Java SE platforms to be set as data model for combo box.
+ */
+ public void updateModel(final JavaPlatform[] platforms) {
+ setModel(new DefaultComboBoxModel(toPlatform(platforms)));
+ }
+
+ /**
+ * Set selected item in the combo box display area to the provided Java SE
+ * platform.
+ * <p/>
+ * @param platform Java SE platform to be set as selected. Default platform
+ * will be used when <code>null</code> value is supplied.
+ */
+ @Override
+ public void setSelectedItem(Object platform) {
+ if (platform == null) {
+ platform = JavaPlatform.getDefault();
+ }
+ if (platform instanceof JavaPlatform) {
+ int i, count = dataModel.getSize();
+ for (i = 0; i < count; i++) {
+ if (((JavaPlatform) platform).getDisplayName().equals(
+ (dataModel.getElementAt(i))
+ .getPlatform().getDisplayName())) {
+ super.setSelectedItem(dataModel.getElementAt(i));
+ break;
+ }
+ }
+ } else {
+ super.setSelectedItem(platform);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.form
new file mode 100644
index 0000000..1e5c69e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.form
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 200]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="" noResource="true"/>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="messageLabel" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="javaLabel" min="-2" max="-2" attributes="0"/>
+ <Component id="propertiesLabel" alignment="1" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="javaComboBox" pref="232" max="32767" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="platformButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Component id="propertiesCheckBox" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="messageLabel" min="-2" pref="67" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="javaLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="javaComboBox" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="platformButton" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="propertiesCheckBox" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="propertiesLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="13" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="messageLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.message" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="javaComboBox">
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JavaPlatformsComboBox(javaPlatforms)"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JLabel" name="javaLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.javaLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="propertiesLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.propertiesLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="propertiesCheckBox">
+ <Properties>
+ <Property name="selected" type="boolean" value="true"/>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="platformButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.platformButtonText" type="code"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JButton(platformButtonAction)"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.java
new file mode 100644
index 0000000..25877cf
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JavaSEPlatformPanel.java
@@ -0,0 +1,337 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.utils.JavaUtils;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import static org.openide.NotifyDescriptor.OK_OPTION;
+import static org.openide.NotifyDescriptor.CANCEL_OPTION;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+
+/**
+ * Warning panel showing an information about unsupported Java SE platform used
+ * and allowing user to select another one from Java SE platforms registered
+ * in NetBeans.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JavaSEPlatformPanel extends JPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Action to invoke Java SE platforms customizer.
+ */
+ private class PlatformAction extends AbstractAction {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ PlatformsCustomizer.showCustomizer(javaPlatform());
+ javaPlatforms = JavaUtils.findSupportedPlatforms(instance);
+ ((JavaPlatformsComboBox)javaComboBox).updateModel(javaPlatforms);
+ setDescriptorButtons(descriptor, javaPlatforms);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(JavaSEPlatformPanel.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set buttons in user notification descriptor depending on Java SE
+ * platforms.
+ * <p/>
+ * This method is used in constructor so it's better to be static.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param javaPlatforms Java SE JDK selection content.
+ */
+ private void setDescriptorButtons(
+ NotifyDescriptor descriptor, JavaPlatform[] javaPlatforms) {
+ if (javaPlatforms == null || javaPlatforms.length == 0) {
+ descriptor.setOptions(new Object[] {CANCEL_OPTION});
+ } else {
+ descriptor.setOptions(new Object[] {OK_OPTION, CANCEL_OPTION});
+ }
+ }
+
+ /**
+ * Display Payara Java SE selector to allow switch Java SE used
+ * to run Payara.
+ * <p/>
+ * Selected Java SE is stored in server instance properties and returned
+ * by this method. Properties are persisted.
+ * <p/>
+ * @param instance Payara server instance to be started.
+ * @param javaHome Java SE home currently selected.
+ */
+ public static FileObject selectServerSEPlatform(
+ final PayaraInstance instance, final File javaHome) {
+ FileObject selectedJavaHome = null;
+ // Matching Java SE home installed platform if exists.
+ JavaPlatform platform = JavaUtils.findInstalledPlatform(javaHome);
+ String platformName = platform != null
+ ? platform.getDisplayName() : javaHome.getAbsolutePath();
+ String message = NbBundle.getMessage(
+ JavaSEPlatformPanel.class,
+ "JavaSEPlatformPanel.warning", platformName);
+ String title = NbBundle.getMessage(
+ JavaSEPlatformPanel.class,
+ "JavaSEPlatformPanel.title", platformName);
+ NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
+ null, title, NotifyDescriptor.OK_CANCEL_OPTION,
+ NotifyDescriptor.PLAIN_MESSAGE, null, null);
+ JavaSEPlatformPanel panel = new JavaSEPlatformPanel(
+ notifyDescriptor, instance, message);
+ Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
+ if (button == CANCEL_OPTION) {
+ return selectedJavaHome;
+ }
+ JavaPlatform selectedPlatform = panel.javaPlatform();
+ if (selectedPlatform != null) {
+ Iterator<FileObject> platformIterator
+ = selectedPlatform.getInstallFolders().iterator();
+ if (platformIterator.hasNext()) {
+ selectedJavaHome = (FileObject)platformIterator.next();
+ }
+ }
+ if (selectedJavaHome != null && panel.updateProperties()) {
+ instance.setJavaHome(panel.isJavaPlatformDefault() ? null
+ : FileUtil.toFile(selectedJavaHome).getAbsolutePath());
+ try {
+ PayaraInstance.writeInstanceToFile(instance);
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ }
+ return selectedJavaHome;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server instance used to search for supported platforms. */
+ private final PayaraInstance instance;
+
+ /** Warning message to be shown in the panel. */
+ private final String message;
+
+ /** Java SE JDK selection label. */
+ private final String javaLabelText;
+
+ /** Update properties check box label. */
+ private final String propertiesLabelText;
+
+ /** Platform customizer button label. */
+ private final String platformButtonText;
+
+ /** Platform customizer button action. */
+ private final PlatformAction platformButtonAction;
+
+ /** Java SE JDK selection content. */
+ JavaPlatform[] javaPlatforms;
+
+ /** User notification descriptor. */
+ private final NotifyDescriptor descriptor;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates new Java SE platform selection panel with message.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param instance Payara server instance used to search
+ * for supported platforms.
+ * @param message Warning text.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ public JavaSEPlatformPanel(final NotifyDescriptor descriptor,
+ final PayaraInstance instance, final String message) {
+ this.descriptor = descriptor;
+ this.instance = instance;
+ this.message = message;
+ this.javaLabelText = NbBundle.getMessage(
+ JavaSEPlatformPanel.class,
+ "JavaSEPlatformPanel.javaLabel");
+ this.propertiesLabelText = NbBundle.getMessage(
+ JavaSEPlatformPanel.class,
+ "JavaSEPlatformPanel.propertiesLabel");
+ this.platformButtonText = NbBundle.getMessage(
+ JavaSEPlatformPanel.class,
+ "JavaSEPlatformPanel.platformButton");
+ this.platformButtonAction = new PlatformAction();
+ javaPlatforms = JavaUtils.findSupportedPlatforms(instance);
+ descriptor.setMessage(this);
+ setDescriptorButtons(this.descriptor, this.javaPlatforms);
+ initComponents();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // GUI Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve state of properties update check box.
+ * <p/>
+ * @return Returns <code>true</code> when properties update check box
+ * was selected or <code>false</code> otherwise.
+ */
+ boolean updateProperties() {
+ return propertiesCheckBox.isSelected();
+ }
+
+ /**
+ * Retrieve selected Java SE platform from java combo box.
+ * <p/>
+ * @return Returns {@see JavaPlatform} object of selected Java SE platform.
+ */
+ JavaPlatform javaPlatform() {
+ JavaPlatformsComboBox.Platform platform =
+ (JavaPlatformsComboBox.Platform)javaComboBox.getSelectedItem();
+ return platform != null ? platform.getPlatform() : null;
+ }
+
+ /**
+ * Check if selected Java SE platform from java combo box
+ * is the default platform.
+ * <p/>
+ * @return Value of <code>true</code> if this platform is the default
+ * platform or <code>false</code> otherwise.
+ */
+ boolean isJavaPlatformDefault() {
+ JavaPlatformsComboBox.Platform platform =
+ (JavaPlatformsComboBox.Platform)javaComboBox.getSelectedItem();
+ return platform != null ? platform.isDefault() : false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Generated GUI code //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ messageLabel = new javax.swing.JLabel();
+ javaComboBox = new JavaPlatformsComboBox(javaPlatforms);
+ javaLabel = new javax.swing.JLabel();
+ propertiesLabel = new javax.swing.JLabel();
+ propertiesCheckBox = new javax.swing.JCheckBox();
+ platformButton = new javax.swing.JButton(platformButtonAction);
+
+ setMaximumSize(new java.awt.Dimension(500, 200));
+ setMinimumSize(new java.awt.Dimension(500, 150));
+ setName(""); // NOI18N
+ setPreferredSize(new java.awt.Dimension(500, 150));
+
+ org.openide.awt.Mnemonics.setLocalizedText(messageLabel, this.message);
+
+ org.openide.awt.Mnemonics.setLocalizedText(javaLabel, this.javaLabelText);
+
+ org.openide.awt.Mnemonics.setLocalizedText(propertiesLabel, this.propertiesLabelText);
+
+ propertiesCheckBox.setSelected(true);
+ propertiesCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+
+ org.openide.awt.Mnemonics.setLocalizedText(platformButton, this.platformButtonText);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(messageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(javaLabel)
+ .addComponent(propertiesLabel, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(javaComboBox, 0, 232, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(platformButton))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(propertiesCheckBox)
+ .addGap(0, 0, Short.MAX_VALUE)))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(messageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(javaLabel)
+ .addComponent(javaComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(platformButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(propertiesCheckBox)
+ .addComponent(propertiesLabel))
+ .addContainerGap(13, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JComboBox javaComboBox;
+ private javax.swing.JLabel javaLabel;
+ private javax.swing.JLabel messageLabel;
+ private javax.swing.JButton platformButton;
+ private javax.swing.JCheckBox propertiesCheckBox;
+ private javax.swing.JLabel propertiesLabel;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.form
new file mode 100644
index 0000000..17fce21
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.form
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="resourceEnabledCB" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="poolNameLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
+ <Component id="poolNameCombo" pref="260" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="poolNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="poolNameCombo" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="resourceEnabledCB" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="poolNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="poolNameCombo"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JdbcResourceCustomizer.poolNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="resourceEnabledCB">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="JdbcResourceCustomizer.enabled.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="enabled" noResource="true"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="poolNameCombo">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="1">
+ <StringItem index="0" value="fetching data...."/>
+ </StringArray>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="resources\.jdbc-connection-pool\..*\.name" noResource="true"/>
+ <Property name="name" type="java.lang.String" value="pool-name" noResource="true"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.java
new file mode 100644
index 0000000..d763ef1
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/JdbcResourceCustomizer.java
@@ -0,0 +1,103 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.Component;
+import java.util.Arrays;
+import java.util.List;
+import org.openide.util.NbBundle;
+
+public class JdbcResourceCustomizer extends BasePanel {
+
+ /** Creates new form JdbcResourceCustomizer */
+ public JdbcResourceCustomizer() {
+ initComponents();
+ String val = NbBundle.getMessage(JdbcResourceCustomizer.class, "MSG_FETCHING_DATA");
+ poolNameCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { val }));
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ poolNameLabel = new javax.swing.JLabel();
+ resourceEnabledCB = new javax.swing.JCheckBox();
+ poolNameCombo = new javax.swing.JComboBox();
+
+ poolNameLabel.setLabelFor(poolNameCombo);
+ org.openide.awt.Mnemonics.setLocalizedText(poolNameLabel, org.openide.util.NbBundle.getMessage(JdbcResourceCustomizer.class, "JdbcResourceCustomizer.poolNameLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(resourceEnabledCB, org.openide.util.NbBundle.getMessage(JdbcResourceCustomizer.class, "JdbcResourceCustomizer.enabled.text")); // NOI18N
+ resourceEnabledCB.setName("enabled"); // NOI18N
+
+ poolNameCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "fetching data...." }));
+ poolNameCombo.setActionCommand("resources\\.jdbc-connection-pool\\..*\\.name"); // NOI18N
+ poolNameCombo.setName("pool-name"); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(resourceEnabledCB)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(poolNameLabel)
+ .addGap(2, 2, 2)
+ .addComponent(poolNameCombo, 0, 260, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(poolNameLabel)
+ .addComponent(poolNameCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(resourceEnabledCB)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JComboBox poolNameCombo;
+ private javax.swing.JLabel poolNameLabel;
+ private javax.swing.JCheckBox resourceEnabledCB;
+ // End of variables declaration//GEN-END:variables
+
+ protected String getPrefix() {
+ return "resources.jdbc-resource."; // NOI18N
+ }
+
+ protected List<Component> getDataComponents() {
+ return Arrays.asList(new Component[] {poolNameCombo,resourceEnabledCB});
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.form
new file mode 100644
index 0000000..0585d04
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.form
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.4" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 200]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="messageLabel" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" alignment="1" attributes="0">
+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
+ <Component id="passwordLabel" alignment="0" max="32767" attributes="0"/>
+ <Component id="userLabel" alignment="0" pref="150" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="userText" pref="314" max="32767" attributes="0"/>
+ <Component id="password" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="messageLabel" min="-2" pref="67" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="userLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="userText" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="passwordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="password" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="15" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="messageLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.message" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="userLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.userLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="passwordLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.passwordLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userText">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.instance.getAdminUser()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="password">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.instance.getAdminPassword()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.java
new file mode 100644
index 0000000..2349abf
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraCredentials.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import static org.openide.NotifyDescriptor.CANCEL_OPTION;
+import org.openide.util.NbBundle;
+
+/**
+ * Input Payara credentials (username and password).
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraCredentials extends CommonPasswordPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraCredentials.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Display Payara credentials panel to get Payara credentials.
+ * <p/>
+ * User name and password is stored in server instance properties.
+ * Properties are persisted.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Value of <code>true</code> when Payara credentials were
+ * updated of <code>false</code> when <code>Cancel</code> button
+ * was selected.
+ */
+ public static boolean setCredentials(final PayaraInstance instance,
+ final String message) {
+ String title = NbBundle.getMessage(
+ PayaraPassword.class, "PayaraCredentials.title");
+ NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
+ null, title, NotifyDescriptor.OK_CANCEL_OPTION,
+ NotifyDescriptor.PLAIN_MESSAGE, null, null);
+ PayaraCredentials panel
+ = new PayaraCredentials(notifyDescriptor, instance, message);
+ Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
+ if (button == CANCEL_OPTION) {
+ return false;
+ }
+ String userName = panel.getUserName();
+ String password = panel.getPassword();
+ instance.setAdminUser(userName);
+ instance.setAdminPassword(password);
+ try {
+ PayaraInstance.writeInstanceToFile(instance);
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ return true;
+ }
+
+ /**
+ * Display Payara credentials panel to get Payara credentials.
+ * <p/>
+ * User name and password is stored in server instance properties.
+ * Properties are persisted.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Value of <code>true</code> when Payara credentials were
+ * updated of <code>false</code> when <code>Cancel</code> button
+ * was selected.
+ */
+ public static boolean setCredentials(final PayaraInstance instance) {
+ String message = NbBundle.getMessage(
+ PayaraPassword.class,
+ "PayaraCredentials.message", instance.getDisplayName());
+ return setCredentials(instance, message);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates new Payara credentials panel.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param instance Payara server instance used to search
+ * for supported platforms.
+ * @param message Message text.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ public PayaraCredentials(final NotifyDescriptor descriptor,
+ final PayaraInstance instance, final String message) {
+ super(descriptor, instance, message);
+ initComponents();
+ initFileds(true);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // GUI Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get password value from form.
+ * <p/>
+ * @return Password value from form.
+ */
+ String getPassword() {
+ return new String(password.getPassword());
+ }
+
+ /**
+ * Get user name value from form.
+ * <p/>
+ * @return User name value from form.
+ */
+ String getUserName() {
+ return userText.getText();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Clear form fields.
+ */
+ public void clear() {
+ this.password.setText("");
+ this.userText.setText("");
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ messageLabel = new javax.swing.JLabel();
+ userLabel = new javax.swing.JLabel();
+ passwordLabel = new javax.swing.JLabel();
+ userText = new javax.swing.JTextField();
+ password = new javax.swing.JPasswordField();
+
+ setMaximumSize(new java.awt.Dimension(500, 200));
+ setMinimumSize(new java.awt.Dimension(500, 150));
+ setPreferredSize(new java.awt.Dimension(500, 150));
+
+ org.openide.awt.Mnemonics.setLocalizedText(messageLabel, this.message);
+
+ org.openide.awt.Mnemonics.setLocalizedText(userLabel, this.userLabelText);
+
+ org.openide.awt.Mnemonics.setLocalizedText(passwordLabel, this.passwordLabelText);
+
+ userText.setText(this.instance.getAdminUser());
+
+ password.setText(this.instance.getAdminPassword());
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(messageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(passwordLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(userLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(userText, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
+ .addComponent(password))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(messageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(userLabel)
+ .addComponent(userText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(passwordLabel)
+ .addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(15, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel messageLabel;
+ private javax.swing.JPasswordField password;
+ private javax.swing.JLabel passwordLabel;
+ private javax.swing.JLabel userLabel;
+ private javax.swing.JTextField userText;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.form
new file mode 100644
index 0000000..abd2142
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.form
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 200]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[500, 150]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="messageLabel" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="userLabel" alignment="0" pref="150" max="32767" attributes="0"/>
+ <Component id="passwordLabel" alignment="0" max="32767" attributes="0"/>
+ <Component id="passwordVerifyLabel" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="userText" pref="314" max="32767" attributes="0"/>
+ <Component id="password" max="32767" attributes="0"/>
+ <Component id="passwordVerify" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="messageLabel" min="-2" pref="67" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="userLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="userText" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="passwordLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="password" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="passwordVerifyLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="passwordVerify" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="messageLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.message" type="code"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[15, 15]"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="userLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.userLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="passwordLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.passwordLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="passwordVerifyLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.passwordVerifyLabelText" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userText">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.instance.getAdminUser()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="password">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.instance.getAdminPassword()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="passwordVerify">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.instance.getAdminPassword()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.java
new file mode 100644
index 0000000..a8a58a2
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPassword.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.event.DocumentListener;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import static org.openide.NotifyDescriptor.CANCEL_OPTION;
+import org.openide.util.NbBundle;
+
+/**
+ * Set or change Payara password panel.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraPassword extends CommonPasswordPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraPassword.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Display Payara password panel to change Payara password.
+ <p/>
+ * Password is stored in server instance properties and returned
+ * by this method. Properties are persisted.
+ * <p/>
+ * @param instance Payara server instance.
+ * @return Password {@see String} when password was successfully changed
+ * or <code>null</code> otherwise.
+ */
+ public static String setPassword(final PayaraInstance instance) {
+ String title = NbBundle.getMessage(PayaraPassword.class, "PayaraPassword.title");
+ String message = NbBundle.getMessage(PayaraPassword.class,
+ "PayaraPassword.message", instance.getDisplayName());
+ NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
+ null, title, NotifyDescriptor.OK_CANCEL_OPTION,
+ NotifyDescriptor.PLAIN_MESSAGE, null, null);
+ PayaraPassword panel
+ = new PayaraPassword(notifyDescriptor, instance, message);
+ Object button = DialogDisplayer.getDefault().notify(notifyDescriptor);
+ if (button == CANCEL_OPTION) {
+ return null;
+ }
+ String password = panel.getPassword();
+ instance.setAdminPassword(password);
+ try {
+ PayaraInstance.writeInstanceToFile(instance);
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ return password;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Password verification label. */
+ private final String passwordVerifyLabelText;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates new Payara password panel.
+ * <p/>
+ * @param descriptor User notification descriptor.
+ * @param instance Payara server instance used to search
+ * for supported platforms.
+ * @param message Message text.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ public PayaraPassword(final NotifyDescriptor descriptor,
+ final PayaraInstance instance, final String message) {
+ super(descriptor, instance, message);
+ this.passwordVerifyLabelText = NbBundle.getMessage(PayaraPassword.class,
+ "PayaraPassword.passwordVerifyLabel");
+ initComponents();
+ initFileds(passwordValid());
+ password.getDocument()
+ .addDocumentListener(initPasswordValidateListener());
+ passwordVerify.getDocument()
+ .addDocumentListener(initPasswordValidateListener());
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // GUI Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get password value from form.
+ * <p/>
+ * @return Password value from form.
+ */
+ String getPassword() {
+ return new String(password.getPassword());
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Validators //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Validate password fields.
+ * <p/>
+ * Password fields have the same length and content.
+ * <p/>
+ * @return <code>true</code> when password fields are valid
+ * or <code>false</code> otherwise.
+ */
+ @SuppressWarnings("LocalVariableHidesMemberVariable")
+ final boolean passwordValid() {
+ char[] password1 = password.getPassword();
+ char[] password2 = passwordVerify.getPassword();
+ if (password1.length == password2.length) {
+ boolean valid = true;
+ int i = 0;
+ while(valid && i < password1.length) {
+ valid = password1[i] == password2[i];
+ i += 1;
+ }
+ return valid;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Create event listener to validate account field on the fly.
+ */
+ private DocumentListener initPasswordValidateListener() {
+ return new ComponentFieldListener() {
+ @Override
+ void processEvent() {
+ valid = passwordValid();
+ setDescriptorButtons(descriptor, valid);
+ }
+ };
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Clear form fields to remove password {@see String}s from them.
+ */
+ public void clear() {
+ this.password.setText("");
+ this.passwordVerify.setText("");
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Generated GUI code //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ messageLabel = new javax.swing.JLabel();
+ userLabel = new javax.swing.JLabel();
+ passwordLabel = new javax.swing.JLabel();
+ passwordVerifyLabel = new javax.swing.JLabel();
+ userText = new javax.swing.JTextField();
+ password = new javax.swing.JPasswordField();
+ passwordVerify = new javax.swing.JPasswordField();
+
+ setMaximumSize(new java.awt.Dimension(500, 200));
+ setMinimumSize(new java.awt.Dimension(500, 150));
+ setPreferredSize(new java.awt.Dimension(500, 150));
+
+ org.openide.awt.Mnemonics.setLocalizedText(messageLabel, this.message);
+ messageLabel.setPreferredSize(new java.awt.Dimension(15, 15));
+
+ org.openide.awt.Mnemonics.setLocalizedText(userLabel, this.userLabelText);
+
+ org.openide.awt.Mnemonics.setLocalizedText(passwordLabel, this.passwordLabelText);
+
+ org.openide.awt.Mnemonics.setLocalizedText(passwordVerifyLabel, this.passwordVerifyLabelText);
+
+ userText.setEditable(false);
+ userText.setText(this.instance.getAdminUser());
+
+ password.setText(this.instance.getAdminPassword());
+
+ passwordVerify.setText(this.instance.getAdminPassword());
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(messageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(userLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
+ .addComponent(passwordLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(passwordVerifyLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(userText, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
+ .addComponent(password)
+ .addComponent(passwordVerify))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(messageLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(userLabel)
+ .addComponent(userText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(passwordLabel)
+ .addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(passwordVerifyLabel)
+ .addComponent(passwordVerify, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel messageLabel;
+ private javax.swing.JPasswordField password;
+ private javax.swing.JLabel passwordLabel;
+ private javax.swing.JPasswordField passwordVerify;
+ private javax.swing.JLabel passwordVerifyLabel;
+ private javax.swing.JLabel userLabel;
+ private javax.swing.JTextField userText;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPropertiesCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPropertiesCustomizer.java
new file mode 100644
index 0000000..11ccc21
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/PayaraPropertiesCustomizer.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.spi.CustomizerCookie;
+import org.openide.util.Lookup;
+
+/**
+ * Payara server properties customizer.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraPropertiesCustomizer extends JTabbedPane {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara server properties customizer events handler.
+ */
+ private static class CustomizerListener implements AncestorListener {
+
+ /** Payara server instance being customized. */
+ private final PayaraInstance instance;
+
+ /**
+ * Creates an instance of Payara server properties customizer
+ * events handler.
+ * <p/>
+ * @param instance Payara server instance being customized.
+ */
+ CustomizerListener(final PayaraInstance instance) {
+ this.instance = instance;
+ }
+
+ /**
+ * Called when the source or one of its ancestors is made visible.
+ * <p/>
+ * Currently do nothing.
+ * <p/>
+ * @param event An event reported to listener.
+ */
+ @Override
+ public void ancestorAdded(final AncestorEvent event) {}
+
+ /**
+ * Called when the source or one of its ancestors is made invisible.
+ * <p/>
+ * Persist updated properties.
+ * <p/>
+ * @param event An event reported to listener.
+ */
+ @Override
+ public void ancestorRemoved(final AncestorEvent event) {
+ LOGGER.log(Level.INFO, "Storing {0} atributes",
+ instance.getDisplayName());
+ try {
+ // #254197
+ // this is weird, but prevents reintroducing the instance that
+ // has just been removed from panel (and thus the customizer as
+ // well)
+ if(instance.getInstanceProvider().getInstance(instance.getUrl()) != null) {
+ PayaraInstance.writeInstanceToFile(instance);
+ }
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO,
+ "Could not store Payara server attributes", ex);
+ }
+ }
+
+ /**
+ * Called when either the source or one of its ancestors is moved.
+ * <p/>
+ * Currently do nothing.
+ * <p/>
+ * @param event An event reported to listener.
+ */
+ @Override
+ public void ancestorMoved(final AncestorEvent event) {}
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(PayaraPropertiesCustomizer.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Customizer events listener. */
+ private final CustomizerListener customizerListener;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server properties customizer.
+ * <p/>
+ * @param instance Payara server instance being customized.
+ * @param lookup Payara server instance local lookup.
+ */
+ public PayaraPropertiesCustomizer(
+ PayaraInstance instance, Lookup lookup) {
+ customizerListener = new CustomizerListener(instance);
+ addAncestorListener(customizerListener);
+ JPanel commonCustomizer = instance.isRemote()
+ ? new InstanceRemotePanel(instance)
+ : new InstanceLocalPanel(instance);
+ JPanel vmCustomizer = new VmCustomizer(instance);
+
+ Collection<JPanel> pages = new LinkedList<>();
+ Collection<? extends CustomizerCookie> lookupAll
+ = lookup.lookupAll(CustomizerCookie.class);
+ for(CustomizerCookie cookie : lookupAll) {
+ pages.addAll(cookie.getCustomizerPages());
+ }
+ pages.add(vmCustomizer);
+ add(commonCustomizer);
+ for (JPanel page : pages) {
+ add(page);
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.form
new file mode 100644
index 0000000..72f4de8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.form
@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <NonVisualComponents>
+ <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
+ </Component>
+ </NonVisualComponents>
+ <Properties>
+ <Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_JavaPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="pickerPanel" alignment="0" max="32767" attributes="0"/>
+ <Component id="debugSettingsPanel" alignment="1" max="32767" attributes="0"/>
+ <Component id="useIDEProxyInfo" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="pickerPanel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="8" max="32767" attributes="0"/>
+ <Component id="debugSettingsPanel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="useIDEProxyInfo" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="debugSettingsPanel">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Debug Settings">
+ <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.debugSettingsPanel.border.title.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </TitledBorder>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="useUserDefinedAddress" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="addressValue" min="-2" pref="99" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="136" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="useSharedMemRB" min="-2" max="-2" attributes="0"/>
+ <Component id="useSocketRB" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="useSharedMemRB" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="useSocketRB" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="useUserDefinedAddress" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="addressValue" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JRadioButton" name="useSocketRB">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="buttonGroup1"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.useSocketRB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_UseSockets" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JRadioButton" name="useSharedMemRB">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="buttonGroup1"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.useSharedMemRB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_SharedMem" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="useUserDefinedAddress">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.useUserDefinedAddress.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}", {arguments})"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_UseSelectedAddress" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="toggleAddressUsage"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="addressValue"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_AddressLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JSpinner" name="addressValue">
+ <Properties>
+ <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="0" maximum="65535" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
+ </Property>
+ <Property name="editor" type="javax.swing.JComponent" editor="org.netbeans.modules.form.editors.SpinnerEditorEditor">
+ <SpinnerEditor format="#####" type="3"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="pickerPanel">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="javaInstallLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="javaComboBox" pref="0" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="platformButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="javaInstallLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="javaComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="platformButton" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="javaInstallLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.javaInstallLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_JavaLabel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="javaComboBox">
+ <Properties>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[400, 32767]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[400, 24]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[400, 24]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JavaPlatformsComboBox(javaPlatforms)"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="platformButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.platformButtonText" type="code"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JButton(platformButtonAction)"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JCheckBox" name="useIDEProxyInfo">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="VmCustomizer.useIDEProxyInfo.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="A11Y_DESC_UseIdeProxySettings" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.java
new file mode 100644
index 0000000..323f79e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/VmCustomizer.java
@@ -0,0 +1,419 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.Iterator;
+import javax.swing.AbstractAction;
+import javax.swing.SpinnerNumberModel;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.utils.JavaUtils;
+import org.netbeans.modules.payara.spi.RegisteredDerbyServer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+public class VmCustomizer extends javax.swing.JPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Action to invoke Java SE platforms customizer.
+ */
+ private class PlatformAction extends AbstractAction {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ PlatformsCustomizer.showCustomizer(javaPlatform());
+ javaPlatforms = JavaUtils.findSupportedPlatforms(instance);
+ ((JavaPlatformsComboBox)javaComboBox)
+ .updateModel(javaPlatforms);
+ }
+
+ }
+
+ /**
+ * Port limits: Minimal value. From {
+ *
+// * @see java.net.ServerSocket} constructor source code.
+ */
+ private static int PORT_MIN = 0x00;
+ /**
+ * Port limits: Maximal value. From {
+ *
+ * @see java.net.ServerSocket} constructor source code.
+ */
+ private static int PORT_MAX = 0xFFFF;
+
+ /** Platform customizer button label. */
+ private final String platformButtonText;
+
+ /** Platform customizer button action. */
+ private final PlatformAction platformButtonAction;
+
+ /** Payara server instance to be modified. */
+ private final PayaraInstance instance;
+
+ /** Java SE JDK selection content. */
+ JavaPlatform[] javaPlatforms;
+
+ /**
+ * Creates new form VmCustomizer
+ */
+ public VmCustomizer(final PayaraInstance instance) {
+ this.instance = instance;
+ javaPlatforms = JavaUtils.findSupportedPlatforms(this.instance);
+ this.platformButtonText = NbBundle.getMessage(
+ VmCustomizer.class,
+ "VmCustomizer.platformButton");
+ this.platformButtonAction = new PlatformAction();
+ initComponents();
+ }
+
+ private void initFields() {
+ String address = instance.getProperty(PayaraModule.DEBUG_PORT);
+ SpinnerNumberModel addressModel = (SpinnerNumberModel) addressValue.getModel();
+ javaPlatforms = JavaUtils.findSupportedPlatforms(this.instance);
+ ((JavaPlatformsComboBox)javaComboBox).updateModel(javaPlatforms);
+ javaComboBox.setSelectedItem(instance.getJavaPlatform());
+ if (null == address || "0".equals(address) || "".equals(address)) {
+ useUserDefinedAddress.setSelected(false);
+ } else {
+ useUserDefinedAddress.setSelected(true);
+ setAddressValue(address);
+ }
+ if (Utilities.isWindows() && !instance.isRemote()) {
+ useSharedMemRB.setSelected("true".equals(instance.getProperty(PayaraModule.USE_SHARED_MEM_ATTR)));
+ useSocketRB.setSelected(!("true".equals(instance.getProperty(PayaraModule.USE_SHARED_MEM_ATTR))));
+ } else {
+ // not windows -- disable shared mem and correct it if it was set...
+ // or remote instance....
+ useSharedMemRB.setEnabled(false);
+ useSharedMemRB.setSelected(false);
+ useSocketRB.setSelected(true);
+ }
+ useIDEProxyInfo.setSelected("true".equals(instance.getProperty(PayaraModule.USE_IDE_PROXY_FLAG)));
+ boolean isLocalDomain = instance.getProperty(PayaraModule.DOMAINS_FOLDER_ATTR) != null;
+ this.javaComboBox.setEnabled(isLocalDomain);
+ this.useIDEProxyInfo.setEnabled(isLocalDomain);
+ this.useSharedMemRB.setEnabled(isLocalDomain);
+ }
+
+ /**
+ * Get value of number stored in
+ * <code>addressValue</code> field.
+ * <p/>
+ * @return Value of number stored in
+ * <code>addressValue</code> field.
+ */
+ private Number getAddressValue() {
+ return ((SpinnerNumberModel) addressValue.getModel()).getNumber();
+ }
+
+ /**
+ * Set value of number stored in
+ * <code>addressValue</code> field.
+ * <p/>
+ * Value will be set to <code>0</code> if there is any problem with
+ * retrieving integer value from <code>String</code> argument.
+ * <p/>
+ * @param number Value of number to be stored in
+ * <code>addressValue</code> field.
+ */
+ private void setAddressValue(String number) {
+ try {
+ addressValue.setValue(new Integer(number));
+ } catch (NumberFormatException nfe) {
+ addressValue.setValue(new Integer(0));
+ }
+ }
+
+ /**
+ * Set value of number stored in
+ * <code>addressValue</code> field.
+ * <p/>
+ * Value of <code>null</code> is stored as <code>0</code>.
+ * <p/>
+ * @param number Value of number to be stored in
+ * <code>addressValue</code> field.
+ */
+ private void setAddressValue(Integer number) {
+ addressValue.setValue(number != null ? number : new Integer(0));
+ }
+
+ private void persistFields() {
+ String selectedJavaHome = null;
+ JavaPlatform selectedPlatform
+ = isJavaPlatformDefault() ? null : javaPlatform();
+ if (selectedPlatform != null) {
+ Iterator<FileObject> platformIterator = selectedPlatform.getInstallFolders().iterator();
+ if (platformIterator.hasNext()) {
+ FileObject javaHomeFO = platformIterator.next();
+ selectedJavaHome = javaHomeFO != null
+ ? FileUtil.toFile(javaHomeFO).getAbsolutePath() : null;
+ }
+ }
+ instance.setJavaHome(selectedJavaHome);
+ if (selectedJavaHome != null) {
+ RegisteredDerbyServer db = Lookup.getDefault().lookup(RegisteredDerbyServer.class);
+ if (null != db) {
+ File f = new File(selectedJavaHome);
+ if (f.exists() && f.canRead() && f.isDirectory()) {
+ File dbdir = new File(f, "db"); // NOI18N
+ if (dbdir.exists() && dbdir.isDirectory() && dbdir.canRead()) {
+ db.initialize(dbdir.getAbsolutePath());
+ }
+ }
+ }
+ }
+ instance.putProperty(PayaraModule.USE_SHARED_MEM_ATTR,
+ Boolean.toString(useSharedMemRB.isSelected()));
+ instance.putProperty(PayaraModule.USE_IDE_PROXY_FLAG,
+ Boolean.toString(useIDEProxyInfo.isSelected()));
+ instance.putProperty(PayaraModule.DEBUG_PORT,
+ getAddressValue().toString());
+ }
+
+ @Override
+ public void addNotify() {
+ super.addNotify();
+ initFields();
+ }
+
+ @Override
+ public void removeNotify() {
+ super.removeNotify();
+ persistFields();
+ }
+
+ /**
+ * Retrieve selected Java SE platform from java combo box.
+ * <p/>
+ * @return Returns {@see JavaPlatform} object of selected Java SE platform.
+ */
+ JavaPlatform javaPlatform() {
+ JavaPlatformsComboBox.Platform platform =
+ (JavaPlatformsComboBox.Platform)javaComboBox.getSelectedItem();
+ return platform != null ? platform.getPlatform() : null;
+ }
+
+ /**
+ * Check if selected Java SE platform from java combo box
+ * is the default platform.
+ * <p/>
+ * @return Value of <code>true</code> if this platform is the default
+ * platform or <code>false</code> otherwise.
+ */
+ boolean isJavaPlatformDefault() {
+ JavaPlatformsComboBox.Platform platform =
+ (JavaPlatformsComboBox.Platform)javaComboBox.getSelectedItem();
+ return platform != null ? platform.isDefault() : false;
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ buttonGroup1 = new javax.swing.ButtonGroup();
+ debugSettingsPanel = new javax.swing.JPanel();
+ useSocketRB = new javax.swing.JRadioButton();
+ useSharedMemRB = new javax.swing.JRadioButton();
+ useUserDefinedAddress = new javax.swing.JCheckBox();
+ jLabel1 = new javax.swing.JLabel();
+ addressValue = new javax.swing.JSpinner();
+ pickerPanel = new javax.swing.JPanel();
+ javaInstallLabel = new javax.swing.JLabel();
+ javaComboBox = new JavaPlatformsComboBox(javaPlatforms);
+ platformButton = new javax.swing.JButton(platformButtonAction);
+ useIDEProxyInfo = new javax.swing.JCheckBox();
+
+ setName(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.name")); // NOI18N
+
+ debugSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.debugSettingsPanel.border.title.text"))); // NOI18N
+
+ buttonGroup1.add(useSocketRB);
+ org.openide.awt.Mnemonics.setLocalizedText(useSocketRB, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.useSocketRB.text")); // NOI18N
+
+ buttonGroup1.add(useSharedMemRB);
+ org.openide.awt.Mnemonics.setLocalizedText(useSharedMemRB, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.useSharedMemRB.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(useUserDefinedAddress, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.useUserDefinedAddress.text", new Object[] {})); // NOI18N
+ useUserDefinedAddress.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ toggleAddressUsage(evt);
+ }
+ });
+
+ jLabel1.setLabelFor(addressValue);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.jLabel1.text")); // NOI18N
+
+ addressValue.setModel(new javax.swing.SpinnerNumberModel(0, 0, 65535, 1));
+ addressValue.setEditor(new javax.swing.JSpinner.NumberEditor(addressValue, "#####"));
+
+ javax.swing.GroupLayout debugSettingsPanelLayout = new javax.swing.GroupLayout(debugSettingsPanel);
+ debugSettingsPanel.setLayout(debugSettingsPanelLayout);
+ debugSettingsPanelLayout.setHorizontalGroup(
+ debugSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(debugSettingsPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(debugSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(debugSettingsPanelLayout.createSequentialGroup()
+ .addComponent(useUserDefinedAddress)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(addressValue, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 136, Short.MAX_VALUE))
+ .addGroup(debugSettingsPanelLayout.createSequentialGroup()
+ .addGroup(debugSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(useSharedMemRB)
+ .addComponent(useSocketRB))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
+ );
+ debugSettingsPanelLayout.setVerticalGroup(
+ debugSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(debugSettingsPanelLayout.createSequentialGroup()
+ .addComponent(useSharedMemRB)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(useSocketRB)
+ .addGap(8, 8, 8)
+ .addGroup(debugSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(useUserDefinedAddress)
+ .addComponent(jLabel1)
+ .addComponent(addressValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ useSocketRB.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_UseSockets")); // NOI18N
+ useSharedMemRB.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_SharedMem")); // NOI18N
+ useUserDefinedAddress.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_UseSelectedAddress")); // NOI18N
+ jLabel1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_AddressLabel")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(javaInstallLabel, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.javaInstallLabel.text")); // NOI18N
+
+ javaComboBox.setMaximumSize(new java.awt.Dimension(400, 32767));
+ javaComboBox.setMinimumSize(new java.awt.Dimension(400, 24));
+ javaComboBox.setPreferredSize(new java.awt.Dimension(400, 24));
+
+ platformButton.setText(this.platformButtonText);
+
+ javax.swing.GroupLayout pickerPanelLayout = new javax.swing.GroupLayout(pickerPanel);
+ pickerPanel.setLayout(pickerPanelLayout);
+ pickerPanelLayout.setHorizontalGroup(
+ pickerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pickerPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(javaInstallLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(javaComboBox, 0, 1, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(platformButton)
+ .addContainerGap())
+ );
+ pickerPanelLayout.setVerticalGroup(
+ pickerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pickerPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(pickerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(javaInstallLabel)
+ .addComponent(javaComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(platformButton))
+ .addContainerGap())
+ );
+
+ javaInstallLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_JavaLabel")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(useIDEProxyInfo, org.openide.util.NbBundle.getMessage(VmCustomizer.class, "VmCustomizer.useIDEProxyInfo.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(pickerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(debugSettingsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(useIDEProxyInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(pickerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
+ .addComponent(debugSettingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(useIDEProxyInfo)
+ .addGap(19, 19, 19))
+ );
+
+ useIDEProxyInfo.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_UseIdeProxySettings")); // NOI18N
+
+ getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(VmCustomizer.class, "A11Y_DESC_JavaPanel")); // NOI18N
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void toggleAddressUsage(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toggleAddressUsage
+ if (useUserDefinedAddress.isSelected()) {
+ // enable the edit field and fill it in
+ addressValue.setEnabled(true);
+ int debugPort = 9009;
+ try {
+ ServerSocket t = new ServerSocket(0);
+ debugPort = t.getLocalPort();
+ t.close();
+ } catch (IOException ioe) {
+ // I will ignore this nor now.
+ }
+ setAddressValue(new Integer(debugPort));
+ } else {
+ // clear the field and disable it
+ setAddressValue(new Integer(0));
+ addressValue.setEnabled(false);
+ }
+ }//GEN-LAST:event_toggleAddressUsage
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JSpinner addressValue;
+ private javax.swing.ButtonGroup buttonGroup1;
+ private javax.swing.JPanel debugSettingsPanel;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JComboBox javaComboBox;
+ private javax.swing.JLabel javaInstallLabel;
+ private javax.swing.JPanel pickerPanel;
+ private javax.swing.JButton platformButton;
+ private javax.swing.JCheckBox useIDEProxyInfo;
+ private javax.swing.JRadioButton useSharedMemRB;
+ private javax.swing.JRadioButton useSocketRB;
+ private javax.swing.JCheckBox useUserDefinedAddress;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.form
new file mode 100644
index 0000000..713c687
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.form
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[400, 125]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="warningLabel" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="showAgain" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="149" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="warningLabel" pref="80" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="showAgain" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="warningLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="this.warning" type="code"/>
+ </Property>
+ <Property name="verticalAlignment" type="int" value="1"/>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[51, 15]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[51, 15]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[51, 15]"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="showAgain">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/ui/Bundle.properties" key="WarnPanel.showAgain.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.java
new file mode 100644
index 0000000..4e489e8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/ui/WarnPanel.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.ui;
+
+import org.netbeans.modules.payara.common.PayaraSettings;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import static org.openide.NotifyDescriptor.YES_OPTION;
+import org.openide.util.NbBundle;
+
+/**
+ * Warning panel showing warning message and check box to let user enable
+ * or disable showing this warning again in the future.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class WarnPanel extends javax.swing.JPanel {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Display warning message and handle <i>Show this warning next time</i> check box.
+ * <p/>
+ * @param serverName Payara server display name.
+ * @param installRoot Payara server installation root.
+ */
+ public static void pfUnknownVersionWarning(final String serverName,
+ final String installRoot) {
+ if (PayaraSettings.showWindowSystem()) {
+ String warning = NbBundle.getMessage(
+ WarnPanel.class, "WarnPanel.gfUnknownVersionWarning",
+ new String[]{serverName, installRoot});
+ NotifyDescriptor notifyDescriptor = new NotifyDescriptor.Message(
+ warning, NotifyDescriptor.PLAIN_MESSAGE);
+ DialogDisplayer.getDefault().notify(notifyDescriptor);
+ }
+ }
+
+ /**
+ * Display Payara process kill warning message and handle <i>Show this
+ * warning next time</i> check box.
+ * <p/>
+ * @param serverName Payara server display name.
+ * @return Value of <code>true</code> when <code>YES</code> button
+ * was selected or Value of <code>false</code> when <code>NO/code>
+ * button was selected. Always returns true after <i>Show this
+ * warning next time</i> check box was turned on.
+ */
+ public static boolean gfKillWarning(final String serverName) {
+ boolean showAgain = PayaraSettings.getGfKillWarningShowAgain();
+ if (showAgain) {
+ String warning = NbBundle.getMessage(
+ WarnPanel.class, "WarnPanel.GfKillWarning", serverName);
+ String title = NbBundle.getMessage(
+ WarnPanel.class, "WarnPanel.GfKillTitle");
+ WarnPanel panel = new WarnPanel(warning, showAgain);
+ NotifyDescriptor notifyDescriptor = new NotifyDescriptor(
+ panel, title, NotifyDescriptor.YES_NO_OPTION,
+ NotifyDescriptor.PLAIN_MESSAGE, null, null);
+ Object button
+ = DialogDisplayer.getDefault().notify(notifyDescriptor);
+ PayaraSettings.setGfKillWarningShowAgain(panel.showAgain());
+ return button == YES_OPTION;
+ } else {
+ return true;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Warning message to be shown in the panel. */
+ private final String warning;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates new warning panel with show again check box.
+ * <p/>
+ * @param warning Warning text.
+ * @param showAgain Show again selection.
+ */
+ public WarnPanel(String warning, boolean showAgain) {
+ this.warning = warning;
+ initComponents();
+ this.showAgain.setSelected(showAgain);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get value of show again check box.
+ * <p/>
+ * @return Value of show again check box.
+ */
+ public boolean showAgain() {
+ return showAgain.isSelected();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Generated GUI code //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ warningLabel = new javax.swing.JLabel();
+ showAgain = new javax.swing.JCheckBox();
+
+ setPreferredSize(new java.awt.Dimension(400, 125));
+
+ warningLabel.setText(this.warning);
+ warningLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+ warningLabel.setMaximumSize(new java.awt.Dimension(51, 15));
+ warningLabel.setMinimumSize(new java.awt.Dimension(51, 15));
+ warningLabel.setPreferredSize(new java.awt.Dimension(51, 15));
+
+ org.openide.awt.Mnemonics.setLocalizedText(showAgain, org.openide.util.NbBundle.getMessage(WarnPanel.class, "WarnPanel.showAgain.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(warningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(showAgain)
+ .addGap(0, 149, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(warningLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(showAgain)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox showAgain;
+ private javax.swing.JLabel warningLabel;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/AdminKeyFile.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/AdminKeyFile.java
new file mode 100644
index 0000000..7757cdb
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/AdminKeyFile.java
@@ -0,0 +1,668 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.utils;
+
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Base64;
+import java.util.Random;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import static org.netbeans.modules.payara.tooling.utils.ServerUtils.PF_DOMAIN_CONFIG_DIR_NAME;
+import static org.netbeans.modules.payara.tooling.utils.ServerUtils.addPathElement;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara <code>admin-keyfile</code>.
+ * <p/>
+ * This class will be moved into Payara Tooling Library after beta release.
+ * Now it's part of NetBeans to avoid new untested Payara Tooling Library
+ * changes.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class AdminKeyFile {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Parse content of <code>admin-keyfile</code>.
+ * <p/>
+ * Currently <code>admin-keyfile</code> contains one line with 3 fields
+ * separated by ';':<br/>
+ * <ul><li><code><file> :: <line></code></li>
+ * <li><code><line> :: <user> ';' <password hash> ';' <tool> <eol></code></li>
+ * <li><code><eol> :: '\n' || '\r' '\n'</code></li>
+ * <li><code><user> :: [^;\r\n]+</code></li>
+ * <li><code><password hash> :: [^;\r\n]+</code></li>
+ * <li><code><tool> :: [^;\r\n]+</code></li></ul>
+ * Empty values of <code><user></code>,
+ * <code><password hash></code> and <code><tool></code>
+ * are not allowed.
+ */
+ private static class Parser {
+
+ /**
+ * State machine input classes.
+ */
+ private enum Input {
+ /** Content of user, password hash or tool strings. */
+ STRING,
+ /** Separator character. */
+ SEPARATOR,
+ /** CR character, beginning of CRLF sequence. */
+ CR,
+ /** LF Character. */
+ LF;
+
+ /** Enumeration length. */
+ private static final int length = Input.values().length;
+
+ /**
+ * Get input class value for provided character.
+ * <p/>
+ * @param c Character to check tor input class.
+ * @return Input class of provided character.
+ */
+ private static Input value(final char c) {
+ switch (c) {
+ case AdminKeyFile.SEPARATOR:
+ return SEPARATOR;
+ case '\r':
+ return CR;
+ case '\n':
+ return LF;
+ default:
+ return STRING;
+ }
+ }
+ }
+
+ /**
+ * State machine internal states.
+ */
+ private enum State {
+ /** Initial state, expecting user <code>String</code>
+ * 1st character. */
+ START,
+ /** Reading user <code>String</code> characters until
+ * 1st separator. */
+ USER_N,
+ /** Expecting password hash <code>String</code> 1st character. */
+ HASH_S,
+ /** Reading password hash <code>String</code> characters until
+ * 2st separator. */
+ HASH_N,
+ /** Expecting tool <code>String</code> 1st character. */
+ TOOL_S,
+ /** Reading tool <code>String</code> characters until
+ end of line or end of file. */
+ TOOL_N,
+ /** Got '\r', expecting '\n' from EOL. */
+ CR,
+ /** Full line received. */
+ LF,
+ /** Error state. */
+ ERROR;
+
+ /** Enumeration length. */
+ private static final int length = State.values().length;
+
+ /** Transition table for [State, Input]. */
+ private static final State transition[][] = {
+ // STRING SEPARATOR CR LF
+ {USER_N, ERROR, CR, LF}, // START
+ {USER_N, HASH_S, CR, LF}, // USER_N
+ {HASH_N, ERROR, CR, LF}, // HASH_S
+ {HASH_N, TOOL_S, CR, LF}, // HASH_N
+ {TOOL_N, ERROR, CR, LF}, // TOOL_S
+ {TOOL_N, ERROR, CR, LF}, // TOOL_N
+ { ERROR, ERROR, ERROR, LF}, // CR
+ { ERROR, ERROR, ERROR, LF}, // LF
+ { ERROR, ERROR, ERROR, ERROR} // ERROR
+ };
+
+ /**
+ * State machine transition.
+ * <p/>
+ * @param s Current machine state.
+ * @param i current input class.
+ * @return Next machine state.
+ */
+ private static State next(final State s, final Input i) {
+ return transition[s.ordinal()][i.ordinal()];
+ }
+ }
+
+ /** Default user builder size to avoid resizing. */
+ private static final int USER_BUILDER_SIZE = 16;
+
+ /** Default password hash builder size to avoid resizing. */
+ private static final int HASH_BUILDER_SIZE = 96;
+
+ /** Default tool builder size to avoid resizing. */
+ private static final int TOOL_BUILDER_SIZE = 16;
+
+ /** Internal <code>admin-keyfile</code> reader buffer size. */
+ private static final int BUFFER_SIZE = 128;
+
+ /** User <code>String</code> being built. */
+ final StringBuilder user;
+
+ /** Password hash <code>String</code> being built. */
+ final StringBuilder hash;
+
+ /** Tool <code>String</code> being built. */
+ final StringBuilder tool;
+
+ /** Reader on <code>admin-keyfile</code>. */
+ private final Reader in;
+
+ /** Internal buffer for <code>admin-keyfile</code> reader. */
+ private final char buff[];
+
+ /** Number of characters stored in <code>admin-keyfile</code>
+ * reader buffer. */
+ private int len;
+
+ /** Machine internal state. */
+ private State state;
+
+ /**
+ * Creates an instance of <code>admin-keyfile</code> content parser.
+ * <p/>
+ * @param in {@see Reader} on <code>admin-keyfile</code> positioned
+ * at the beginning of the file.
+ */
+ private Parser(final Reader in) {
+ user = new StringBuilder(USER_BUILDER_SIZE);
+ hash = new StringBuilder(HASH_BUILDER_SIZE);
+ tool = new StringBuilder(TOOL_BUILDER_SIZE);
+ this.in = in;
+ buff = new char[BUFFER_SIZE];
+ len = 0;
+ state = State.START;
+ }
+
+ /**
+ * Reads and parses content of <code>admin-keyfile</code>.
+ * <p/>
+ * {@see Reader} provided in constructor is not closed at the end
+ * of reading and parsing. It must be done by method caller.
+ * <p/>
+ * @return Value of <code>true</code> when <code>admin-keyfile</code>
+ * was read successfully or <code>false</code> otherwise.
+ */
+ private boolean parse() {
+ boolean exit = !read();
+ while(!exit) {
+ for (int pos = 0; pos < len; pos++) {
+ state = action(buff[pos]);
+ }
+ exit = !read();
+ }
+ return state == State.TOOL_N || state == State.LF;
+ }
+
+ /**
+ * Read data from <code>admin-keyfile</code> {@see Reader} and store
+ * them into internal buffer.
+ * <p/>
+ * @return Value of <code>true</code> when read finished successfully
+ * or <code>false</code> otherwise.
+ */
+ private boolean read() {
+ try {
+ return (len = in.read(buff)) >= 0;
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ "Error reading admin-keyfile: {0}", ioe.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * Run parser action based on current state and character class.
+ * <p/>
+ * @param c Current character being processed from {@see Reader} buffer.
+ * @return Next state transition based on current state
+ * and character class.
+ */
+ private State action(final char c) {
+ Input cl = Input.value(c);
+ switch (state) {
+ case START: switch (cl) {
+ case STRING:
+ userChar(c);
+ break;
+ } break;
+ case USER_N: switch (cl) {
+ case STRING:
+ userChar(c);
+ break;
+ } break;
+ case HASH_S: switch (cl) {
+ case STRING:
+ hashChar(c);
+ break;
+ } break;
+ case HASH_N: switch (cl) {
+ case STRING:
+ hashChar(c);
+ break;
+ } break;
+ case TOOL_S: switch (cl) {
+ case STRING:
+ toolChar(c);
+ break;
+ } break;
+ case TOOL_N: switch (cl) {
+ case STRING:
+ toolChar(c);
+ break;
+ } break;
+ }
+ return State.next(state, cl);
+ }
+
+ /**
+ * Append current character to user <code>String</code>.
+ * <p/>
+ * @param c Current character from {@see Reader} buffer.
+ */
+ private void userChar(final char c) {
+ user.append(c);
+ }
+
+ /**
+ * Append current character to password hash <code>String</code>.
+ * <p/>
+ * @param c Current character from {@see Reader} buffer.
+ */
+ private void hashChar(final char c) {
+ hash.append(c);
+ }
+
+ /**
+ * Append current character to tool <code>String</code>.
+ * <p/>
+ * @param c Current character from {@see Reader} buffer.
+ */
+ private void toolChar(final char c) {
+ tool.append(c);
+ }
+
+ /**
+ * Get value of user <code>String</code> read
+ * from <code>admin-keyfile</code>.
+ * <p/>
+ * @rerurn Value of user <code>String</code>.
+ */
+ private String getUser() {
+ return user.toString();
+ }
+
+ /**
+ * Get value of password hash <code>String</code> read
+ * from <code>admin-keyfile</code>.
+ * <p/>
+ * @rerurn Value of password hash <code>String</code>.
+ */
+ private String getPasswordHash() {
+ return hash.toString();
+ }
+
+ /**
+ * Get value of tool <code>String</code> read
+ * from <code>admin-keyfile</code>.
+ * <p/>
+ * @rerurn Value of tool <code>String</code>.
+ */
+ private String getTool() {
+ return tool.toString();
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local Payara module logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(AdminKeyFile.class);
+
+ /** Default Payara administrator username. */
+ public static final String DEFAULT_USER = "admin";
+
+ /** Default Payara <code>admin-keyfile</code> file tool. */
+ public static final String DEFAULT_TOOL = "asadmin";
+
+ /** Password reset <code>String</code> in password hash field. */
+ public static final String PASSWORD_RESET = "RESET";
+
+ /** Name of <code>admin-keyfile</code> file. */
+ public static final String ADMIN_KEYFILE_NAME = "admin-keyfile";
+
+ /** Separator of <code>admin-keyfile</code> fields. */
+ public static final char SEPARATOR = ';';
+
+ /** Hash algorithm prefix in <code>admin-keyfile</code>. */
+ public static final char HASH_ALGORITHM_PREFIX = '{';
+
+ /** Hash algorithm suffix in <code>admin-keyfile</code>. */
+ public static final char HASH_ALGORITHM_SUFFIX = '}';
+
+ /** Password encoding used to compute password hash. */
+ public static final String PASSWORD_ENCODING = "UTF-8";
+
+ /** <code>MessageDigest</code> algorithm to encode password. */
+ public static final String HASH_ALGORITHM = "SHA-1";
+
+ /** Hash algorithm name in <code>admin-keyfile</code>. */
+ public static final String HASH_ALGORITHM_GALSSFISH = "SSHA";
+
+ /** End of line. */
+ public static final String EOL = System.getProperty("line.separator");
+
+ /** Default random password length. */
+ public static final int RANDOM_PASSWORD_LENGTH = 12;
+
+ /** Random password character map. */
+ private static final char[] passwordChars = {
+ // Capital letters
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'Y', 'Z',
+ // Lower letters
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+ 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+ 'u', 'v', 'w', 'x', 'y', 'z',
+ // Numeric literals
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ // Special characters
+ '!', '#', '%', '&', '+', '-', '.', '@', '^', '_'
+ };
+
+ /** Random password character map size to use for 1st character. */
+ private static final int CHARS_PW0 = 52;
+
+ /** Random password character map size to use for inner characters. */
+ private static final int CHARS_PW = passwordChars.length;
+
+ /** Random password character map size to use for last character. */
+ private static final int CHARS_PWL= 62;
+
+ /** Minimal password size. Keep this value at least 3. */
+ private static final int MIN_PW_SIZE = 3;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build <code>admin-keyfile</code> path for provided server instance.
+ * <p/>
+ * @param server Payara server instance.
+ * @return Full <code>admin-keyfile</code> path.
+ */
+ public static String buildAdminKeyFilePath(final PayaraServer server) {
+ String domainsFolder = server.getDomainsFolder();
+ String domainName = server.getDomainName();
+ if (domainsFolder == null || domainName == null) {
+ throw new IllegalArgumentException(
+ "Domains folder and domain name shall not be null.");
+ }
+ StringBuilder sb = new StringBuilder(
+ domainsFolder.length() + OsUtils.FILE_SEPARATOR_LENGTH
+ + domainName.length() + OsUtils.FILE_SEPARATOR_LENGTH
+ + PF_DOMAIN_CONFIG_DIR_NAME.length()
+ + OsUtils.FILE_SEPARATOR_LENGTH + ADMIN_KEYFILE_NAME.length());
+ sb.append(domainsFolder);
+ addPathElement(sb, domainName);
+ addPathElement(sb, PF_DOMAIN_CONFIG_DIR_NAME);
+ addPathElement(sb, ADMIN_KEYFILE_NAME);
+ return sb.toString();
+ }
+
+ /**
+ * Generate random password of given length.
+ * <p/>
+ * @param len PAssword length. Minimal size is 3.
+ */
+ public static String randomPassword(int len) {
+ // Update to minimal size.
+ if (len < MIN_PW_SIZE) {
+ len = MIN_PW_SIZE;
+ }
+ Random random = new Random();
+ StringBuilder pw = new StringBuilder(len);
+ if (len > 0) {
+ int inLen = len - 1;
+ pw.append(passwordChars[random.nextInt(CHARS_PW0)]);
+ for (int i = 1; i < inLen; i++) {
+ pw.append(passwordChars[random.nextInt(CHARS_PW)]);
+ }
+ if (len > 1) {
+ pw.append(passwordChars[random.nextInt(CHARS_PWL)]);
+ }
+ }
+ return pw.toString();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara <code>admin-keyfile</code> path. */
+ private final String adminKeyFile;
+
+ /** Payara administrator username stored
+ * in <code>admin-keyfile</code>. */
+ private String user;
+
+ /** Payara administrator password hash stored
+ * in <code>admin-keyfile</code>. */
+ private String passwordHash;
+
+ /** Payara tool stored in <code>admin-keyfile</code>. */
+ private String tool;
+
+ /** Payara administrator password hash contains <code>RESET</code>
+ * <code>String</code>. */
+ private boolean reset;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara <code>admin-keyfile</code>.
+ * <p/>
+ * Default user and tool values and <code>null</code> password hash value
+ * are set.
+ * <p/>
+ * @param server Payara server instance.
+ */
+ public AdminKeyFile(final PayaraServer server) {
+ adminKeyFile = buildAdminKeyFilePath(server);
+ user = DEFAULT_USER;
+ passwordHash = null;
+ tool = DEFAULT_TOOL;
+ reset = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Read Payara <code>admin-keyfile</code> file and store it into
+ * this instance if read successfully.
+ * <p/>
+ * @return Value of <code>true</code> when file was successfully read
+ * and stored or <code>false</code> otherwise.
+ */
+ public boolean read() {
+ boolean success = false;
+ Parser parser = null;
+ Reader in = null;
+ try {
+ in = new FileReader(adminKeyFile);
+ parser = new Parser(in);
+ success = parser.parse();
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO, "Caught IOException when reading {0}: {1}",
+ new Object[] {adminKeyFile, ioe.getMessage()});
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO,
+ "Cannot close {0} Reader", adminKeyFile);
+ }
+ }
+ }
+ if (success && parser != null) {
+ user = parser.getUser();
+ passwordHash = parser.getPasswordHash();
+ tool = parser.getTool();
+ reset = PASSWORD_RESET.equalsIgnoreCase(passwordHash);
+ }
+ return success;
+ }
+
+ /**
+ * Write Payara <code>admin-keyfile</code> file using stored values.
+ * <p/>
+ * @return Value of <code>true</code> when file was successfully written
+ * or <code>false</code> otherwise.
+ */
+ public boolean write() {
+ if (user == null) {
+ throw new IllegalStateException("No user is set");
+ }
+ if (passwordHash == null) {
+ throw new IllegalStateException("No password hash is set");
+ }
+ if (tool == null) {
+ throw new IllegalStateException("No tool is set");
+ }
+ boolean success = true;
+ StringBuilder sb = new StringBuilder(user.length() + 1
+ + passwordHash.length() + 1 + tool.length() + EOL.length());
+ sb.append(user);
+ sb.append(SEPARATOR);
+ sb.append(passwordHash);
+ sb.append(SEPARATOR);
+ sb.append(tool);
+ // Log admin-keyfile content without EOL.
+ LOGGER.log(Level.INFO, "Writting admin-keyfile: {0}", sb.toString());
+ sb.append(EOL);
+ Writer out = null;
+ try {
+ out = new FileWriter(adminKeyFile);
+ out.write(sb.toString());
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO, "Caught IOException when writting {0}: {1}",
+ new Object[] {adminKeyFile, ioe.getMessage()});
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO,
+ "Cannot close {0} Writer", adminKeyFile);
+ }
+ }
+ }
+ return success;
+ }
+
+ /**
+ * Does Payara administrator password hash contains <code>RESET</code>
+ * <code>String</code>?
+ * <p/>
+ * @return Value of <code>true</code> when password hash does contain
+ * <code>RESET</code> <code>String</code> or <code>false</code>
+ * otherwise.
+ */
+ public boolean isReset() {
+ return reset;
+ }
+
+ /**
+ * Update password hash using supplied password <code>String</code>.
+ * <p/>
+ * @param password New password to be set.
+ */
+ public boolean setPassword(final String password) {
+ boolean success = true;
+ byte[] passwordBytes = null;
+ MessageDigest md = null;
+ try {
+ passwordBytes = password.getBytes(PASSWORD_ENCODING);
+ md = MessageDigest.getInstance(HASH_ALGORITHM);
+ } catch (UnsupportedEncodingException uee) {
+ success = false;
+ LOGGER.log(Level.INFO,
+ "Cannot convert password to bytes array: {0}",
+ uee.getMessage());
+ } catch (NoSuchAlgorithmException nae) {
+ success = false;
+ LOGGER.log(Level.INFO,
+ "Cannot initialize message digest to produce {0}: {1}",
+ new Object[] {HASH_ALGORITHM, nae.getMessage()});
+ }
+ if (success && passwordBytes != null && md != null) {
+ Base64.Encoder b64Enc = Base64.getEncoder();
+ md.reset();
+ md.update(passwordBytes);
+ String b64Hash = b64Enc.encodeToString(md.digest());
+ if (b64Hash != null) {
+ StringBuilder sb = new StringBuilder(
+ 1 + HASH_ALGORITHM_GALSSFISH.length()
+ + 1 + b64Hash.length());
+ sb.append(HASH_ALGORITHM_PREFIX);
+ sb.append(HASH_ALGORITHM_GALSSFISH);
+ sb.append(HASH_ALGORITHM_SUFFIX);
+ sb.append(b64Hash);
+ passwordHash = sb.toString();
+ } else {
+ success = false;
+ }
+ }
+ return success;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/JavaUtils.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/JavaUtils.java
new file mode 100644
index 0000000..a6dc1b7
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/JavaUtils.java
@@ -0,0 +1,312 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraJavaSEConfig;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.Specification;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.java.j2seplatform.api.J2SEPlatformCreator;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Parameters;
+
+/**
+ * Java platform utilities.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JavaUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(JavaUtils.class);
+
+ /** Platform display name prefix (including trailing space). */
+ private static final String
+ PF_PLATFORM_DISPLAY_NAME_PREFIX = "JDK ";
+
+ /** Platform display name suffix (including leading space). */
+ private static final String
+ PF_PLATFORM_DISPLAY_NAME_SUFFIX = " (Payara)";
+
+ /** Java SE specification name. */
+ public static final String
+ JAVA_SE_SPECIFICATION_NAME = "j2se";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get installed Java SE platforms.
+ * <p/>
+ * @return Installed Java SE platforms.
+ */
+ public static JavaPlatform[] getInstalledJavaSEPlatforms() {
+ return JavaPlatformManager.getDefault()
+ .getPlatforms(null, new Specification(
+ JAVA_SE_SPECIFICATION_NAME, null));
+ }
+
+ /**
+ * Check if provided Java SE platform is supported by Payara server
+ * instance.
+ * <p/>
+ * @param instance Payara server instance to be started.
+ * @param javaHome Java SE home currently selected.
+ */
+ public static boolean isJavaPlatformSupported(
+ @NonNull final PayaraInstance instance,
+ @NonNull final File javaHome) {
+ // Avoid NPEs and troll developer a bit.
+ Parameters.notNull("instance", instance);
+ Parameters.notNull("javaHome", javaHome);
+ // Java SE platfofms supported by Payara .
+ PayaraJavaSEConfig javaSEConfig
+ = ConfigBuilderProvider.getBuilder(instance)
+ .getJavaSEConfig(instance.getVersion());
+ Set<JavaSEPlatform> supportedPlatforms = javaSEConfig.getPlatforms();
+ // Try to find Java SE home in installed Java SE platformsList first.
+ // It's much faster than external platform version check.
+ JavaPlatform platform = findInstalledPlatform(javaHome);
+ if (platform != null) {
+ JavaSEPlatform javaSEPlatform = JavaSEPlatform.toValue(
+ platform.getSpecification().getVersion().toString());
+ if (javaSEPlatform != null
+ && supportedPlatforms.contains(javaSEPlatform)) {
+ return true;
+ }
+ }
+ // Java SE home was not found in installed Java SE platforms.
+ // Version should be retrieved using external check.
+ String javaExec = org.netbeans.modules.payara.tooling.utils.JavaUtils
+ .javaVmExecutableFullPath(javaHome.getAbsolutePath());
+ org.netbeans.modules.payara.tooling.utils.JavaUtils.JavaVersion version
+ = org.netbeans.modules.payara.tooling.utils.JavaUtils
+ .javaVmVersion(new File(javaExec));
+ JavaSEPlatform javaSEPlatform
+ = version != null ? version.toPlatform() : null;
+ return javaSEPlatform != null
+ && supportedPlatforms.contains(javaSEPlatform);
+ }
+
+ /**
+ * Search provided Java SE home in installed platformsList.
+ * <p/>
+ * @param javaHome Java SE home currently selected.
+ * @return Returns Java SE platform {@see JavaPlatform} object matching
+ * provided Java SE home or <code>null</code> if no such
+ * installed platform was found.
+ */
+ public static JavaPlatform findInstalledPlatform(
+ @NonNull final File javaHome) {
+ // Avoid NPEs and troll developer a bit.
+ Parameters.notNull("javaHome", javaHome);
+ // Scan all install folders of all onstalled platformsList
+ // for Java SE home.
+ JavaPlatform[] platforms = getInstalledJavaSEPlatforms();
+ JavaPlatform javaPlatform = null;
+ for (JavaPlatform platform : platforms) {
+ for (FileObject fo : platform.getInstallFolders()) {
+ if (javaHome.equals(FileUtil.toFile(fo))) {
+ javaPlatform = platform;
+ break;
+ }
+ }
+ if (javaPlatform != null) {
+ break;
+ }
+ }
+ return javaPlatform;
+ }
+
+ /**
+ * Search Java SE with provided java home in provided platforms array.
+ * <p/>
+ * @param javaPlatforms Java SE platforms to search in.
+ * @param javaHome Java SE home to search for.
+ * @return Returns Java SE platform {@see JavaPlatform} object matching
+ * provided Java SE home or <code>null</code> if no such
+ * installed platform was found.
+ */
+ public static JavaPlatform findPlatformByJavaHome(
+ @NonNull final JavaPlatform[] javaPlatforms,
+ @NonNull final File javaHome) {
+ // Avoid NPEs and troll developer a bit.
+ Parameters.notNull("javaPlatforms", javaPlatforms);
+ Parameters.notNull("javaHome", javaHome);
+ // Scan all install folders of all onstalled platformsList
+ // for Java SE home.
+ JavaPlatform javaPlatform = null;
+ for (JavaPlatform platform : javaPlatforms) {
+ for (FileObject fo : platform.getInstallFolders()) {
+ if (javaHome.equals(FileUtil.toFile(fo))) {
+ javaPlatform = platform;
+ break;
+ }
+ }
+ if (javaPlatform != null) {
+ break;
+ }
+ }
+ return javaPlatform;
+ }
+
+ /**
+ * Search for installed Java SE platformsList supported by Payara server.
+ * <p/>
+ * @param instance Payara server instance used to search
+ * for supported platformsList.
+ * @return Returns Array of Java SE platform {@see JavaPlatform} objects
+ * supported by Payara server. Empty array is returned if there
+ * is no such a platform.
+ */
+ public static JavaPlatform[] findSupportedPlatforms(
+ @NonNull final PayaraInstance instance) {
+ // Avoid NPEs and troll developer a bit.
+ Parameters.notNull("instance", instance);
+ // Search for supported Java SE platforms.
+ List<JavaPlatform> platformsList = new LinkedList<JavaPlatform>();
+ JavaPlatform[] allPlatforms = getInstalledJavaSEPlatforms();
+ PayaraJavaSEConfig javaSEConfig
+ = ConfigBuilderProvider.getBuilder(instance)
+ .getJavaSEConfig(instance.getVersion());
+ Set<JavaSEPlatform> supportedPlatforms = javaSEConfig.getPlatforms();
+ // Finish quickly for empty set.
+ if (supportedPlatforms == null || supportedPlatforms.isEmpty()) {
+ return new JavaPlatform[0];
+ }
+ // Processs non-empty set.
+ for (JavaPlatform platform : allPlatforms) {
+ for (FileObject fo : platform.getInstallFolders()) {
+ if (supportedPlatforms.contains(JavaSEPlatform.toValue(
+ platform.getSpecification()
+ .getVersion().toString()))) {
+ platformsList.add(platform);
+ }
+ }
+ }
+ JavaPlatform[] platforms = new JavaPlatform[platformsList.size()];
+ int i = 0;
+ for (JavaPlatform platform : platformsList) {
+ platforms[i++] = platform;
+ }
+ return platforms;
+ }
+
+ /**
+ * Search for first available installed folder in Java SE platform.
+ * <p/>
+ * @param platform Java SE platform to search for first available
+ * installed folder.
+ * @return First available installed folder or <code>null</code> if no such
+ * folder exists.
+ */
+ public static String getJavaHome(JavaPlatform platform) {
+ String javaHome = null;
+ Iterator<FileObject> platformIterator
+ = platform.getInstallFolders().iterator();
+ if (platformIterator.hasNext()) {
+ FileObject javaHomeFO = platformIterator.next();
+ if (javaHomeFO != null) {
+ javaHome = FileUtil.toFile(javaHomeFO).getAbsolutePath();
+ }
+ }
+ return javaHome;
+ }
+
+ /**
+ * Get default Java SE platform home.
+ * <p/>
+ * @return Default Java SE platform home.
+ */
+ public static String getDefaultJavaHome() {
+ return getJavaHome(
+ JavaPlatformManager.getDefault().getDefaultPlatform());
+ }
+
+ /**
+ * Verify Java platform and register it when needed.
+ * <p/>
+ * @param javaHome Installation folder of Java platform.
+ * @return Value of <code>true</code> when Java platform is valid JDK
+ * installation folder or <code>false</code> otherwise.
+ */
+ public static boolean checkAndRegisterJavaPlatform(final String javaHome) {
+ // Value of null is not installation folder of Java platform.
+ if (javaHome == null) {
+ return false;
+ }
+ File javaHomeFile = new File(javaHome);
+ // Java home must be readable directory.
+ if (javaHomeFile.isDirectory() && javaHomeFile.canRead()) {
+ // Check for already registered platforms.
+ if (findInstalledPlatform(javaHomeFile) != null) {
+ return true;
+ }
+ // Otherwise check for Java version and register when valid.
+ File javaVm = new File(org.netbeans.modules.payara.tooling.utils
+ .JavaUtils.javaVmExecutableFullPath(javaHome));
+ if (javaVm.canExecute()) {
+ org.netbeans.modules.payara.tooling.utils.JavaUtils.JavaVersion javaVersion
+ = org.netbeans.modules.payara.tooling.utils
+ .JavaUtils.javaVmVersion(javaVm);
+ if (javaVersion != null) {
+ String platformversion = javaVersion.toPlatform().toString();
+ StringBuilder sb = new StringBuilder(
+ PF_PLATFORM_DISPLAY_NAME_PREFIX.length()
+ + PF_PLATFORM_DISPLAY_NAME_SUFFIX.length()
+ + platformversion.length());
+ sb.append(PF_PLATFORM_DISPLAY_NAME_PREFIX);
+ sb.append(platformversion);
+ sb.append(PF_PLATFORM_DISPLAY_NAME_SUFFIX);
+ try {
+ J2SEPlatformCreator.createJ2SEPlatform(
+ FileUtil.toFileObject(javaHomeFile),
+ sb.toString());
+ return true;
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ "Unable to register Java platform {0}", javaHome);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/ServerUtils.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/ServerUtils.java
new file mode 100644
index 0000000..30635c0
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/ServerUtils.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.common.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+
+/**
+ * Payara server utilities.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ServerUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(ServerUtils.class);
+ /** Domains folder prefix. */
+ private static final String DOMAINS_FOLDER_PREFIX = "GF_";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get the file attribute with the specified name as {@see String}.
+ * <p/>
+ * @param fo File objects on a file system.
+ * @param attrName Name of the attribute.
+ * @return Value of the file attribute with the specified name
+ * or <code>null</code> if no file attribute was found.
+ */
+ public static String getStringAttribute(FileObject fo, String attrName) {
+ return getStringAttribute(fo, attrName, null);
+ }
+
+ /**
+ * Get the file attribute with the specified name as {@see String}.
+ * <p/>
+ * @param fo File objects on a file system.
+ * @param attrName Name of the attribute.
+ * @param defValue Default value of the attribute if no value
+ * is stored in file object.
+ * @return Value of the file attribute with the specified name or default
+ * value if no file attribute was found.
+ */
+ public static String getStringAttribute(FileObject fo, String attrName,
+ String defValue) {
+ String result = defValue;
+ Object attr = fo.getAttribute(attrName);
+ if(attr instanceof String) {
+ result = (String) attr;
+ }
+ return result;
+ }
+
+ /**
+ * Set file attribute of given file object.
+ * <p/>
+ * @param fo File object.
+ * @param key Attribute key.
+ * @param value Attribute value.
+ */
+ public static void setStringAttribute(FileObject fo, String key,
+ String value) {
+ try {
+ fo.setAttribute(key, value);
+ } catch (IOException ioe) {
+ LOGGER.log(Level.WARNING,
+ "Cannot update file object value: {0} -> {1} in {2}",
+ new Object[]{key, value, fo.getPath()});
+ }
+ }
+
+ /**
+ * Get NetBeans repository directory under default configuration file system
+ * root with specified sub path.
+ * <p/>
+ * @param path Path to be appended to default configuration file system
+ * root.
+ * @param create Create path under default configuration file system root
+ * if it does not exist.
+ * @return NetBeans repository directory under default configuration
+ * file system.
+ */
+ public static FileObject getRepositoryDir(String path, boolean create) {
+ FileObject dir = FileUtil.getConfigFile(path);
+ if(dir == null && create) {
+ try {
+ dir = FileUtil.createFolder(FileUtil.getConfigRoot(), path);
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ }
+ return dir;
+ }
+
+ /**
+ * Verify that provided String represents valid readable directory
+ * in file system.
+ * <p/>
+ * @param folderName Path of directory in file system to be verified.
+ */
+ public static boolean isValidFolder(String folderName) {
+ if (folderName == null) {
+ return false;
+ }
+ File f = new File(folderName);
+ return f.isDirectory() && f.canRead();
+ }
+
+ /**
+ * Build domains folder for Payara server using Payara version.
+ * <p/>
+ * Domains folder name is build using all versions number parts
+ * (<code>major</code>, <code>minor</code>, <code>update</code>
+ * and <code>build</code>). But <code>update</code> and <code>build</code>
+ * <p/>
+ * values are used only when they are not part of zero only sequence.<br/>
+ * Folder names for individual Payara server versions will be:<ul>
+ * <li><code>PF_4.1.144</code> for Payara 4.1.144</li>
+ * <li><code>PF_4.1.151</code> for Payara 4.1.151</li>
+ * <p/>
+ * @param instance Payara server to build domains folder for.
+ * @return Domains folder.
+ */
+ public static String getDomainsFolder(@NonNull PayaraInstance instance) {
+ PayaraVersion version = instance.getVersion();
+ if (version == null) {
+ throw new IllegalStateException(NbBundle.getMessage(PayaraInstance.class,
+ "PayaraInstance.getDomainsFolder.versionIsNull",
+ instance.getDisplayName()));
+ }
+ boolean useBuild = version.getBuild() > 0;
+ boolean useUpdate = useBuild || version.getUpdate() > 0;
+ // Allocate 2 characters per version number part and 1 character
+ // per separator.
+ StringBuilder sb = new StringBuilder(DOMAINS_FOLDER_PREFIX.length() + 5
+ + (useUpdate ? (useBuild ? 6 : 3) : 0));
+ sb.append(DOMAINS_FOLDER_PREFIX);
+ sb.append(Short.toString(version.getMajor()));
+ sb.append(PayaraVersion.SEPARATOR);
+ sb.append(Short.toString(version.getMinor()));
+ if (useUpdate) {
+ sb.append(PayaraVersion.SEPARATOR);
+ sb.append(Short.toString(version.getUpdate()));
+ if (useBuild) {
+ sb.append(PayaraVersion.SEPARATOR);
+ sb.append(Short.toString(version.getBuild()));
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Check if Payara server process is still running.
+ * <p/>
+ * @param process Payara server process. May not be <code>null</code>.
+ */
+ public static boolean isProcessRunning(final Process process) {
+ try {
+ process.exitValue();
+ return false;
+ } catch (IllegalThreadStateException itse) {
+ return true;
+ }
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/Util.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/Util.java
new file mode 100644
index 0000000..f362e01
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/utils/Util.java
@@ -0,0 +1,300 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.utils;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.common.PortCollection;
+import org.netbeans.modules.payara.common.parser.TreeParser;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.filesystems.FileUtil;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+/**
+ *
+ * @author vkraemer
+ */
+public final class Util {
+ private static String DOMAIN_XML_PATH = "config/domain.xml";
+
+ private Util() {
+ }
+
+ public static final String PF_LOOKUP_PATH = "Servers/Payara"; // NOI18N
+
+ private static String INDICATOR = File.separatorChar == '/' ? "jrunscript" : "jrunscript.exe";
+ private static FilenameFilter JDK6_DETECTION_FILTER = new FilenameFilter() {
+ @Override
+ public boolean accept(File arg0, String arg1) {
+ if (arg1.equalsIgnoreCase(INDICATOR)) {
+ return true;
+ }
+ return false;
+ }
+ };
+
+ public static boolean appearsToBeJdk6OrBetter(File javaExecutable) {
+ File dir = javaExecutable.getParentFile();
+ if (null != dir) {
+ String[] hits = dir.list(Util.JDK6_DETECTION_FILTER);
+ if (null != hits) {
+ return hits.length > 0;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Add quotes to string if and only if it contains space characters.
+ *
+ * Note: does not handle generalized white space (tabs, localized white
+ * space, etc.)
+ *
+ * @param path file path in string form.
+ * @return quote path if it contains any space characters, otherwise same.
+ */
+ public static String quote(String path) {
+ return path.indexOf(' ') == -1 ? path : "\"" + path + "\""; // NOI18N
+ }
+
+ /**
+ * Add escape characters for backslash and dollar sign characters in
+ * path field.
+ *
+ * @param path file path in string form.
+ * @return adjusted path with backslashes and dollar signs escaped with
+ * backslash character.
+ * @deprecated use spi.Utils.escapePath(String)
+ */
+ @Deprecated
+ public static String escapePath(String path) {
+ return Utils.escapePath(path);
+ }
+
+ /**
+ * Convert classpath fragment using standard separator to a list of
+ * normalized files (nonexistent jars will be removed).
+ *
+ * @param cp classpath string
+ * @param root root folder for expanding relative path names
+ * @return list of existing jars, normalized
+ */
+ public final List<File> classPathToFileList(String cp, File root) {
+ List<File> result = new ArrayList<>();
+ if(cp != null && cp.length() > 0) {
+ String [] jars = cp.split(File.pathSeparator);
+ for(String jar: jars) {
+ File jarFile = new File(jar);
+ if(!jarFile.isAbsolute() && root != null) {
+ jarFile = new File(root, jar);
+ }
+ if(jarFile.exists()) {
+ result.add(FileUtil.normalizeFile(jarFile));
+ }
+ }
+ }
+ return result;
+ }
+
+ public static boolean readServerConfiguration(File domainDir, PortCollection wi) {
+ boolean result = false;
+ File domainXml = new File(domainDir, DOMAIN_XML_PATH);
+ final Map<String, HttpData> httpMap = new LinkedHashMap<>();
+
+ if (domainXml.exists()) {
+ List<TreeParser.Path> pathList = new ArrayList<>();
+ pathList.add(new TreeParser.Path("/domain/configs/config/http-service/http-listener",
+ new TreeParser.NodeReader() {
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ // <http-listener
+ // id="http-listener-1" port="8080" xpowered-by="true"
+ // enabled="true" address="0.0.0.0" security-enabled="false"
+ // family="inet" default-virtual-server="server"
+ // server-name="" blocking-enabled="false" acceptor-threads="1">
+ try {
+ String id = attributes.getValue("id");
+ if(id != null && id.length() > 0) {
+ int port = Integer.parseInt(attributes.getValue("port"));
+ boolean secure = "true".equals(attributes.getValue("security-enabled"));
+ boolean enabled = !"false".equals(attributes.getValue("enabled"));
+ if(enabled) {
+ HttpData data = new HttpData(id, port, secure);
+ Logger.getLogger("payara").log(Level.FINER, " Adding {0}", data); // NOI18N
+ httpMap.put(id, data);
+ } else {
+ Logger.getLogger("payara").log(Level.FINER,
+ "http-listener {0} is not enabled and won''t be used.", id); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara").log(Level.FINEST, "http-listener found with no name");
+ }
+ } catch(NumberFormatException ex) {
+ throw new SAXException(ex);
+ }
+ }
+ }));
+
+ pathList.add(new TreeParser.Path("/domain/configs/config/network-config/network-listeners/network-listener",
+ new TreeParser.NodeReader() {
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ // <http-listener
+ // id="http-listener-1" port="8080" xpowered-by="true"
+ // enabled="true" address="0.0.0.0" security-enabled="false"
+ // family="inet" default-virtual-server="server"
+ // server-name="" blocking-enabled="false" acceptor-threads="1">
+ try {
+ String id = attributes.getValue("name");
+ if(id != null && id.length() > 0) {
+ String portAttr = attributes.getValue("port");
+ if (null == portAttr || portAttr.startsWith("$")) {
+ return;
+ }
+ int port = Integer.parseInt(portAttr);
+ boolean secure = "true".equals(attributes.getValue("security-enabled"));
+ boolean enabled = !"false".equals(attributes.getValue("enabled"));
+ if(enabled) {
+ HttpData data = new HttpData(id, port, secure);
+ Logger.getLogger("payara").log(Level.FINER, " Adding {0}", data); // NOI18N
+ httpMap.put(id, data);
+ } else {
+ Logger.getLogger("payara").log(Level.FINER,
+ "http-listener {0} is not enabled and won''t be used.", id); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara").log(Level.FINEST, "http-listener found with no name");
+ }
+ } catch(NumberFormatException ex) {
+ throw new SAXException(ex);
+ }
+ }
+ }));
+
+ try {
+ TreeParser.readXml(domainXml, pathList);
+
+ // !PW This probably more convoluted than it had to be, but while
+ // http-listeners are usually named "http-listener-1", "http-listener-2", ...
+ // technically they could be named anything.
+ //
+ // For now, the logic is as follows:
+ // admin port is the one named "admin-listener"
+ // http port is the first non-secure enabled port - typically http-listener-1
+ // https port is the first secure enabled port - typically http-listener-2
+ // disabled ports are ignored.
+ //
+ HttpData adminData = httpMap.remove("admin-listener");
+ if (null != wi) {
+ wi.setAdminPort(adminData != null ? adminData.getPort() : -1);
+ }
+
+ HttpData httpData = null;
+ HttpData httpsData = null;
+
+ for(HttpData data: httpMap.values()) {
+ if(data.isSecure()) {
+ if(httpsData == null) {
+ httpsData = data;
+ }
+ } else {
+ if(httpData == null) {
+ httpData = data;
+ }
+ }
+ if(httpData != null && httpsData != null) {
+ break;
+ }
+ }
+
+ int httpPort = httpData != null ? httpData.getPort() : -1;
+ int adminPort = null!=adminData ? adminData.getPort() : -1;
+ if (null != wi) {
+ wi.setHttpPort(httpPort);
+ wi.setHttpsPort(httpsData != null ? httpsData.getPort() : -1);
+ }
+ result = httpPort != -1 && adminPort != -1;
+ } catch(IllegalStateException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ return result;
+ }
+ private static class HttpData {
+
+ private final String id;
+ private final int port;
+ private final boolean secure;
+
+ public HttpData(String id, int port, boolean secure) {
+ this.id = id;
+ this.port = port;
+ this.secure = secure;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public boolean isSecure() {
+ return secure;
+ }
+
+ @Override
+ public String toString() {
+ return "{ " + id + ", " + port + ", " + secure + " }";
+ }
+
+ }
+
+ static public String computeTarget(Map<String, String> ip) {
+ String retVal = null;
+ String url = ip.get(PayaraModule.URL_ATTR);
+ if (null != url) {
+ int lastColon = url.lastIndexOf(':');
+ if (lastColon != -1) {
+ String candidate = url.substring(lastColon+1);
+ if (!Character.isDigit(candidate.charAt(0))) {
+ retVal = candidate;
+ }
+ }
+ }
+ return retVal;
+ }
+
+ static public boolean isDefaultOrServerTarget(Map<String, String> ip) {
+ String target = Util.computeTarget(ip);
+ return null == target || "server".equals(target);
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationPanel.java
new file mode 100644
index 0000000..0d11007
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationPanel.java
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.awt.Component;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.modules.payara.tooling.server.config.PayaraConfigManager;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.ui.IpComboBox;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+
+public class AddDomainLocationPanel implements WizardDescriptor.Panel, ChangeListener {
+
+ private final String PROP_ERROR_MESSAGE = WizardDescriptor.PROP_ERROR_MESSAGE;
+ private final String PROP_WARNING_MESSAGE = WizardDescriptor.PROP_WARNING_MESSAGE;
+ private final String PROP_INFO_MESSAGE = WizardDescriptor.PROP_INFO_MESSAGE;
+
+ private final ServerWizardIterator wizardIterator;
+ private AddDomainLocationVisualPanel component;
+ private WizardDescriptor wizard;
+ private final transient List<ChangeListener> listeners
+ = new CopyOnWriteArrayList<>();
+ private String gfRoot;
+
+ /** Default Java SE platform is supported by selected Payara server. */
+ boolean defaultJavaSESupported;
+
+ /**
+ *
+ * @param instantiatingIterator
+ */
+ public AddDomainLocationPanel(ServerWizardIterator wizardIterator) {
+ this.wizardIterator = wizardIterator;
+ wizard = null;
+ }
+
+ private final AtomicBoolean isValidating = new AtomicBoolean();
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public boolean isValid() {
+ if (isValidating.compareAndSet(false, true)) {
+ try {
+ AddDomainLocationVisualPanel panel = (AddDomainLocationVisualPanel) getComponent();
+ if (wizardIterator.isLocal()) {
+ return validateForLocalDomain(panel);
+ } else {
+ return validateForRemoteDomain(panel);
+ }
+ } finally {
+ isValidating.set(false);
+ }
+ }
+ return true;
+ }
+
+ /**
+ *
+ * @param ev
+ */
+ @Override
+ public void stateChanged(ChangeEvent ev) {
+ fireChangeEvent(ev);
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ listeners.remove(l);
+ }
+
+ private void fireChangeEvent(ChangeEvent ev) {
+ for(ChangeListener listener: listeners) {
+ listener.stateChanged(ev);
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public Component getComponent() {
+ if (component == null) {
+ component = new AddDomainLocationVisualPanel();
+ component.addChangeListener(this);
+ }
+ return component;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public HelpCtx getHelp() {
+ FileObject fo = FileUtil.getConfigFile("Services/JavaHelp/org-netbeans-modules-usersguide-helpset.xml");
+ if (null != fo)
+ return new HelpCtx("registering_app_server_hk2_domain"); //NOI18N
+ else
+ return null;
+ }
+
+ /**
+ *
+ * @param settings
+ */
+ @Override
+ public void readSettings(Object settings) {
+ if (wizard == null) {
+ wizard = (WizardDescriptor) settings;
+ }
+ gfRoot = wizardIterator.getPayaraRoot();
+ ((AddDomainLocationVisualPanel) getComponent())
+ .initModels(gfRoot, wizardIterator.isLocal());
+
+ // Check if default Java SE platform is supported\
+ // by selected Payara server.
+ JavaPlatform defaultJava = JavaPlatform.getDefault();
+ JavaSEPlatform defaultJavaPlatform = JavaSEPlatform.toValue(
+ defaultJava.getSpecification().getVersion().toString());
+ PayaraVersion gpayaraVersion
+ = ServerUtils.getServerVersion(gfRoot);
+ PayaraConfig configAdapter = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(gpayaraVersion));
+ JavaSESet javaSEConfig = configAdapter != null
+ ? configAdapter.getJavaSE() : null;
+ Set<JavaSEPlatform> javaSEPlatfors = javaSEConfig != null
+ ? javaSEConfig.platforms() : null;
+ defaultJavaSESupported = javaSEPlatfors != null
+ ? javaSEPlatfors.contains(defaultJavaPlatform) : false;
+ wizardIterator.serDefaultJavaSESupported(defaultJavaSESupported);
+ }
+
+ /**
+ *
+ * @param settings
+ */
+ @Override
+ public void storeSettings(Object settings) {
+ }
+
+ /**
+ * Sets Payara server target, administrator's user name and password into
+ * wizard iterator.
+ * <p/>
+ * @param wizardIterator Target wizard iterator object.
+ * @param panel Source wizard panel component.
+ */
+ private static void setGlobalValues(ServerWizardIterator wizardIterator, AddDomainLocationVisualPanel panel) {
+ wizardIterator.setTargetValue(panel.getTargetValue());
+ wizardIterator.setUserName(panel.getUserNameValue());
+ wizardIterator.setPassword(panel.getPasswordValue());
+ wizardIterator.setAdminPort(Integer.parseInt(panel.getAdminPortValue()));
+ wizardIterator.setHttpPort(Integer.parseInt(panel.getHttpPortValue()));
+ }
+
+ private String validateLocalHost(final Object rawHost) {
+ if (rawHost instanceof IpComboBox.InetAddr) {
+ return ((IpComboBox.InetAddr)rawHost).toString();
+ } else if (rawHost instanceof String) {
+ String host = (String)rawHost;
+ if (host.length() == 0) {
+ host = IpComboBox.IP_4_127_0_0_1_NAME;
+ }
+ return host;
+ } else {
+ return IpComboBox.IP_4_127_0_0_1_NAME;
+ }
+ }
+
+ private boolean validateForLocalDomain(AddDomainLocationVisualPanel panel) throws MissingResourceException {
+ String domainField = panel.getLocalDomain().trim();
+ File domainDirCandidate = new File(gfRoot, PayaraInstance.DEFAULT_DOMAINS_FOLDER + File.separator + domainField); // NOI18N
+ String host = validateLocalHost(panel.getLocalHost());
+ if (domainField.length() < 1) {
+ if (!Utils.canWrite(domainDirCandidate)) {
+ // the user needs to enter the name of a directory for
+ // a personal domain
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(this.getClass(), "MSG_EnterDomainDirectory")); // NOI18N
+ } else {
+ // the user probably deleted a valid name from the field.
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "MSG_MustHaveName")); // NOI18N
+ }
+ return false;
+ }
+ int dex = domainField.indexOf(File.separator);
+ // Existing domain
+ if (AddServerLocationPanel.isRegisterableDomain(domainDirCandidate, wizardIterator)) {
+ String uri = wizardIterator.formatUri(PayaraInstance.DEFAULT_HOST_NAME, wizardIterator.getAdminPort(), panel.getTargetValue(),
+ new File(gfRoot, PayaraInstance.DEFAULT_DOMAINS_FOLDER).getAbsolutePath(), domainField);
+ if (-1 == wizardIterator.getHttpPort()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_InvalidDomainData", domainField)); // NOI18N
+ return false;
+ }
+ if (-1 == wizardIterator.getAdminPort()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_InvalidDomainData", domainField)); // NOI18N
+ return false;
+ }
+ if (wizardIterator.hasServer(uri)) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_DomainAlreadyRegistered", domainField)); // NOI18N
+ return false;
+ }
+ // the entry resolves to a domain name that we can register
+ wizardIterator.setDomainLocation(domainDirCandidate.getAbsolutePath());
+ // Let's believe to what user provided in UI
+ wizardIterator.setHostName(host);
+ panel.setPortsFields(wizardIterator.getAdminPort(),
+ wizardIterator.getHttpPort(), true);
+ setGlobalValues(wizardIterator, panel);
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(this.getClass(), "MSG_RegisterExistingEmbedded", domainField)); // NOI18N
+ return true;
+ } else {
+ panel.setPortsFields(false);
+ List<String> errors = new LinkedList<>();
+ int dasPort = strToInt(panel.getAdminPortValue(),
+ "AddDomainLocationPanel.invalidDasPort", errors);
+ int httpPort = strToInt(panel.getHttpPortValue(),
+ "AddDomainLocationPanel.invalidHttpPort", errors);
+ if (dasPort < 0 || httpPort < 0) {
+ if(errors.isEmpty()) {
+ if (dasPort < 0){
+ errors.add(NbBundle.getMessage(this.getClass(), "AddDomainLocationPanel.invalidDasPort", dasPort));
+ }
+ if (httpPort < 0){
+ errors.add(NbBundle.getMessage(this.getClass(), "AddDomainLocationPanel.invalidHttpPort", httpPort));
+ }
+ }
+ wizard.putProperty(PROP_ERROR_MESSAGE, joinErrorMessages(errors));
+ return false;
+ }
+ if (dasPort == httpPort) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "AddDomainLocationPanel.duplicatePortAssigned", httpPort));
+ return false;
+ }
+ }
+ File domainsDir = domainDirCandidate.getParentFile();
+ if (Utils.canWrite(domainsDir) && dex < 0 && !ServerUtilities.isTP2(gfRoot) &&
+ !domainDirCandidate.exists()) {
+ wizardIterator.setDomainLocation(domainDirCandidate.getAbsolutePath());
+ wizardIterator.setHostName(host);
+ wizardIterator.setUseDefaultPorts(panel.getUseDefaultPorts());
+ setGlobalValues(wizardIterator, panel);
+ if (defaultJavaSESupported) {
+ wizard.putProperty(PROP_INFO_MESSAGE,
+ NbBundle.getMessage(this.getClass(),
+ "MSG_CreateEmbedded", domainField)); // NOI18N
+ } else {
+ wizard.putProperty(PROP_WARNING_MESSAGE,
+ NbBundle.getMessage(this.getClass(),
+ "WRN_CreateEmbedded", domainField)); // NOI18N
+ }
+ return defaultJavaSESupported;
+ }
+ domainDirCandidate = new File(domainField);
+ String domainLoc = domainDirCandidate.getAbsolutePath();
+ if (AddServerLocationPanel.isRegisterableDomain(domainDirCandidate)) {
+ // the entry resolves to a domain name that we can register
+ //String domainLoc = domainDirCandidate.getAbsolutePath();
+ wizardIterator.setDomainLocation(domainLoc);
+ wizardIterator.setHostName(host);
+ setGlobalValues(wizardIterator, panel);
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(this.getClass(), "MSG_RegisterExisting", domainField)); // NOI18N
+ org.netbeans.modules.payara.common.utils.Util.readServerConfiguration(domainDirCandidate, wizardIterator);
+ return true;
+ }
+ if (AddServerLocationPanel.canCreate(domainDirCandidate) && !ServerUtilities.isTP2(gfRoot)) {
+ wizardIterator.setDomainLocation(domainLoc);
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(this.getClass(), "MSG_CreateDomain", domainField)); // NOI18N
+ wizardIterator.setUseDefaultPorts(panel.getUseDefaultPorts());
+ wizardIterator.setHostName(host);
+ setGlobalValues(wizardIterator, panel);
+ return true;
+ }
+ if (new File(domainsDir, domainField).exists()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_UnusableDomain", domainField)); // NOI18N
+ } else if (domainDirCandidate.exists()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_UnusableDomain", domainField)); // NOI18N
+ } else {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(this.getClass(), "ERR_CannotCreateDomain", domainField)); // NOI18N
+ }
+ return false;
+ }
+
+ /**
+ * Convert {@link String} representation of integer value into real integer.
+ * <p/>
+ * @param str {@link String} representation of integer value.
+ * @param msgKey Error message key.
+ * @return Real non negative integer value or <code>-1</code> when value
+ * could not be converted
+ */
+ private int strToInt(final String str, final String msgKey,
+ final List<String> errors) {
+ try {
+ return Integer.parseInt(str);
+ } catch (NumberFormatException nfe) {
+ errors.add(NbBundle.getMessage(this.getClass(), msgKey, str));
+ return -1;
+ }
+ }
+
+ /***
+ * Join error messages.
+ * <p/>
+ * @param errors {@link List} of individual error messages to be joined.
+ * @return Joined error messages from errors {@link List}.
+ */
+ private String joinErrorMessages(final List<String> errors) {
+ final String eol = "<br/>";
+ int length = 0;
+ for (String error : errors) {
+ length += (length > 0 ? eol.length() : 0) + error.length();
+ }
+ StringBuilder sb = new StringBuilder(length);
+ for (String error : errors) {
+ if (sb.length() > 0) {
+ sb.append(eol);
+ }
+ sb.append(error);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * There is not much to verify for remote domain.
+ * <p/>
+ * @param panel Domain specific attributes panel.
+ * @return Is form valid?
+ */
+ private boolean validateForRemoteDomain(
+ final AddDomainLocationVisualPanel panel) {
+ String host = panel.getRemoteHost();
+ List<String> errors = new LinkedList<>();
+ int dasPort = strToInt(panel.getAdminPortValue(),
+ "AddDomainLocationPanel.invalidDasPort", errors);
+ int httpPort = strToInt(panel.getHttpPortValue(),
+ "AddDomainLocationPanel.invalidHttpPort", errors);
+ if (dasPort < 0 || httpPort < 0) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, joinErrorMessages(errors));
+ return false;
+ }
+ wizardIterator.setAdminPort(dasPort);
+ wizardIterator.setHttpPort(httpPort);
+ wizardIterator.setHostName(host);
+ wizardIterator.setRemoteDomain(panel.getRemoteDomain());
+ setGlobalValues(wizardIterator, panel);
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(
+ this.getClass(), "AddDomainLocationPanel.remoteInstance",
+ host, Integer.toString(dasPort), Integer.toString(httpPort)));
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.form
new file mode 100644
index 0000000..588d333
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.form
@@ -0,0 +1,416 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.4" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[438, 353]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="domainLocalLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="domainRemoteLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="hostLocalLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="hostRemoteLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="dasPortFieldLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="targetValueLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="userNameLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="passwordLabel" linkSize="3" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="hostLocalField" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="localIpCB" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="domainRemoteField" max="32767" attributes="1"/>
+ <Component id="domainLocalField" max="32767" attributes="0"/>
+ <Component id="hostRemoteField" alignment="0" max="32767" attributes="1"/>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="passwordField" max="32767" attributes="0"/>
+ <Component id="userNameField" alignment="0" max="32767" attributes="0"/>
+ <Component id="targetValueField" alignment="0" max="32767" attributes="1"/>
+ <Group type="102" attributes="0">
+ <Component id="dasPortField" pref="73" max="32767" attributes="1"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortFieldLabel" linkSize="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortField" pref="74" max="32767" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="useDefaultPortsCB" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <EmptySpace min="-2" pref="112" max="-2" attributes="0"/>
+ <Component id="remotePanel" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ <Component id="remoteLink" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="domainLocalLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="domainLocalField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="domainRemoteLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="domainRemoteField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="hostLocalLabel" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="hostLocalField" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="localIpCB" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="hostRemoteLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="hostRemoteField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="dasPortField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="useDefaultPortsCB" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="dasPortFieldLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortFieldLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="httpPortField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="targetValueLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="targetValueField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="userNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="userNameField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="passwordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="passwordField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="remoteLink" max="-2" attributes="0"/>
+ <EmptySpace pref="73" max="32767" attributes="0"/>
+ <Component id="remotePanel" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="targetValueLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="dasPortField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.targetValueLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="targetValueField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.targetValueField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="userNameLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.userNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="userNameField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="initUserNameValue()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="passwordLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.passwordLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="passwordField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="initPasswordValue()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="dasPortFieldLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="dasPortField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.dasPortFieldLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="dasPortField">
+ <Properties>
+ <Property name="columns" type="int" value="5"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="initAdminPortValue()" type="code"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.dasPortField.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="httpPortFieldLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="httpPortField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.httpPortFieldLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="httpPortField">
+ <Properties>
+ <Property name="columns" type="int" value="5"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="initHttpPortValue()" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="useDefaultPortsCB">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.useDefaultPortsCB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.useDefaultPortsCB.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.useDefaultPortsCB.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Container class="javax.swing.JPanel" name="remotePanel">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="37" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ </Container>
+ <Component class="javax.swing.JLabel" name="domainLocalLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="domainLocalField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.domainLocalLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="domainLocalField">
+ <Properties>
+ <Property name="editable" type="boolean" value="true"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.domainLocalField.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="hostLocalLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="hostLocalField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.hostLocalLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="localIpCB">
+ <Properties>
+ <Property name="selected" type="boolean" value="true"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.localIpCB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="hostLocalField">
+ <Properties>
+ <Property name="editable" type="boolean" value="true"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new IpComboBox(ips, localIpCB.isSelected())"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="hostRemoteField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.hostRemoteField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[32767, 32767]"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.hostRemoteField.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="hostRemoteLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="hostRemoteField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.hostRemoteLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[62, 16]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JLabel" name="domainRemoteLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="domainLocalField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.domainRemoteLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="domainRemoteField">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.domainRemoteField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[32767, 32767]"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="remoteLink">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddDomainLocationVisualPanel.remoteLink.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="remoteLinkMouseClicked"/>
+ </Events>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.java
new file mode 100644
index 0000000..aabfea0
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddDomainLocationVisualPanel.java
@@ -0,0 +1,686 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.io.File;
+import java.io.FileFilter;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.ServerDetails;
+import org.netbeans.modules.payara.common.ui.IpComboBox;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.awt.HtmlBrowser;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author vbk
+ */
+public class AddDomainLocationVisualPanel extends javax.swing.JPanel {
+
+ private transient final List<ChangeListener> listeners;
+
+ /** IP addresses selection content. */
+ Set<? extends InetAddress> ips;
+
+ /** Payara server is local or remote. */
+ private boolean isLocal;
+
+ /** DAS port value to be set as default. */
+ private int defaultDasPort;
+
+ /** HTTP port value to be set as default. */
+ private int defaultHttpPort;
+
+ /** Creates new form AddDomainLocationVisualPanel */
+ public AddDomainLocationVisualPanel() {
+ listeners = new CopyOnWriteArrayList<>();
+ ips = NetUtils.getHostIP4s();
+ initComponents();
+ dasPortField.setEnabled(false);
+ httpPortField.setEnabled(false);
+ defaultDasPort = PayaraInstance.DEFAULT_ADMIN_PORT;
+ defaultHttpPort = PayaraInstance.DEFAULT_HTTP_PORT;
+ setName(NbBundle.getMessage(AddDomainLocationVisualPanel.class, "TITLE_DomainLocation")); // NOI18N
+ }
+
+ void initModels(final String gfRoot, final boolean isLocal) {
+ if (isLocal) {
+ domainLocalLabel.setVisible(true);
+ domainLocalField.setVisible(true);
+ hostLocalLabel.setVisible(true);
+ hostLocalField.setVisible(true);
+ localIpCB.setVisible(true);
+ domainRemoteLabel.setVisible(false);
+ domainRemoteField.setVisible(false);
+ hostRemoteLabel.setVisible(false);
+ hostRemoteField.setVisible(false);
+ remoteLink.setVisible(false);
+ } else {
+ domainLocalLabel.setVisible(false);
+ domainLocalField.setVisible(false);
+ hostLocalLabel.setVisible(false);
+ hostLocalField.setVisible(false);
+ localIpCB.setVisible(false);
+ domainRemoteLabel.setVisible(true);
+ domainRemoteField.setVisible(true);
+ hostRemoteLabel.setVisible(true);
+ hostRemoteField.setVisible(true);
+ remoteLink.setVisible(true);
+ }
+ KeyListener kl = new MyKeyListener();
+ if (isLocal) {
+ // Put the choices into the combo box...
+ DefaultComboBoxModel model = new DefaultComboBoxModel();
+ File domainsDir = new File(
+ gfRoot, PayaraInstance.DEFAULT_DOMAINS_FOLDER);
+ File candidates[] = domainsDir.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File dir) {
+ File logsDir = new File(dir, "logs"); // NOI18N
+ return Utils.canWrite(logsDir);
+ }
+ });
+ if (null != candidates) {
+ for (File f : candidates) {
+ model.addElement(f.getName());
+ }
+ }
+ if (model.getSize() == 0) {
+ FileObject userHome = FileUtil.toFileObject(
+ FileUtil.normalizeFile(
+ new File(System.getProperty("user.home"))));
+ String defaultItem = FileUtil.findFreeFolderName(
+ userHome, "personal_domain");
+ model.addElement(System.getProperty("user.home")
+ + File.separator + defaultItem);
+ }
+ domainLocalField.setModel(model);
+ domainLocalField.getEditor()
+ .getEditorComponent().addKeyListener(kl);
+ domainLocalField.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ domainLocalField.getEditor().setItem(
+ domainLocalField.getSelectedItem());
+ fireChangeEvent();
+ }
+ });
+ localIpCB.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ updateLocalIpsCombobox();
+ fireChangeEvent();
+ }
+ });
+ updateLocalIpsCombobox();
+ } else {
+ domainRemoteField.addKeyListener(kl);
+ hostRemoteField.addKeyListener(kl);
+ }
+ useDefaultPortsCB.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ updatePortsFields();
+ fireChangeEvent();
+ }
+ });
+ dasPortField.addKeyListener(kl);
+ httpPortField.addKeyListener(kl);
+ initPortsFields();
+ // make sure the target field is ok...
+ if (ServerDetails.getVersionFromInstallDirectory(new File(gfRoot)) <
+ ServerDetails.PAYARA_SERVER_4_1_144.getVersion()) {
+ targetValueField.setText(""); // NOI18N
+ targetValueField.setEnabled(false);
+ } else {
+ targetValueField.setText(""); // NOI18N
+ targetValueField.setEnabled(true);
+ }
+ targetValueField.addKeyListener(kl);
+ userNameField.addKeyListener(kl);
+ passwordField.addKeyListener(kl);
+ }
+
+ /**
+ * Retrieve DAS port value stored in form.
+ * <p/>
+ * @return DAS port value stored in form.
+ */
+ String getAdminPortValue() {
+ return dasPortField.getText().trim();
+ }
+
+ /**
+ * Set DAS port value of corresponding form field.
+ * <p/>
+ * @param port DAS port value to be set.
+ */
+ void setAdminPortValue(String port) {
+ dasPortField.setText(port);
+ }
+
+ /**
+ * Retrieve HTTP port value stored in form.
+ * <p/>
+ * @return HTTP port value stored in form.
+ */
+ String getHttpPortValue() {
+ return httpPortField.getText().trim();
+ }
+
+ /**
+ * Set HTTP port value of corresponding form field.
+ * <p/>
+ * @param port HTTP port value to be set.
+ */
+ void setHttpPortValue(String port) {
+ httpPortField.setText(port);
+ }
+
+ String getTargetValue() {
+ return targetValueField.getText().trim();
+ }
+
+ /**
+ * Return administrator's user name value from text field.
+ * <p/>
+ * @return Administrator's user name value from text field.
+ */
+ String getUserNameValue() {
+ return userNameField.getText().trim();
+ }
+
+ /**
+ * Return administrator's password value from text field.
+ * <p/>
+ * @return Administrator's password value from text field.
+ */
+ String getPasswordValue() {
+ return new String(passwordField.getPassword());
+ }
+
+ boolean getUseDefaultPorts() {
+ return useDefaultPortsCB.isEnabled() && useDefaultPortsCB.isSelected();
+ }
+
+ /**
+ * Get local host from form in local domain mode.
+ * <p/>
+ * @return Local host field value.
+ */
+ Object getLocalHost() {
+ return hostLocalField.getEditor().getItem();
+ }
+
+ /**
+ * Get remote host from form in remote domain mode.
+ * <p/>
+ * @return Remote host field value.
+ */
+ String getRemoteHost() {
+ return hostRemoteField.getText().trim();
+ }
+
+ /**
+ * Get local domain name from form in remote domain mode.
+ * <p/>
+ * @return Local domain name field value.
+ */
+ String getLocalDomain() {
+ return (String)domainLocalField.getEditor().getItem();
+ }
+
+ /**
+ * Get remote domain name from form in remote domain mode.
+ * <p/>
+ * @return Remote domain name field value.
+ */
+ String getRemoteDomain() {
+ return domainRemoteField.getText().trim();
+ }
+
+ /**
+ * Initialize server port with default value.
+ * <p/>
+ * @return Default administrator's user name value.
+ */
+ private String initAdminPortValue() {
+ return Integer.toString(defaultDasPort);
+ }
+
+ /**
+ * Initialize server port with default value.
+ * <p/>
+ * @return Default administrator's user name value.
+ */
+ private String initHttpPortValue() {
+ return Integer.toString(defaultHttpPort);
+ }
+
+ /**
+ * Initialize administrator's user name with default value.
+ * <p/>
+ * @return Default administrator's user name value.
+ */
+ private String initUserNameValue() {
+ //return PayaraInstance.DEFAULT_ADMIN_NAME;
+ return "";
+ }
+
+ /**
+ * Initialize administrator's password with default value.
+ * <p/>
+ * @return Default administrator's password value.
+ */
+ private String initPasswordValue() {
+ //return PayaraInstance.DEFAULT_ADMIN_PASSWORD;
+ return "";
+ }
+
+ /**
+ *
+ * @param l
+ */
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ /**
+ *
+ * @param l
+ */
+ public void removeChangeListener(ChangeListener l ) {
+ listeners.remove(l);
+ }
+
+ private void fireChangeEvent() {
+ ChangeEvent ev = new ChangeEvent(this);
+ for(ChangeListener listener: listeners) {
+ listener.stateChanged(ev);
+ }
+ }
+
+ /**
+ * Update content of host IPs combo box depending
+ * on <code>Looopback</code> check box status.
+ * <p/>
+ * @param e A semantic event which indicates that a component-defined
+ * action occurred.
+ */
+ private void updateLocalIpsCombobox() {
+ ((IpComboBox)hostLocalField).updateModel(ips, localIpCB.isSelected());
+ }
+
+ /**
+ * Initialize content of port fields values depending
+ * on <code>Default</code> check box status.
+ */
+ private void initPortsFields() {
+ dasPortField.setText(initAdminPortValue());
+ httpPortField.setText(initHttpPortValue());
+ if (useDefaultPortsCB.isSelected()) {
+ dasPortField.setEnabled(false);
+ httpPortField.setEnabled(false);
+ } else {
+ dasPortField.setEnabled(true);
+ httpPortField.setEnabled(true);
+ }
+ }
+
+ /**
+ * Update content of port fields values depending
+ * on <code>Default</code> check box status.
+ */
+ private void updatePortsFields() {
+ if (useDefaultPortsCB.isSelected()) {
+ dasPortField.setText(initAdminPortValue());
+ httpPortField.setText(initHttpPortValue());
+ dasPortField.setEnabled(false);
+ httpPortField.setEnabled(false);
+ } else {
+ dasPortField.setEnabled(true);
+ httpPortField.setEnabled(true);
+ }
+ }
+
+ /**
+ * Update ports fields to contain valid values and handle default ports
+ * check box depending on local domain availability.
+ * <p/>
+ * Default port values are updated to supplied values
+ * of <code>dasPort</code> and <code>httpPort</code>.
+ * <p/>
+ * @param dasPort DAS port to be set in form.
+ * @param httpPort HTTP port to be set in form.
+ * @param localExistindDomain Is local domain available?
+ */
+ void setPortsFields(final int dasPort, final int httpPort,
+ final boolean localExistindDomain) {
+ if (localExistindDomain) {
+ useDefaultPortsCB.setSelected(true);
+ useDefaultPortsCB.setEnabled(false);
+ if (dasPort >= 0) {
+ defaultDasPort = dasPort;
+ }
+ if (httpPort >= 0) {
+ defaultHttpPort = httpPort;
+ }
+ } else {
+ useDefaultPortsCB.setEnabled(true);
+ defaultDasPort = PayaraInstance.DEFAULT_ADMIN_PORT;
+ defaultHttpPort = PayaraInstance.DEFAULT_HTTP_PORT;
+ }
+ updatePortsFields();
+ }
+
+ /**
+ * Update ports fields to contain valid values and handle default ports
+ * check box depending on local domain availability.
+ * <p/>
+ * Default port values are not updated.
+ * <p/>
+ * @param localExistindDomain Is local domain available?
+ */
+ void setPortsFields(final boolean localExistindDomain) {
+ setPortsFields(-1, -1, localExistindDomain);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked") // NOI18N
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ targetValueLabel = new javax.swing.JLabel();
+ targetValueField = new javax.swing.JTextField();
+ userNameLabel = new javax.swing.JLabel();
+ userNameField = new javax.swing.JTextField();
+ passwordLabel = new javax.swing.JLabel();
+ passwordField = new javax.swing.JPasswordField();
+ dasPortFieldLabel = new javax.swing.JLabel();
+ dasPortField = new javax.swing.JTextField();
+ httpPortFieldLabel = new javax.swing.JLabel();
+ httpPortField = new javax.swing.JTextField();
+ useDefaultPortsCB = new javax.swing.JCheckBox();
+ remotePanel = new javax.swing.JPanel();
+ domainLocalLabel = new javax.swing.JLabel();
+ domainLocalField = new javax.swing.JComboBox();
+ hostLocalLabel = new javax.swing.JLabel();
+ localIpCB = new javax.swing.JCheckBox();
+ hostLocalField = new IpComboBox(ips, localIpCB.isSelected());
+ hostRemoteField = new javax.swing.JTextField();
+ hostRemoteLabel = new javax.swing.JLabel();
+ domainRemoteLabel = new javax.swing.JLabel();
+ domainRemoteField = new javax.swing.JTextField();
+ remoteLink = new javax.swing.JLabel();
+
+ setPreferredSize(new java.awt.Dimension(438, 353));
+
+ targetValueLabel.setLabelFor(dasPortField);
+ org.openide.awt.Mnemonics.setLocalizedText(targetValueLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.targetValueLabel.text")); // NOI18N
+
+ targetValueField.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.targetValueField.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(userNameLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.userNameLabel.text")); // NOI18N
+
+ userNameField.setText(initUserNameValue());
+
+ org.openide.awt.Mnemonics.setLocalizedText(passwordLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.passwordLabel.text")); // NOI18N
+
+ passwordField.setText(initPasswordValue());
+
+ dasPortFieldLabel.setLabelFor(dasPortField);
+ org.openide.awt.Mnemonics.setLocalizedText(dasPortFieldLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.dasPortFieldLabel.text")); // NOI18N
+
+ dasPortField.setColumns(5);
+ dasPortField.setText(initAdminPortValue());
+
+ httpPortFieldLabel.setLabelFor(httpPortField);
+ httpPortFieldLabel.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.httpPortFieldLabel.text")); // NOI18N
+
+ httpPortField.setColumns(5);
+ httpPortField.setText(initHttpPortValue());
+
+ org.openide.awt.Mnemonics.setLocalizedText(useDefaultPortsCB, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.useDefaultPortsCB.text")); // NOI18N
+ useDefaultPortsCB.setToolTipText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.useDefaultPortsCB.toolTipText")); // NOI18N
+
+ javax.swing.GroupLayout remotePanelLayout = new javax.swing.GroupLayout(remotePanel);
+ remotePanel.setLayout(remotePanelLayout);
+ remotePanelLayout.setHorizontalGroup(
+ remotePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 0, Short.MAX_VALUE)
+ );
+ remotePanelLayout.setVerticalGroup(
+ remotePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 37, Short.MAX_VALUE)
+ );
+
+ domainLocalLabel.setLabelFor(domainLocalField);
+ org.openide.awt.Mnemonics.setLocalizedText(domainLocalLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.domainLocalLabel.text")); // NOI18N
+
+ domainLocalField.setEditable(true);
+
+ hostLocalLabel.setLabelFor(hostLocalField);
+ hostLocalLabel.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.hostLocalLabel.text")); // NOI18N
+ hostLocalLabel.setMaximumSize(new java.awt.Dimension(62, 16));
+ hostLocalLabel.setMinimumSize(new java.awt.Dimension(62, 16));
+ hostLocalLabel.setPreferredSize(new java.awt.Dimension(62, 16));
+
+ localIpCB.setSelected(true);
+ localIpCB.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.localIpCB.text")); // NOI18N
+
+ hostLocalField.setEditable(true);
+
+ hostRemoteField.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.hostRemoteField.text")); // NOI18N
+ hostRemoteField.setMaximumSize(new java.awt.Dimension(32767, 32767));
+
+ hostRemoteLabel.setLabelFor(hostRemoteField);
+ org.openide.awt.Mnemonics.setLocalizedText(hostRemoteLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.hostRemoteLabel.text")); // NOI18N
+ hostRemoteLabel.setMaximumSize(new java.awt.Dimension(62, 16));
+ hostRemoteLabel.setMinimumSize(new java.awt.Dimension(62, 16));
+ hostRemoteLabel.setPreferredSize(new java.awt.Dimension(62, 16));
+
+ domainRemoteLabel.setLabelFor(domainLocalField);
+ org.openide.awt.Mnemonics.setLocalizedText(domainRemoteLabel, org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.domainRemoteLabel.text")); // NOI18N
+
+ domainRemoteField.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.domainRemoteField.text")); // NOI18N
+ domainRemoteField.setMaximumSize(new java.awt.Dimension(32767, 32767));
+
+ remoteLink.setText(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.remoteLink.text")); // NOI18N
+ remoteLink.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ remoteLinkMouseClicked(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(domainLocalLabel)
+ .addComponent(domainRemoteLabel)
+ .addComponent(hostLocalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(hostRemoteLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(dasPortFieldLabel)
+ .addComponent(targetValueLabel)
+ .addComponent(userNameLabel)
+ .addComponent(passwordLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(hostLocalField, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(localIpCB))
+ .addComponent(domainRemoteField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(domainLocalField, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(hostRemoteField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(passwordField)
+ .addComponent(userNameField, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(targetValueField, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(dasPortField, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(httpPortFieldLabel)))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(httpPortField, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(useDefaultPortsCB))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(112, 112, 112)
+ .addComponent(remotePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
+ .addComponent(remoteLink)))
+ );
+
+ layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {dasPortFieldLabel, domainLocalLabel, domainRemoteLabel, hostLocalLabel, hostRemoteLabel, httpPortFieldLabel, passwordLabel, targetValueLabel, userNameLabel});
+
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(domainLocalLabel)
+ .addComponent(domainLocalField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(6, 6, 6)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(domainRemoteLabel)
+ .addComponent(domainRemoteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(6, 6, 6)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(hostLocalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(hostLocalField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(localIpCB))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(hostRemoteLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(hostRemoteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(dasPortField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(useDefaultPortsCB)
+ .addComponent(dasPortFieldLabel)
+ .addComponent(httpPortFieldLabel)
+ .addComponent(httpPortField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(targetValueLabel)
+ .addComponent(targetValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(userNameLabel)
+ .addComponent(userNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(passwordLabel)
+ .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(remoteLink, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
+ .addComponent(remotePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ );
+
+ dasPortField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.dasPortField.AccessibleContext.accessibleDescription")); // NOI18N
+ useDefaultPortsCB.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.useDefaultPortsCB.AccessibleContext.accessibleDescription")); // NOI18N
+ domainLocalField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.domainLocalField.AccessibleContext.accessibleDescription")); // NOI18N
+ hostRemoteField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddDomainLocationVisualPanel.class, "AddDomainLocationVisualPanel.hostRemoteField.AccessibleContext.accessibleDescription")); // NOI18N
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void remoteLinkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_remoteLinkMouseClicked
+ try {
+ HtmlBrowser.URLDisplayer.getDefault().showURL(
+ new URL("http://wiki.netbeans.org/RemoteGlassFish4")); // NOI18N
+ } catch (MalformedURLException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }//GEN-LAST:event_remoteLinkMouseClicked
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField dasPortField;
+ private javax.swing.JLabel dasPortFieldLabel;
+ private javax.swing.JComboBox domainLocalField;
+ private javax.swing.JLabel domainLocalLabel;
+ private javax.swing.JTextField domainRemoteField;
+ private javax.swing.JLabel domainRemoteLabel;
+ private javax.swing.JComboBox hostLocalField;
+ private javax.swing.JLabel hostLocalLabel;
+ private javax.swing.JTextField hostRemoteField;
+ private javax.swing.JLabel hostRemoteLabel;
+ private javax.swing.JTextField httpPortField;
+ private javax.swing.JLabel httpPortFieldLabel;
+ private javax.swing.JCheckBox localIpCB;
+ private javax.swing.JPasswordField passwordField;
+ private javax.swing.JLabel passwordLabel;
+ private javax.swing.JLabel remoteLink;
+ private javax.swing.JPanel remotePanel;
+ private javax.swing.JTextField targetValueField;
+ private javax.swing.JLabel targetValueLabel;
+ private javax.swing.JCheckBox useDefaultPortsCB;
+ private javax.swing.JTextField userNameField;
+ private javax.swing.JLabel userNameLabel;
+ // End of variables declaration//GEN-END:variables
+
+ class MyKeyListener implements KeyListener {
+ @Override
+ public void keyTyped(KeyEvent arg0) {
+ //throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void keyPressed(KeyEvent arg0) {
+ //throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void keyReleased(KeyEvent arg0) {
+ //throw new UnsupportedOperationException("Not supported yet.");
+ fireChangeEvent();
+ }
+
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanel.java
new file mode 100644
index 0000000..00b3bd0
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanel.java
@@ -0,0 +1,360 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.regex.Pattern;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PortCollection;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+
+/**
+ * @author Ludo
+ * @author vince
+ */
+public class AddServerLocationPanel implements WizardDescriptor.FinishablePanel, ChangeListener {
+
+ private final String PROP_ERROR_MESSAGE = WizardDescriptor.PROP_ERROR_MESSAGE;
+ private final String PROP_WARNING_MESSAGE = WizardDescriptor.PROP_WARNING_MESSAGE;
+ private final String PROP_INFO_MESSAGE = WizardDescriptor.PROP_INFO_MESSAGE;
+
+ private ServerWizardIterator wizardIterator;
+ private AddServerLocationVisualPanel component;
+ private WizardDescriptor wizard;
+ private transient List<ChangeListener> listeners
+ = new CopyOnWriteArrayList<>();
+
+ /**
+ *
+ * @param instantiatingIterator
+ */
+ public AddServerLocationPanel(ServerWizardIterator wizardIterator){
+ this.wizardIterator = wizardIterator;
+ wizard = null;
+ }
+
+ /**
+ *
+ * @param ev
+ */
+ @Override
+ public void stateChanged(ChangeEvent ev) {
+ fireChangeEvent(ev);
+ }
+
+ private void fireChangeEvent(ChangeEvent ev) {
+ for(ChangeListener listener: listeners) {
+ listener.stateChanged(ev);
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public Component getComponent() {
+ if (component == null) {
+ component = new AddServerLocationVisualPanel(wizardIterator);
+ component.addChangeListener(this);
+ }
+ return component;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public HelpCtx getHelp() {
+ FileObject fo = FileUtil.getConfigFile("Services/JavaHelp/org-netbeans-modules-usersguide-helpset.xml");
+ if (null != fo)
+ return new HelpCtx("registering_app_server_hk2_location"); //NOI18N
+ else
+ return null;
+ }
+
+ private AtomicBoolean isValidating = new AtomicBoolean();
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public boolean isValid() {
+ if (isValidating.compareAndSet(false, true)) {
+ try {
+ wizardIterator.setHttpPort(-1);
+ AddServerLocationVisualPanel panel = (AddServerLocationVisualPanel) getComponent();
+
+ AddServerLocationVisualPanel.DownloadState downloadState = panel.getDownloadState();
+ if (downloadState == AddServerLocationVisualPanel.DownloadState.DOWNLOADING) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, panel.getStatusText());
+ return false;
+ }
+
+ String locationStr = panel.getHk2HomeLocation();
+ locationStr = (locationStr != null) ? locationStr.trim() : null;
+ if (locationStr == null || locationStr.length() == 0) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "ERR_BlankInstallDir"));
+ return false;
+ }
+
+ // !PW Replace some or all of this with a single call to a validate method
+ // that throws an exception with a precise reason for validation failure.
+ // e.g. domain dir not found, domain.xml corrupt, no ports defined, etc.
+ //
+ File installDir = new File(locationStr).getAbsoluteFile();
+ File payaraDir = getPayaraRoot(installDir);
+ File domainDir = getDefaultDomain(payaraDir);
+ if (!installDir.exists()) {
+ if (!isLegalFolder(installDir)) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "ERR_InstallDirInvalid", locationStr));
+ return false;
+ } else if (canCreate(installDir)) {
+ if (downloadState == AddServerLocationVisualPanel.DownloadState.AVAILABLE) {
+ panel.updateMessageText(NbBundle.getMessage(AddServerLocationPanel.class,
+ "LBL_NewInstallDirCanBeUsed", getSanitizedPath(installDir))); // NOI18N
+ wizard.putProperty(PROP_ERROR_MESSAGE, panel.getStatusText());
+ return false;
+ } else {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "ERR_InstallDirDoesNotExist", getSanitizedPath(installDir)));
+ return false;
+ }
+ } else {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "ERR_CannotCreate", getSanitizedPath(installDir)));
+ return false;
+ }
+ } else {
+ Object candidate = wizardIterator.isValidInstall(installDir, payaraDir, wizard);
+ if (null == candidate) {
+ String errMsg = NbBundle.getMessage(AddServerLocationPanel.class, "ERR_InstallationInvalid", // NOI18N
+ FileUtil.normalizeFile(installDir).getPath());
+ wizard.putProperty(PROP_ERROR_MESSAGE, errMsg);
+ return false;
+ } else if (!isRegisterableDomain(domainDir)) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "ERR_DefaultDomainInvalid", getSanitizedPath(installDir)));
+ } else {
+ org.netbeans.modules.payara.common.utils.Util.readServerConfiguration(domainDir, wizardIterator);
+ // finish initializing the registration data
+ if (installDir.equals(payaraDir)) {
+ installDir = payaraDir.getParentFile();
+ }
+ wizardIterator.setInstallRoot(installDir.getAbsolutePath());
+ wizardIterator.setPayaraRoot(payaraDir.getAbsolutePath());
+ String uri = wizardIterator.formatUri(PayaraInstance.DEFAULT_HOST_NAME,
+ wizardIterator.getAdminPort(), wizardIterator.getTargetValue(),
+ domainDir.getParentFile().getAbsolutePath(), domainDir.getName());
+ if (-1 == wizardIterator.getHttpPort()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE,
+ NbBundle.getMessage(this.getClass(), "ERR_InvalidDomainData", domainDir.getName())); // NOI18N
+ return false;
+ }
+ if (-1 == wizardIterator.getAdminPort()) {
+ wizard.putProperty(PROP_ERROR_MESSAGE,
+ NbBundle.getMessage(this.getClass(), "ERR_InvalidDomainData", domainDir.getName())); // NOI18N
+ return false;
+ }
+ if (wizardIterator.hasServer(uri)) {
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(AddServerLocationPanel.class, "MSG_DefaultDomainExists",
+ getSanitizedPath(installDir), PayaraInstance.DEFAULT_DOMAIN_NAME));
+ wizardIterator.setHttpPort(-1); // FIXME this is a hack - disables finish button
+ } else {
+ String statusText = panel.getStatusText();
+ if (statusText != null && statusText.length() > 0) {
+ wizard.putProperty(PROP_ERROR_MESSAGE, statusText);
+ return false;
+ } else {
+ wizard.putProperty(PROP_ERROR_MESSAGE, null);
+ wizard.putProperty(PROP_INFO_MESSAGE, NbBundle.getMessage(
+ AddServerLocationPanel.class, "MSG_NextForSpecial", candidate)); // NOI18N
+ }
+ }
+ }
+ }
+ // message has already been set, do not clear it here (see above).
+
+ // finish initializing the registration data
+ if (installDir.equals(payaraDir)) {
+ installDir = payaraDir.getParentFile();
+ }
+ wizardIterator.setInstallRoot(installDir.getAbsolutePath());
+ wizardIterator.setPayaraRoot(payaraDir.getAbsolutePath());
+ wizardIterator.setDomainLocation(domainDir.getAbsolutePath());
+
+ return true;
+ } finally {
+ isValidating.set(false);
+ }
+ }
+ return false;
+ }
+
+ private static String getSanitizedPath(File dir) {
+ return FileUtil.normalizeFile(dir).getPath();
+ }
+
+ // These characters ( ? * : | < > " ) are illegal on Windows (NTFS).
+ // The first four are detected by getCanonicalFile(), but the last 3 are not
+ // so check for them specifically.
+ private static Pattern ILLEGAL_WINDOWS_CHARS = Pattern.compile("<|>|\\\"");
+
+ private static boolean isLegalFolder(File installDir) {
+ return getCanonicalFile(installDir) != null &&
+ (!Utilities.isWindows() || ILLEGAL_WINDOWS_CHARS.matcher(installDir.getPath()).find() == false);
+ }
+
+ private static File getCanonicalFile(File file) {
+ try {
+ return file.getCanonicalFile();
+ } catch (IOException ex) {
+ return null;
+ }
+ }
+
+ static boolean canCreate(File dir) {
+ if (dir.exists()) {
+ return false;
+ }
+ while(dir != null && !dir.exists()) {
+ dir = dir.getParentFile();
+ }
+ return dir != null ? dir.canRead() && Utils.canWrite(dir) : false;
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ listeners.remove(l);
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ /**
+ *
+ * @param settings
+ */
+ @Override
+ public void readSettings(Object settings) {
+ if (wizard == null) {
+ wizard = (WizardDescriptor) settings;
+ }
+ }
+
+ /**
+ *
+ * @param settings
+ */
+ @Override
+ public void storeSettings(Object settings) {
+ }
+
+ /**
+ * Domain attributes should be checked before finishing this wizard.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ public boolean isFinishPanel() {
+ return false;
+ }
+
+ /**
+ * Validates if <code>domainDir</code> contains valid Payara domain.
+ * <p/>
+ * @param domainDir Payara domain directory to be validated.
+ * @param portCollection Information from <code>domain.xml</code>
+ * configuration file is stored here when
+ * <code>domainDir</code> contains valid Payara
+ * domain.
+ * @return Value of <code>true</code> when <code>domainDir</code> contains
+ * valid Payara domain or <code>false</code> otherwise.
+ */
+ static boolean isRegisterableDomain(final File domainDir,
+ final PortCollection portCollection) {
+ File testFile = new File(domainDir, "logs"); // NOI18N
+ if (!testFile.exists()) {
+ testFile = domainDir;
+ }
+ return Utils.canWrite(testFile) &&
+ org.netbeans.modules.payara.common.utils.Util
+ .readServerConfiguration(domainDir, portCollection);
+ }
+
+ /**
+ * Validates if <code>domainDir</code> contains valid Payara domain.
+ * <p/>
+ * @param domainDir Payara domain directory to be validated.
+ * @return Value of <code>true</code> when <code>domainDir</code> contains
+ * valid Payara domain or <code>false</code> otherwise.
+ */
+ static boolean isRegisterableDomain(File domainDir) {
+ return isRegisterableDomain(domainDir, null);
+ }
+
+ private File getPayaraRoot(File installDir) {
+ File glassfishDir = new File(installDir, "glassfish"); // ${payara}/glassfish
+ if(!glassfishDir.exists()) {
+ glassfishDir = installDir;
+ }
+ return glassfishDir;
+ }
+
+ private File getDefaultDomain(File payaraDir) {
+ File retVal = new File(payaraDir, PayaraInstance.DEFAULT_DOMAINS_FOLDER +
+ File.separator + PayaraInstance.DEFAULT_DOMAIN_NAME); // NOI18N
+ if (!isRegisterableDomain(retVal)) {
+ // see if there is some other domain that will work.
+ File domainsDir = new File(payaraDir, PayaraInstance.DEFAULT_DOMAINS_FOLDER); // NOI18N
+ File candidates[] = domainsDir.listFiles();
+ if (null != candidates && candidates.length > 0) {
+ // try to pick a candidate
+ for (File c : candidates) {
+ if (isRegisterableDomain(c)) {
+ retVal = c;
+ break;
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.form b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.form
new file mode 100644
index 0000000..c13d715
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.form
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <NonVisualComponents>
+ <Component class="javax.swing.ButtonGroup" name="domainType">
+ </Component>
+ </NonVisualComponents>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="downloadStatusLabel" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="localDomainRadioButton" min="-2" pref="121" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
+ <Component id="remoteDomainRadioButton" pref="253" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="hk2HomeTextField" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="browseButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="hk2HomeLabel" min="-2" max="-2" attributes="0"/>
+ <Component id="chooseServerLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="chooseServerComboBox" alignment="0" min="-2" pref="159" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="downloadButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="agreeCheckBox" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="readlicenseButton" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="hk2HomeLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="hk2HomeTextField" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="browseButton" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="2" attributes="0">
+ <Component id="localDomainRadioButton" alignment="2" min="-2" max="-2" attributes="0"/>
+ <Component id="remoteDomainRadioButton" alignment="2" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
+ <Component id="chooseServerLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="chooseServerComboBox" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="agreeCheckBox" min="-2" max="-2" attributes="0"/>
+ <Component id="downloadButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="6" max="32767" attributes="0"/>
+ <Component id="downloadStatusLabel" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Component id="readlicenseButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="hk2HomeLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="hk2HomeTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="LBL_InstallLocation" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="hk2HomeTextField">
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.hk2HomeTextField.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JButton" name="browseButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="LBL_BrowseButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.browseButton.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="downloadButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="[download/cancel]" noResource="true"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="agreeCheckBox">
+ <Properties>
+ <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+ <Insets value="[4, 0, 4, 4]"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.agreeCheckBox.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="agreeCheckBoxActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="readlicenseButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="LBL_ReadLicenseText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="2" left="2" right="2" top="2"/>
+ </Border>
+ </Property>
+ <Property name="borderPainted" type="boolean" value="false"/>
+ <Property name="contentAreaFilled" type="boolean" value="false"/>
+ <Property name="horizontalAlignment" type="int" value="10"/>
+ <Property name="verticalAlignment" type="int" value="1"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.readlicenseButton.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="readlicenseButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="downloadStatusLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="[download status]" noResource="true"/>
+ <Property name="verticalAlignment" type="int" value="1"/>
+ <Property name="horizontalTextPosition" type="int" value="10"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JRadioButton" name="localDomainRadioButton">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="domainType"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.localDomainRadioButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="localDomainRadioButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JRadioButton" name="remoteDomainRadioButton">
+ <Properties>
+ <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
+ <ComponentRef name="domainType"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="AddServerLocationVisualPanel.remoteDomainRadioButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="remoteDomainRadioButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="chooseServerLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="hk2HomeTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/common/wizards/Bundle.properties" key="LBL_ChooseOne" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="chooseServerComboBox">
+ <Properties>
+ <Property name="selectedItem" type="java.lang.Object" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="wizardIterator.downloadableValues[0]" type="code"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JComboBox<ServerDetails>(wizardIterator.downloadableValues)"/>
+ <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<ServerDetails>"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.java
new file mode 100644
index 0000000..f98310d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/AddServerLocationVisualPanel.java
@@ -0,0 +1,530 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.prefs.Preferences;
+import javax.swing.JFileChooser;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import org.netbeans.modules.payara.common.ServerDetails;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.awt.HtmlBrowser.URLDisplayer;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
+
+/**
+ * @author pblaha
+ * @author Peter Williams
+ */
+public class AddServerLocationVisualPanel extends javax.swing.JPanel implements Retriever.Updater {
+
+ public static enum DownloadState { AVAILABLE, DOWNLOADING, COMPLETED };
+
+ public static final String DOWNLOAD_PREFIX = "https://www.payara.fish/"; // NOI18N
+
+ private final List<ChangeListener> listeners = new CopyOnWriteArrayList<ChangeListener>();
+ private Retriever retriever;
+ private volatile DownloadState downloadState;
+ private volatile String statusText;
+ private ServerWizardIterator wizardIterator;
+
+ public AddServerLocationVisualPanel(ServerWizardIterator swi) {
+ this.wizardIterator = swi;
+ initComponents();
+ initUserComponents();
+ }
+
+ private void initUserComponents() {
+ downloadButton.setEnabled(false);
+
+ setName(NbBundle.getMessage(AddServerLocationVisualPanel.class, "TITLE_ServerLocation"));
+
+ hk2HomeTextField.setText(getPreviousValue());
+ hk2HomeTextField.getDocument().addDocumentListener(new DocumentListener() {
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ homeFolderChanged();
+ }
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ homeFolderChanged();
+ }
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ homeFolderChanged();
+ }
+ });
+ chooseServerComboBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if(e.getStateChange() == ItemEvent.SELECTED) {
+ serverVersionChanged();
+ }
+ }
+ });
+ setDownloadState(DownloadState.AVAILABLE);
+ updateMessageText("");
+ // Set initial radio buttons status to local server.
+ localDomainRadioButton.setSelected(true);
+ remoteDomainRadioButton.setSelected(false);
+ wizardIterator.setLocal(true);
+ }
+
+ private String getPreviousValue() {
+ Preferences prefs = NbPreferences.forModule(wizardIterator.getClass());
+ String prevValue = null;
+ if (null != prefs) {
+ prevValue = prefs.get("INSTALL_ROOT_KEY", null); // NOI18N
+ }
+ if (null == prevValue) {
+ String installDir = System.getProperty("INSTALL_ROOT_PROPERTY"); // NOI18N
+ if (null != installDir && !(installDir.trim().length() == 0)) {
+ return installDir;
+ } else {
+ return System.getProperty("user.home") + File.separatorChar + "Payara_Server"; // NOI18N
+ }
+ } else {
+ return prevValue;
+ }
+ }
+
+ public DownloadState getDownloadState() {
+ return downloadState;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getHk2HomeLocation() {
+ return hk2HomeTextField.getText();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getStatusText() {
+ return statusText;
+ }
+
+ /**
+ *
+ * @param l
+ */
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ /**
+ * Get local/remote server selection.
+ * <p/>
+ * @return Value of <code>true</code> when local button is selected
+ * and <code>false</code> when remote button is selected.
+ */
+ public boolean isLocal() {
+ return localDomainRadioButton.isSelected();
+ }
+
+ /**
+ *
+ * @param l
+ */
+ public void removeChangeListener(ChangeListener l ) {
+ listeners.remove(l);
+ }
+
+ private void fireChangeEvent() {
+ ChangeEvent ev = new ChangeEvent(this);
+ for(ChangeListener listener: listeners) {
+ listener.stateChanged(ev);
+ }
+ }
+
+ private String browseHomeLocation() {
+ String hk2Location = null;
+ JFileChooser chooser = getJFileChooser();
+ int returnValue = chooser.showDialog(this, NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_ChooseButton")); //NOI18N
+ if(returnValue == JFileChooser.APPROVE_OPTION) {
+ hk2Location = chooser.getSelectedFile().getAbsolutePath();
+ }
+ return hk2Location;
+ }
+
+ private JFileChooser getJFileChooser() {
+ JFileChooser chooser = new JFileChooser();
+ String t = NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_ChooserName");
+ chooser.setDialogTitle(t); //NOI18N
+ chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ chooser.setApproveButtonMnemonic("Choose_Button_Mnemonic".charAt(0)); //NOI18N
+ chooser.setMultiSelectionEnabled(false);
+ chooser.addChoosableFileFilter(new DirFilter());
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setApproveButtonToolTipText(t); //NOI18N
+ chooser.getAccessibleContext().setAccessibleName(t); //NOI18N
+ chooser.getAccessibleContext().setAccessibleDescription(t); //NOI18N
+
+ // set the current directory
+ File currentLocation = new File(hk2HomeTextField.getText());
+ File currentLocationParent = currentLocation.getParentFile();
+ if(currentLocationParent != null && currentLocationParent.exists()) {
+ chooser.setCurrentDirectory(currentLocationParent);
+ }
+ if (currentLocation.exists() && currentLocation.isDirectory()) {
+ chooser.setSelectedFile(currentLocation);
+ }
+
+ return chooser;
+ }
+
+ @Override
+ public void removeNotify() {
+ // !PW Is there a better place for this? If the retriever is still running
+ // the user must have hit cancel on the wizard, so tell the retriever thread
+ // to shut down and clean up.
+ if(retriever != null) {
+ retriever.stopRetrieval();
+ }
+ super.removeNotify();
+ }
+
+ // ------------------------------------------------------------------------
+ // Updater implementation
+ // ------------------------------------------------------------------------
+ @Override
+ public void updateMessageText(final String msg) {
+ Mutex.EVENT.readAccess(new Runnable() {
+ @Override
+ public void run() {
+ if (msg.trim().startsWith("<html>")) {
+ downloadStatusLabel.setText(msg);
+ } else {
+ downloadStatusLabel.setText("<html>"+msg+"</html>");
+ }
+ fireChangeEvent();
+ }
+ });
+ }
+
+ @Override
+ public void updateStatusText(final String status) {
+ statusText = status;
+ fireChangeEvent();
+ }
+
+ @Override
+ public void clearCancelState() {
+ setDownloadState(retriever.getDownloadState() == Retriever.STATUS_COMPLETE ?
+ DownloadState.COMPLETED : DownloadState.AVAILABLE);
+ retriever = null;
+ }
+
+ // ------------------------------------------------------------------------
+ private void updateButton() {
+ Mutex.EVENT.readAccess(new Runnable() {
+ @Override
+ public void run() {
+ DownloadState state = AddServerLocationVisualPanel.this.downloadState;
+ boolean licenseAccepted = agreeCheckBox.isSelected();
+ File val = new File(hk2HomeTextField.getText().trim());
+ boolean writableLoc = AddServerLocationPanel.canCreate(val) || Utils.canWrite(val);
+ String buttonTextKey =
+ state == DownloadState.DOWNLOADING ? "LBL_CancelDownload" :
+ state == DownloadState.COMPLETED ? "LBL_DownloadComplete" : "LBL_DownloadNow";
+ String buttonText = NbBundle.getMessage(AddServerLocationVisualPanel.class, buttonTextKey);
+ downloadButton.setText(buttonText);
+ downloadButton.setEnabled(state != DownloadState.COMPLETED && licenseAccepted && writableLoc);
+ }
+ });
+ }
+
+ private synchronized void setDownloadState(DownloadState state) {
+ downloadState = state;
+ updateButton();
+ }
+
+ private void homeFolderChanged() {
+ updateMessageText("");
+ if(downloadState == DownloadState.COMPLETED) {
+ setDownloadState(DownloadState.AVAILABLE);
+ } else {
+ updateButton();
+ }
+ }
+
+ private void serverVersionChanged() {
+ agreeCheckBox.setSelected(false);
+ agreeCheckBoxActionPerformed(null);
+ }
+
+ private static class DirFilter extends javax.swing.filechooser.FileFilter {
+ DirFilter() {
+ }
+
+ @Override
+ public boolean accept(File f) {
+ if(!f.exists() || !f.canRead() || !f.isDirectory()) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_DirType");
+ }
+
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ domainType = new javax.swing.ButtonGroup();
+ hk2HomeLabel = new javax.swing.JLabel();
+ hk2HomeTextField = new javax.swing.JTextField();
+ browseButton = new javax.swing.JButton();
+ downloadButton = new javax.swing.JButton();
+ agreeCheckBox = new javax.swing.JCheckBox();
+ readlicenseButton = new javax.swing.JButton();
+ downloadStatusLabel = new javax.swing.JLabel();
+ localDomainRadioButton = new javax.swing.JRadioButton();
+ remoteDomainRadioButton = new javax.swing.JRadioButton();
+ chooseServerLabel = new javax.swing.JLabel();
+ chooseServerComboBox = new javax.swing.JComboBox<ServerDetails>(wizardIterator.downloadableValues);
+
+ hk2HomeLabel.setLabelFor(hk2HomeTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(hk2HomeLabel, org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_InstallLocation")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_BrowseButton")); // NOI18N
+ browseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ browseButtonActionPerformed(evt);
+ }
+ });
+
+ downloadButton.setText("[download/cancel]"); // NOI18N
+ downloadButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ downloadButtonActionPerformed(evt);
+ }
+ });
+
+ agreeCheckBox.setMargin(new java.awt.Insets(4, 0, 4, 4));
+ agreeCheckBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ agreeCheckBoxActionPerformed(evt);
+ }
+ });
+
+ readlicenseButton.setText(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_ReadLicenseText")); // NOI18N
+ readlicenseButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
+ readlicenseButton.setBorderPainted(false);
+ readlicenseButton.setContentAreaFilled(false);
+ readlicenseButton.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
+ readlicenseButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+ readlicenseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ readlicenseButtonActionPerformed(evt);
+ }
+ });
+
+ downloadStatusLabel.setText("[download status]"); // NOI18N
+ downloadStatusLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
+ downloadStatusLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
+
+ domainType.add(localDomainRadioButton);
+ localDomainRadioButton.setText(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.localDomainRadioButton")); // NOI18N
+ localDomainRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ localDomainRadioButtonActionPerformed(evt);
+ }
+ });
+
+ domainType.add(remoteDomainRadioButton);
+ remoteDomainRadioButton.setText(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.remoteDomainRadioButton")); // NOI18N
+ remoteDomainRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ remoteDomainRadioButtonActionPerformed(evt);
+ }
+ });
+
+ chooseServerLabel.setLabelFor(hk2HomeTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(chooseServerLabel, org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "LBL_ChooseOne")); // NOI18N
+
+ chooseServerComboBox.setSelectedItem(wizardIterator.downloadableValues[0]);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(downloadStatusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(localDomainRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(17, 17, 17)
+ .addComponent(remoteDomainRadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(hk2HomeTextField)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(browseButton))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(hk2HomeLabel)
+ .addComponent(chooseServerLabel)
+ .addComponent(chooseServerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(0, 0, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(downloadButton)
+ .addGap(18, 18, 18)
+ .addComponent(agreeCheckBox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(readlicenseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(hk2HomeLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(hk2HomeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(browseButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(localDomainRadioButton)
+ .addComponent(remoteDomainRadioButton))
+ .addGap(10, 10, 10)
+ .addComponent(chooseServerLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(chooseServerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(agreeCheckBox)
+ .addComponent(downloadButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
+ .addComponent(downloadStatusLabel))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(readlicenseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+
+ hk2HomeTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.hk2HomeTextField.AccessibleContext.accessibleDescription")); // NOI18N
+ browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.browseButton.AccessibleContext.accessibleDescription")); // NOI18N
+ agreeCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.agreeCheckBox.AccessibleContext.accessibleDescription")); // NOI18N
+ readlicenseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AddServerLocationVisualPanel.class, "AddServerLocationVisualPanel.readlicenseButton.AccessibleContext.accessibleDescription")); // NOI18N
+ }// </editor-fold>//GEN-END:initComponents
+
+private void readlicenseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readlicenseButtonActionPerformed
+ try {
+ ServerDetails chosenServerVersion = (ServerDetails) chooseServerComboBox.getSelectedItem();
+ URLDisplayer.getDefault().showURL(
+ new URL(chosenServerVersion.getLicenseUrl())); //NOI18N
+ } catch (Exception ex){
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+}//GEN-LAST:event_readlicenseButtonActionPerformed
+
+private void downloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadButtonActionPerformed
+ if(retriever == null) {
+ ServerDetails selectedValue = wizardIterator.downloadableValues[0];
+ if (wizardIterator.downloadableValues.length > 1) {
+ selectedValue = (ServerDetails) chooseServerComboBox.getSelectedItem();
+ }
+ if (null != selectedValue) {
+ updateStatusText(""); // NOI18N
+ retriever = new Retriever(new File(hk2HomeTextField.getText()),
+ selectedValue.getIndirectUrl(), DOWNLOAD_PREFIX,
+ selectedValue.getDirectUrl(),
+ this, "payara"); // NOI18N
+ new Thread(retriever).start();
+ setDownloadState(DownloadState.DOWNLOADING);
+ }
+ } else {
+ retriever.stopRetrieval();
+ setDownloadState(DownloadState.AVAILABLE);
+ }
+}//GEN-LAST:event_downloadButtonActionPerformed
+
+private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
+ String newLoc = browseHomeLocation();
+ if(newLoc != null && newLoc.length() > 0) {
+ hk2HomeTextField.setText(newLoc);
+ }
+}//GEN-LAST:event_browseButtonActionPerformed
+
+private void agreeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agreeCheckBoxActionPerformed
+ DownloadState state = downloadState;
+ if(state == DownloadState.COMPLETED) {
+ setDownloadState(DownloadState.AVAILABLE);
+ } else {
+ File val = new File(hk2HomeTextField.getText().trim());
+ boolean writableLoc = AddServerLocationPanel.canCreate(val) || Utils.canWrite(val);
+ downloadButton.setEnabled(agreeCheckBox.isSelected() && writableLoc);
+ }
+}//GEN-LAST:event_agreeCheckBoxActionPerformed
+
+ private void remoteDomainRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remoteDomainRadioButtonActionPerformed
+ wizardIterator.setLocal(!remoteDomainRadioButton.isSelected());
+ }//GEN-LAST:event_remoteDomainRadioButtonActionPerformed
+
+ private void localDomainRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localDomainRadioButtonActionPerformed
+ wizardIterator.setLocal(localDomainRadioButton.isSelected());
+ }//GEN-LAST:event_localDomainRadioButtonActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox agreeCheckBox;
+ private javax.swing.JButton browseButton;
+ private javax.swing.JComboBox<ServerDetails> chooseServerComboBox;
+ private javax.swing.JLabel chooseServerLabel;
+ private javax.swing.ButtonGroup domainType;
+ private javax.swing.JButton downloadButton;
+ private javax.swing.JLabel downloadStatusLabel;
+ private javax.swing.JLabel hk2HomeLabel;
+ private javax.swing.JTextField hk2HomeTextField;
+ private javax.swing.JRadioButton localDomainRadioButton;
+ private javax.swing.JButton readlicenseButton;
+ private javax.swing.JRadioButton remoteDomainRadioButton;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Bundle.properties b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Bundle.properties
new file mode 100644
index 0000000..09e8d1e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Bundle.properties
@@ -0,0 +1,173 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#title for wizard server location panel
+TITLE_ServerLocation=Server Location
+TITLE_Properties=Instance Properties
+TITLE_DomainLocation=Domain Location
+STEP_ServerLocation=Server Location
+STEP_Properties=Instance Properties
+STEP_Domain=Domain Name/Location
+#LBL_PreludeInstallLocation=Payara Prelude Installation &Location:
+LBL_BrowseButton=Br&owse...
+#MSG_InvalidPreludeServerLocation=Provide a valid Payara Prelude Home Location
+LBL_ChooserName=Choose Installation Location
+LBL_DirType=Payara Server Install Locations
+LBL_ChooseButton=Choose
+MSG_InstanceRegistrationFailed=Registration Failed
+
+# Download button labels
+LBL_DownloadNow=Download Now...
+LBL_CancelDownload=Cancel Download
+LBL_DownloadComplete=Download Complete
+
+# Download messages
+MSG_DownloadComplete=Download & Install completed in {0}.
+MSG_DownloadCancelled=Download cancelled.
+
+# Add server properties panel
+LBL_USER=&User:
+LBL_PASSWORD=&Password:
+LBL_ADMIN_PORT=&Admin Port:
+LBL_HTTP_PORT=H&TTP Port:
+
+A11Y_NAME_PANEL=Add server
+A11Y_DESC_PANEL=Add server specific data
+A11Y_PASSWD_TXT=Admin user password
+A11Y_ADMIN_PORT_TXT=Administration port
+A11Y_HTTP_PORT_TXT=HTTP port
+
+LBL_InitializationTitle=Initialize
+LBL_ReadLicenseText=<html><body><span style="text-decoration: underline;">I have read and accept the license agreement... (click)</span></body></html>
+LBL_NewInstallDirCanBeUsed=<html><body>{0} does not exist but server can be downloaded and installed there.</body></html>
+
+ERR_BlankInstallDir=Install location cannot be empty.
+ERR_CannotCreate=Cannot be created.
+ERR_InstallDirDoesNotExist=Does not exist.
+ERR_InstallDirInvalid=Not an acceptable folder name.
+ERR_InstallationInvalid=Not a valid Payara Server installation.
+ERR_DefaultDomainInvalid=No usable default domain. Use Next to create a personal domain.
+ERR_DomainExists=The server at {0} is already present on the server tab.
+MSG_DefaultDomainExists=<html>{1} is already registered for this installation.<br/>\
+Choose a different domain on the next page.</html>
+ERR_WrongPort=HTTP port or Admin port is being used or is wrong.
+ERR_MissingData=User or password should be entered.
+
+ERR_DomainAlreadyRegistered=Domain {0} is already registered for this installation.
+MSG_RegisterExistingEmbedded=Register existing embedded domain: {0}
+MSG_CreateEmbedded=Create new embedded domain: {0}
+WRN_CreateEmbedded=<html>Default Java platform is not supported by selected \
+server.<br/>Please create {0} manually using asadmin command line utility<br/> \
+and open this wizard again.</html>
+MSG_RegisterExisting=Register existing domain: {0}
+MSG_CreateDomain=Create domain at {0}
+ERR_CannotCreateDomain=Cannot create domain at {0}
+ERR_UnusableDomain=Unsupported domain at {0}; Admin-listener is disabled or no enabled http-listener
+MSG_MustHaveName=The domain name cannot be blank.
+MSG_EnterDomainDirectory=Enter the path to a directory that will contain a new domain.
+
+ERR_TargetExists=Target {0} already exists. Terminating archive installation.
+ERR_FolderCreationFailed=Failed to create folder: {0}. Terminating archive installation.
+ERR_FolderMoveFailed=Unable to move existing folder {0} out of the way.
+ERR_FileMoveFailed=Unable to move existing file {0} out of the way.
+ERR_TooManyPreludeBackups=Unable to backup {0}. Too many backups already.
+ERR_ChmodFailed=Could not run {0} : Exit value={1}
+ERR_ChmodNotFound=Unable to locate the chmod program.\n\nYou will need to \
+ensure the scripts in the following directories have execute permissions or \
+some tools such as Update Center may not run properly\n
+
+# MSG_Installing - {0} = path, {1} = size string, from MSG_SizeXX below
+# example: Installing glassfish/bin/updatetool.bat (798 bytes))
+MSG_Installing=Installing {0} ({1})
+MSG_Installing2={1} of {2} : Installing {0}
+MSG_SizeBytes={0} bytes
+MSG_SizeKb={0}k
+MSG_SizeMb={0}.{1}m
+
+STATUS_Ready=Ready.
+STATUS_Connecting=Connecting...
+STATUS_Downloading=Downloading...
+STATUS_Complete=
+STATUS_Failed={0}: {1}
+STATUS_Terminated=
+STATUS_InvalidWsdl=Response from this URL is not a valid WSDL file.
+
+TIME_ETERNITY=an eternity
+TIME_NO_TIME=no time at all
+TIME_HOURS={0,choice, 1#{0} hour|2#{0} hours}
+TIME_MINUTES={0,choice, 1#{0} minute|2#{0} minutes}
+TIME_SECONDS={0,choice, 1#{0} second|2#{0} seconds}
+TIME_MILISECONDS={0} ms
+TIME_SEPARATOR=,\
+LBL_InstallLocation=Installation &Location:
+
+MSG_CheckNetworkConfig=Check network configuration
+MSG_InvalidUrl=Invalid URL: {0}
+MSG_FileProblem=File format issue: {0}
+AddServerLocationVisualPanel.downloadStatusLabel.text=<html>[download status] and more and more and more and more</html>
+
+#ERR_BrokenGF3_1_2=<html>{0} is known to have serious bug in JAX-WS.<br>This bug may cause NetBeans to stop responding.<br>Click Next if you really want to register remote or custom local domains with broken server.</html>
+ERR_BrokenGF3_1_2=<html>{0} includes libraries that can cause NetBeans to become<br/>\
+unstable when working on web services. Use the View Domain Update Center<br/>\
+action on server node to upgrade your 3.1.2 installation to 3.1.2.2.</html>
+
+MSG_NextForSpecial=Detected a {0} install. Click Next to register remote or custom local domains.
+ERR_InvalidDomainData=The domain ({0}) has invalid data in domain.xml
+
+TIP_No_file_to_download=No file available to download
+AddDomainLocationVisualPanel.useDefaultPortsCB.text=&Default
+AddDomainLocationVisualPanel.useDefaultPortsCB.text2=Use default ports (disabled due to port conflicts)
+AddDomainLocationVisualPanel.useDefaultPortsCB.toolTipText=4848, 8080, etc.
+
+
+TIP_ADMIN_IN_USE=Default admin port (4848) in use
+TIP_HTTP_IN_USE=Default http port (8080) in use
+
+STR_PF_FAMILY_NAME=Payara Server
+LBL_SELECT_BITS=Select
+LBL_ChooseOne=Choose server to download:
+
+AddDomainLocationPanel.duplicatePortAssigned=Duplicate port value assigned: {0}
+AddDomainLocationPanel.invalidDasPort=Invalid DAS port value: {0}
+AddDomainLocationPanel.invalidHttpPort=Invalid HTTP port value: {0}
+AddDomainLocationPanel.remoteInstance=Remote host: {0} DAS: {1} HTTP: {2}
+AddDomainLocationVisualPanel.useDefaultPortsCB.AccessibleContext.accessibleDescription=Use the standard ports if a domain is created
+AddServerLocationVisualPanel.readlicenseButton.AccessibleContext.accessibleDescription=Press to open license file in window
+AddServerLocationVisualPanel.browseButton.AccessibleContext.accessibleDescription=Open a file chooser to select Payara server installation location
+AddServerLocationVisualPanel.hk2HomeTextField.AccessibleContext.accessibleDescription=Enter Payara server installation location
+AddServerLocationVisualPanel.agreeCheckBox.AccessibleContext.accessibleDescription=Select to acknowledge that you have read the license
+AddServerLocationVisualPanel.remoteDomainRadioButton=Remote Domain
+AddServerLocationVisualPanel.localDomainRadioButton=Local Domain
+AddDomainLocationVisualPanel.targetValueLabel.text=&Target:
+AddDomainLocationVisualPanel.targetValueField.text=\ \ \ \ \ \ \ \ \ \ \ \ \ \
+AddDomainLocationVisualPanel.userNameLabel.text=&User Name:
+AddDomainLocationVisualPanel.passwordLabel.text=Pass&word:
+AddDomainLocationVisualPanel.httpPortFieldLabel.text=HTTP Port:
+AddDomainLocationVisualPanel.dasPortFieldLabel.text=DAS &Port:
+AddDomainLocationVisualPanel.dasPortField.AccessibleContext.accessibleDescription=Enter the value of the admin listener port
+AddDomainLocationVisualPanel.hostRemoteField.AccessibleContext.accessibleDescription=enter the host name or IP address of the remote server
+AddDomainLocationVisualPanel.hostRemoteField.text=
+AddDomainLocationVisualPanel.domainLocalField.AccessibleContext.accessibleDescription=enter the name of the domain that you want to register or create
+AddDomainLocationVisualPanel.domainLocalLabel.text=&Domain:
+AddDomainLocationVisualPanel.domainRemoteLabel.text=&Domain:
+AddDomainLocationVisualPanel.domainRemoteField.text=
+AddDomainLocationVisualPanel.hostLocalLabel.text=Host:
+AddDomainLocationVisualPanel.hostRemoteLabel.text=&Host:
+AddDomainLocationVisualPanel.localIpCB.text=Loopback
+AddDomainLocationVisualPanel.remoteLink.text=<html><a href="#">Note the remote administration needs to be enabled before registering the remote domain.</a></html>
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/PayaraWizardProvider.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/PayaraWizardProvider.java
new file mode 100644
index 0000000..e6f9186
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/PayaraWizardProvider.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import org.netbeans.modules.payara.common.ServerDetails;
+import org.netbeans.spi.server.ServerWizardProvider;
+import org.openide.WizardDescriptor.InstantiatingIterator;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Peter Williams
+ * @author vince kraemer
+ */
+public class PayaraWizardProvider implements ServerWizardProvider {
+
+ public static PayaraWizardProvider createEe6() {
+ return new PayaraWizardProvider(
+ NbBundle.getMessage(PayaraWizardProvider.class,
+ "STR_PF_FAMILY_NAME", new Object[]{}) // NOI18N
+ );
+ }
+
+ public static PayaraWizardProvider createEe7() {
+ return new PayaraWizardProvider(
+ NbBundle.getMessage(PayaraWizardProvider.class,
+ "STR_PF_FAMILY_NAME", new Object[]{}) // NOI18N
+ );
+ }
+
+ public static PayaraWizardProvider createEe8() {
+ return new PayaraWizardProvider(
+ NbBundle.getMessage(PayaraWizardProvider.class,
+ "STR_PF_FAMILY_NAME", new Object[]{}) // NOI18N
+ );
+ }
+
+ private final String displayName;
+
+ private PayaraWizardProvider(
+ String displayName
+ ) {
+ this.displayName = displayName;
+ }
+
+ // ------------------------------------------------------------------------
+ // ServerWizardProvider interface implementation
+ // ------------------------------------------------------------------------
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * Creates an iterator for a wizard to instantiate server objects.
+ * <p/>
+ * @return Server wizard iterator initialized with supported Payara
+ * server versions.
+ */
+ @Override
+ public InstantiatingIterator getInstantiatingIterator() {
+ return ServerDetails.getInstantiatingIterator();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Retriever.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Retriever.java
new file mode 100644
index 0000000..a22cc16
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Retriever.java
@@ -0,0 +1,550 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.ConnectException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.text.MessageFormat;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Retriever implements Runnable {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Trusted certificates manager.
+ * >p/>
+ * Let's just trust any server that we connect to.
+ */
+ private static class RetrieverTrustManager implements X509TrustManager {
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] arg0,
+ String arg1) throws CertificateException {}
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] arg0,
+ String arg1) throws CertificateException {}
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ }
+
+ /**
+ * Host name verification.
+ * <p/>
+ * Let's just trust any server that we connect to.
+ */
+ private static class RetrieverHostnameVerifier implements HostnameVerifier {
+
+ @Override
+ public boolean verify(String string, SSLSession ssls) {
+ return true;
+ }
+ }
+
+ public interface Updater {
+ public void updateMessageText(String msg);
+ public void updateStatusText(String status);
+ public void clearCancelState();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(Retriever.class);
+
+ public static final int LOCATION_DOWNLOAD_TIMEOUT = 20000;
+ public static final int LOCATION_TRIES = 3;
+ public static final int ZIP_DOWNLOAD_TIMEOUT = 120000;
+
+ public static final int STATUS_START = 0;
+ public static final int STATUS_CONNECTING = 1;
+ public static final int STATUS_DOWNLOADING = 2;
+ public static final int STATUS_COMPLETE = 3;
+ public static final int STATUS_FAILED = 4;
+ public static final int STATUS_TERMINATED = 5;
+ public static final int STATUS_BAD_DOWNLOAD = 6;
+
+ /** Trusted certificates manager. */
+ private static final TrustManager[] trustManager
+ = new TrustManager[]{new RetrieverTrustManager()};
+
+ /** Host name verification. */
+ private static final RetrieverHostnameVerifier hostnameVerifier
+ = new RetrieverHostnameVerifier();
+
+ private static final String [] STATUS_MESSAGE = {
+ NbBundle.getMessage(Retriever.class, "STATUS_Ready"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_Connecting"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_Downloading"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_Complete"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_Failed"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_Terminated"), //NOI18N
+ NbBundle.getMessage(Retriever.class, "STATUS_InvalidWsdl") //NOI18N
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Handle HTTPS connection.
+ * <p/>
+ * @param conn HTTPS connection.
+ */
+ protected static void handleSecureConnection(HttpsURLConnection conn) {
+ SSLContext context;
+ try {
+ context = SSLContext.getInstance("SSL");
+ context.init(null, trustManager, null);
+ conn.setSSLSocketFactory(context.getSocketFactory());
+ conn.setHostnameVerifier(hostnameVerifier);
+ } catch (NoSuchAlgorithmException | KeyManagementException ex) {
+ LOGGER.log(Level.INFO, "Cannot handle HTTPS connection", ex);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ private Updater updater;
+ private final String locationUrl;
+ private final String targetUrlPrefix;
+ private final String defaultTargetUrl;
+ private File targetInstallDir;
+ private String topLevelPrefix;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public Retriever(File installDir, String locationUrl, String urlPrefix,
+ String defaultTargetUrl, Updater u, String topLevelPrefix) {
+ this.targetInstallDir = installDir;
+ this.locationUrl = locationUrl;
+ this.targetUrlPrefix = urlPrefix;
+ this.defaultTargetUrl = defaultTargetUrl;
+ this.updater = u;
+ this.topLevelPrefix = topLevelPrefix;
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Thread support for downloading...
+ public void stopRetrieval() {
+ shutdown = true;
+ }
+
+ public int getDownloadState() {
+ return status;
+ }
+
+ private void setDownloadState(int newState) {
+ setDownloadState(newState, true);
+ }
+
+ private void setDownloadState(int newState, boolean display) {
+ status = newState;
+ if(display) {
+ updateMessage(STATUS_MESSAGE[newState]);
+ }
+ }
+
+ private void setDownloadState(int newState, String msg, Exception ex) {
+ status = newState;
+ Object [] args = new Object [] { msg, ex.getMessage()};
+ updateStatus(MessageFormat.format(STATUS_MESSAGE[newState], args));
+ }
+
+ private void updateMessage(final String msg) {
+ updater.updateMessageText(msg);
+ }
+
+ private void updateStatus(final String status) {
+ updater.updateStatusText(status);
+ }
+
+ private String countAsString(int c) {
+ String size; //NOI18N
+ if(c < 1024) {
+ size = NbBundle.getMessage(Retriever.class, "MSG_SizeBytes", c); //NOI18N
+ } else if(c < 1048676) {
+ size = NbBundle.getMessage(Retriever.class, "MSG_SizeKb", c / 1024); //NOI18N
+ } else {
+ int m = c / 1048676;
+ int d = (c - m * 1048676)*10 / 1048676;
+ size = NbBundle.getMessage(Retriever.class, "MSG_SizeMb", m, d); //NOI18N
+ }
+ return size;
+ }
+
+ // Thread plumbing
+ private volatile boolean shutdown;
+ private volatile int status;
+
+ @Override
+ public void run() {
+ // Set name of thread for easier debugging in case of deadlocks, etc.
+ Thread.currentThread().setName("Downloader"); // NOI18N
+
+ shutdown = false;
+ status = STATUS_START;
+ URL targetUrl = null;
+ URLConnection connection = null;
+ InputStream in = null;
+ File backupDir = null;
+ long start = System.currentTimeMillis();
+ String message = null;
+
+ try {
+ backupDir = backupInstallDir(targetInstallDir);
+
+ setDownloadState(STATUS_CONNECTING);
+ targetUrl = new URL(getDownloadLocation());
+
+ Logger.getLogger("payara").log(Level.FINE, "Downloading from {0}", targetUrl); // NOI18N
+ connection = targetUrl.openConnection();
+ connection.setConnectTimeout(ZIP_DOWNLOAD_TIMEOUT);
+ connection.setReadTimeout(ZIP_DOWNLOAD_TIMEOUT);
+ in = connection.getInputStream();
+ setDownloadState(STATUS_DOWNLOADING);
+ int len = connection.getContentLength();
+
+ // Download and unzip the V3 archive.
+ downloadAndInstall(in, targetInstallDir, len);
+
+ if(!shutdown) {
+ long end = System.currentTimeMillis();
+ String duration = getDurationString((int) (end - start));
+ setDownloadState(STATUS_COMPLETE, false);
+ message = NbBundle.getMessage(Retriever.class, "MSG_DownloadComplete", duration); // NOI18N
+ } else {
+ setDownloadState(STATUS_TERMINATED, false);
+ message = NbBundle.getMessage(Retriever.class, "MSG_DownloadCancelled"); // NOI18N
+ }
+ } catch(ConnectException ex) {
+ Logger.getLogger("payara").log(Level.FINE, ex.getLocalizedMessage(), ex); //NOI18N
+ setDownloadState(STATUS_FAILED, "Connection Exception", ex); // NOI18N
+ } catch(MalformedURLException ex) {
+ Logger.getLogger("payara").log(Level.FINE, ex.getLocalizedMessage(), ex); //NOI18N
+ setDownloadState(STATUS_FAILED, "Badly formed URL", ex); // NOI18N
+ } catch(IOException ex) {
+ Logger.getLogger("payara").log(Level.FINE, ex.getLocalizedMessage(), ex); //NOI18N
+ Logger.getLogger("payara").log(Level.FINE, "backupDir =={0}", backupDir); //NOI18N
+ Logger.getLogger("payara").log(Level.FINE, "connection == {0}", connection); //NOI18N
+ Logger.getLogger("payara").log(Level.FINE, "in == {0}", in); //NOI18N
+ setDownloadState(STATUS_FAILED, "I/O Exception", ex); // NOI18N
+ updateMessage(in != null
+ ? NbBundle.getMessage(Retriever.class, "MSG_FileProblem",
+ connection != null ? connection.getURL() : null)
+ : NbBundle.getMessage(Retriever.class, "MSG_InvalidUrl",
+ null == connection ? targetUrl : connection.getURL()));
+ } catch(RuntimeException ex) {
+ Logger.getLogger("payara").log(Level.FINE, ex.getLocalizedMessage(), ex); //NOI18N
+ setDownloadState(STATUS_FAILED, "Runtime Exception", ex); // NOI18N
+ } finally {
+ if(shutdown || status != STATUS_COMPLETE) {
+ restoreInstallDir(targetInstallDir, backupDir);
+ }
+ if(in != null) {
+ try { in.close(); } catch(IOException ex) { }
+ }
+ if(message != null) {
+ updateMessage(message);
+ }
+ updater.clearCancelState();
+ }
+ }
+
+ /**
+ * Retrieve Payara installation bundle download location.
+ * <p/>
+ * @return Payara installation bundle download location.
+ */
+ private String getDownloadLocation() {
+ String location = locationUrl;
+ String result = defaultTargetUrl;
+ int retries = 0;
+ boolean run = true;
+ while(run) {
+ URLConnection conn;
+ try {
+ URL url = new URL(location);
+ conn = url.openConnection();
+ if (conn instanceof HttpURLConnection) {
+ HttpURLConnection hconn = (HttpURLConnection) conn;
+ hconn.setConnectTimeout(LOCATION_DOWNLOAD_TIMEOUT);
+ hconn.setReadTimeout(LOCATION_DOWNLOAD_TIMEOUT);
+ hconn.setRequestMethod("HEAD");
+ if (hconn instanceof HttpsURLConnection) {
+ handleSecureConnection((HttpsURLConnection)hconn);
+ }
+ hconn.connect();
+ int responseCode = hconn.getResponseCode();
+ LOGGER.log(Level.FINE, "URL Response code: {0} {1}",
+ new String[] {Integer.toString(responseCode),
+ hconn.getResponseMessage()});
+ switch (responseCode) {
+ case 301: case 302:
+ location = hconn.getHeaderField("Location");
+ if (location == null || location.trim().isEmpty()) {
+ run = false;
+ } else {
+ LOGGER.log(Level.FINE, "URL Redirrection: {0}",
+ location);
+ run = retries++ < LOCATION_TRIES;
+ }
+ break;
+ case 200:
+ int len = hconn.getContentLength();
+ if (len > 0) {
+ result = location;
+ LOGGER.log(Level.FINE,
+ "New Payara Location: {0}", result);
+ }
+ default:
+ run = false;
+ }
+ } else {
+ LOGGER.log(Level.INFO,
+ "Unexpected connection type: {0}", location);
+ }
+ } catch (MalformedURLException mue) {
+ LOGGER.log(Level.INFO, "Error opening URL connection", mue);
+ run = false;
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, "Error reading from URL", ioe);
+ run = false;
+ }
+ }
+ return result;
+ }
+
+ private static final int READ_BUF_SIZE = 131072; // 128k
+ private static final int WRITE_BUF_SIZE = 131072; // 128k
+
+ private boolean downloadAndInstall(final InputStream in, final File targetFolder, final int filelen) throws IOException {
+ BufferedInputStream bufferedStream = null;
+ JarInputStream jarStream = null;
+ try {
+ final byte [] buffer = new byte [WRITE_BUF_SIZE];
+ bufferedStream = new BufferedInputStream(in, READ_BUF_SIZE);
+ jarStream = new JarInputStream(bufferedStream);
+ final InputStream entryStream = jarStream;
+ int totalBytesRead = 0;
+ JarEntry entry;
+ while(!shutdown && jarStream != null && (entry = (JarEntry)jarStream.getNextEntry()) != null) {
+ String entryName = stripTopLevelDir(entry.getName());
+ if(entryName == null || entryName.length() == 0) {
+ continue;
+ }
+ final File entryFile = new File(targetFolder, entryName);
+ if(entryFile.exists()) {
+ // !PW FIXME entry already exists, offer overwrite option...
+ throw new RuntimeException(NbBundle.getMessage(
+ Retriever.class, "ERR_TargetExists", entryFile.getPath())); // NOI18N
+ } else if(entry.isDirectory()) {
+ if(!entryFile.mkdirs()) {
+ throw new RuntimeException(NbBundle.getMessage(
+ Retriever.class, "ERR_FolderCreationFailed", entryFile.getName())); // NOI18N
+ }
+ } else {
+ File parentFile = entryFile.getParentFile();
+ if(!parentFile.exists() && !parentFile.mkdirs()) {
+ throw new RuntimeException(NbBundle.getMessage(
+ Retriever.class, "ERR_FolderCreationFailed", parentFile.getName())); // NOI18N
+ }
+
+ int bytesRead = 0;
+ FileOutputStream os = null;
+ try {
+ os = new FileOutputStream(entryFile);
+ int len;
+ long lastUpdate = 1;
+ while(!shutdown && (len = entryStream.read(buffer)) >= 0) {
+ bytesRead += len;
+ long update = System.currentTimeMillis() / 333;
+ if(update != lastUpdate) {
+ if (filelen < 1) {
+ // do not know the content length... thanks bogus hoster config
+ updateMessage(NbBundle.getMessage(Retriever.class,
+ "MSG_Installing", entryName, countAsString(bytesRead))); // NOI18N
+ } else {
+ updateMessage(NbBundle.getMessage(Retriever.class,
+ "MSG_Installing2", entryName, countAsString(totalBytesRead), countAsString(filelen))); // NOI18N
+ }
+ lastUpdate = update;
+ }
+ os.write(buffer, 0, len);
+ }
+ } finally {
+ if(os != null) {
+ try { os.close(); } catch(IOException ex) { }
+ }
+ }
+ totalBytesRead += entry.getCompressedSize();
+ }
+ }
+ } finally {
+ if(bufferedStream != null) {
+ try { bufferedStream.close(); } catch(IOException ex) { }
+ }
+ if(jarStream != null) {
+ try { jarStream.close(); } catch(IOException ex) { }
+ }
+ }
+
+ // execute permissions on script files will be corrected in instantiate()
+ return shutdown;
+ }
+
+ private String stripTopLevelDir(String name) {
+ if(name.startsWith(topLevelPrefix)) {
+ int slashIndex = slashIndexOf(name, topLevelPrefix.length());
+ if(slashIndex >= 0) {
+ name = name.substring(slashIndex + 1);
+ }
+ }
+ return name;
+ }
+
+ private static int slashIndexOf(String s, int offset) {
+ int len = s.length();
+ for(int i = offset; i < len; i++) {
+ char c = s.charAt(i);
+ if(c == '/' || c == '\\') {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private File backupInstallDir(File installDir) throws IOException {
+ if(installDir.exists()) {
+ File parent = installDir.getParentFile();
+ String tempName = installDir.getName();
+ for(int i = 1; i < 100; i++) {
+ File target = new File(parent, tempName + i);
+ if(!target.exists()) {
+ if(!installDir.renameTo(target)) {
+ throw new IOException(NbBundle.getMessage(Retriever.class,
+ installDir.isDirectory() ? "ERR_FolderCreationFailed" : "ERR_FileCreationFailed", // NOI18N
+ installDir.getAbsolutePath()));
+ }
+ return target;
+ }
+ }
+ throw new IOException(NbBundle.getMessage(
+ Retriever.class, "ERR_TooManyBackups", installDir.getAbsolutePath())); // NOI18N
+ }
+ return null;
+ }
+
+ private void restoreInstallDir(File installDir, File backupDir) {
+ if(installDir != null && installDir.exists()) {
+ Util.deleteFolder(installDir);
+ }
+
+ if(backupDir != null && backupDir.exists()) {
+ backupDir.renameTo(installDir);
+ }
+ }
+
+ static String getDurationString(int time) {
+ // < 1000 -> XXX ms
+ // > 1000 -> XX seconds
+ // > 60000 -> XX minutes, XX seconds
+ // > 3600000 -> XX hours, XX minutes, XX seconds
+ StringBuilder builder = new StringBuilder(100);
+ if(time < 0) {
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_ETERNITY")); //NOI18N
+ } else if(time == 0) {
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_NO_TIME")); //NOI18N
+ } else {
+ String separator = NbBundle.getMessage(Retriever.class, "TIME_SEPARATOR"); //NOI18N
+ if(time >= 3600000) {
+ int hours = time / 3600000;
+ time %= 3600000;
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_HOURS", hours)); //NOI18N
+ }
+ if(time >= 60000) {
+ if(builder.length() > 0) {
+ builder.append(separator);
+ }
+ int minutes = time / 60000;
+ time %= 60000;
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_MINUTES", minutes)); //NOI18N
+ }
+ if(time >= 1000) { // || builder.length() > 0) {
+ if(builder.length() > 0) {
+ builder.append(separator);
+ }
+ int seconds = (time + 500) / 1000;
+ time %= 1000;
+ if(seconds > 0) {
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_SECONDS", seconds)); //NOI18N
+ }
+ } else if (time > 0 && builder.length() < 1) {
+ builder.append(NbBundle.getMessage(Retriever.class, "TIME_MILISECONDS", time)); //NOI18N
+ }
+ }
+
+ return builder.toString();
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/ServerWizardIterator.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/ServerWizardIterator.java
new file mode 100644
index 0000000..2751799
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/ServerWizardIterator.java
@@ -0,0 +1,538 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import org.netbeans.modules.payara.common.ServerDetails;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.CreateDomain;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.spi.RegisteredDerbyServer;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.payara.spi.Utils;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.NbPreferences;
+import org.openide.util.Utilities;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.common.PortCollection;
+import org.netbeans.modules.payara.spi.PayaraModule;
+
+
+/**
+ * @author Ludo
+ * @author Gaurav Gupta
+ */
+public class ServerWizardIterator extends PortCollection implements WizardDescriptor.InstantiatingIterator, ChangeListener {
+
+ private static final String DEFAULT_USERNAME = "admin";
+ private static final String DEFAULT_PASSWORD = "";
+
+ private transient AddServerLocationPanel locationPanel = null;
+ private transient AddDomainLocationPanel locationPanel2 = null;
+
+ private WizardDescriptor wizard;
+ private transient int index = 0;
+ private transient WizardDescriptor.Panel[] panels = null;
+
+ private final transient List<ChangeListener> listeners = new CopyOnWriteArrayList<>();
+ private String domainsDir;
+ private String domainName;
+ private ServerDetails serverDetails;
+ private final PayaraInstanceProvider instanceProvider;
+ ServerDetails[] acceptedValues;
+ ServerDetails[] downloadableValues;
+ private String targetValue;
+
+ public String getTargetValue() {
+ return targetValue;
+ }
+
+ public void setTargetValue(String targetValue) {
+ this.targetValue = targetValue;
+ }
+
+ public ServerWizardIterator(ServerDetails[] possibleValues, ServerDetails[] downloadableValues) {
+ this.acceptedValues = possibleValues;
+ this.downloadableValues = downloadableValues;
+ this.instanceProvider = PayaraInstanceProvider.getProvider();
+ this.hostName = "localhost"; // NOI18N
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ listeners.remove(l);
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ @Override
+ public void uninitialize(WizardDescriptor wizard) {
+ }
+
+ @Override
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ @Override
+ public void previousPanel() {
+ index--;
+ }
+
+ @Override
+ public void nextPanel() {
+ if (!hasNext()) throw new NoSuchElementException();
+ index++;
+ }
+
+ @Override
+ public String name() {
+ return "Payara Server AddInstanceIterator"; // NOI18N
+ }
+
+ public static void showInformation(final String msg, final String title){
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE);
+ d.setTitle(title);
+ DialogDisplayer.getDefault().notify(d);
+ }
+ });
+ }
+
+ @Override
+ public Set instantiate() throws IOException {
+ Set<ServerInstance> result = new HashSet<>();
+ File ir = new File(installRoot);
+ ensureExecutable(ir);
+ if (null != domainsDir) {
+ handleLocalDomains(result, ir);
+ } else {
+ handleRemoteDomains(result,ir);
+ }
+ // lookup the javadb register service here and use it.
+ RegisteredDerbyServer db = Lookup.getDefault().lookup(RegisteredDerbyServer.class);
+ if (null != db) {
+ File f = new File(ir, "javadb");
+ if (f.exists() && f.isDirectory() && f.canRead()) {
+ db.initialize(f.getAbsolutePath());
+ }
+ }
+ NbPreferences.forModule(this.getClass()).put("INSTALL_ROOT_KEY", installRoot); // NOI18N
+ return result;
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return index < getPanels().length - 1;
+ }
+
+ protected String[] createSteps() {
+ return new String[] {
+ NbBundle.getMessage(ServerWizardIterator.class, "STEP_ServerLocation"), // NOI18N
+ NbBundle.getMessage(ServerWizardIterator.class, "STEP_Domain"), // NOI18N
+ };
+ }
+
+ protected final String[] getSteps() {
+ if (steps == null) {
+ steps = createSteps();
+ }
+ return steps;
+ }
+
+ protected final WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = createPanels();
+ }
+ return panels;
+ }
+
+ protected WizardDescriptor.Panel[] createPanels() {
+ if (locationPanel == null) {
+ locationPanel = new AddServerLocationPanel(this);
+ locationPanel.addChangeListener(this);
+ }
+ if (locationPanel2 == null) {
+ locationPanel2 = new AddDomainLocationPanel(this);
+ locationPanel2.addChangeListener(this);
+ }
+
+ return new WizardDescriptor.Panel[] {
+ (WizardDescriptor.Panel) locationPanel,
+ (WizardDescriptor.Panel) locationPanel2,
+// (WizardDescriptor.Panel)propertiesPanel
+ };
+ }
+
+ private transient String[] steps = null;
+
+ protected final int getIndex() {
+ return index;
+ }
+
+ @Override
+ public WizardDescriptor.Panel current() {
+ WizardDescriptor.Panel result = getPanels()[index];
+ JComponent component = (JComponent)result.getComponent();
+ component.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, getSteps()); // NOI18N
+ component.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, getIndex());// NOI18N
+ return result;
+ }
+
+ @Override
+ public void stateChanged(javax.swing.event.ChangeEvent changeEvent) {
+ fireChangeEvent();
+ }
+
+ protected final void fireChangeEvent() {
+ ChangeEvent ev = new ChangeEvent(this);
+ for(ChangeListener listener: listeners) {
+ listener.stateChanged(ev);
+ }
+ }
+
+ /** Payara server administrator's user name. */
+ private String userName;
+ /** Payara server administrator's password. */
+ private String password;
+ private String installRoot;
+ private String payaraRoot;
+ private String hostName;
+ /** Payara server is local or remote. Value is <code>true</code>
+ * for local server and <code>false</code> for remote server. */
+ private boolean isLocal;
+ private boolean useDefaultPorts;
+ private boolean defaultJavaSESupported;
+
+ public boolean isUseDefaultPorts() {
+ return useDefaultPorts;
+ }
+
+ public void setUseDefaultPorts(boolean useDefaultPorts) {
+ this.useDefaultPorts = useDefaultPorts;
+ }
+
+ public void serDefaultJavaSESupported(boolean defaultJavaSESupported) {
+ this.defaultJavaSESupported = defaultJavaSESupported;
+ }
+
+ public boolean isDefaultJavaSESupported() {
+ return defaultJavaSESupported;
+ }
+
+ /**
+ * Is Payara server local or remote?
+ * <p/>
+ * @return Value is <code>true</code> for local server
+ * and <code>false</code> for remote server.
+ */
+ public boolean isLocal() {
+ return isLocal;
+ }
+
+ /**
+ * Set Payara server as local or remote.
+ * <p/>
+ * @param isLocal Value is <code>true</code> for local server
+ * and <code>false</code> for remote server.
+ */
+ public void setLocal(final boolean isLocal) {
+ this.isLocal = isLocal;
+ }
+
+ public String formatUri(String host, int port, String target,
+ String domainsD, String domainN) {
+ String domainInfo = "";
+ if (null != domainsD && domainsD.length() > 0 &&
+ null != domainN && domainN.length() > 0) {
+ domainInfo
+ = File.pathSeparator + domainsD + File.separator + domainN;
+ }
+ if (null == target || "".equals(target.trim())) {
+ return null != serverDetails
+ ? "[" + payaraRoot + domainInfo + "]"
+ + serverDetails.getUriFragment() + ":" + host + ":" + port
+ : "[" + payaraRoot + domainInfo + "]null:"
+ + host + ":" + port;
+ } else {
+ return null != serverDetails
+ ? "[" + payaraRoot + domainInfo + "]"
+ + serverDetails.getUriFragment() + ":" + host + ":" + port+":"+target
+ : "[" + payaraRoot + domainInfo + "]null:"
+ + host + ":" + port+":"+target;
+ }
+ }
+
+ /**
+ * Set Payara server administrator's user name.
+ * <p/>
+ * @param userName Payara server administrator's user name to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * Set Payara server administrator's password.
+ * <p/>
+ * @param password Payara server administrator's password to set.
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setInstallRoot(String installRoot) {
+ this.installRoot = installRoot;
+ }
+
+ String getPayaraRoot() {
+ return this.payaraRoot;
+ }
+
+ public void setPayaraRoot(String payaraRoot) {
+ this.payaraRoot = payaraRoot;
+ }
+
+ boolean hasServer(String uri) {
+ return instanceProvider.hasServer(uri);
+ }
+
+ ServerDetails isValidInstall(File installDir, File payaraDir, WizardDescriptor wizard) {
+ String errMsg = NbBundle.getMessage(AddServerLocationPanel.class, "ERR_InstallationInvalid", // NOI18N
+ FileUtil.normalizeFile(installDir).getPath());
+ wizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, errMsg); // getSanitizedPath(installDir)));
+ File jar = ServerUtilities.getJarName(payaraDir.getAbsolutePath(), ServerUtilities.GF_JAR_MATCHER);
+ if (jar == null || !jar.exists()) {
+ return null;
+ }
+
+ File containerRef = new File(payaraDir, "config" + File.separator + "glassfish.container");
+ if (!containerRef.exists()) {
+ return null;
+ }
+ for (ServerDetails candidate : acceptedValues) {
+ if (candidate.isInstalledInDirectory(payaraDir)) {
+ wizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, " ");
+ this.serverDetails = candidate;
+ return candidate;
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * Set values for remote domain.
+ * <p/>
+ * Domains directory shall be <code>null</code> for remote domains.
+ * <p/>
+ * @param domainName Domain name to set.
+ */
+ public void setRemoteDomain(final String domainName) {
+ this.domainsDir = null;
+ this.domainName = domainName;
+ }
+
+ // expose for qa-functional tests
+ public void setDomainLocation(String absolutePath) {
+ if (null == absolutePath) {
+ domainsDir = null;
+ domainName = null;
+ } else {
+ int dex = absolutePath.lastIndexOf(File.separator);
+ this.domainsDir = absolutePath.substring(0,dex);
+ this.domainName = absolutePath.substring(dex+1);
+ }
+ }
+
+ // Borrowed from RubyPlatform...
+ private void ensureExecutable(File installDir) {
+ // No excute permissions on Windows. On Unix and Mac, try.
+ if(Utilities.isWindows()) {
+ return;
+ }
+
+ if(!Utils.canWrite(installDir)) {
+ // for unwritable installs (e.g root), don't even bother.
+ return;
+ }
+
+ List<File> binList = new ArrayList<>();
+ for(String binPath: new String[] { "bin", "glassfish/bin", "javadb/bin", // NOI18N
+ "javadb/frameworks/NetworkServer/bin", "javadb/frameworks/embedded/bin" }) { // NOI18N
+ File dir = new File(installDir, binPath);
+ if(dir.exists()) {
+ binList.add(dir);
+ }
+ }
+
+ if(binList.isEmpty()) {
+ return;
+ }
+
+ // Ensure that the binaries are installed as expected
+ // The following logic is from CLIHandler in core/bootstrap:
+ File chmod = new File("/bin/chmod"); // NOI18N
+
+ if(!chmod.isFile()) {
+ // Mac & Linux use /bin, Solaris /usr/bin, others hopefully one of those
+ chmod = new File("/usr/bin/chmod"); // NOI18N
+ }
+
+ if(chmod.isFile()) {
+ try {
+ for(File binDir: binList) {
+ List<String> argv = new ArrayList<>();
+ argv.add(chmod.getAbsolutePath());
+ argv.add("u+rx"); // NOI18N
+
+ String[] files = binDir.list();
+ for(String file : files) {
+ if(file.indexOf('.') == -1 || file.endsWith(".ksh")) {
+ argv.add(file);
+ }
+ }
+
+ ProcessBuilder pb = new ProcessBuilder(argv);
+ pb.directory(binDir);
+ Process process = pb.start();
+ int chmoded = process.waitFor();
+
+ if(chmoded != 0) {
+ throw new IOException(NbBundle.getMessage(
+ Retriever.class, "ERR_ChmodFailed", argv, chmoded)); // NOI18N
+ }
+ }
+ } catch (IOException | InterruptedException | MissingResourceException ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ } else {
+ String message = NbBundle.getMessage(Retriever.class, "ERR_ChmodNotFound"); // NOI18N
+ StringBuilder builder = new StringBuilder(message.length() + 50 * binList.size());
+ builder.append(message);
+ for(File binDir: binList) {
+ builder.append('\n'); // NOI18N
+ builder.append(binDir);
+ }
+ DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
+ builder.toString(), NotifyDescriptor.WARNING_MESSAGE));
+ }
+ }
+
+ private void handleLocalDomains(Set<ServerInstance> result, File ir) {
+ File domainDir = new File(domainsDir, domainName);
+ String canonicalPath = null;
+ try {
+ canonicalPath = domainDir.getCanonicalPath();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara").log(Level.INFO, domainDir.getAbsolutePath(), ioe); // NOI18N
+ }
+ if (null != canonicalPath && !canonicalPath.equals(domainDir.getAbsolutePath())) {
+ setDomainLocation(canonicalPath);
+ domainDir = new File(domainsDir, domainName);
+ }
+ if (!domainDir.exists() && AddServerLocationPanel.canCreate(domainDir)) {
+ // Need to create a domain right here!
+ Map<String, String> ip = new HashMap<>();
+ ip.put(PayaraModule.INSTALL_FOLDER_ATTR, installRoot);
+ ip.put(PayaraModule.PAYARA_FOLDER_ATTR, payaraRoot);
+ ip.put(PayaraModule.DISPLAY_NAME_ATTR, (String) wizard.getProperty("ServInstWizard_displayName")); // NOI18N
+ ip.put(PayaraModule.DOMAINS_FOLDER_ATTR, domainsDir);
+ ip.put(PayaraModule.DOMAIN_NAME_ATTR, domainName);
+ ip.put(PayaraModule.HTTPPORT_ATTR, Integer.toString(getHttpPort()));
+ ip.put(PayaraModule.ADMINPORT_ATTR, Integer.toString(getAdminPort()));
+
+ userName = userName == null || userName.trim().isEmpty() ? DEFAULT_USERNAME : userName;
+ password = password == null || password.trim().isEmpty() ? DEFAULT_PASSWORD : password;
+
+ CreateDomain cd = new CreateDomain(
+ userName, password, new File(payaraRoot),
+ ip, instanceProvider, false, // NOI18N
+ useDefaultPorts,"INSTALL_ROOT_KEY"); // NOI18N
+ int newHttpPort = cd.getHttpPort();
+ int newAdminPort = cd.getAdminPort();
+ cd.start();
+ PayaraInstance instance = PayaraInstance.create((String) wizard.getProperty("ServInstWizard_displayName"), // NOI18N
+ installRoot, payaraRoot, domainsDir, domainName,
+ newHttpPort, newAdminPort, userName, password, targetValue,
+ formatUri(hostName, newAdminPort, getTargetValue(),domainsDir,domainName),
+ instanceProvider);
+ result.add(instance.getCommonInstance());
+ } else {
+ PayaraInstance instance = PayaraInstance.create((String) wizard.getProperty("ServInstWizard_displayName"), // NOI18N
+ installRoot, payaraRoot, domainsDir, domainName,
+ getHttpPort(), getAdminPort(), userName, password, targetValue,
+ formatUri(hostName, getAdminPort(), getTargetValue(), domainsDir, domainName),
+ instanceProvider);
+ result.add(instance.getCommonInstance());
+ }
+ }
+
+ private void handleRemoteDomains(Set<ServerInstance> result, File ir) {
+ String hn = getHostName();
+ if ("localhost".equals(hn)) {
+ hn = "127.0.0.1";
+ }
+ PayaraInstance instance = PayaraInstance.create((String) wizard.getProperty("ServInstWizard_displayName"), // NOI18N
+ installRoot, payaraRoot, null, domainName,
+ getHttpPort(), getAdminPort(), userName, password, targetValue,
+ formatUri(hn, getAdminPort(), getTargetValue(),null, domainName),
+ instanceProvider);
+ result.add(instance.getCommonInstance());
+ }
+
+ /**
+ * @return the hostName
+ */
+ public String getHostName() {
+ return hostName;
+ }
+
+ /**
+ * @param hostName the hostName to set
+ */
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Util.java b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Util.java
new file mode 100644
index 0000000..abb419d
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/common/wizards/Util.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.io.File;
+
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Util {
+
+ private Util() {
+ }
+
+ public static boolean deleteFolder(final File targetDir) {
+ boolean result = true;
+ File [] children = targetDir.listFiles();
+ if(children != null) {
+ for(int i = 0; i < children.length && result; i++) {
+ File target = new File(targetDir, children[i].getName());
+ if(children[i].isDirectory()) {
+ result &= deleteFolder(children[i]);
+ } else {
+ result &= target.delete();
+ }
+ }
+ }
+ result &= targetDir.delete();
+ return result;
+ }
+
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/AppDesc.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/AppDesc.java
new file mode 100644
index 0000000..70bed16
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/AppDesc.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class AppDesc {
+
+ private final String name;
+ private final String path;
+ private final String contextRoot;
+ private final boolean enabled;
+
+ public AppDesc(final String name, final String path, final String contextRoot, boolean enabled) {
+ this.name = name;
+ this.path = path;
+ this.contextRoot = contextRoot;
+ this.enabled = enabled;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getContextRoot() {
+ return contextRoot;
+ }
+
+ public boolean getEnabled() {
+ return enabled;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CommandFactory.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CommandFactory.java
new file mode 100644
index 0000000..69c27c3
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CommandFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+
+/**
+ *
+ * @author vkraemer
+ */
+public interface CommandFactory {
+
+ public CommandSetProperty getSetPropertyCommand(
+ String property, String value);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CustomizerCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CustomizerCookie.java
new file mode 100644
index 0000000..3e4020f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/CustomizerCookie.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.Collection;
+import javax.swing.JPanel;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public interface CustomizerCookie {
+
+ /**
+ * Called when the the server instance customizer is being displayed.
+ *
+ * Addon modules should implement this if they need to provide any pages on
+ * the server instance customizer.
+ *
+ * @return Collection of JPanels which will be displayed as tabs on the
+ * customizer.
+ */
+ public Collection<JPanel> getCustomizerPages();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Decorator.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Decorator.java
new file mode 100644
index 0000000..640898e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Decorator.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.awt.Image;
+import org.openide.util.ImageUtilities;
+
+/**
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+public abstract class Decorator {
+
+ public static final String DISABLED = "disabled ";
+
+ public static final Image DISABLED_BADGE =
+ ImageUtilities.loadImage("org/netbeans/modules/payara/common/resources/disabled-badge.gif"); // NOI18N
+ /**
+ * Returns the badge to be used to decorate the default icon for this node.
+ *
+ * @return badge to apply to default icon for this node.
+ */
+ public Image getIconBadge() {
+ return null;
+ }
+
+ /**
+ * Find an icon for this node (closed).
+ *
+ * @param type constant from BeanInfo
+ * @return icon used to represent the node
+ */
+ public Image getIcon(int type) {
+ return null;
+ }
+
+ /**
+ * Find an icon for this node (opened).
+ *
+ * @param type constant from BeanInfo
+ * @return icon used to represent the node
+ */
+ public Image getOpenedIcon(int type) {
+ return null;
+ }
+
+ /**
+ * Should a refresh action be displayed for this node.
+ *
+ * @return true if refresh is supported.
+ */
+ public boolean isRefreshable() {
+ return false;
+ }
+
+ /**
+ * Can this node be deployed to?
+ *
+ * @return true if deploy is supported (typically folder or instance nodes only.)
+ */
+ public boolean canDeployTo() {
+ return false;
+ }
+
+ /**
+ * Can this node be undeployed?
+ *
+ * @return true if undeploy is supported.
+ */
+ public boolean canUndeploy() {
+ return false;
+ }
+
+ /**
+ * Can this node be undeployed?
+ *
+ * @return true if undeploy is supported.
+ */
+ public boolean canUnregister() {
+ return false;
+ }
+
+ /**
+ * Can this node be executed to show a browser page?
+ *
+ * @return true if can be shown by a browser.
+ */
+ public boolean canShowBrowser() {
+ return false;
+ }
+
+ /**
+ * Can the user edit details about this objects config on the server?
+ *
+ * @return true if the object has a customizer dialog
+ */
+ public boolean canEditDetails() {
+ return false;
+ }
+
+ /**
+ * Can this node be enabled?
+ *
+ * @return true if enable is supported.
+ */
+ public boolean canEnable() {
+ return false;
+ }
+
+ /**
+ * Can this node be disabled?
+ *
+ * @return true if disable is supported.
+ */
+ public boolean canDisable() {
+ return false;
+ }
+
+ /**
+ * Can CDI Probe mode be enabled?
+ *
+ * @return true if CDI Probe mode enable is supported.
+ */
+ public boolean canCDIProbeEnable() {
+ return false;
+ }
+
+ /**
+ * Can CDI Probe mode be disabled?
+ *
+ * @return true if CDI Probe mode disable is supported.
+ */
+ public boolean canCDIProbeDisable() {
+ return false;
+ }
+
+ /**
+ * Can this node be tested?
+ *
+ * @return true if test is supported.
+ */
+ public boolean canTest() {
+ return false;
+ }
+
+ /**
+ * Can this node be copied?
+ *
+ * @return true if copy is supported.
+ */
+ public boolean canCopy() {
+ return false;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/DecoratorFactory.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/DecoratorFactory.java
new file mode 100644
index 0000000..3153137
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/DecoratorFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public interface DecoratorFactory {
+
+ /**
+ * Indicates whether this decorator supports the specified type. Type is
+ * currently one of the strings returned by list-applications for segregating
+ * applications.
+ *
+ * @param type String indicating what type the item to be decorated is.
+ * @return true if this decorator should be used with that type, false otherwise.
+ */
+ public boolean isTypeSupported(String type);
+
+ /**
+ * Obtain a decorator object for the specified type.
+ *
+ * @param type String indicating what type the item to be decorated is.
+ * @return decorator instance
+ */
+ public Decorator getDecorator(String type);
+
+ /**
+ * Returns a map of all decorators supported by this factory, indexed by type.
+ *
+ * @return map of supported decorators
+ */
+ public Map<String, Decorator> getAllDecorators();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ExecSupport.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ExecSupport.java
new file mode 100644
index 0000000..70766da
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ExecSupport.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import org.openide.ErrorManager;
+import org.openide.windows.InputOutput;
+import org.openide.windows.OutputWriter;
+
+public class ExecSupport {
+
+ /** Creates a new instance of ExecSupport */
+ public ExecSupport() {
+ }
+
+ /**
+ * Redirect the standard output and error streams of the child
+ * process to an output window.
+ */
+ public void displayProcessOutputs(final Process child, String displayName, String initialMessage)
+ throws IOException, InterruptedException {
+ // Get a tab on the output window. If this client has been
+ // executed before, the same tab will be returned.
+ InputOutput io = org.openide.windows.IOProvider.getDefault().getIO(displayName, false);
+ OutputWriter ow = io.getOut();
+ try {
+ io.getOut().reset();
+ } catch (IOException e) {
+ // not a critical error, continue
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+// io.select();
+ ow.println(initialMessage);
+ final Thread[] copyMakers = new Thread[3];
+ (copyMakers[0] = new OutputCopier(new InputStreamReader(child.getInputStream()), ow, true)).start();
+ (copyMakers[1] = new OutputCopier(new InputStreamReader(child.getErrorStream()), io.getErr(), true)).start();
+ (copyMakers[2] = new OutputCopier(io.getIn(), new OutputStreamWriter(child.getOutputStream()), true)).start();
+ new Thread() {
+
+ @Override
+ public void run() {
+ try {
+ child.waitFor();
+ Thread.sleep(2000); // time for copymakers
+
+ } catch (InterruptedException e) {
+ } finally {
+ try {
+ copyMakers[0].interrupt();
+ copyMakers[1].interrupt();
+ copyMakers[2].interrupt();
+ } catch (Exception e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ }
+ }
+ }.start();
+ }
+
+ /** This thread simply reads from given Reader and writes read chars to given Writer. */
+ static public class OutputCopier extends Thread {
+ final Writer os;
+ final Reader is;
+ /** while set to false at streams that writes to the OutputWindow it must be
+ * true for a stream that reads from the window.
+ */
+ final boolean autoflush;
+ private boolean done = false;
+
+ public OutputCopier(Reader is, Writer os, boolean b) {
+ this.os = os;
+ this.is = is;
+ autoflush = b;
+ }
+
+ /* Makes copy. */
+ @Override
+ public void run() {
+ int read;
+ char[] buff = new char[256];
+ try {
+ while ((read = read(is, buff, 0, 256)) > 0x0) {
+ if (os != null) {
+ os.write(buff, 0, read);
+ if (autoflush) {
+ os.flush();
+ }
+ }
+ }
+ } catch (IOException | InterruptedException ex) {
+ }
+ }
+
+ @Override
+ public void interrupt() {
+ super.interrupt();
+ done = true;
+ }
+
+ private int read(Reader is, char[] buff, int start, int count) throws InterruptedException, IOException {
+
+ while (!is.ready() && !done) {
+ sleep(100);
+ }
+ return is.read(buff, start, count);
+ }
+ }
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/JrePicker.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/JrePicker.java
new file mode 100644
index 0000000..ab97c29
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/JrePicker.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import javax.swing.JPanel;
+
+/**
+ * Allow modules to override the default UI for the Java page of the v3 instance
+ * customizer.
+ *
+ * @author vkraemer
+ */
+public interface JrePicker {
+ JPanel component(PayaraModule locationHolder);
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule.java
new file mode 100644
index 0000000..88a621f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule.java
@@ -0,0 +1,386 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.Future;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.common.PayaraJvmMode;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+
+/**
+ * Interface implemented by common server support. Always available in server
+ * instance lookup.
+ *
+ * @author Peter Williams
+ */
+public interface PayaraModule {
+
+ // Attribute keys for InstanceProperties map
+ public static final String URL_ATTR = "url"; // NOI18N
+ public static final String INSTALL_FOLDER_ATTR = "installfolder"; // NOI18N
+ public static final String PAYARA_FOLDER_ATTR = "homefolder"; // NOI18N
+ public static final String DISPLAY_NAME_ATTR = "displayName"; // NOI18N
+ public static final String USERNAME_ATTR = "username"; // NOI18N
+ public static final String PASSWORD_ATTR = "password"; // NOI18N
+ public static final String ADMINPORT_ATTR = "adminPort"; // NOI18N
+ public static final String TARGET_ATTR = "target";
+ public static final String HTTPPORT_ATTR = "httpportnumber"; // NOI18N
+ public static final String HOSTNAME_ATTR = "host"; // NOI18N
+ public static final String JRUBY_HOME = "jruby.home"; // NOI18N
+ public static final String GEM_HOME = "GEM_HOME"; // NOI18N
+ public static final String GEM_PATH = "GEM_PATH"; // NOI18N
+ public static final String DOMAINS_FOLDER_ATTR = "domainsfolder"; // NOI18N
+ public static final String DOMAIN_NAME_ATTR = "domainname";
+ public static final String JAVA_PLATFORM_ATTR = "java.platform";
+ public static final String HTTP_MONITOR_FLAG = "httpMonitorOn";
+ public static final String DRIVER_DEPLOY_FLAG = "driverDeployOn";
+ public static final String START_DERBY_FLAG = "derbyStartOn";
+ public static final String USE_IDE_PROXY_FLAG = "useIDEProxyOn";
+ public static final String LOOPBACK_FLAG = "loopbackOn";
+ public static final String HTTPHOST_ATTR = "httphostname"; // NOI18N -- necessary for cluster and instance support
+
+ public static final String USE_SHARED_MEM_ATTR = "use.shared.mem"; // NOI18N
+ public static final String DEBUG_PORT = "debugPort"; // NOI18N
+ public static final String DEBUG_MEM = "debugMem"; // NOI18N
+ public static final String JVM_MODE = "jvmMode"; // NOI18N
+ public static final String NORMAL_MODE = PayaraJvmMode.NORMAL.toString();
+ public static final String DEBUG_MODE = PayaraJvmMode.DEBUG.toString();
+ public static final String PROFILE_MODE = PayaraJvmMode.PROFILE.toString();
+
+ public static final String COMET_FLAG = "v3.grizzly.cometSupport"; // NOI18N
+
+ // Contract provider constants (identify the different containers in V3)
+ public static final String EAR_CONTAINER = "ear"; // NOI18N
+ public static final String WEB_CONTAINER = "web"; // NOI18N
+ public static final String JRUBY_CONTAINER = "jruby"; // NOI18N
+ public static final String EJB_CONTAINER = "ejb"; // NOI18N
+ public static final String APPCLIENT_CONTAINER = "appclient"; // NOI18N
+ public static final String CONNECTOR_CONTAINER = "connector"; // NOI18N
+
+ // Resource types
+ public static final String JDBC = "JDBC"; // NOI18N
+ public static final String JDBC_RESOURCE = "jdbc-resource"; // NOI18N
+ public static final String JDBC_CONNECTION_POOL = "jdbc-connection-pool"; // NOI18N
+ public static final String SESSION_PRESERVATION_FLAG = "preserveSessionsOn";
+
+ public static final String CONNECTORS = "CONNECTORS"; // NOI18N
+ public static final String CONN_RESOURCE = "connector-resource"; // NOI18N
+ public static final String CONN_CONNECTION_POOL = "connector-connection-pool"; // NOI18N
+ public static final String ADMINOBJECT_RESOURCE = "admin-object"; // NOI18N
+
+ public static final String JAVAMAIL = "JAVAMAIL"; // NOI18N
+ public static final String JAVAMAIL_RESOURCE = "javamail-resource"; // NOI18N
+
+ /** Key to mark properties already imported into NetBeans 7.3 and fixed. */
+ public static final String NB73_IMPORT_FIXED = "nb73ImportFixed";
+
+ /** Properties fetching timeout [ms]. */
+ public static final int PROPERTIES_FETCH_TIMEOUT = 10000;
+
+ public CommandFactory getCommandFactory();
+
+ public String getResourcesXmlName();
+
+ public boolean isWritable();
+
+ /**
+ * Enum for the current state of the server (stopped, running, etc.)
+ */
+ public static enum ServerState {
+ STARTING,
+ RUNNING,
+ RUNNING_JVM_DEBUG,
+ RUNNING_JVM_PROFILER,
+ STOPPING,
+ STOPPED,
+ STOPPED_JVM_BP,
+ STOPPED_JVM_PROFILER,
+ UNKNOWN}
+
+ /**
+ * Returns a read-only map of the current instance properties. Use the
+ * attribute constants defined in this file to locate specific properties.
+ *
+ * @return read-only map containing all current instance properties
+ */
+ public Map<String, String> getInstanceProperties();
+
+ public PayaraInstanceProvider getInstanceProvider();
+
+ /**
+ * Returns true if server is remote. Remote servers have special
+ * properties, such as being non-startable from within the IDE.
+ *
+ * @return true if this is a remote server.
+ */
+ public boolean isRemote();
+
+ /**
+ * Sets a property in the instance properties map, if that property has not
+ * been set yet.
+ *
+ * @param name key for this map entry.
+ * @param value value for this key.
+ * @param overwrite true if you want to overwrite the existing key value if any.
+ *
+ * @return the current value of this key, if present in the map already
+ * and overwrite is false. Otherwise, returns the new value being set.
+ */
+ public String setEnvironmentProperty(String name, String value, boolean overwrite);
+
+ /**
+ * Start the server.
+ *
+ * @param stateListener listener to listen message describing the startup
+ * process as it progresses. Can be null.
+ * @param endState {@linkplain ServerState} the server is to be put to upon successful startup
+ * @return Future instance that finishes when the server startup has
+ * completed (or failed).
+ */
+ public Future<TaskState> startServer(TaskStateListener stateListener, ServerState endState);
+
+ /**
+ * Stop the server.
+ *
+ * XXX returned Future instance shouldn't "finish" until server vm has
+ * terminated (or been killed if it hangs).
+ *
+ * @param stateListener listener to listen message describing the shutdown
+ * process as it progresses. Can be null.
+ *
+ * @return Future instance that finishes when the server shutdown message
+ * has been acknowledged.
+ *
+ */
+ public Future<TaskState> stopServer(TaskStateListener stateListener);
+
+ /**
+ * Terminates local Payara server process when started from UI.
+ * <p/>
+ * @param stateListener listener to listen message describing the shutdown
+ * process as it progresses. Can be null.
+ * @return Asynchronous Payara server termination task that finishes
+ * when the server stops responding.
+ */
+ public Future<TaskState> killServer(final TaskStateListener stateListener);
+
+ /**
+ * Restart the server. Starts the server if it's not running. Stops and
+ * then starts the server if it is currently running.
+ *
+ * @param stateListener listener to listen message describing the startup
+ * process as it progresses. Can be null.
+ *
+ * @return Future instance that finishes when the server startup has
+ * completed (or failed).
+ */
+ public Future<TaskState> restartServer(TaskStateListener stateListener);
+
+ /**
+ * Deploy the specified directory or application archive onto the server.
+ *
+ * @param stateListener listener to listen message describing the deploy
+ * process as it progresses. Can be null.
+ * @param application either the root folder of the application (directory
+ * deployment) or the application archive (e.g. war file, etc.)
+ * @param name name to deploy this application under.
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+ public Future<ResultString> deploy(TaskStateListener stateListener,
+ File application, String name);
+
+ /**
+ * Deploy the specified directory or application archive onto the server.
+ *
+ * @param stateListener listener to listen message describing the deploy
+ * process as it progresses. Can be null.
+ * @param application either the root folder of the application (directory
+ * deployment) or the application archive (e.g. war file, etc.)
+ * @param name name to deploy this application under.
+ * @param contextRoot to use for this application on deploy.
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+
+ public Future<ResultString> deploy(TaskStateListener stateListener,
+ File application, String name, String contextRoot);
+
+ /**
+ * Deploy the specified directory or application archive onto the server.
+ *
+ * @param stateListener listener to listen message describing the deploy
+ * process as it progresses. Can be null.
+ * @param application either the root folder of the application (directory
+ * deployment) or the application archive (e.g. war file, etc.)
+ * @param name name to deploy this application under.
+ * @param contextRoot to use for this application on deploy.
+ * @param properties deployment properties
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+
+ public Future<ResultString> deploy(TaskStateListener stateListener,
+ File application, String name, String contextRoot, Map<String,String> properties);
+
+ /**
+ * Redeploy the named application onto the server. The application must
+ * have previously been directory deployed. If not, use deploy().
+ *
+ * @param stateListener listener to listen message describing the redeploy
+ * process as it progresses. Can be null.
+ * @param name name this application is deployed under.
+ *
+ * @return Future instance that finishes when the redeploy command has been
+ * completed.
+ */
+ public Future<ResultString> redeploy(final TaskStateListener stateListener,
+ final String name, final boolean resourcesChanged);
+
+ /**
+ * Redeploy the named application onto the server with a new context root
+ * value. The application must have previously been directory deployed.
+ * If not, use deploy().
+ *
+ * @param stateListener listener to listen message describing the redeploy
+ * process as it progresses. Can be null.
+ * @param name name this application is deployed under.
+ * @param contextRoot to use for this application on deploy (can be null to
+ * reuse existing contextRoot.)
+ *
+ * @return Future instance that finishes when the redeploy command has been
+ * completed.
+ */
+ public Future<ResultString> redeploy(final TaskStateListener stateListener,
+ final String name, final String contextRoot, final boolean resourcesChanged);
+
+ /**
+ * Undeploy the named application.
+ *
+ * @param stateListener listener to listen message describing the undeploy
+ * process as it progresses. Can be null.
+ * @param name name of application to undeploy.
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+ public Future<ResultString> undeploy(TaskStateListener stateListener,
+ String name);
+
+ /**
+ * Enable the named application.
+ *
+ * @param stateListener listener to listen message describing the enable
+ * process as it progresses. Can be null.
+ * @param name name of application to enable.
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+ public Future<ResultString> enable(TaskStateListener stateListener,
+ String name);
+ /**
+ * Disable the named application.
+ *
+ * @param stateListener listener to listen message describing the disable
+ * process as it progresses. Can be null.
+ * @param name name of application to disable.
+ *
+ * @return Future instance that finishes when the deploy command has been
+ * completed.
+ */
+ public Future<ResultString> disable(TaskStateListener stateListener,
+ String name);
+// /**
+// * Execute the specified server command.
+// *
+// * @param command Object representing the server command to execute.
+// *
+// * @return Future instance that finishes when the command has been completed.
+// */
+// public Future<TaskState> execute(ServerCommand command);
+
+ /**
+ * List the applications currently deployed on the server.
+ *
+ * @return array of application names current deployed.
+ */
+ public AppDesc [] getModuleList(String container);
+
+ /**
+ * Map of the resources of specified type currently deployed on the server.
+ *
+ * @return map of resources current deployed.
+ */
+ public Map<String, ResourceDesc> getResourcesMap(String type);
+
+ /**
+ * Returns the current server state (stopped, running, etc.)
+ *
+ * @return current server state as an enum. See enum declaration for
+ * possible states.
+ */
+ public ServerState getServerState();
+
+ /**
+ * Adds a listener that is notified when the server state changes. Call
+ * <code>getServerState()</code> in the listener's method body to find out
+ * the current server state.
+ *
+ * @param listener listener to add.
+ */
+ public void addChangeListener(ChangeListener listener);
+
+ /**
+ * Removes a server state change listener previously added.
+ *
+ * @param listener listener to remove.
+ */
+ public void removeChangeListener(ChangeListener listener);
+
+ public static final String PASSWORD_CONVERTED_FLAG =
+ "this really long string is used to identify a password that has been stored in the Keyring";
+ /**
+ * Get <code>PayaraInstance</code> object associated with this object.
+ * <p/>
+ * @return <code>PayaraInstance</code> object associated with this object.
+ */
+ public PayaraServer getInstance();
+
+ /**
+ * get the password for this server
+ */
+ public String getPassword();
+
+ public boolean supportsRestartInDebug();
+
+ public boolean isRestfulLogAccessSupported();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule2.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule2.java
new file mode 100644
index 0000000..4532a9e
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule2.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+
+/**
+ * Extended version of PayaraModule supporting deployment of standalone
+ * EE module with libraries they require.
+ *
+ * @since org.netbeans.modules.payara.common/0 1.0
+ */
+public interface PayaraModule2 extends PayaraModule {
+
+ /**
+ * @param libraries array of jar files on which standalone EE module depends
+ * and which need to be part of deployment
+ */
+ Future<ResultString> deploy(final TaskStateListener stateListener,
+ final File application, final String name, final String contextRoot,
+ final Map<String,String> properties, final File[] libraries);
+
+ /**
+ * @param libraries array of jar files on which standalone EE module depends
+ * and which need to be part of deployment
+ */
+ Future<ResultString> redeploy(final TaskStateListener stateListener,
+ final String name, final String contextRoot, File[] libraries,
+ boolean resourcesChanged);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule3.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule3.java
new file mode 100644
index 0000000..ed520f1
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModule3.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.spi;
+
+import org.openide.util.RequestProcessor;
+
+/**
+ * Extended version of PayaraModule supporting the server state refresh.
+ *
+ * @author Petr Hejl
+ * @since 1.24
+ */
+public interface PayaraModule3 extends PayaraModule2 {
+
+ /**
+ * Requests the refresh of the server state.
+ * <p/>
+ * @return Task handler when refresh is executed as asynchronous thread
+ * or <code>null</code> otherwise.
+ */
+ RequestProcessor.Task refresh();
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModuleFactory.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModuleFactory.java
new file mode 100644
index 0000000..ec5ae09
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PayaraModuleFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.Properties;
+import org.openide.util.Lookup;
+
+
+/**
+ *
+ * @author Peter Williams
+ */
+public interface PayaraModuleFactory {
+
+ /** Returns true if specified payara install supports the module type
+ * in question.
+ *
+ * @param payaraHome
+ * @param asenvProps
+ * @return true or false depending on whether the referenced payara
+ * install supports this container type.
+ */
+ public boolean isModuleSupported(String payaraHome, Properties asenvProps);
+
+ /** Creates support object for whatever Payara module type this is.
+ *
+ * @param instanceLookup Lookup for the owning Payara Server Instance.
+ * Used by created support object to access common instance functionality
+ * such as start/stop server.
+ *
+ * @return Support object for this Payara module type (JRuby, JavaEE, etc.)
+ */
+ public Object createModule(Lookup instanceLookup);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PluggableNodeProvider.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PluggableNodeProvider.java
new file mode 100644
index 0000000..dd7b815
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/PluggableNodeProvider.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.Map;
+import org.openide.nodes.Node;
+
+public interface PluggableNodeProvider {
+
+ public Node getPluggableNode(Map<String,String> serverProperties);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Recognizer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Recognizer.java
new file mode 100644
index 0000000..28f6b2b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Recognizer.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import org.openide.windows.OutputListener;
+
+/**
+ * Implement this interface to be able to augment server log window processing
+ *
+ * Useful for enabling links and actions in the output window. General design
+ * inspired by Payara and Ruby/Rails project output window support since
+ * V3 needs to support both (and more, e.g. Phobos, Grails, etc.)
+ *
+ * @author Peter Williams
+ */
+public interface Recognizer {
+
+ /**
+ * Process the text field and return an appropriate OutputListener object
+ * if the text field is deemed intersting to this recognizer.
+ *
+ * @param text field to process
+ * @return listener to use with this printed field or null if not interested
+ */
+ public OutputListener processLine(String text);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RecognizerCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RecognizerCookie.java
new file mode 100644
index 0000000..4922a7b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RecognizerCookie.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.Collection;
+
+/**
+ * Addon modules should implement this interface to be able to process server
+ * output in the log window. Useful for turning stack traces into file links.
+ *
+ * @author Peter Williams
+ */
+public interface RecognizerCookie {
+
+ /**
+ * Called whenever the output window log readers are being configured.
+ *
+ * @return Collection of recognizer objects or empty collection if none
+ * available.
+ */
+ public Collection<? extends Recognizer> getRecognizers();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisterDatabase.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisterDatabase.java
new file mode 100644
index 0000000..c24efaf
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisterDatabase.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.modules.derby.api.DerbyDatabases;
+import org.netbeans.modules.derby.spi.support.DerbySupport;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileStateInvalidException;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author Nitya Doraisamy
+ */
+public class RegisterDatabase {
+
+ private static volatile RegisterDatabase reg = null;
+
+ public static RegisterDatabase getDefault(){
+ if (reg == null) {
+ reg = new RegisterDatabase();
+ }
+ return reg;
+ }
+
+ public void setupDerby(String serverinstall) {
+ String location = DerbySupport.getLocation();
+ if (null != location && location.trim().length() > 0) {
+ return;
+ }
+ File dbloc = new File(serverinstall, "javadb"); //NOI18N
+ if (dbloc.exists() && dbloc.isDirectory() && dbloc.canRead()) {
+ DerbySupport.setLocation(dbloc.getAbsolutePath());
+ location = DerbySupport.getSystemHome();
+ if (null != location && location.trim().length() > 0) {
+ return;
+ }else{
+ File dbdir = new File(DerbySupport.getDefaultSystemHome());
+ if (dbdir.exists() == false) {
+ dbdir.mkdirs();
+ }
+ }
+ DerbySupport.setSystemHome(DerbySupport.getDefaultSystemHome());
+ }
+ configureDatabase();
+ }
+
+ public void configureDatabase(){
+ String location = DerbySupport.getLocation();
+ File dbInstall = new File(location);
+ if (dbInstall != null && dbInstall.exists()){
+ registerDerbyLibrary(dbInstall);
+ RequestProcessor.getDefault().post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ DerbyDatabases.createSampleDatabase();
+ } catch (DatabaseException | IOException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ex.getLocalizedMessage(), ex); //NOI18N
+ }
+ //NOI18N
+
+ }
+ });
+ }
+ }
+
+ private void registerDerbyLibrary(final File location) {
+ final FileObject libsFolder = FileUtil.getConfigFile("org-netbeans-api-project-libraries/Libraries"); //NOI18N
+ if (libsFolder!=null){
+ try {
+ libsFolder.getFileSystem().runAtomicAction(
+ new DerbyLibraryRegistrar(location, libsFolder));
+ } catch (FileStateInvalidException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ex.getLocalizedMessage(), ex); //NOI18N
+ } catch (IOException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ex.getLocalizedMessage(), ex); //NOI18N
+ }
+ }
+ }
+
+ static class DerbyLibraryRegistrar implements FileSystem.AtomicAction {
+
+ private File location;
+
+ private FileObject libsFolder;
+
+ DerbyLibraryRegistrar(File location, FileObject libsFolder) {
+ this.location = location;
+ this.libsFolder = libsFolder;
+ }
+
+ @Override
+ public void run() throws IOException {
+ FileLock ld = null;
+ java.io.OutputStream outStreamd = null;
+ Writer outd = null;
+ OutputStreamWriter osw = null;
+ try {
+ // the derby lib driver:
+ FileObject derbyLib =null;
+ derbyLib = libsFolder.getFileObject("JavaDB" ,"xml");//NOI18N
+ if (null == derbyLib) {
+ derbyLib = libsFolder.createData("JavaDB" ,"xml");//NOI18N
+ ld = derbyLib.lock();
+ outStreamd = derbyLib.getOutputStream(ld);
+ osw = new OutputStreamWriter(outStreamd);
+ outd = new BufferedWriter(osw);
+ outd.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE library PUBLIC \"-//NetBeans//DTD Library Declaration 1.0//EN\" \"http://www.netbeans.org/dtds/library-declaration-1_0.dtd\">\n");//NOI18N
+ outd.write("<library version=\"1.0\">\n<name>JAVADB_DRIVER_LABEL</name>\n");//NOI18N
+ outd.write("<type>j2se</type>\n");//NOI18N
+ outd.write("<localizing-bundle>org.netbeans.modules.payara.eecommon.api.Bundle</localizing-bundle>\n");//NOI18N
+ outd.write("<volume>\n<type>classpath</type>\n"); //NOI18N
+ outd.write("<resource>jar:"+new File(location.getAbsolutePath()+"/lib/derby.jar").toURI().toURL()+"!/</resource>\n"); //NOI18N
+ outd.write("<resource>jar:"+new File(location.getAbsolutePath()+"/lib/derbyclient.jar").toURI().toURL()+"!/</resource>\n"); //NOI18N
+ outd.write("<resource>jar:"+new File(location.getAbsolutePath()+"/lib/derbynet.jar").toURI().toURL()+"!/</resource>\n"); //NOI18N
+ outd.write("</volume>\n<volume>\n<type>src</type>\n</volume>\n"); //NOI18N
+ outd.write("<volume>\n<type>javadoc</type>\n"); //NOI18N
+ outd.write("</volume>\n</library>"); //NOI18N
+ }
+ } finally {
+ if (null != outd) {
+ try {
+ outd.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ioe.getLocalizedMessage(), ioe); //NOI18N
+ }
+ }
+ if (null != outStreamd) {
+ try {
+ outStreamd.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ioe.getLocalizedMessage(), ioe); //NOI18N
+ }
+ }
+ if (null != ld) {
+ ld.releaseLock();
+ }
+ }
+ } //run
+ } //DerbyLibraryRegistrar
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDDCatalog.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDDCatalog.java
new file mode 100644
index 0000000..bd624d8
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDDCatalog.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import org.netbeans.spi.server.ServerInstanceProvider;
+
+/**
+ *
+ * @author raccah
+ */
+public interface RegisteredDDCatalog {
+ public void registerRunTimeDDCatalog(ServerInstanceProvider pip);
+ public void refreshRunTimeDDCatalog(ServerInstanceProvider pip, String installRoot);
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDerbyServer.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDerbyServer.java
new file mode 100644
index 0000000..4592f25
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RegisteredDerbyServer.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+/**
+ *
+ * @author vkraemer
+ */
+public interface RegisteredDerbyServer {
+
+ public void initialize(String candidate);
+ public void start();
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RemoveCookie.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RemoveCookie.java
new file mode 100644
index 0000000..699d8da
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/RemoveCookie.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public interface RemoveCookie {
+
+ /**
+ * Called when the associated server instance is being removed from the IDE.
+ *
+ * Addon modules should implement this if they need notification when the
+ * server instance is removed from the IDE (e.g. JavaEE module needs to
+ * remove corresponding JavaEE server instance.)
+ *
+ * @param serverUri uri of server instance being removed although the addon
+ * module should already have this information.
+ */
+ public void removeInstance(String serverUri);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDecorator.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDecorator.java
new file mode 100644
index 0000000..8e1b79f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDecorator.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public abstract class ResourceDecorator extends Decorator {
+
+ /**
+ * What property name does the delete resource command for this resource
+ * type use.
+ *
+ * @return property name to use to specify resource name in delete resource command
+ */
+ public abstract String getCmdPropertyName();
+
+ /**
+ * Does this resource's delete command support --cascade to remove dependent
+ * resources (e.g. connection-pools)
+ *
+ * @return true if we should use cascade=true on delete
+ */
+ public boolean isCascadeDelete() {
+ return false;
+ }
+
+ @Override
+ public boolean canEditDetails() {
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDesc.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDesc.java
new file mode 100644
index 0000000..9d45d96
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ResourceDesc.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.admin.CommandListResources;
+import org.netbeans.modules.payara.tooling.admin.ResultList;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+
+/**
+ * Resource description.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public class ResourceDesc implements Comparable<ResourceDesc> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(ResourceDesc.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Fetch list of resource descriptions of given resource type from given
+ * Payara instance.
+ * <p/>
+ * @param instance Payara instance from which to retrieve
+ * resource descriptions.
+ * @param type Resource type to search for (<code>jdbc-resource</code>,
+ * <code>jdbc-connection-pool</code>, ...).
+ * @return List of resource descriptions retrieved from Payara server.
+ */
+ public static List<ResourceDesc> getResources(
+ PayaraInstance instance, String type) {
+ List<ResourceDesc> resourcesList;
+ List<String> values;
+ ResultList<String> result
+ = CommandListResources.listResources(instance, type, null);
+ if (result != null && result.getState() == TaskState.COMPLETED) {
+ values = result.getValue();
+ } else {
+ values = null;
+ }
+ if (values != null && values.size() > 0) {
+ resourcesList = new ArrayList<ResourceDesc>(values.size());
+ for (String value : values) {
+ resourcesList.add(new ResourceDesc(value, type));
+ }
+ } else {
+ resourcesList = Collections.emptyList();
+ }
+ return resourcesList;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Resource name. */
+ private final String name;
+
+ /** Command type (<code>jdbc-resource</code>,
+ * <code>jdbc-connection-pool</code>, ...). */
+ private final String cmdType;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of resource description.
+ * <p/>
+ * @param name Resource name.
+ * @param cmdType Command type.
+ */
+ public ResourceDesc(final String name, final String cmdType) {
+ this.name = name;
+ this.cmdType = cmdType;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get resource name from resource description.
+ * <p/>
+ * @return Resource name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get command type from resource description.
+ * <p/>
+ * @return Command type.
+ */
+ public String getCommandType() {
+ return cmdType;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Compare this resource description with another one.
+ * <p/>
+ * @param resourceDesc Resource description to be compared with this object.
+ * @return The value <code>0</code> if resource name and command type
+ * <code>String</code> values of this and provided objects
+ * are equal.
+ * The value <code>>0</code> if this resource name (or command
+ * type when resource names are equal) <code>String</code> value
+ * is lexicographically less than in provided object.
+ * The value <code><0</code> if this resource name (or command
+ * type when resource names are equal) <code>String</code> value
+ * is lexicographically greater than in provided object.
+ */
+ @Override
+ public int compareTo(ResourceDesc resourceDesc) {
+ int result = name.compareTo(resourceDesc.name);
+ if(result == 0) {
+ result = cmdType.compareTo(resourceDesc.cmdType);
+ }
+ return result;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ServerUtilities.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ServerUtilities.java
new file mode 100644
index 0000000..efd1240
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/ServerUtilities.java
@@ -0,0 +1,349 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.common.ServerDetails;
+import org.netbeans.modules.payara.common.wizards.PayaraWizardProvider;
+import org.netbeans.spi.server.ServerInstanceProvider;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+
+
+/**
+ * General helper methods for accessing Payara server objects.
+ *
+ * @author Peter Williams
+ * @author Ludovic Champenois
+ * @author Gaurav Gupta
+ */
+public final class ServerUtilities {
+
+ public static final int ACTION_TIMEOUT = 15000;
+ public static final TimeUnit ACTION_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
+ public static final String PF_MODULES_DIR_NAME = "modules"; // NOI18N
+ public static final String PF_LIB_DIR_NAME = "lib"; // NOI18N
+ public static final String VERSION_MATCHER = "(?:-[0-9bSNAPHOT]+(?:\\.[0-9]+(?:_[0-9]+|)|).*|).jar"; // NOI18N
+ public static final String GF_JAR_MATCHER = "glassfish" + VERSION_MATCHER; // NOI18N
+ public static final String PROP_FIRST_RUN = "first_run";
+ private PayaraInstanceProvider pip;
+ private PayaraWizardProvider gwp;
+
+
+ private ServerUtilities(PayaraInstanceProvider pip, PayaraWizardProvider gwp) {
+ assert null != pip;
+ this.pip = pip;
+ this.gwp = gwp;
+ }
+
+// public static ServerUtilities getPreludeUtilities() {
+// PayaraInstanceProvider pip = PayaraInstanceProvider.getPrelude();
+// return null == pip ? null : new ServerUtilities(pip,null);
+// }
+
+ public static ServerUtilities getEe6Utilities() {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ return null == pip ? null : new ServerUtilities(pip,
+ PayaraWizardProvider.createEe6());
+ }
+
+
+ public static ServerUtilities getEe7Utilities() {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ return null == pip ? null : new ServerUtilities(pip,
+ PayaraWizardProvider.createEe7());
+ }
+
+ public static ServerUtilities getEe8Utilities() {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ return null == pip ? null : new ServerUtilities(pip,
+ PayaraWizardProvider.createEe8());
+ }
+
+// public static ServerUtilities getEe6WCUtilities() {
+// PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+// return null == pip ? null : new ServerUtilities(pip,
+// PayaraWizardProvider.createEe6WC());
+// }
+
+ /**
+ * Returns the ServerInstance object for the server with the specified URI.
+ *
+ * @param uri uri identifying the server instance.
+ *
+ * @return ServerInstance object for this server instance.
+ */
+ public ServerInstance getServerInstance(String uri) {
+ ServerInstance retVal = pip.getInstance(uri);
+ return retVal;
+ }
+
+ /**
+ * Creates an iterator for a wizard to instantiate server objects.
+ * <p/>
+ * @return Server wizard iterator initialized with supported Payara
+ * server versions.
+ */
+ public static WizardDescriptor.InstantiatingIterator
+ getInstantiatingIterator() {
+ return ServerDetails.getInstantiatingIterator();
+ }
+
+ /**
+ * Returns true if this server is registered or is in the process of being
+ * registered.
+ *
+ * @param uri uri identifying the server instance.
+ *
+ * @return True if this server is or is being registered, false otherwise.
+ */
+ public boolean isRegisteredUri(String uri) {
+ return pip.getInstance(uri) != null ||
+ PayaraInstanceProvider.activeRegistrationSet.contains(uri);
+ }
+
+ /**
+ * Returns the lookup object for a server instance when the caller only has
+ * the public handle available via common server API.
+ *
+ * @param ServerInstance object for this server instance.
+ *
+ * @return Lookup object maintained by backing instance implementation
+ */
+ public Lookup getLookupFor(ServerInstance instance) {
+ return pip.getLookupFor(instance);
+ }
+
+ /**
+ * Returns the facade implementation for the specified server, if that server
+ * supports the facade class passed in.
+ *
+ * @param uri uri identifying the server instance.
+ * @param serverFacadeClass class definition of the server facade we're
+ * looking for.
+ *
+ * @return facade implementation for specified server or null if either the
+ * server does not exist or the server does not implement this facade.
+ */
+ public <T> T getInstanceByCapability(String uri, Class <T> serverFacadeClass) {
+ return pip.getInstanceByCapability(uri, serverFacadeClass);
+ }
+
+ /**
+ * Returns a list of the server instances that support the facade class
+ * specified (e.g. all servers that support <code>RubyInstance</code>).
+ *
+ * @param serverFacadeClass class definition of the server facade we're
+ * looking for.
+ *
+ * @return list of servers that support the interface specified or an empty
+ * list if no servers support that interface.
+ */
+ public<T> List<T> getInstancesByCapability(Class<T> serverFacadeClass) {
+ return pip.getInstancesByCapability(serverFacadeClass);
+ }
+
+ /**
+ * Returns the ServerInstanceImplementation instance for the server with the
+ * specified URI. Use when you need to avoid calling through the ServerInstance
+ * facade wrapper. Otherwise, you should call <code>getServerInstance()</code> instead.
+ *
+ * @param uri uri identifying the server instance.
+ *
+ * @return ServerInstanceImplementation object for this server instance.
+ */
+// public static ServerInstanceImplementation getInternalServerInstance(String uri) {
+// return PayaraInstanceProvider.getDefault().getInternalInstance(uri);
+// }
+
+ /**
+ * Returns the ServerInstanceProvider for this server plugin so we don't
+ * have to look it up via common server SPI.
+ *
+ * @return the Payara impl for ServerInstanceProvider.
+ */
+ public ServerInstanceProvider getServerProvider() {
+ return pip;
+ }
+
+ /**
+ * Returns the fqn jar name with the correct version
+ *
+ * @return the File with full path of the jar or null
+ */
+ public static File getJarName(String payaraInstallRoot, String jarNamePattern) {
+ return getJarName(payaraInstallRoot, jarNamePattern, PF_MODULES_DIR_NAME);
+ }
+
+ public static File getJarName(String payaraInstallRoot, String jarNamePattern, String subdirectoryName) {
+ File searchDirectory = new File(payaraInstallRoot + File.separatorChar + subdirectoryName);
+ return Utils.getFileFromPattern(jarNamePattern, searchDirectory);
+ }
+
+ /**
+ * Returns the fqn jar name with the correct version
+ *
+ * @return the File with full path of the jar or null
+ */
+ public static File getWsJarName(String payaraInstallRoot, String jarNamePattern) {
+ File modulesDir = new File(payaraInstallRoot + File.separatorChar + PF_MODULES_DIR_NAME);
+ File retVal = Utils.getFileFromPattern(jarNamePattern, modulesDir);
+ if (null == retVal) {
+ retVal = Utils.getFileFromPattern(jarNamePattern,
+ new File(modulesDir,"endorsed"));
+ }
+ return retVal;
+ }
+
+ /**
+ * Get the url for a file, including proper protocol for archive files (jars).
+ *
+ * @param file File to create URL from.
+ *
+ * @return url URL for file with proper protocol specifier.
+ *
+ * @throws java.net.MalformedURLException
+ */
+ public static URL fileToUrl(File file) throws MalformedURLException {
+ URL url = file.toURI().toURL();
+ if (FileUtil.isArchiveFile(url)) {
+ url = FileUtil.getArchiveRoot(url);
+ }
+ return url;
+ }
+
+ /**
+ * Surround the submitted string with quotes if it contains any embedded
+ * whitespace characters.
+ *
+ * Implementation note: Do not trim the submitted string. Assume all
+ * whitespace character are part of a file name or path that requires
+ * quotes.
+ *
+ * !PW FIXME handles only spaces right now. Should handle all whitespace.
+ * !PW FIMME 4NT completion on Windows quotes paths if a folder has a comma
+ * in the name. Might need that too, though I haven't proved it yet. *
+ * @param path
+ * @return
+ */
+ public static final String quote(String path) {
+ return path.indexOf(' ') == -1 ? path : "\"" + path + "\"";
+ }
+
+
+ /**
+ * Determine if the named directory is a TP2 install.
+ *
+ * @param gfRoot the name of the directory to check against.
+ * @return true if the directory appears to be the root of a TP2 installation.
+ */
+ static public boolean isTP2(String gfRoot) {
+ return ServerUtilities.getJarName(gfRoot, ServerUtilities.GF_JAR_MATCHER).getName().indexOf("-tp-2-") > -1; // NOI18N
+ }
+
+ /**
+ * create a list of jars that appear to be Java EE api jars that live in the
+ * modules directory.
+ *
+ * @param jarList the list "so far"
+ * @param parent the directory to look into. Should not be null.
+ * @param depth depth of the server
+ * @param escape pass true if backslashes in jar names should be escaped
+ * @return the complete list of jars that match the selection criteria
+ */
+ public static List<String> filterByManifest(List<String> jarList, FileObject parent, int depth, boolean escape) {
+ // be kind to clients that pass in null
+ if(null != parent) {
+ int parentLength = parent.getPath().length();
+ /* modules/web/jsf-impl.jar was not seen (or added with wrong relative name).
+ * need to calculate size relative to the modules/ dir and not the subdirs
+ * notice: this works only for depth=0 or 1
+ * not need to make it work deeper anyway
+ * with this test, we now also return "web/jsf-impl.jar" which is correct
+ */
+ if (depth==1){
+ parentLength = parent.getParent().getPath().length();
+ }
+
+ for(FileObject candidate: parent.getChildren()) {
+ if(candidate.isFolder()) {
+ if(depth < 1) {
+ filterByManifest(jarList, candidate, depth+1, escape);
+ }
+ continue;
+ } else if(!candidate.getNameExt().endsWith(".jar")) {
+ continue;
+ }
+ JarFile jarFile = null;
+ try {
+ jarFile = new JarFile(FileUtil.toFile(candidate), false);
+ Manifest manifest = jarFile.getManifest();
+ if(manifest != null) {
+ Attributes attrs = manifest.getMainAttributes();
+ if(attrs != null) {
+ String bundleName = attrs.getValue("Bundle-SymbolicName");
+ //String bundleName = attrs.getValue("Extension-Name");
+ if(bundleName != null && bundleName.contains("javax")) {
+ String val = candidate.getPath().substring(parentLength);
+ if(escape) {
+ val = val.replace("\\", "\\\\");
+ }
+ jarList.add(val);
+ }
+ }
+ }
+ } catch (IOException ex) {
+ Logger.getLogger(ServerUtilities.class.getName()).log(Level.INFO,
+ candidate.getPath(), ex);
+ } finally {
+ if (null != jarFile) {
+ try {
+ jarFile.close();
+ } catch (IOException ex) {
+ Logger.getLogger(ServerUtilities.class.getName()).log(Level.INFO,
+ candidate.getPath(), ex);
+ }
+ jarFile = null;
+ }
+ }
+
+ }
+ } else {
+ Logger.getLogger(ServerUtilities.class.getName()).log(Level.FINER,
+ "Null FileObject passed in as the parent parameter. Returning the original list");
+ }
+ return jarList;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Utils.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Utils.java
new file mode 100644
index 0000000..b8a586b
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/Utils.java
@@ -0,0 +1,373 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+/**
+ * Utilities.
+ * <p/>
+ * @author Vince Kraemer
+ */
+public class Utils {
+
+ /**
+ * A canWrite test that may tell the truth on Windows.
+ *
+ * This is a work around for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4420020
+ * @param f the file or directory to test
+ * @return true when the file is writable...
+ */
+ public static boolean canWrite(File f) {
+ if (org.openide.util.Utilities.isWindows()) {
+ // File.canWrite() has lots of bogus return cases associated with
+ // read-only directories and files...
+ boolean retVal = true;
+ java.io.File tmp = null;
+ if (!f.exists()) {
+ retVal = false;
+ } else if (f.isDirectory()) {
+ try {
+ tmp = java.io.File.createTempFile("foo", ".tmp", f);
+ }
+ catch (IOException ex) {
+ // I hate using exceptions for flow of control
+ retVal = false;
+ } finally {
+ if (null != tmp) {
+ tmp.delete();
+ }
+ }
+ } else {
+ java.io.FileOutputStream fos = null;
+ try {
+ fos = new java.io.FileOutputStream(f, true);
+ }
+ catch (FileNotFoundException ex) {
+ // I hate using exceptions for flow of control
+ retVal = false;
+ } finally {
+ if (null != fos) {
+ try {
+ fos.close();
+ } catch (java.io.IOException ioe) {
+ Logger.getLogger(Utils.class.getName()).log(Level.FINEST,
+ null, ioe);
+ }
+ }
+ }
+ }
+ return retVal;
+ } else {
+ // we can actually trust the canWrite() implementation...
+ return f.canWrite();
+ }
+ }
+
+ public static final String VERSIONED_JAR_SUFFIX_MATCHER = "(?:-[0-9]+(?:\\.[0-9]+(?:_[0-9]+|)|).*|).jar"; // NOI18N
+
+ /**
+ *
+ * @param jarNamePattern the name pattern to search for
+ * @param modulesDir the place to look for the pattern
+ * @return the jar file that matches the pattern, null otherwise.
+ *
+ * @since 1.5
+ */
+ public static File getFileFromPattern(String jarNamePattern, File modulesDir) {
+ // if asserts are on... blame the caller
+ assert jarNamePattern != null : "jarNamePattern should not be null";
+ // if this is in production, asserts are off and we should handle this a bit more gracefully
+ if (null == jarNamePattern) {
+ // and log an error message
+ Logger.getLogger("payara").log(Level.INFO, "caller passed invalid jarNamePattern",
+ new NullPointerException("jarNamePattern"));
+ return null;
+ }
+
+ // if asserts are on... blame the caller
+ assert modulesDir != null : "modulesDir should not be null";
+ // if this is in production, asserts are off and we should handle this a bit more gracefully
+ if (null == modulesDir) {
+ // and log an error message
+ Logger.getLogger("payara").log(Level.INFO, "caller passed invalid param",
+ new NullPointerException("modulesDir"));
+ return null;
+ }
+
+ int subindex = jarNamePattern.lastIndexOf("/");
+ if (subindex != -1) {
+ String subdir = jarNamePattern.substring(0, subindex);
+ jarNamePattern = jarNamePattern.substring(subindex + 1);
+ modulesDir = new File(modulesDir, subdir);
+ }
+ if (modulesDir.canRead() && modulesDir.isDirectory()) {
+ // try the express check...
+ String expressPattern = jarNamePattern.replace(ServerUtilities.VERSION_MATCHER, ".jar"); // NOI18N
+ File candidate = new File(modulesDir, expressPattern);
+ if (!"".equals(expressPattern) && candidate.exists()) {
+ return candidate;
+ }
+ // try the longer check...
+ File[] candidates = modulesDir.listFiles(new VersionFilter(jarNamePattern));
+ if (candidates != null && candidates.length > 0) {
+ return candidates[0]; // the first one
+ }
+ }
+ return null;
+ }
+
+ private static class VersionFilter implements FileFilter {
+
+ private final Pattern pattern;
+
+ public VersionFilter(String namePattern) {
+ pattern = Pattern.compile(namePattern);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ }
+
+ public static String sanitizeName(String name) {
+ if (null == name || name.matches("[\\p{L}\\p{N}_][\\p{L}\\p{N}\\-_./;#:]*")) {
+ return name;
+ }
+ // the string is bad...
+ return "_" + name.replaceAll("[^\\p{L}\\p{N}\\-_./;#:]", "_");
+ }
+
+ /**
+ * Add escape characters for backslash and dollar sign characters in
+ * path field.
+ *
+ * @param path file path in string form.
+ * @return adjusted path with backslashes and dollar signs escaped with
+ * backslash character.
+ */
+ public static final String escapePath(String path) {
+ return path.replace("\\", "\\\\").replace("$", "\\$"); // NOI18N
+ }
+
+ /**
+ * Determine if a local port is occupied.
+ *
+ * @param port
+ * @return true, if the local port is in use.
+ */
+ public static boolean isLocalPortOccupied(int port) {
+ ServerSocket ss = null;
+ boolean retVal = true;
+ try {
+ ss = new ServerSocket(port);
+ retVal = false;
+ } catch (IOException ioe) {
+ // do nothing
+ } finally {
+ if (null != ss) {try { ss.close(); } catch (IOException ioe) {} }
+ }
+ return retVal;
+ }
+
+ /**
+ * identify the http/https protocol designator for a port
+ *
+ */
+ public static String getHttpListenerProtocol(String hostname, String port) {
+ String retVal = "http";
+ try {
+ retVal = getHttpListenerProtocol(hostname, Integer.parseInt(port));
+ } catch (NumberFormatException nfe) {
+ Logger.getLogger("payara").log(Level.INFO, "returning http due to exception", nfe);
+ }
+ return retVal;
+ }
+
+ /**
+ * identify the http/https protocol designator for a port
+ *
+ */
+ public static String getHttpListenerProtocol(String hostname, int port) {
+ String retVal = "http";
+ try {
+ if (isSecurePort(hostname, port)) {
+ retVal = "https";
+ }
+ } catch (ConnectException ex) {
+ Logger.getLogger("payara").log(Level.INFO, null, ex);
+ } catch (SocketException ex) {
+ Logger.getLogger("payara").log(Level.FINE, null, ex);
+ } catch (SocketTimeoutException ex) {
+ Logger.getLogger("payara").log(Level.INFO, null, ex);
+ } catch (IOException ex) {
+ Logger.getLogger("payara").log(Level.INFO, null, ex);
+ }
+ return retVal;
+ }
+
+ private static final int PORT_CHECK_TIMEOUT = 2000; // Port check timeout in ms
+
+ /**
+ * Determine whether an http listener is secure or not..
+ *
+ * This method accepts a hostname and port #. It uses this information
+ * to attempt to connect to the port, send a test query, analyze the
+ * result to determine if the port is secure or unsecure (currently only
+ * http / https is supported).
+ * it might emit a warning in the server log for Payara cases
+ * No Harm, just an annoying warning, so we need to use this call only when really needed
+ *
+ * @param hostname the host for the http-listener
+ * @param port the port for the http-listener
+ * @throws IOException
+ * @throws SocketTimeoutException
+ * @throws ConnectException
+ */
+ public static boolean isSecurePort(String hostname, int port)
+ throws IOException, ConnectException, SocketTimeoutException {
+ return isSecurePort(hostname,port, 0);
+ }
+
+ private static boolean isSecurePort(String hostname, int port, int depth)
+ throws IOException, ConnectException, SocketTimeoutException {
+ // Open the socket with a short timeout for connects and reads.
+ Socket socket = new Socket();
+ try {
+ Logger.getLogger("payara-socket-connect-diagnostic").log(Level.FINE, "Using socket.connect", new Exception());
+ socket.connect(new InetSocketAddress(hostname, port), PORT_CHECK_TIMEOUT);
+ socket.setSoTimeout(PORT_CHECK_TIMEOUT);
+ } catch(SocketException ex) { // this could be bug 70020 due to SOCKs proxy not having localhost
+ String socksNonProxyHosts = System.getProperty("socksNonProxyHosts");
+ if(socksNonProxyHosts != null && socksNonProxyHosts.indexOf("localhost") < 0) {
+ String localhost = socksNonProxyHosts.length() > 0 ? "|localhost" : "localhost";
+ System.setProperty("socksNonProxyHosts", socksNonProxyHosts + localhost);
+ ConnectException ce = new ConnectException();
+ ce.initCause(ex);
+ throw ce; //status unknow at this point
+ //next call, we'll be ok and it will really detect if we are secure or not
+ }
+ }
+ //This is the test query used to ping the server in an attempt to
+ //determine if it is secure or not.
+ InputStream is = socket.getInputStream();
+ String testQuery = "GET / HTTP/1.0";
+ PrintWriter pw = new PrintWriter(socket.getOutputStream());
+ pw.println(testQuery);
+ pw.println();
+ pw.flush();
+ byte[] respArr = new byte[1024];
+ boolean isSecure = true;
+ while (is.read(respArr) != -1) {
+ String resp = new String(respArr);
+ if (checkHelper(resp) == false) {
+ isSecure = false;
+ break;
+ }
+ }
+ // Close the socket
+ socket.close();
+ return isSecure;
+ }
+
+ private static boolean checkHelper(String respText) {
+ boolean isSecure = true;
+ if (respText.startsWith("http/1.") || respText.startsWith("HTTP/1.")) {
+ isSecure = false;
+ } else if (respText.contains("<html")) {
+ isSecure = false;
+ } else if (respText.contains("</html")) {
+ // New test added to resolve 106245
+ // when the user has the IDE use a proxy (like webcache.foo.bar.com),
+ // the response comes back as "d><title>....</html>". It looks like
+ // something eats the "<html><hea" off the front of the data that
+ // gets returned.
+ //
+ // This test makes an allowance for that behavior. I figure testing
+ // the likely "last bit" is better than testing a bit that is close
+ // to the data that seems to get eaten.
+ //
+ isSecure = false;
+ } else if (respText.contains("connection: ")) {
+ isSecure = false;
+ }
+ return isSecure;
+ }
+
+ public static void doCopy(FileObject from, FileObject toParent) throws IOException {
+ if (null != from) {
+ if (from.isFolder()) {
+ //FileObject copy = toParent.getF
+ FileObject copy = FileUtil.createFolder(toParent,from.getNameExt());
+ FileObject[] kids = from.getChildren();
+ for (int i = 0; i < kids.length; i++) {
+ doCopy(kids[i], copy);
+ }
+ } else {
+ assert from.isData();
+ FileObject target = toParent.getFileObject(from.getName(),from.getExt());
+ if (null == target) {
+ FileUtil.copyFile(from, toParent, from.getName(), from.getExt());
+ }
+ }
+ }
+ }
+
+ /**
+ * Use the server instance id for a project to decide whether the server specific DD/resource
+ * file should use the {@code glassfish-} prefix.
+ *
+ * @param serverInstanceID
+ * @return
+ */
+ public static boolean useGlassFishPrefix(String serverInstanceID) {
+ if (null == serverInstanceID) {
+ return true;
+ }
+ if (serverInstanceID.contains(PayaraInstanceProvider.EE6WC_DEPLOYER_FRAGMENT)) {
+ return true;
+ }
+ // this check must happen AFTER the EE6WC check...
+ if (serverInstanceID.contains(PayaraInstanceProvider.EE6_DEPLOYER_FRAGMENT)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/VMIntrospector.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/VMIntrospector.java
new file mode 100644
index 0000000..efc892f
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/VMIntrospector.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.spi;
+
+/**
+ *
+ * @author vkraemer
+ *
+ * @since org.netbeans.modules.payara.common/0 1.0
+ */
+public interface VMIntrospector {
+
+ boolean isSuspended(String host, String port);
+
+}
diff --git a/enterprise/payara.common/src/org/netbeans/modules/payara/spi/WSDesc.java b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/WSDesc.java
new file mode 100644
index 0000000..08425f5
--- /dev/null
+++ b/enterprise/payara.common/src/org/netbeans/modules/payara/spi/WSDesc.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.CommandListWebServices;
+import org.netbeans.modules.payara.tooling.admin.ResultList;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.common.PayaraLogger;
+import org.netbeans.modules.payara.common.PayaraInstance;
+
+/**
+ * Web service description.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public class WSDesc {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = PayaraLogger.get(WSDesc.class);
+
+ /** URL extension for WSDL file URL. */
+ private static String WSDL_URL_EXTENSION = "?wsdl";
+
+ /** URL extension for URL for testing. */
+ private static String TEST_URL_EXTENSION = "?Tester";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build WSDL file URL from web service name.
+ * <p/>
+ * @return WSDL file URL.
+ */
+ private static String buildWsdlUrl(String name) {
+ if (name == null)
+ throw new IllegalArgumentException(
+ "Parameter name shall not be null.");
+ StringBuilder sb = new StringBuilder(
+ name.length() + WSDL_URL_EXTENSION.length());
+ sb.append(name);
+ sb.append(WSDL_URL_EXTENSION);
+ return sb.toString();
+ }
+
+ /**
+ * Build URL for testing from web service name.
+ * <p/>
+ * @return URL for testing.
+ */
+ private static String buildTestUrl(String name) {
+ if (name == null)
+ throw new IllegalArgumentException(
+ "Parameter name shall not be null.");
+ StringBuilder sb = new StringBuilder(
+ name.length() + TEST_URL_EXTENSION.length());
+ sb.append(name);
+ sb.append(TEST_URL_EXTENSION);
+ return sb.toString();
+ }
+
+ /**
+ * Fetch list of web service descriptions from given Payara instance.
+ * <p/>
+ * @param instance Payara instance from which to retrieve
+ * web service descriptions.
+ * @return List of web service descriptions retrieved from Payara server.
+ */
+ public static List<WSDesc> getWebServices(PayaraInstance instance) {
+ List<WSDesc> wsList;
+ List<String> values = null;
+ Future<ResultList<String>> future =
+ ServerAdmin.<ResultList<String>>exec(instance,
+ new CommandListWebServices());
+ try {
+ ResultList<String> result = future.get();
+ values = result.getValue();
+ } catch (ExecutionException | InterruptedException | CancellationException ee) {
+ LOGGER.log(Level.INFO, ee.getMessage(), ee);
+ }
+ if (values != null && values.size() > 0) {
+ wsList = new ArrayList<WSDesc>(values.size());
+ for (String value : values) {
+ wsList.add(new WSDesc(value));
+ }
+ } else {
+ wsList = Collections.emptyList();
+ }
+ return wsList;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Web Services Description Language file URL. */
+ private final String wsdlUrl;
+
+ /** URL for testing. */
+ private final String testUrl;
+
+ /** Web service name. */
+ private final String name;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of web service description.
+ * <p/>
+ * @param name Web service name.
+ * @param wsdlUrl WSDL file URL.
+ * @param testUrl URL for testing.
+ */
+ public WSDesc(final String name) {
+ this.name = name;
+ this.wsdlUrl = buildWsdlUrl(name);
+ this.testUrl = buildTestUrl(name);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get web service name from web service description.
+ * <p/>
+ * @return Web service name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get URL for testing from web service description.
+ * <p/>
+ * @return URL for testing.
+ */
+ public String getTestURL() {
+ return testUrl;
+ }
+
+ /**
+ * Get WSDL file URL from web service description.
+ * <p/>
+ * @return WSDL file URL.
+ */
+ public String getWsdlUrl() {
+ return wsdlUrl;
+ }
+
+}
diff --git a/enterprise/payara.common/test/unit/data/modules/endorsed/nottaDirE b/enterprise/payara.common/test/unit/data/modules/endorsed/nottaDirE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/enterprise/payara.common/test/unit/data/modules/endorsed/nottaDirE
diff --git a/enterprise/payara.common/test/unit/data/modules/nottaDir b/enterprise/payara.common/test/unit/data/modules/nottaDir
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/enterprise/payara.common/test/unit/data/modules/nottaDir
diff --git a/enterprise/payara.common/test/unit/data/nottaDir b/enterprise/payara.common/test/unit/data/nottaDir
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/enterprise/payara.common/test/unit/data/nottaDir
diff --git a/enterprise/payara.common/test/unit/data/nottaDir-4_1_2.jar b/enterprise/payara.common/test/unit/data/nottaDir-4_1_2.jar
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/enterprise/payara.common/test/unit/data/nottaDir-4_1_2.jar
@@ -0,0 +1 @@
+
diff --git a/enterprise/payara.common/test/unit/data/subdir/nottaDir-5.0.jar b/enterprise/payara.common/test/unit/data/subdir/nottaDir-5.0.jar
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/enterprise/payara.common/test/unit/data/subdir/nottaDir-5.0.jar
@@ -0,0 +1 @@
+
diff --git a/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/ServerDetailsTest.java b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/ServerDetailsTest.java
new file mode 100644
index 0000000..069bc21
--- /dev/null
+++ b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/ServerDetailsTest.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common;
+
+import java.io.File;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class ServerDetailsTest {
+
+ public ServerDetailsTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of valueOf method, of class ServerDetails.
+ */
+ @Test
+ public void testValueOf() {
+ System.out.println("valueOf");
+ String name = "PAYARA_SERVER_4_1_144";
+ ServerDetails expResult = ServerDetails.PAYARA_SERVER_4_1_144;
+ ServerDetails result = ServerDetails.valueOf(name);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getVersionFromInstallDirectory method, of class ServerDetails.
+ */
+ @Test
+ public void testGetVersionFromInstallDirectory() {
+ System.out.println("getVersionFromInstallDirectory");
+ File glassfishDir = null;
+ int expResult = -1;
+ int result = ServerDetails.getVersionFromInstallDirectory(glassfishDir);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getVersionFromDomainXml method, of class ServerDetails.
+ */
+ @Test
+ public void testGetVersionFromDomainXml() {
+ System.out.println("getVersionFromDomainXml");
+ File domainXml = null;
+ int expResult = -1;
+ int result = ServerDetails.getVersionFromDomainXml(domainXml);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of isInstalledInDirectory method, of class ServerDetails.
+ */
+ @Test
+ public void testIsInstalledInDirectory() {
+ System.out.println("isInstalledInDirectory");
+ File glassfishDir = null;
+ ServerDetails instance = ServerDetails.PAYARA_SERVER_4_1_144;
+ boolean expResult = false;
+ boolean result = instance.isInstalledInDirectory(glassfishDir);
+ assertEquals(expResult, result);
+ }
+
+}
\ No newline at end of file
diff --git a/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesActionTest.java b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesActionTest.java
new file mode 100644
index 0000000..c33cf2c
--- /dev/null
+++ b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/nodes/actions/EnableModulesActionTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.nodes.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class EnableModulesActionTest {
+
+ public EnableModulesActionTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of noDups method, of class EnableModulesAction.
+ */
+ @Test
+ public void testGetDup() {
+ System.out.println("getDup");
+ List<String> targets = null;
+ String expResult = null;
+ String result = EnableModulesAction.getDup(targets);
+ assertEquals(expResult, result);
+ targets = new ArrayList<String>();
+ targets.add("A");
+ result = EnableModulesAction.getDup(targets);
+ assertEquals(expResult, result);
+ targets.add("B");
+ result = EnableModulesAction.getDup(targets);
+ assertEquals(expResult, result);
+ targets.add("C:1");
+ result = EnableModulesAction.getDup(targets);
+ assertEquals(expResult, result);
+ expResult = "C";
+ targets.add("C");
+ result = EnableModulesAction.getDup(targets);
+ assertEquals(expResult, result);
+ }
+
+}
\ No newline at end of file
diff --git a/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanelTest.java b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanelTest.java
new file mode 100644
index 0000000..f135c80
--- /dev/null
+++ b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/common/wizards/AddServerLocationPanelTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.common.wizards;
+
+import java.io.File;
+import java.io.IOException;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AddServerLocationPanelTest {
+
+ public AddServerLocationPanelTest() {
+ }
+
+
+ /**
+ * Test of canCreate method, of class AddServerLocationPanel.
+ */
+ @Test
+ public void testCanCreate() throws IOException {
+ System.out.println("canCreate"); // NOI18N
+ File dir = File.createTempFile("foo", "bar"); // NOI18N
+ boolean expResult = false;
+ boolean result = AddServerLocationPanel.canCreate(dir);
+ assertEquals(expResult, result);
+ dir.delete();
+ expResult = true;
+ result = AddServerLocationPanel.canCreate(dir);
+ assertEquals(expResult, result);
+ }
+
+}
diff --git a/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/spi/UtilsTest.java b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/spi/UtilsTest.java
new file mode 100644
index 0000000..d532891
--- /dev/null
+++ b/enterprise/payara.common/test/unit/src/org/netbeans/modules/payara/spi/UtilsTest.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.junit.*;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.payara.common.PayaraInstance;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class UtilsTest extends NbTestCase {
+
+ public UtilsTest(String testName) {
+ super(testName);
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ @Override
+ public void setUp() {
+ }
+
+ @After
+ @Override
+ public void tearDown() {
+ }
+
+
+ /**
+ * Test of getHttpListenerProtocol method, of class Utils.
+ */
+ @Test
+ public void testGetHttpListenerProtocol() {
+ System.out.println("getHttpListenerProtocol");
+ String hostname = "glassfish.java.net";
+ //int port = 443;
+ //String expResult = "https";
+ //String result = Utils.getHttpListenerProtocol(hostname, port);
+ //assertEquals(expResult, result);
+ int port = 80;
+ String expResult = "http";
+ String result = Utils.getHttpListenerProtocol(hostname, port);
+ assertEquals(expResult, result);
+ }
+
+ @Test
+ public void testGetFileFromPattern() throws Exception {
+ System.out.println("getFileFromPattern");
+ File f;
+ try {
+ f = Utils.getFileFromPattern(null, null);
+ assertNull(f);
+ } catch (AssertionError ae) {
+ // I expect this
+ }
+ try {
+ f = Utils.getFileFromPattern("", null);
+ assertNull(f);
+ } catch (AssertionError ae) {
+ // I expect this
+ }
+ File dataDir = getDataDir();
+ try {
+ f = Utils.getFileFromPattern(null, dataDir);
+ assertNull(f);
+ } catch (AssertionError ae) {
+ // I expect this
+ }
+ f = Utils.getFileFromPattern("", dataDir);
+ assertNull(f);
+ f = Utils.getFileFromPattern("", new File(dataDir, "nottaDir"));
+ assertNull(f);
+ f = Utils.getFileFromPattern("nottaDir", dataDir);
+ assertNotNull(f);
+ f = Utils.getFileFromPattern("nottaDir"+Utils.VERSIONED_JAR_SUFFIX_MATCHER, dataDir);
+ assertNotNull(f);
+ f = Utils.getFileFromPattern("nottaDir.jar", dataDir);
+ assertNull(f);
+ f = Utils.getFileFromPattern("subdir/nottaDir"+Utils.VERSIONED_JAR_SUFFIX_MATCHER, dataDir);
+ assertNotNull(f);
+ f = Utils.getFileFromPattern("subdir/nottaDir.jar", dataDir);
+ assertNull(f);
+ f = Utils.getFileFromPattern("nottasubdir/nottaDir"+Utils.VERSIONED_JAR_SUFFIX_MATCHER, dataDir);
+ assertNull(f);
+ }
+ /**
+ * Test of sanitizeName method, of class Commands.
+ */
+ @Test
+ public void testSanitizeName() {
+ System.out.println("sanitizeName");
+ String name = "aa";
+ String expResult = "aa";
+ String result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ name = "1a";
+ expResult = "1a";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = "_a";
+ expResult = "_a";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = ".a";
+ expResult = "_.a";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = "foo(bar)";
+ expResult = "_foo_bar_";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = "foo((bar)";
+ expResult = "_foo__bar_";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = ".a()";
+ expResult = "_.a__";
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ name = null;
+ expResult = null;
+ result = Utils.sanitizeName(name);
+ assertEquals(expResult, result);
+ }
+
+ public static void main(String... args)
+ throws InterruptedException, ExecutionException {
+ for (int i = 0 ; i < 2000 ; i++) {
+ String hostname = //"127.0.0.1";
+ "10.229.117.91";
+ int port = 4848;
+ Map<String,String> ip = new HashMap<String,String>();
+ ip.put(PayaraModule.HOSTNAME_ATTR, hostname);
+ ip.put(PayaraModule.ADMINPORT_ATTR, port+"");
+ PayaraInstance instance = PayaraInstance.create(ip, null);
+ ResultMap<String, String> result
+ = CommandGetProperty.getProperties(
+ instance, "*.server-config.*.http-listener-1.port");
+ if (result.getState() == TaskState.COMPLETED) {
+ System.out.println(result.getValue());
+ } else {
+ System.out.println(
+ "Could not retrieve properties from server.");
+ }
+ }
+ System.exit(0);
+ }
+
+ @Test
+ public void testIsLocalPortOccupied() throws IOException {
+ System.out.println("isLocalPortOccupied");
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ assert Utils.isLocalPortOccupied(port) : "the port is not occupied?";
+ ss.close();
+ assert !Utils.isLocalPortOccupied(port) : "the port is occupied?";
+ }
+}
diff --git a/enterprise/payara.eecommon/build.xml b/enterprise/payara.eecommon/build.xml
new file mode 100644
index 0000000..9913325
--- /dev/null
+++ b/enterprise/payara.eecommon/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project basedir="." default="build" name="enterprise/payara.eecommon">
+ <description>Builds, tests, and runs the project org.netbeans.modules.payara.eecommon</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
\ No newline at end of file
diff --git a/enterprise/payara.eecommon/licenseinfo.xml b/enterprise/payara.eecommon/licenseinfo.xml
new file mode 100644
index 0000000..261c3aa
--- /dev/null
+++ b/enterprise/payara.eecommon/licenseinfo.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<licenseinfo>
+ <fileset>
+ <file>src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.dtd</file>
+ <license ref="CDDL-1.1" />
+ <comment type="CATEGORY_B" />
+ </fileset>
+ <fileset>
+ <file>src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web.xml</file>
+ <license ref="Apache-2.0-ASF" />
+ <comment type="COMMENT_UNSUPPORTED" />
+ </fileset>
+</licenseinfo>
diff --git a/enterprise/payara.eecommon/manifest.mf b/enterprise/payara.eecommon/manifest.mf
new file mode 100644
index 0000000..06729c8
--- /dev/null
+++ b/enterprise/payara.eecommon/manifest.mf
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.modules.payara.eecommon/0
+OpenIDE-Module-Implementation-Version: 1
+OpenIDE-Module-Layer: org/netbeans/modules/payara/eecommon/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/payara/eecommon/Bundle.properties
+
+
diff --git a/enterprise/payara.eecommon/nbproject/org-netbeans-modules-payara-eecommon.sig b/enterprise/payara.eecommon/nbproject/org-netbeans-modules-payara-eecommon.sig
new file mode 100644
index 0000000..cf37be3
--- /dev/null
+++ b/enterprise/payara.eecommon/nbproject/org-netbeans-modules-payara-eecommon.sig
@@ -0,0 +1,1525 @@
+#Signature file v4.1
+#Version 1.41.1
+
+CLSS public abstract java.awt.Component
+cons protected init()
+fld protected javax.accessibility.AccessibleContext accessibleContext
+fld public final static float BOTTOM_ALIGNMENT = 1.0
+fld public final static float CENTER_ALIGNMENT = 0.5
+fld public final static float LEFT_ALIGNMENT = 0.0
+fld public final static float RIGHT_ALIGNMENT = 1.0
+fld public final static float TOP_ALIGNMENT = 0.0
+innr protected BltBufferStrategy
+innr protected FlipBufferStrategy
+innr protected abstract AccessibleAWTComponent
+innr public final static !enum BaselineResizeBehavior
+intf java.awt.MenuContainer
+intf java.awt.image.ImageObserver
+intf java.io.Serializable
+meth protected boolean requestFocus(boolean)
+meth protected boolean requestFocusInWindow(boolean)
+meth protected final void disableEvents(long)
+meth protected final void enableEvents(long)
+meth protected java.awt.AWTEvent coalesceEvents(java.awt.AWTEvent,java.awt.AWTEvent)
+meth protected java.lang.String paramString()
+meth protected void firePropertyChange(java.lang.String,boolean,boolean)
+meth protected void firePropertyChange(java.lang.String,int,int)
+meth protected void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth protected void processComponentEvent(java.awt.event.ComponentEvent)
+meth protected void processEvent(java.awt.AWTEvent)
+meth protected void processFocusEvent(java.awt.event.FocusEvent)
+meth protected void processHierarchyBoundsEvent(java.awt.event.HierarchyEvent)
+meth protected void processHierarchyEvent(java.awt.event.HierarchyEvent)
+meth protected void processInputMethodEvent(java.awt.event.InputMethodEvent)
+meth protected void processKeyEvent(java.awt.event.KeyEvent)
+meth protected void processMouseEvent(java.awt.event.MouseEvent)
+meth protected void processMouseMotionEvent(java.awt.event.MouseEvent)
+meth protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent)
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean action(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean areFocusTraversalKeysSet(int)
+meth public boolean contains(int,int)
+meth public boolean contains(java.awt.Point)
+meth public boolean getFocusTraversalKeysEnabled()
+meth public boolean getIgnoreRepaint()
+meth public boolean gotFocus(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean handleEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public boolean hasFocus()
+meth public boolean imageUpdate(java.awt.Image,int,int,int,int,int)
+meth public boolean inside(int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean isBackgroundSet()
+meth public boolean isCursorSet()
+meth public boolean isDisplayable()
+meth public boolean isDoubleBuffered()
+meth public boolean isEnabled()
+meth public boolean isFocusCycleRoot(java.awt.Container)
+meth public boolean isFocusOwner()
+meth public boolean isFocusTraversable()
+ anno 0 java.lang.Deprecated()
+meth public boolean isFocusable()
+meth public boolean isFontSet()
+meth public boolean isForegroundSet()
+meth public boolean isLightweight()
+meth public boolean isMaximumSizeSet()
+meth public boolean isMinimumSizeSet()
+meth public boolean isOpaque()
+meth public boolean isPreferredSizeSet()
+meth public boolean isShowing()
+meth public boolean isValid()
+meth public boolean isVisible()
+meth public boolean keyDown(java.awt.Event,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean keyUp(java.awt.Event,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean lostFocus(java.awt.Event,java.lang.Object)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseDown(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseDrag(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseEnter(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseExit(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseMove(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean mouseUp(java.awt.Event,int,int)
+ anno 0 java.lang.Deprecated()
+meth public boolean postEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public boolean prepareImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
+meth public boolean prepareImage(java.awt.Image,java.awt.image.ImageObserver)
+meth public boolean requestFocusInWindow()
+meth public final java.lang.Object getTreeLock()
+meth public final void dispatchEvent(java.awt.AWTEvent)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int checkImage(java.awt.Image,int,int,java.awt.image.ImageObserver)
+meth public int checkImage(java.awt.Image,java.awt.image.ImageObserver)
+meth public int getBaseline(int,int)
+meth public int getHeight()
+meth public int getWidth()
+meth public int getX()
+meth public int getY()
+meth public java.awt.Color getBackground()
+meth public java.awt.Color getForeground()
+meth public java.awt.Component getComponentAt(int,int)
+meth public java.awt.Component getComponentAt(java.awt.Point)
+meth public java.awt.Component locate(int,int)
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component$BaselineResizeBehavior getBaselineResizeBehavior()
+meth public java.awt.ComponentOrientation getComponentOrientation()
+meth public java.awt.Container getFocusCycleRootAncestor()
+meth public java.awt.Container getParent()
+meth public java.awt.Cursor getCursor()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension getSize()
+meth public java.awt.Dimension getSize(java.awt.Dimension)
+meth public java.awt.Dimension minimumSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension preferredSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension size()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Font getFont()
+meth public java.awt.FontMetrics getFontMetrics(java.awt.Font)
+meth public java.awt.Graphics getGraphics()
+meth public java.awt.GraphicsConfiguration getGraphicsConfiguration()
+meth public java.awt.Image createImage(int,int)
+meth public java.awt.Image createImage(java.awt.image.ImageProducer)
+meth public java.awt.Point getLocation()
+meth public java.awt.Point getLocation(java.awt.Point)
+meth public java.awt.Point getLocationOnScreen()
+meth public java.awt.Point getMousePosition()
+meth public java.awt.Point location()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Rectangle bounds()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Rectangle getBounds()
+meth public java.awt.Rectangle getBounds(java.awt.Rectangle)
+meth public java.awt.Toolkit getToolkit()
+meth public java.awt.dnd.DropTarget getDropTarget()
+meth public java.awt.event.ComponentListener[] getComponentListeners()
+meth public java.awt.event.FocusListener[] getFocusListeners()
+meth public java.awt.event.HierarchyBoundsListener[] getHierarchyBoundsListeners()
+meth public java.awt.event.HierarchyListener[] getHierarchyListeners()
+meth public java.awt.event.InputMethodListener[] getInputMethodListeners()
+meth public java.awt.event.KeyListener[] getKeyListeners()
+meth public java.awt.event.MouseListener[] getMouseListeners()
+meth public java.awt.event.MouseMotionListener[] getMouseMotionListeners()
+meth public java.awt.event.MouseWheelListener[] getMouseWheelListeners()
+meth public java.awt.im.InputContext getInputContext()
+meth public java.awt.im.InputMethodRequests getInputMethodRequests()
+meth public java.awt.image.ColorModel getColorModel()
+meth public java.awt.image.VolatileImage createVolatileImage(int,int)
+meth public java.awt.image.VolatileImage createVolatileImage(int,int,java.awt.ImageCapabilities) throws java.awt.AWTException
+meth public java.awt.peer.ComponentPeer getPeer()
+ anno 0 java.lang.Deprecated()
+meth public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
+meth public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String)
+meth public java.lang.String getName()
+meth public java.lang.String toString()
+meth public java.util.Locale getLocale()
+meth public java.util.Set<java.awt.AWTKeyStroke> getFocusTraversalKeys(int)
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public void add(java.awt.PopupMenu)
+meth public void addComponentListener(java.awt.event.ComponentListener)
+meth public void addFocusListener(java.awt.event.FocusListener)
+meth public void addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
+meth public void addHierarchyListener(java.awt.event.HierarchyListener)
+meth public void addInputMethodListener(java.awt.event.InputMethodListener)
+meth public void addKeyListener(java.awt.event.KeyListener)
+meth public void addMouseListener(java.awt.event.MouseListener)
+meth public void addMouseMotionListener(java.awt.event.MouseMotionListener)
+meth public void addMouseWheelListener(java.awt.event.MouseWheelListener)
+meth public void addNotify()
+meth public void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void applyComponentOrientation(java.awt.ComponentOrientation)
+meth public void deliverEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public void disable()
+ anno 0 java.lang.Deprecated()
+meth public void doLayout()
+meth public void enable()
+ anno 0 java.lang.Deprecated()
+meth public void enable(boolean)
+ anno 0 java.lang.Deprecated()
+meth public void enableInputMethods(boolean)
+meth public void firePropertyChange(java.lang.String,byte,byte)
+meth public void firePropertyChange(java.lang.String,char,char)
+meth public void firePropertyChange(java.lang.String,double,double)
+meth public void firePropertyChange(java.lang.String,float,float)
+meth public void firePropertyChange(java.lang.String,long,long)
+meth public void firePropertyChange(java.lang.String,short,short)
+meth public void hide()
+ anno 0 java.lang.Deprecated()
+meth public void invalidate()
+meth public void layout()
+ anno 0 java.lang.Deprecated()
+meth public void list()
+meth public void list(java.io.PrintStream)
+meth public void list(java.io.PrintStream,int)
+meth public void list(java.io.PrintWriter)
+meth public void list(java.io.PrintWriter,int)
+meth public void move(int,int)
+ anno 0 java.lang.Deprecated()
+meth public void nextFocus()
+ anno 0 java.lang.Deprecated()
+meth public void paint(java.awt.Graphics)
+meth public void paintAll(java.awt.Graphics)
+meth public void print(java.awt.Graphics)
+meth public void printAll(java.awt.Graphics)
+meth public void remove(java.awt.MenuComponent)
+meth public void removeComponentListener(java.awt.event.ComponentListener)
+meth public void removeFocusListener(java.awt.event.FocusListener)
+meth public void removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener)
+meth public void removeHierarchyListener(java.awt.event.HierarchyListener)
+meth public void removeInputMethodListener(java.awt.event.InputMethodListener)
+meth public void removeKeyListener(java.awt.event.KeyListener)
+meth public void removeMouseListener(java.awt.event.MouseListener)
+meth public void removeMouseMotionListener(java.awt.event.MouseMotionListener)
+meth public void removeMouseWheelListener(java.awt.event.MouseWheelListener)
+meth public void removeNotify()
+meth public void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void repaint()
+meth public void repaint(int,int,int,int)
+meth public void repaint(long)
+meth public void repaint(long,int,int,int,int)
+meth public void requestFocus()
+meth public void reshape(int,int,int,int)
+ anno 0 java.lang.Deprecated()
+meth public void resize(int,int)
+ anno 0 java.lang.Deprecated()
+meth public void resize(java.awt.Dimension)
+ anno 0 java.lang.Deprecated()
+meth public void revalidate()
+meth public void setBackground(java.awt.Color)
+meth public void setBounds(int,int,int,int)
+meth public void setBounds(java.awt.Rectangle)
+meth public void setComponentOrientation(java.awt.ComponentOrientation)
+meth public void setCursor(java.awt.Cursor)
+meth public void setDropTarget(java.awt.dnd.DropTarget)
+meth public void setEnabled(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFocusTraversalKeysEnabled(boolean)
+meth public void setFocusable(boolean)
+meth public void setFont(java.awt.Font)
+meth public void setForeground(java.awt.Color)
+meth public void setIgnoreRepaint(boolean)
+meth public void setLocale(java.util.Locale)
+meth public void setLocation(int,int)
+meth public void setLocation(java.awt.Point)
+meth public void setMaximumSize(java.awt.Dimension)
+meth public void setMinimumSize(java.awt.Dimension)
+meth public void setName(java.lang.String)
+meth public void setPreferredSize(java.awt.Dimension)
+meth public void setSize(int,int)
+meth public void setSize(java.awt.Dimension)
+meth public void setVisible(boolean)
+meth public void show()
+ anno 0 java.lang.Deprecated()
+meth public void show(boolean)
+ anno 0 java.lang.Deprecated()
+meth public void transferFocus()
+meth public void transferFocusBackward()
+meth public void transferFocusUpCycle()
+meth public void update(java.awt.Graphics)
+meth public void validate()
+supr java.lang.Object
+hfds FOCUS_TRAVERSABLE_DEFAULT,FOCUS_TRAVERSABLE_SET,FOCUS_TRAVERSABLE_UNKNOWN,LOCK,acc,actionListenerK,adjustmentListenerK,appContext,autoFocusTransferOnDisposal,background,backgroundEraseDisabled,boundsOp,bufferStrategy,changeSupport,coalesceEventsParams,coalesceMap,coalescingEnabled,componentListener,componentListenerK,componentOrientation,componentSerializedDataVersion,compoundShape,containerListenerK,cursor,dropTarget,enabled,eventCache,eventLog,eventMask,focusListener,focusListenerK,focusLog,focusTraversalKeyPropertyNames,focusTraversalKeys,focusTraversalKeysEnabled,focusable,font,foreground,graphicsConfig,height,hierarchyBoundsListener,hierarchyBoundsListenerK,hierarchyListener,hierarchyListenerK,ignoreRepaint,incRate,inputMethodListener,inputMethodListenerK,isAddNotifyComplete,isFocusTraversableOverridden,isInc,isPacked,itemListenerK,keyListener,keyListenerK,locale,log,maxSize,maxSizeSet,minSize,minSizeSet,mixingCutoutRegion,mixingLog,mouseListener,mouseListenerK,mouseMotionListener,mouseMotionListenerK,mouseWheelListener,mouseWheelListenerK,name,nameExplicitlySet,newEventsOnly,objectLock,ownedWindowK,parent,peer,peerFont,popups,prefSize,prefSizeSet,requestFocusController,serialVersionUID,textListenerK,valid,visible,width,windowClosingException,windowFocusListenerK,windowListenerK,windowStateListenerK,x,y
+hcls AWTTreeLock,BltSubRegionBufferStrategy,DummyRequestFocusController,FlipSubRegionBufferStrategy,ProxyCapabilities,SingleBufferStrategy
+
+CLSS public java.awt.Container
+cons public init()
+innr protected AccessibleAWTContainer
+meth protected java.lang.String paramString()
+meth protected void addImpl(java.awt.Component,java.lang.Object,int)
+meth protected void processContainerEvent(java.awt.event.ContainerEvent)
+meth protected void processEvent(java.awt.AWTEvent)
+meth protected void validateTree()
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean areFocusTraversalKeysSet(int)
+meth public boolean isAncestorOf(java.awt.Component)
+meth public boolean isFocusCycleRoot()
+meth public boolean isFocusCycleRoot(java.awt.Container)
+meth public boolean isFocusTraversalPolicySet()
+meth public boolean isValidateRoot()
+meth public final boolean isFocusTraversalPolicyProvider()
+meth public final void setFocusTraversalPolicyProvider(boolean)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int countComponents()
+ anno 0 java.lang.Deprecated()
+meth public int getComponentCount()
+meth public int getComponentZOrder(java.awt.Component)
+meth public java.awt.Component add(java.awt.Component)
+meth public java.awt.Component add(java.awt.Component,int)
+meth public java.awt.Component add(java.lang.String,java.awt.Component)
+meth public java.awt.Component findComponentAt(int,int)
+meth public java.awt.Component findComponentAt(java.awt.Point)
+meth public java.awt.Component getComponent(int)
+meth public java.awt.Component getComponentAt(int,int)
+meth public java.awt.Component getComponentAt(java.awt.Point)
+meth public java.awt.Component locate(int,int)
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component[] getComponents()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension minimumSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Dimension preferredSize()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.FocusTraversalPolicy getFocusTraversalPolicy()
+meth public java.awt.Insets getInsets()
+meth public java.awt.Insets insets()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.LayoutManager getLayout()
+meth public java.awt.Point getMousePosition(boolean)
+meth public java.awt.event.ContainerListener[] getContainerListeners()
+meth public java.util.Set<java.awt.AWTKeyStroke> getFocusTraversalKeys(int)
+meth public void add(java.awt.Component,java.lang.Object)
+meth public void add(java.awt.Component,java.lang.Object,int)
+meth public void addContainerListener(java.awt.event.ContainerListener)
+meth public void addNotify()
+meth public void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
+meth public void applyComponentOrientation(java.awt.ComponentOrientation)
+meth public void deliverEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public void doLayout()
+meth public void invalidate()
+meth public void layout()
+ anno 0 java.lang.Deprecated()
+meth public void list(java.io.PrintStream,int)
+meth public void list(java.io.PrintWriter,int)
+meth public void paint(java.awt.Graphics)
+meth public void paintComponents(java.awt.Graphics)
+meth public void print(java.awt.Graphics)
+meth public void printComponents(java.awt.Graphics)
+meth public void remove(int)
+meth public void remove(java.awt.Component)
+meth public void removeAll()
+meth public void removeContainerListener(java.awt.event.ContainerListener)
+meth public void removeNotify()
+meth public void setComponentZOrder(java.awt.Component,int)
+meth public void setFocusCycleRoot(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
+meth public void setFont(java.awt.Font)
+meth public void setLayout(java.awt.LayoutManager)
+meth public void transferFocusDownCycle()
+meth public void update(java.awt.Graphics)
+meth public void validate()
+supr java.awt.Component
+hfds EMPTY_ARRAY,INCLUDE_SELF,SEARCH_HEAVYWEIGHTS,component,containerListener,containerSerializedDataVersion,descendUnconditionallyWhenValidating,descendantsCount,dispatcher,eventLog,focusCycleRoot,focusTraversalPolicy,focusTraversalPolicyProvider,isJavaAwtSmartInvalidate,layoutMgr,listeningBoundsChildren,listeningChildren,log,mixingLog,modalAppContext,modalComp,numOfHWComponents,numOfLWComponents,preserveBackgroundColor,printing,printingThreads,serialPersistentFields,serialVersionUID
+hcls DropTargetEventTargetFilter,EventTargetFilter,MouseEventTargetFilter,WakingRunnable
+
+CLSS public abstract interface java.awt.MenuContainer
+meth public abstract boolean postEvent(java.awt.Event)
+ anno 0 java.lang.Deprecated()
+meth public abstract java.awt.Font getFont()
+meth public abstract void remove(java.awt.MenuComponent)
+
+CLSS public abstract interface java.awt.image.ImageObserver
+fld public final static int ABORT = 128
+fld public final static int ALLBITS = 32
+fld public final static int ERROR = 64
+fld public final static int FRAMEBITS = 16
+fld public final static int HEIGHT = 2
+fld public final static int PROPERTIES = 4
+fld public final static int SOMEBITS = 8
+fld public final static int WIDTH = 1
+meth public abstract boolean imageUpdate(java.awt.Image,int,int,int,int,int)
+
+CLSS public abstract interface java.beans.PropertyChangeListener
+intf java.util.EventListener
+meth public abstract void propertyChange(java.beans.PropertyChangeEvent)
+
+CLSS public abstract interface java.io.Externalizable
+intf java.io.Serializable
+meth public abstract void readExternal(java.io.ObjectInput) throws java.io.IOException,java.lang.ClassNotFoundException
+meth public abstract void writeExternal(java.io.ObjectOutput) throws java.io.IOException
+
+CLSS public abstract interface java.io.FileFilter
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract boolean accept(java.io.File)
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
+meth public abstract int compareTo({java.lang.Comparable%0})
+
+CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
+cons protected init(java.lang.String,int)
+intf java.io.Serializable
+intf java.lang.Comparable<{java.lang.Enum%0}>
+meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected final void finalize()
+meth public final boolean equals(java.lang.Object)
+meth public final int compareTo({java.lang.Enum%0})
+meth public final int hashCode()
+meth public final int ordinal()
+meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
+meth public final java.lang.String name()
+meth public java.lang.String toString()
+meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
+supr java.lang.Object
+hfds name,ordinal
+
+CLSS public abstract interface !annotation java.lang.FunctionalInterface
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public abstract interface java.lang.Runnable
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract void run()
+
+CLSS public java.lang.Thread
+cons public init()
+cons public init(java.lang.Runnable)
+cons public init(java.lang.Runnable,java.lang.String)
+cons public init(java.lang.String)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable,java.lang.String)
+cons public init(java.lang.ThreadGroup,java.lang.Runnable,java.lang.String,long)
+cons public init(java.lang.ThreadGroup,java.lang.String)
+fld public final static int MAX_PRIORITY = 10
+fld public final static int MIN_PRIORITY = 1
+fld public final static int NORM_PRIORITY = 5
+innr public abstract interface static UncaughtExceptionHandler
+innr public final static !enum State
+intf java.lang.Runnable
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth public boolean isInterrupted()
+meth public final boolean isAlive()
+meth public final boolean isDaemon()
+meth public final int getPriority()
+meth public final java.lang.String getName()
+meth public final java.lang.ThreadGroup getThreadGroup()
+meth public final void checkAccess()
+meth public final void join() throws java.lang.InterruptedException
+meth public final void join(long) throws java.lang.InterruptedException
+meth public final void join(long,int) throws java.lang.InterruptedException
+meth public final void resume()
+ anno 0 java.lang.Deprecated()
+meth public final void setDaemon(boolean)
+meth public final void setName(java.lang.String)
+meth public final void setPriority(int)
+meth public final void stop()
+ anno 0 java.lang.Deprecated()
+meth public final void stop(java.lang.Throwable)
+ anno 0 java.lang.Deprecated()
+meth public final void suspend()
+ anno 0 java.lang.Deprecated()
+meth public int countStackFrames()
+ anno 0 java.lang.Deprecated()
+meth public java.lang.ClassLoader getContextClassLoader()
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String toString()
+meth public java.lang.Thread$State getState()
+meth public java.lang.Thread$UncaughtExceptionHandler getUncaughtExceptionHandler()
+meth public long getId()
+meth public static boolean holdsLock(java.lang.Object)
+meth public static boolean interrupted()
+meth public static int activeCount()
+meth public static int enumerate(java.lang.Thread[])
+meth public static java.lang.Thread currentThread()
+meth public static java.lang.Thread$UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()
+meth public static java.util.Map<java.lang.Thread,java.lang.StackTraceElement[]> getAllStackTraces()
+meth public static void dumpStack()
+meth public static void setDefaultUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler)
+meth public static void sleep(long) throws java.lang.InterruptedException
+meth public static void sleep(long,int) throws java.lang.InterruptedException
+meth public static void yield()
+meth public void destroy()
+ anno 0 java.lang.Deprecated()
+meth public void interrupt()
+meth public void run()
+meth public void setContextClassLoader(java.lang.ClassLoader)
+meth public void setUncaughtExceptionHandler(java.lang.Thread$UncaughtExceptionHandler)
+meth public void start()
+supr java.lang.Object
+hfds EMPTY_STACK_TRACE,SUBCLASS_IMPLEMENTATION_PERMISSION,blocker,blockerLock,contextClassLoader,daemon,defaultUncaughtExceptionHandler,eetop,group,inheritableThreadLocals,inheritedAccessControlContext,name,nativeParkEventPointer,parkBlocker,priority,single_step,stackSize,stillborn,target,threadInitNumber,threadLocalRandomProbe,threadLocalRandomSecondarySeed,threadLocalRandomSeed,threadLocals,threadQ,threadSeqNumber,threadStatus,tid,uncaughtExceptionHandler
+hcls Caches,WeakClassKey
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
+CLSS public abstract interface java.util.EventListener
+
+CLSS public abstract interface javax.accessibility.Accessible
+meth public abstract javax.accessibility.AccessibleContext getAccessibleContext()
+
+CLSS public abstract javax.swing.JComponent
+cons public init()
+fld protected javax.swing.event.EventListenerList listenerList
+fld protected javax.swing.plaf.ComponentUI ui
+fld public final static int UNDEFINED_CONDITION = -1
+fld public final static int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT = 1
+fld public final static int WHEN_FOCUSED = 0
+fld public final static int WHEN_IN_FOCUSED_WINDOW = 2
+fld public final static java.lang.String TOOL_TIP_TEXT_KEY = "ToolTipText"
+innr public abstract AccessibleJComponent
+intf java.io.Serializable
+meth protected boolean isPaintingOrigin()
+meth protected boolean processKeyBinding(javax.swing.KeyStroke,java.awt.event.KeyEvent,int,boolean)
+meth protected boolean requestFocusInWindow(boolean)
+meth protected java.awt.Graphics getComponentGraphics(java.awt.Graphics)
+meth protected java.lang.String paramString()
+meth protected void fireVetoableChange(java.lang.String,java.lang.Object,java.lang.Object) throws java.beans.PropertyVetoException
+meth protected void paintBorder(java.awt.Graphics)
+meth protected void paintChildren(java.awt.Graphics)
+meth protected void paintComponent(java.awt.Graphics)
+meth protected void printBorder(java.awt.Graphics)
+meth protected void printChildren(java.awt.Graphics)
+meth protected void printComponent(java.awt.Graphics)
+meth protected void processComponentKeyEvent(java.awt.event.KeyEvent)
+meth protected void processKeyEvent(java.awt.event.KeyEvent)
+meth protected void processMouseEvent(java.awt.event.MouseEvent)
+meth protected void processMouseMotionEvent(java.awt.event.MouseEvent)
+meth protected void setUI(javax.swing.plaf.ComponentUI)
+meth public <%0 extends java.util.EventListener> {%%0}[] getListeners(java.lang.Class<{%%0}>)
+meth public boolean contains(int,int)
+meth public boolean getAutoscrolls()
+meth public boolean getInheritsPopupMenu()
+meth public boolean getVerifyInputWhenFocusTarget()
+meth public boolean isDoubleBuffered()
+meth public boolean isManagingFocus()
+ anno 0 java.lang.Deprecated()
+meth public boolean isOpaque()
+meth public boolean isOptimizedDrawingEnabled()
+meth public boolean isPaintingTile()
+meth public boolean isRequestFocusEnabled()
+meth public boolean isValidateRoot()
+meth public boolean requestDefaultFocus()
+ anno 0 java.lang.Deprecated()
+meth public boolean requestFocus(boolean)
+meth public boolean requestFocusInWindow()
+meth public final boolean isPaintingForPrint()
+meth public final java.lang.Object getClientProperty(java.lang.Object)
+meth public final javax.swing.ActionMap getActionMap()
+meth public final javax.swing.InputMap getInputMap()
+meth public final javax.swing.InputMap getInputMap(int)
+meth public final void putClientProperty(java.lang.Object,java.lang.Object)
+meth public final void setActionMap(javax.swing.ActionMap)
+meth public final void setInputMap(int,javax.swing.InputMap)
+meth public float getAlignmentX()
+meth public float getAlignmentY()
+meth public int getBaseline(int,int)
+meth public int getConditionForKeyStroke(javax.swing.KeyStroke)
+meth public int getDebugGraphicsOptions()
+meth public int getHeight()
+meth public int getWidth()
+meth public int getX()
+meth public int getY()
+meth public java.awt.Component getNextFocusableComponent()
+ anno 0 java.lang.Deprecated()
+meth public java.awt.Component$BaselineResizeBehavior getBaselineResizeBehavior()
+meth public java.awt.Container getTopLevelAncestor()
+meth public java.awt.Dimension getMaximumSize()
+meth public java.awt.Dimension getMinimumSize()
+meth public java.awt.Dimension getPreferredSize()
+meth public java.awt.Dimension getSize(java.awt.Dimension)
+meth public java.awt.FontMetrics getFontMetrics(java.awt.Font)
+meth public java.awt.Graphics getGraphics()
+meth public java.awt.Insets getInsets()
+meth public java.awt.Insets getInsets(java.awt.Insets)
+meth public java.awt.Point getLocation(java.awt.Point)
+meth public java.awt.Point getPopupLocation(java.awt.event.MouseEvent)
+meth public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent)
+meth public java.awt.Rectangle getBounds(java.awt.Rectangle)
+meth public java.awt.Rectangle getVisibleRect()
+meth public java.awt.event.ActionListener getActionForKeyStroke(javax.swing.KeyStroke)
+meth public java.beans.VetoableChangeListener[] getVetoableChangeListeners()
+meth public java.lang.String getToolTipText()
+meth public java.lang.String getToolTipText(java.awt.event.MouseEvent)
+meth public java.lang.String getUIClassID()
+meth public javax.swing.InputVerifier getInputVerifier()
+meth public javax.swing.JPopupMenu getComponentPopupMenu()
+meth public javax.swing.JRootPane getRootPane()
+meth public javax.swing.JToolTip createToolTip()
+meth public javax.swing.KeyStroke[] getRegisteredKeyStrokes()
+meth public javax.swing.TransferHandler getTransferHandler()
+meth public javax.swing.border.Border getBorder()
+meth public javax.swing.event.AncestorListener[] getAncestorListeners()
+meth public static boolean isLightweightComponent(java.awt.Component)
+meth public static java.util.Locale getDefaultLocale()
+meth public static void setDefaultLocale(java.util.Locale)
+meth public void addAncestorListener(javax.swing.event.AncestorListener)
+meth public void addNotify()
+meth public void addVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public void computeVisibleRect(java.awt.Rectangle)
+meth public void disable()
+ anno 0 java.lang.Deprecated()
+meth public void enable()
+ anno 0 java.lang.Deprecated()
+meth public void firePropertyChange(java.lang.String,boolean,boolean)
+meth public void firePropertyChange(java.lang.String,char,char)
+meth public void firePropertyChange(java.lang.String,int,int)
+meth public void grabFocus()
+meth public void hide()
+ anno 0 java.lang.Deprecated()
+meth public void paint(java.awt.Graphics)
+meth public void paintImmediately(int,int,int,int)
+meth public void paintImmediately(java.awt.Rectangle)
+meth public void print(java.awt.Graphics)
+meth public void printAll(java.awt.Graphics)
+meth public void registerKeyboardAction(java.awt.event.ActionListener,java.lang.String,javax.swing.KeyStroke,int)
+meth public void registerKeyboardAction(java.awt.event.ActionListener,javax.swing.KeyStroke,int)
+meth public void removeAncestorListener(javax.swing.event.AncestorListener)
+meth public void removeNotify()
+meth public void removeVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public void repaint(java.awt.Rectangle)
+meth public void repaint(long,int,int,int,int)
+meth public void requestFocus()
+meth public void resetKeyboardActions()
+meth public void reshape(int,int,int,int)
+ anno 0 java.lang.Deprecated()
+meth public void revalidate()
+meth public void scrollRectToVisible(java.awt.Rectangle)
+meth public void setAlignmentX(float)
+meth public void setAlignmentY(float)
+meth public void setAutoscrolls(boolean)
+meth public void setBackground(java.awt.Color)
+meth public void setBorder(javax.swing.border.Border)
+meth public void setComponentPopupMenu(javax.swing.JPopupMenu)
+meth public void setDebugGraphicsOptions(int)
+meth public void setDoubleBuffered(boolean)
+meth public void setEnabled(boolean)
+meth public void setFocusTraversalKeys(int,java.util.Set<? extends java.awt.AWTKeyStroke>)
+meth public void setFont(java.awt.Font)
+meth public void setForeground(java.awt.Color)
+meth public void setInheritsPopupMenu(boolean)
+meth public void setInputVerifier(javax.swing.InputVerifier)
+meth public void setMaximumSize(java.awt.Dimension)
+meth public void setMinimumSize(java.awt.Dimension)
+meth public void setNextFocusableComponent(java.awt.Component)
+ anno 0 java.lang.Deprecated()
+meth public void setOpaque(boolean)
+meth public void setPreferredSize(java.awt.Dimension)
+meth public void setRequestFocusEnabled(boolean)
+meth public void setToolTipText(java.lang.String)
+meth public void setTransferHandler(javax.swing.TransferHandler)
+meth public void setVerifyInputWhenFocusTarget(boolean)
+meth public void setVisible(boolean)
+meth public void unregisterKeyboardAction(javax.swing.KeyStroke)
+meth public void update(java.awt.Graphics)
+meth public void updateUI()
+supr java.awt.Container
+hfds ACTIONMAP_CREATED,ANCESTOR_INPUTMAP_CREATED,ANCESTOR_USING_BUFFER,AUTOSCROLLS_SET,COMPLETELY_OBSCURED,CREATED_DOUBLE_BUFFER,DEBUG_GRAPHICS_LOADED,FOCUS_INPUTMAP_CREATED,FOCUS_TRAVERSAL_KEYS_BACKWARD_SET,FOCUS_TRAVERSAL_KEYS_FORWARD_SET,INHERITS_POPUP_MENU,INPUT_VERIFIER_SOURCE_KEY,IS_DOUBLE_BUFFERED,IS_OPAQUE,IS_PAINTING_TILE,IS_PRINTING,IS_PRINTING_ALL,IS_REPAINTING,KEYBOARD_BINDINGS_KEY,KEY_EVENTS_ENABLED,NEXT_FOCUS,NOT_OBSCURED,OPAQUE_SET,PARTIALLY_OBSCURED,REQUEST_FOCUS_DISABLED,RESERVED_1,RESERVED_2,RESERVED_3,RESERVED_4,RESERVED_5,RESERVED_6,WHEN_IN_FOCUSED_WINDOW_BINDINGS,WIF_INPUTMAP_CREATED,WRITE_OBJ_COUNTER_FIRST,WRITE_OBJ_COUNTER_LAST,aaTextInfo,actionMap,alignmentX,alignmentY,ancestorInputMap,autoscrolls,border,clientProperties,componentObtainingGraphicsFrom,componentObtainingGraphicsFromLock,defaultLocale,flags,focusController,focusInputMap,inputVerifier,isAlignmentXSet,isAlignmentYSet,managingFocusBackwardTraversalKeys,managingFocusForwardTraversalKeys,paintingChild,popupMenu,readObjectCallbacks,revalidateRunnableScheduled,tempRectangles,uiClassID,verifyInputWhenFocusTarget,vetoableChangeSupport,windowInputMap
+hcls ActionStandin,IntVector,KeyboardState,ReadObjectCallback
+
+CLSS public org.netbeans.modules.payara.eecommon.api.ConfigureProfilerHelper
+cons public init()
+meth public static boolean modifyAsEnvScriptFile(java.io.File,java.lang.String)
+supr java.lang.Object
+hfds ASENV_INSERTION_POINT_NOWIN_STRING,ASENV_INSERTION_POINT_WIN_STRING
+
+CLSS public org.netbeans.modules.payara.eecommon.api.DomainEditor
+cons public init(java.lang.String,java.lang.String)
+meth public boolean addProfilerElements(org.w3c.dom.Document,java.lang.String,java.lang.String[])
+meth public boolean removeProfilerElements(org.w3c.dom.Document)
+meth public boolean setHttpProxyOptions(java.lang.String[])
+meth public java.lang.String getDomainLocation()
+meth public java.lang.String[] getHttpProxyOptions()
+meth public java.util.HashMap<java.lang.String,java.lang.String> getAdminObjectResourcesFromXml()
+meth public java.util.HashMap<java.lang.String,java.util.Map> getConnPoolsFromXml()
+meth public java.util.HashMap<java.lang.String,java.util.Map> getSunDatasourcesFromXml()
+meth public org.w3c.dom.Document getDomainDocument()
+meth public org.w3c.dom.Document getDomainDocument(java.lang.String)
+meth public void createSampleDatasource()
+supr java.lang.Object
+hfds CONST_AO,CONST_CP,CONST_DATABASE_NAME,CONST_DERBY_CONN_ATTRS,CONST_DRIVER_CLASS,CONST_DS_CLASS,CONST_ENABLED,CONST_JDBC,CONST_JNDINAME,CONST_JVM_OPTIONS,CONST_LOWER_DATABASE_NAME,CONST_LOWER_PORT_NUMBER,CONST_NAME,CONST_OBJTYPE,CONST_PASSWORD,CONST_POOLNAME,CONST_PORT_NUMBER,CONST_PROP,CONST_RES_TYPE,CONST_SERVER_NAME,CONST_SID,CONST_URL,CONST_USER,CONST_VALUE,HTTPS_PROXY_HOST,HTTPS_PROXY_PORT,HTTP_PROXY_HOST,HTTP_PROXY_NO_HOST,HTTP_PROXY_PORT,LOGGER,NBPROFILERNAME,SAMPLE_CONNPOOL,SAMPLE_DATASOURCE,XML_ENTITY,dmLoc,dmName,isPayaraV1OrV2,sysDatasources
+hcls InnerResolver
+
+CLSS public org.netbeans.modules.payara.eecommon.api.ExecSupport
+innr public static OutputCopier
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.ExecSupport$OutputCopier
+ outer org.netbeans.modules.payara.eecommon.api.ExecSupport
+cons public init(java.io.Reader,java.io.Writer,boolean)
+meth public void interrupt()
+meth public void run()
+supr java.lang.Thread
+hfds autoflush,done,is,os
+
+CLSS public org.netbeans.modules.payara.eecommon.api.FindJSPServletHelper
+meth public static java.lang.String getServletEncoding(java.lang.String,java.lang.String)
+meth public static java.lang.String getServletResourcePath(java.lang.String,java.lang.String)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.eecommon.api.HttpMonitorHelper
+cons public init()
+meth public !varargs static boolean synchronizeMonitor(java.lang.String,java.lang.String,boolean,java.lang.String[]) throws java.io.IOException,org.xml.sax.SAXException
+supr java.lang.Object
+hfds MONITOR_FILTER_CLASS,MONITOR_FILTER_NAME,MONITOR_FILTER_PATTERN,MONITOR_INTERNALPORT_PARAM_NAME,MONITOR_MODULE_NAME,httpMonitorInfo,monitorInfoListener,monitorLookupListener,monitorSpy,res
+hcls ModuleSpy,MonitorInfoListener,MonitorLookupListener
+
+CLSS public org.netbeans.modules.payara.eecommon.api.JDBCDriverDeployHelper
+cons public init()
+meth public static java.util.List<java.net.URL> getMissingDrivers(java.io.File[],java.util.Set<org.netbeans.modules.j2ee.deployment.common.api.Datasource>)
+meth public static javax.enterprise.deploy.spi.status.ProgressObject getProgressObject(java.io.File,java.util.List)
+supr java.lang.Object
+hcls JDBCDriversProgressObject
+
+CLSS public org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport
+cons public init()
+innr public Link
+innr public static AppServerLogSupport
+innr public static LineInfo
+meth public org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport$Link getLink(java.lang.String,java.lang.String,int)
+meth public void detachAnnotation()
+supr java.lang.Object
+hfds errAnnot,links
+hcls ErrorAnnotation
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport$AppServerLogSupport
+ outer org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport
+cons public init(java.lang.String,java.lang.String)
+meth public org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport$LineInfo analyzeLine(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport
+hfds STANDARD_CONTEXT,STANDARD_CONTEXT_LENGTH,context,globalPathReg,pathAccess,prevMessage
+hcls PathAccess
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport$LineInfo
+ outer org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport
+cons public init(java.lang.String,int,java.lang.String,boolean,boolean)
+meth public boolean isAccessible()
+meth public boolean isError()
+meth public int line()
+meth public java.lang.String message()
+meth public java.lang.String path()
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds accessible,error,line,message,path
+
+CLSS public org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport$Link
+ outer org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport
+intf org.openide.windows.OutputListener
+meth public boolean equals(java.lang.Object)
+meth public int hashCode()
+meth public void outputLineAction(org.openide.windows.OutputEvent)
+meth public void outputLineCleared(org.openide.windows.OutputEvent)
+meth public void outputLineSelected(org.openide.windows.OutputEvent)
+supr java.lang.Object
+hfds hashCode,line,msg,path
+
+CLSS public org.netbeans.modules.payara.eecommon.api.ProgressEventSupport
+cons public init(java.lang.Object)
+meth public javax.enterprise.deploy.spi.status.DeploymentStatus getDeploymentStatus()
+meth public static javax.enterprise.deploy.spi.status.DeploymentStatus createStatus(javax.enterprise.deploy.shared.ActionType,javax.enterprise.deploy.shared.CommandType,java.lang.String,javax.enterprise.deploy.shared.StateType)
+meth public void addProgressListener(javax.enterprise.deploy.spi.status.ProgressListener)
+meth public void clearProgressListener()
+meth public void fireHandleProgressEvent(javax.enterprise.deploy.spi.TargetModuleID,javax.enterprise.deploy.spi.status.DeploymentStatus)
+meth public void removeProgressListener(javax.enterprise.deploy.spi.status.ProgressListener)
+supr java.lang.Object
+hfds listeners,obj,status,tmID
+
+CLSS public org.netbeans.modules.payara.eecommon.api.UrlData
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public java.lang.String getAlternateDBName()
+meth public java.lang.String getDatabaseName()
+meth public java.lang.String getHostName()
+meth public java.lang.String getInstanceName()
+meth public java.lang.String getPort()
+meth public java.lang.String getPrefix()
+meth public java.lang.String getSid()
+meth public java.lang.String getUrl()
+meth public java.util.Map<java.lang.String,java.lang.String> getProperties()
+supr java.lang.Object
+hfds DBURL_PATTERN,DB_ALT_DBNAME,DB_HOST,DB_INSTANCE_NAME,DB_PORT,DB_PREFIX,DB_PRIMARY_DBNAME,DB_PROPERTIES,NUM_PARTS,parts,props,url,urlPattern
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.Utils
+innr public static JarFileFilter
+meth public final static boolean notEmpty(java.lang.String)
+meth public final static boolean strEmpty(java.lang.String)
+meth public final static boolean strEquals(java.lang.String,java.lang.String)
+meth public final static boolean strEquivalent(java.lang.String,java.lang.String)
+meth public final static int strCompareTo(java.lang.String,java.lang.String)
+meth public static java.lang.String computeModuleID(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,java.io.File,java.lang.String)
+meth public static java.lang.String getInstanceReleaseID(org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider)
+meth public static org.openide.filesystems.FileObject getSunDDFromProjectsModuleVersion(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,java.lang.String)
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.Utils$JarFileFilter
+ outer org.netbeans.modules.payara.eecommon.api.Utils
+cons public init()
+intf java.io.FileFilter
+meth public boolean accept(java.io.File)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.eecommon.api.VerifierSupport
+cons public init(java.lang.String)
+meth protected java.lang.String preferredID()
+meth protected void componentClosed()
+meth protected void componentOpened()
+meth public boolean isVerifierIsStillRunning()
+meth public int getPersistenceType()
+meth public java.util.Vector getDefaultResultsForDisplay()
+meth public java.util.Vector getErrorResultsForDisplay()
+meth public java.util.Vector getFailResultsForDisplay()
+meth public java.util.Vector getNaResultsForDisplay()
+meth public java.util.Vector getNotImplementedResultsForDisplay()
+meth public java.util.Vector getNotRunResultsForDisplay()
+meth public java.util.Vector getPassResultsForDisplay()
+meth public java.util.Vector getWarnResultsForDisplay()
+meth public static void launchVerifier(java.lang.String,java.io.OutputStream,org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+meth public void clearResults()
+meth public void initUI()
+meth public void saveErrorResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error)
+meth public void saveFailResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Test)
+meth public void saveNaResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Test)
+meth public void savePassResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Test)
+meth public void saveWarnResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Test)
+meth public void setDetailText(java.lang.String)
+meth public void setVerifierIsStillRunning(boolean)
+meth public void showInMode()
+meth public void updateDisplay()
+supr org.openide.windows.TopComponent
+hfds ALL,FAIL,LOGGER,STATUS_LIT,WARN,_archiveName,allButton,allString,columnNames,controlPanel,defaultResults,detailText,errorResults,failButton,failResults,failString,myListener,naResults,notImplementedResults,notRunResults,panelDesc,panelName,passResults,radioButtonDesc,radioButtonName,resultPanel,statusLeveltoDisplay,table,tableModel,tableScrollPane,tableSelectionListener,textScrollPane,verifierIsStillRunning,warnButton,warnResults,warnString
+hcls RadioListener
+
+CLSS public org.netbeans.modules.payara.eecommon.api.XmlFileCreator
+cons public init(org.openide.filesystems.FileObject,org.openide.filesystems.FileObject,java.lang.String,java.lang.String)
+intf org.openide.filesystems.FileSystem$AtomicAction
+meth public org.openide.filesystems.FileObject getResult()
+meth public void run() throws java.io.IOException
+supr java.lang.Object
+hfds destFolder,ext,name,result,source
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.config.AppClientVersion
+fld public final static org.netbeans.modules.payara.eecommon.api.config.AppClientVersion APP_CLIENT_1_3
+fld public final static org.netbeans.modules.payara.eecommon.api.config.AppClientVersion APP_CLIENT_1_4
+fld public final static org.netbeans.modules.payara.eecommon.api.config.AppClientVersion APP_CLIENT_5_0
+fld public final static org.netbeans.modules.payara.eecommon.api.config.AppClientVersion APP_CLIENT_6_0
+meth public int compareTo(java.lang.Object)
+meth public static org.netbeans.modules.payara.eecommon.api.config.AppClientVersion getAppClientVersion(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion APPLICATION_1_3
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion APPLICATION_1_4
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion APPLICATION_5_0
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion APPLICATION_6_0
+meth public int compareTo(java.lang.Object)
+meth public static org.netbeans.modules.payara.eecommon.api.config.ApplicationVersion getApplicationVersion(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+
+CLSS public org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration)
+innr public abstract interface static BeanVisitor
+innr public abstract interface static NameVisitor
+innr public abstract interface static NameVisitorFactory
+innr public abstract static AbstractBeanVisitor
+innr public final static EntityAndSessionRemoteVisitor
+innr public final static MessageDrivenVisitor
+innr public final static WebserviceDescriptionBeanVisitor
+innr public static EjbRefVisitor
+innr public static EntityAndSessionVisitor
+innr public static EntityBeanVisitor
+innr public static MDBeanVisitor
+innr public static MessageDestinationRefVisitor
+innr public static MessageDestinationVisitor
+innr public static PortComponentRefVisitor
+innr public static PortComponentVisitor
+innr public static ResourceEnvRefVisitor
+innr public static ResourceRefVisitor
+innr public static SecurityRoleVisitor
+innr public static ServiceRefVisitor
+innr public static SessionBeanVisitor
+intf java.beans.PropertyChangeListener
+meth public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor getNameVisitor(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public static void addBeanVisitorMappings(java.util.Map<java.lang.String,org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$BeanVisitor>)
+meth public static void addNameVisitorFactory(org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitorFactory)
+meth public void addListener(org.netbeans.modules.j2ee.dd.api.common.RootInterface)
+meth public void propertyChange(java.beans.PropertyChangeEvent)
+meth public void removeListener(org.netbeans.modules.j2ee.dd.api.common.RootInterface)
+meth public void removeListeners()
+supr java.lang.Object
+hfds EVENT_DELAY,config,handlerCache,lastEvent,lastEventMonitor,lastEventTask,nameVisitorFactories,stdRootDD,stdRootDDWeakListener,visitorCache,wsRootDD,wsRootDDWeakListener
+hcls BasicNameVisitorFactory
+
+CLSS public abstract static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$AbstractBeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$BeanVisitor
+meth public void beanChanged(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void beanCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void beanDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void fieldChanged(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object,java.lang.Object)
+meth public void fieldCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+meth public void fieldDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+supr java.lang.Object
+
+CLSS public abstract interface static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$BeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+meth public abstract void beanChanged(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public abstract void beanCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public abstract void beanDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public abstract void fieldChanged(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object,java.lang.Object)
+meth public abstract void fieldCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+meth public abstract void fieldDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$EjbRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public final static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$EntityAndSessionRemoteVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+meth public void fieldCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+meth public void fieldDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,java.lang.Object,java.lang.Object)
+supr org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$AbstractBeanVisitor
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$EntityAndSessionVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+meth public void beanCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void beanDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+supr org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$AbstractBeanVisitor
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$EntityBeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$MDBeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$MessageDestinationRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$MessageDestinationVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public final static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$MessageDrivenVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+meth public void beanCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void beanDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+supr org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$AbstractBeanVisitor
+
+CLSS public abstract interface static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+meth public abstract java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public abstract java.lang.String getNameProperty()
+
+CLSS public abstract interface static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitorFactory
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+meth public abstract org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor createNameVisitor(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$PortComponentRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$PortComponentVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$ResourceEnvRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$ResourceRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$SecurityRoleVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$ServiceRefVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$SessionBeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+intf org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$NameVisitor
+meth public java.lang.String getName(org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public java.lang.String getNameProperty()
+supr java.lang.Object
+
+CLSS public final static org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$WebserviceDescriptionBeanVisitor
+ outer org.netbeans.modules.payara.eecommon.api.config.DescriptorListener
+cons public init()
+meth public void beanCreated(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+meth public void beanDeleted(org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration,java.lang.String,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean,org.netbeans.modules.j2ee.dd.api.common.CommonDDBean)
+supr org.netbeans.modules.payara.eecommon.api.config.DescriptorListener$AbstractBeanVisitor
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion
+fld public final static org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion EJBJAR_2_0
+fld public final static org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion EJBJAR_2_1
+fld public final static org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion EJBJAR_3_0
+fld public final static org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion EJBJAR_3_1
+meth public int compareTo(java.lang.Object)
+meth public static org.netbeans.modules.payara.eecommon.api.config.EjbJarVersion getEjbJarVersion(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+
+CLSS public org.netbeans.modules.payara.eecommon.api.config.FolderListener
+intf org.openide.filesystems.FileChangeListener
+meth public static org.openide.filesystems.FileChangeListener createListener(java.io.File,org.openide.filesystems.FileObject,org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule$Type)
+meth public void fileAttributeChanged(org.openide.filesystems.FileAttributeEvent)
+meth public void fileChanged(org.openide.filesystems.FileEvent)
+meth public void fileDataCreated(org.openide.filesystems.FileEvent)
+meth public void fileDeleted(org.openide.filesystems.FileEvent)
+meth public void fileFolderCreated(org.openide.filesystems.FileEvent)
+meth public void fileRenamed(org.openide.filesystems.FileRenameEvent)
+supr java.lang.Object
+hfds configKey,targets
+
+CLSS public abstract org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration
+cons protected init(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper,org.netbeans.modules.payara.tooling.data.PayaraVersion) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+cons protected init(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,org.netbeans.modules.payara.tooling.data.PayaraVersion) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+cons public init()
+ anno 0 java.lang.Deprecated()
+fld protected final java.io.File primaryDD
+fld protected final java.io.File secondaryDD
+fld protected final org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper moduleHelper
+fld protected final org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule module
+fld protected org.netbeans.modules.payara.eecommon.api.config.DescriptorListener descriptorListener
+fld protected org.netbeans.modules.payara.tooling.data.PayaraVersion version
+innr public final static !enum ChangeOperation
+intf org.netbeans.modules.j2ee.deployment.plugins.spi.config.ContextRootConfiguration
+intf org.netbeans.modules.j2ee.deployment.plugins.spi.config.DatasourceConfiguration
+intf org.netbeans.modules.j2ee.deployment.plugins.spi.config.EjbResourceConfiguration
+intf org.netbeans.modules.j2ee.deployment.plugins.spi.config.MessageDestinationConfiguration
+meth protected <%0 extends org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean> {%%0} findNamedBean(org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean,java.lang.String,java.lang.String,java.lang.String)
+meth protected org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider getProvider(java.io.File)
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getInstalledAppServerVersion(java.io.File)
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getTargetAppServerVersion()
+meth protected org.netbeans.modules.j2ee.sun.dd.api.RootInterface getPayaraDDRoot(boolean) throws java.io.IOException
+meth protected org.openide.filesystems.FileObject getPayaraDD(java.io.File,boolean) throws java.io.IOException
+meth protected void createDefaultSunDD(java.io.File) throws java.io.IOException
+meth protected void displayError(java.lang.Exception,java.lang.String)
+meth protected void handleEventRelatedException(java.lang.Exception)
+meth protected void handleEventRelatedIOException(java.io.IOException)
+meth public <%0 extends java.lang.Object> org.netbeans.modules.j2ee.metadata.model.api.MetadataModel<{%%0}> getMetadataModel(java.lang.Class<{%%0}>)
+meth public abstract boolean supportsCreateDatasource()
+meth public abstract boolean supportsCreateMessageDestination()
+meth public abstract java.util.Set<org.netbeans.modules.j2ee.deployment.common.api.Datasource> getDatasources() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract java.util.Set<org.netbeans.modules.j2ee.deployment.common.api.MessageDestination> getMessageDestinations() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract org.netbeans.modules.j2ee.deployment.common.api.Datasource createDatasource(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException,org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException
+meth public abstract org.netbeans.modules.j2ee.deployment.common.api.MessageDestination createMessageDestination(java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public final org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD()
+meth public final org.netbeans.modules.j2ee.dd.api.webservices.Webservices getWebServicesRootDD()
+meth public final static org.openide.util.Pair<java.io.File,java.lang.Boolean> getExistingResourceFile(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public final static org.openide.util.Pair<java.io.File,java.lang.Boolean> getNewResourceFile(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule,org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public java.lang.String findDatasourceJndiName(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public java.lang.String findDatasourceJndiNameForEjb(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public java.lang.String findJndiNameForEjb(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public java.lang.String findMessageDestinationName(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public java.lang.String getContextRoot() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion getJ2eeVersion()
+meth public org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule getJ2eeModule()
+meth public org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getAppServerVersion()
+meth public org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMaxASVersion()
+meth public org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion()
+meth public org.netbeans.modules.j2ee.sun.dd.api.RootInterface getPayaraDDRoot(java.io.File,boolean) throws java.io.IOException
+meth public static org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration getConfiguration(java.io.File)
+meth public static void addConfiguration(java.io.File,org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration)
+meth public static void removeConfiguration(java.io.File)
+meth public void bindDatasourceReference(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindDatasourceReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindEjbReference(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindEjbReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindMdbToMessageDestination(java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindMessageDestinationReference(java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void bindMessageDestinationReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void dispose()
+meth public void saveConfiguration(java.io.OutputStream) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public void setAppServerVersion(org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+meth public void setContextRoot(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+supr java.lang.Object
+hfds LOGGER,RESOURCE_FILES,RESOURCE_FILES_SUFFIX,RP,appServerVersion,configurationMap,configurationMonitor,defaultcr,deferredAppServerChange,maxASVersion,minASVersion,sunServerIds
+
+CLSS public final static !enum org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation
+ outer org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration
+fld public final static org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation CREATE
+fld public final static org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation DELETE
+meth public static org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration$ChangeOperation>
+
+CLSS public abstract org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+cons protected init(java.lang.String,int,java.lang.String,int)
+intf java.lang.Comparable
+meth protected int numericCompare(org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion)
+meth public boolean equals(java.lang.Object)
+meth public int compareSpecification(org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion)
+meth public int hashCode()
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion getVersion(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule$Type,java.lang.String)
+supr java.lang.Object
+hfds j2eeModuleVersion,numericModuleVersion,numericSpecVersion
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.config.J2EEVersion
+fld public final static org.netbeans.modules.payara.eecommon.api.config.J2EEVersion J2EE_1_3
+fld public final static org.netbeans.modules.payara.eecommon.api.config.J2EEVersion J2EE_1_4
+fld public final static org.netbeans.modules.payara.eecommon.api.config.J2EEVersion JAVAEE_5_0
+fld public final static org.netbeans.modules.payara.eecommon.api.config.J2EEVersion JAVAEE_6_0
+meth public int compareTo(java.lang.Object)
+meth public static org.netbeans.modules.payara.eecommon.api.config.J2EEVersion getJ2EEVersion(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+
+CLSS public abstract org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+fld public final static java.lang.String GF_WEB_XML_V1
+fld public final static java.lang.String GF_WEB_XML_V2
+fld public final static java.lang.String PAYARA_WEB_XML_V4
+fld public final static java.lang.String WEB_INF = "WEB-INF"
+innr public static ClientDDHelper
+innr public static EarDDHelper
+innr public static EjbDDHelper
+innr public static WebDDHelper
+innr public static WebServerDDHelper
+meth protected abstract org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected abstract org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+meth public final static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper getPayaraDDModuleHelper(java.lang.Object)
+meth public final static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper getSunDDModuleHelper(java.lang.Object)
+meth public final static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper getWsModuleHelper(java.lang.String)
+meth public java.io.File getPrimaryDDFile(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule)
+meth public java.io.File getSecondaryDDFile(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule)
+meth public java.lang.Object getJ2eeModule()
+meth public java.lang.String getPrimaryDDName()
+meth public java.lang.String getSecondaryDDName()
+meth public java.lang.String getStandardDDName()
+meth public java.lang.String getWebserviceDDName()
+meth public org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule)
+meth public org.netbeans.modules.j2ee.dd.api.webservices.Webservices getWebServicesRootDD(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule)
+meth public static boolean isGlassFishWeb(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule)
+supr java.lang.Object
+hfds gfhelperMap,helperMap,moduleType,primarySunDDName,secondarySunDDName,standardDDName,webserviceDDName
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper$ClientDDHelper
+ outer org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+meth protected org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+supr org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper$EarDDHelper
+ outer org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+meth protected org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+supr org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper$EjbDDHelper
+ outer org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+meth protected org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+supr org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper$WebDDHelper
+ outer org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+meth protected org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+supr org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+
+CLSS public static org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper$WebServerDDHelper
+ outer org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+meth protected org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD(org.openide.filesystems.FileObject) throws java.io.IOException
+meth protected org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion getMinASVersion(java.lang.String,org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion)
+supr org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper
+
+CLSS public final !enum org.netbeans.modules.payara.eecommon.api.config.JavaEEModule
+fld public final static int length
+fld public final static java.lang.String META_INF = "META-INF"
+fld public final static java.lang.String WEB_INF = "WEB-INF"
+fld public final static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule CAR
+fld public final static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule EAR
+fld public final static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule EJB
+fld public final static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule RAR
+fld public final static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule WAR
+meth public final static java.lang.String getConfigDir(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule$Type)
+meth public java.lang.String getConfigDir()
+meth public static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule toValue(org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule$Type)
+meth public static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.eecommon.api.config.JavaEEModule[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.eecommon.api.config.JavaEEModule>
+hfds LOGGER,j2eeModuleTypeToValue,moduleType
+
+CLSS public final org.netbeans.modules.payara.eecommon.api.config.ServletVersion
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ServletVersion SERVLET_2_3
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ServletVersion SERVLET_2_4
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ServletVersion SERVLET_2_5
+fld public final static org.netbeans.modules.payara.eecommon.api.config.ServletVersion SERVLET_3_0
+meth public int compareTo(java.lang.Object)
+meth public static org.netbeans.modules.payara.eecommon.api.config.ServletVersion getServletVersion(java.lang.String)
+supr org.netbeans.modules.payara.eecommon.api.config.J2EEBaseVersion
+
+CLSS public abstract interface org.netbeans.modules.j2ee.deployment.plugins.spi.config.ContextRootConfiguration
+meth public abstract java.lang.String getContextRoot() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void setContextRoot(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+
+CLSS public abstract interface org.netbeans.modules.j2ee.deployment.plugins.spi.config.DatasourceConfiguration
+meth public abstract boolean supportsCreateDatasource()
+meth public abstract java.lang.String findDatasourceJndiName(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract java.lang.String findDatasourceJndiNameForEjb(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract java.util.Set<org.netbeans.modules.j2ee.deployment.common.api.Datasource> getDatasources() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract org.netbeans.modules.j2ee.deployment.common.api.Datasource createDatasource(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException,org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException
+meth public abstract void bindDatasourceReference(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindDatasourceReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+
+CLSS public abstract interface org.netbeans.modules.j2ee.deployment.plugins.spi.config.EjbResourceConfiguration
+meth public abstract java.lang.String findJndiNameForEjb(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindEjbReference(java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindEjbReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+
+CLSS public abstract interface org.netbeans.modules.j2ee.deployment.plugins.spi.config.MessageDestinationConfiguration
+meth public abstract boolean supportsCreateMessageDestination()
+meth public abstract java.lang.String findMessageDestinationName(java.lang.String) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract java.util.Set<org.netbeans.modules.j2ee.deployment.common.api.MessageDestination> getMessageDestinations() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract org.netbeans.modules.j2ee.deployment.common.api.MessageDestination createMessageDestination(java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindMdbToMessageDestination(java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindMessageDestinationReference(java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+meth public abstract void bindMessageDestinationReferenceForEjb(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.j2ee.deployment.common.api.MessageDestination$Type) throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException
+
+CLSS public abstract interface org.openide.filesystems.FileChangeListener
+intf java.util.EventListener
+meth public abstract void fileAttributeChanged(org.openide.filesystems.FileAttributeEvent)
+meth public abstract void fileChanged(org.openide.filesystems.FileEvent)
+meth public abstract void fileDataCreated(org.openide.filesystems.FileEvent)
+meth public abstract void fileDeleted(org.openide.filesystems.FileEvent)
+meth public abstract void fileFolderCreated(org.openide.filesystems.FileEvent)
+meth public abstract void fileRenamed(org.openide.filesystems.FileRenameEvent)
+
+CLSS public abstract org.openide.filesystems.FileSystem
+cons public init()
+fld public final static java.lang.String PROP_DISPLAY_NAME = "displayName"
+fld public final static java.lang.String PROP_HIDDEN = "hidden"
+ anno 0 java.lang.Deprecated()
+fld public final static java.lang.String PROP_READ_ONLY = "readOnly"
+fld public final static java.lang.String PROP_ROOT = "root"
+fld public final static java.lang.String PROP_SYSTEM_NAME = "systemName"
+ anno 0 java.lang.Deprecated()
+fld public final static java.lang.String PROP_VALID = "valid"
+innr public abstract interface static AtomicAction
+intf java.io.Serializable
+meth protected final void fireFileStatusChanged(org.openide.filesystems.FileStatusEvent)
+meth protected final void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)
+meth protected final void fireVetoableChange(java.lang.String,java.lang.Object,java.lang.Object) throws java.beans.PropertyVetoException
+meth protected final void setSystemName(java.lang.String) throws java.beans.PropertyVetoException
+ anno 0 java.lang.Deprecated()
+meth public abstract boolean isReadOnly()
+meth public abstract java.lang.String getDisplayName()
+meth public abstract org.openide.filesystems.FileObject findResource(java.lang.String)
+meth public abstract org.openide.filesystems.FileObject getRoot()
+meth public final boolean isDefault()
+meth public final boolean isValid()
+meth public final java.lang.String getSystemName()
+ anno 0 java.lang.Deprecated()
+meth public final void addFileChangeListener(org.openide.filesystems.FileChangeListener)
+meth public final void addFileStatusListener(org.openide.filesystems.FileStatusListener)
+meth public final void addPropertyChangeListener(java.beans.PropertyChangeListener)
+meth public final void addVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public final void removeFileChangeListener(org.openide.filesystems.FileChangeListener)
+meth public final void removeFileStatusListener(org.openide.filesystems.FileStatusListener)
+meth public final void removePropertyChangeListener(java.beans.PropertyChangeListener)
+meth public final void removeVetoableChangeListener(java.beans.VetoableChangeListener)
+meth public final void runAtomicAction(org.openide.filesystems.FileSystem$AtomicAction) throws java.io.IOException
+meth public java.lang.String toString()
+meth public org.openide.filesystems.FileObject createTempFile(org.openide.filesystems.FileObject,java.lang.String,java.lang.String,boolean) throws java.io.IOException
+meth public org.openide.filesystems.FileObject find(java.lang.String,java.lang.String,java.lang.String)
+ anno 0 java.lang.Deprecated()
+meth public org.openide.filesystems.FileObject getTempFolder() throws java.io.IOException
+meth public org.openide.filesystems.StatusDecorator getDecorator()
+meth public org.openide.util.Lookup findExtrasFor(java.util.Set<org.openide.filesystems.FileObject>)
+meth public void addNotify()
+meth public void refresh(boolean)
+meth public void removeNotify()
+supr java.lang.Object
+hfds LOG,SFS_STATUS,STATUS_NONE,assigned,changeSupport,defFS,fclSupport,fileStatusList,internLock,repository,serialVersionUID,statusResult,systemName,thrLocal,valid,vetoableChangeList
+hcls AsyncAtomicAction,EventDispatcher,FileStatusDispatcher
+
+CLSS public abstract interface static org.openide.filesystems.FileSystem$AtomicAction
+ outer org.openide.filesystems.FileSystem
+meth public abstract void run() throws java.io.IOException
+
+CLSS public final org.openide.util.HelpCtx
+cons public init(java.lang.Class<?>)
+ anno 0 java.lang.Deprecated()
+cons public init(java.lang.String)
+cons public init(java.net.URL)
+ anno 0 java.lang.Deprecated()
+fld public final static org.openide.util.HelpCtx DEFAULT_HELP
+innr public abstract interface static Displayer
+innr public abstract interface static Provider
+meth public boolean display()
+meth public boolean equals(java.lang.Object)
+meth public int hashCode()
+meth public java.lang.String getHelpID()
+meth public java.lang.String toString()
+meth public java.net.URL getHelp()
+meth public static org.openide.util.HelpCtx findHelp(java.awt.Component)
+meth public static org.openide.util.HelpCtx findHelp(java.lang.Object)
+meth public static void setHelpIDString(javax.swing.JComponent,java.lang.String)
+supr java.lang.Object
+hfds err,helpCtx,helpID
+
+CLSS public abstract interface static org.openide.util.HelpCtx$Provider
+ outer org.openide.util.HelpCtx
+meth public abstract org.openide.util.HelpCtx getHelpCtx()
+
+CLSS public abstract org.openide.util.Lookup
+cons public init()
+fld public final static org.openide.util.Lookup EMPTY
+innr public abstract interface static Provider
+innr public abstract static Item
+innr public abstract static Result
+innr public final static Template
+meth public <%0 extends java.lang.Object> java.util.Collection<? extends {%%0}> lookupAll(java.lang.Class<{%%0}>)
+meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Item<{%%0}> lookupItem(org.openide.util.Lookup$Template<{%%0}>)
+meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookupResult(java.lang.Class<{%%0}>)
+meth public abstract <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookup(org.openide.util.Lookup$Template<{%%0}>)
+meth public abstract <%0 extends java.lang.Object> {%%0} lookup(java.lang.Class<{%%0}>)
+meth public static org.openide.util.Lookup getDefault()
+supr java.lang.Object
+hfds LOG,defaultLookup,defaultLookupProvider
+hcls DefLookup,Empty
+
+CLSS public abstract interface static org.openide.util.Lookup$Provider
+ outer org.openide.util.Lookup
+meth public abstract org.openide.util.Lookup getLookup()
+
+CLSS public abstract interface org.openide.windows.OutputListener
+intf java.util.EventListener
+meth public abstract void outputLineAction(org.openide.windows.OutputEvent)
+meth public abstract void outputLineCleared(org.openide.windows.OutputEvent)
+meth public abstract void outputLineSelected(org.openide.windows.OutputEvent)
+
+CLSS public org.openide.windows.TopComponent
+cons public init()
+cons public init(org.openide.util.Lookup)
+fld public final static int CLOSE_EACH = 0
+ anno 0 java.lang.Deprecated()
+fld public final static int CLOSE_LAST = 1
+ anno 0 java.lang.Deprecated()
+fld public final static int PERSISTENCE_ALWAYS = 0
+fld public final static int PERSISTENCE_NEVER = 2
+fld public final static int PERSISTENCE_ONLY_OPENED = 1
+fld public final static java.lang.String PROP_CLOSING_DISABLED = "netbeans.winsys.tc.closing_disabled"
+fld public final static java.lang.String PROP_DND_COPY_DISABLED = "netbeans.winsys.tc.draganddrop_copy_disabled"
+fld public final static java.lang.String PROP_DRAGGING_DISABLED = "netbeans.winsys.tc.dragging_disabled"
+fld public final static java.lang.String PROP_KEEP_PREFERRED_SIZE_WHEN_SLIDED_IN = "netbeans.winsys.tc.keep_preferred_size_when_slided_in"
+fld public final static java.lang.String PROP_MAXIMIZATION_DISABLED = "netbeans.winsys.tc.maximization_disabled"
+fld public final static java.lang.String PROP_SLIDING_DISABLED = "netbeans.winsys.tc.sliding_disabled"
+fld public final static java.lang.String PROP_UNDOCKING_DISABLED = "netbeans.winsys.tc.undocking_disabled"
+innr public abstract interface static !annotation Description
+innr public abstract interface static !annotation OpenActionRegistration
+innr public abstract interface static !annotation Registration
+innr public abstract interface static Cloneable
+innr public abstract interface static Registry
+innr public final static SubComponent
+innr public static NodeName
+intf java.io.Externalizable
+intf javax.accessibility.Accessible
+intf org.openide.util.HelpCtx$Provider
+intf org.openide.util.Lookup$Provider
+meth protected boolean processKeyBinding(javax.swing.KeyStroke,java.awt.event.KeyEvent,int,boolean)
+meth protected final void associateLookup(org.openide.util.Lookup)
+meth protected java.lang.Object writeReplace() throws java.io.ObjectStreamException
+meth protected java.lang.String preferredID()
+meth protected void closeNotify()
+ anno 0 java.lang.Deprecated()
+meth protected void componentActivated()
+meth protected void componentClosed()
+meth protected void componentDeactivated()
+meth protected void componentHidden()
+meth protected void componentOpened()
+meth protected void componentShowing()
+meth protected void openNotify()
+ anno 0 java.lang.Deprecated()
+meth public boolean canClose()
+meth public boolean canClose(org.openide.windows.Workspace,boolean)
+ anno 0 java.lang.Deprecated()
+meth public boolean requestFocusInWindow()
+meth public final boolean close()
+meth public final boolean close(org.openide.windows.Workspace)
+ anno 0 java.lang.Deprecated()
+meth public final boolean isOpened()
+meth public final boolean isOpened(org.openide.windows.Workspace)
+ anno 0 java.lang.Deprecated()
+meth public final int getCloseOperation()
+ anno 0 java.lang.Deprecated()
+meth public final int getTabPosition()
+meth public final org.openide.nodes.Node[] getActivatedNodes()
+meth public final static org.openide.windows.TopComponent$Registry getRegistry()
+meth public final void cancelRequestAttention()
+meth public final void makeBusy(boolean)
+meth public final void openAtTabPosition(int)
+meth public final void requestAttention(boolean)
+meth public final void setActivatedNodes(org.openide.nodes.Node[])
+meth public final void setAttentionHighlight(boolean)
+meth public final void setCloseOperation(int)
+ anno 0 java.lang.Deprecated()
+meth public int getPersistenceType()
+meth public java.awt.Image getIcon()
+meth public java.lang.String getDisplayName()
+meth public java.lang.String getHtmlDisplayName()
+meth public java.lang.String getShortName()
+meth public java.util.List<org.openide.windows.Mode> availableModes(java.util.List<org.openide.windows.Mode>)
+meth public javax.accessibility.AccessibleContext getAccessibleContext()
+meth public javax.swing.Action[] getActions()
+meth public org.openide.awt.UndoRedo getUndoRedo()
+meth public org.openide.util.HelpCtx getHelpCtx()
+meth public org.openide.util.Lookup getLookup()
+meth public org.openide.util.actions.SystemAction[] getSystemActions()
+ anno 0 java.lang.Deprecated()
+meth public org.openide.windows.TopComponent$SubComponent[] getSubComponents()
+meth public static javax.swing.Action openAction(org.openide.windows.TopComponent,java.lang.String,java.lang.String,boolean)
+meth public void addNotify()
+meth public void open()
+meth public void open(org.openide.windows.Workspace)
+ anno 0 java.lang.Deprecated()
+meth public void readExternal(java.io.ObjectInput) throws java.io.IOException,java.lang.ClassNotFoundException
+meth public void requestActive()
+meth public void requestFocus()
+meth public void requestVisible()
+meth public void setDisplayName(java.lang.String)
+meth public void setHtmlDisplayName(java.lang.String)
+meth public void setIcon(java.awt.Image)
+meth public void setName(java.lang.String)
+meth public void setToolTipText(java.lang.String)
+meth public void toFront()
+meth public void writeExternal(java.io.ObjectOutput) throws java.io.IOException
+supr javax.swing.JComponent
+hfds LOG,MODE_ID_PREFERENCES_KEY_INFIX,UILOG,activatedNodes,attentionGetter,closeOperation,defaultLookupLock,defaultLookupRef,displayName,htmlDisplayName,icon,modeName,nodeName,serialVersion,serialVersionUID,warnedClasses,warnedTCPIClasses
+hcls AttentionGetter,CloneWindowAction,CloseWindowAction,Replacer,SynchronizeNodes
+
diff --git a/enterprise/payara.eecommon/nbproject/project.properties b/enterprise/payara.eecommon/nbproject/project.properties
new file mode 100644
index 0000000..47a0578
--- /dev/null
+++ b/enterprise/payara.eecommon/nbproject/project.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+is.autoload=true
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
+spec.version.base=1.0
+
+test.config.stableBTD.includes=**/*Test.class
+test.config.stableBTD.excludes=\
+ **/HttpMonitorHelperTest.class
diff --git a/enterprise/payara.eecommon/nbproject/project.xml b/enterprise/payara.eecommon/nbproject/project.xml
new file mode 100644
index 0000000..2614781
--- /dev/null
+++ b/enterprise/payara.eecommon/nbproject/project.xml
@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.payara.eecommon</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.18</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.templates</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.13</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.core.multiview</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.49</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.db</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.25</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.26</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.dd</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.dd.webservice</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.metadata</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.5</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.sun.dd</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.sun.ddui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.41.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeapis</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.10</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>4</release-version>
+ <specification-version>1.46</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.tooling</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.18</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.93</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.schema2beans</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.18</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.core</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.48</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.multiview</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.43</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.io</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.13</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.61</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.text</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.21</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.2</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.insane</code-name-base>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <friend-packages>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
+ <friend>org.netbeans.modules.j2ee.sun.ws7</friend>
+ <package>org.netbeans.modules.payara.eecommon.api</package>
+ <package>org.netbeans.modules.payara.eecommon.api.config</package>
+ </friend-packages>
+ </data>
+ </configuration>
+</project>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Bundle.properties b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Bundle.properties
new file mode 100644
index 0000000..a7864d9
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Bundle.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+OpenIDE-Module-Display-Category=Java EE
+OpenIDE-Module-Long-Description=\
+ This module contains helper functions, api classes and spi interfaces to make it easy to share code between the payara server modules.
+OpenIDE-Module-Name=Payara EE Common
+OpenIDE-Module-Short-Description=Shared code for Payara servers
+
+PayaraResourcesFolder=Payara
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Status.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Status.java
new file mode 100644
index 0000000..028f08e
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/Status.java
@@ -0,0 +1,84 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// </editor-fold>
+
+package org.netbeans.modules.payara.eecommon;
+
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+
+/** Implementation of DeploymentStatus
+ */
+public class Status implements DeploymentStatus {
+
+ /** Value of action type. */
+ private ActionType at;
+
+ /** Executed command. */
+ private CommandType ct;
+
+ /** Status message. */
+ private String msg;
+
+ /** Current state. */
+ private StateType state;
+
+ public Status (ActionType at, CommandType ct, String msg, StateType state) {
+ this.at = at;
+ this.ct = ct;
+ this.msg = msg;
+ this.state = state;
+ }
+
+ public ActionType getAction () {
+ return at;
+ }
+
+ public CommandType getCommand () {
+ return ct;
+ }
+
+ public String getMessage () {
+ return msg;
+ }
+
+ public StateType getState () {
+ return state;
+ }
+
+ public boolean isCompleted () {
+ return StateType.COMPLETED.equals (state);
+ }
+
+ public boolean isFailed () {
+ return StateType.FAILED.equals (state);
+ }
+
+ public boolean isRunning () {
+ return StateType.RUNNING.equals (state);
+ }
+
+ public String toString () {
+ return "A="+getAction ()+" S="+getState ()+" "+getMessage (); // NOI18N
+ }
+}
+
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Bundle.properties b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Bundle.properties
new file mode 100644
index 0000000..229fe53
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Bundle.properties
@@ -0,0 +1,113 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# driver deploy helper
+MSG_CheckMissingDrivers=Checking for missing drivers
+MSG_DeployDriver=Deploying driver: {0}
+ERR_DeployDriver=Could not copy {0} to {1}
+MSG_DeployDriverComplete=Driver deployment completed
+ERR_DeployDriverFailed=Driver deployment encountered error
+JAVADB_DRIVER_LABEL=Java DB Driver
+
+Not_Run=Not Run
+
+Not_Implemented=Not Implemented
+
+Not_Applicable=Not Applicable
+
+Warning=Warning
+
+Fail=Fail
+
+Pass=Pass
+
+Error=Error
+
+This_is_a_label=This is a label
+
+Label=Label
+
+DisplayLabel=Display\:
+
+Detail\:=Detail\:
+
+ScrollListPane=This is a scroll pane that helps to scroll the list
+
+This_is_a_text_area=This is a text area
+
+Text_Area=Text Area
+
+This_is_a_text_field=This is a text field
+
+Text_Field=Text Field
+
+ScrollArea=This is a scroll pane that helps to scroll the list
+
+Scroll_Pane=Scroll Pane
+
+Running...=Running...
+
+Running_Verifier_Tool...=Running Verifier Tool...
+
+Wait=Wait...
+
+This_is_a_table_of_items=This is a table of items
+
+Table=Table
+
+This_is_a_panel=This is a panel
+
+verifierID=verifierID
+
+running_=Running Payara Verifier Tool: {0} {1}
+
+Result=Result
+
+Test_Description=Test Description
+
+Status=Status
+
+VerifierPanel=This is a panel in the verifier window
+
+Panel=Panel
+
+RadioButtonToSelect=This is a radio button used to select one from option from many choices
+
+Radio_Button=Radio Button
+
+ButtonToSelect=This is a button used to select an action
+
+Button=Button
+
+Failures_and_Warnings_only=Failures and &Warnings only
+
+Failures_Only=&Failures Only
+
+All_Results=A&ll Results
+
+MSG_INSTALL_VERIFIER=<html>Use the Payara Update Center to install<br/>the Payara Verifier Tool</html>
+
+ERR_PARSING_OUTPUT=Verifier output unparsable
+READ_OUTPUT_WINDOW=The "raw" output of the verifier is available in the Output window.\nIt may have information that will help resolve the failure.
+
+LBL_Verifier=Verifier: {0}
+
+MSG_ExceptionOccurred=Exception Occurred
+
+ERR_NO_OUTPUT_TO_PARSE=Verifier output \({0}\) not found.
\ No newline at end of file
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ConfigureProfilerHelper.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ConfigureProfilerHelper.java
new file mode 100644
index 0000000..b49a2ac
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ConfigureProfilerHelper.java
@@ -0,0 +1,120 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// </editor-fold>
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class ConfigureProfilerHelper {
+
+
+ private static final String ASENV_INSERTION_POINT_WIN_STRING = "set AS_JAVA";
+ private static final String ASENV_INSERTION_POINT_NOWIN_STRING = "AS_JAVA";
+
+
+ // replaces the AS_JAVA item in asenv.bat/conf
+ static public boolean modifyAsEnvScriptFile( File irf, String targetJavaHomePath) {
+
+ String ext = (isUnix() ? "conf" : "bat");
+ //File irf = ((SunDeploymentManagerInterface)dm).getPlatformRoot();
+ if (null == irf || !irf.exists()) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINER,"installRoot issue");
+ return false;
+ }
+ String installRoot = irf.getAbsolutePath(); //System.getProperty("com.sun.aas.installRoot");
+ String asEnvScriptFilePath = installRoot+"/config/asenv." + ext;
+ File asEnvScriptFile = new File(asEnvScriptFilePath);
+ if (!asEnvScriptFile.canWrite()) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINER,"asenv issue");
+ return false;
+ }
+ String lineBreak = System.getProperty("line.separator");
+ BufferedReader br = null;
+ FileWriter fw = null;
+ try {
+
+ String line;
+ FileReader fr = new FileReader(asEnvScriptFile);
+ br = new BufferedReader(fr);
+ StringBuilder buffer = new StringBuilder(Math.min(asEnvScriptFilePath.length(), 60000));
+
+ String asJavaString = (isUnix() ? ASENV_INSERTION_POINT_NOWIN_STRING : ASENV_INSERTION_POINT_WIN_STRING);
+
+ // copy config file from disk into memory buffer and modify line containing AS_JAVA definition
+ while ((line = br.readLine()) != null) {
+ if (line.trim().startsWith(asJavaString)) {
+ buffer.append(asJavaString);
+ buffer.append('=');
+ buffer.append(targetJavaHomePath);
+ } else {
+ buffer.append(line);
+ }
+ buffer.append(lineBreak);
+ }
+ //br.close();
+
+ // flush modified config file from memory buffer back to disk
+ fw = new FileWriter(asEnvScriptFile);
+ fw.write(buffer.toString());
+ fw.flush();
+ //fw.close();
+
+ if (isUnix()) {
+ Runtime.getRuntime().exec("chmod a+r " + asEnvScriptFile.getAbsolutePath()); //NOI18N
+ }
+
+ return true;
+
+ } catch (RuntimeException re) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINER,"",re);
+ return false;
+ } catch (Exception ex) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINER,"",ex);
+ return false;
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException ioe) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINEST,"",ioe);
+ }
+ }
+ if (fw != null) {
+ try {
+ fw.close();
+ } catch (IOException ioe) {
+ Logger.getLogger(ConfigureProfilerHelper.class.getName()).log(Level.FINEST,"",ioe);
+ }
+ }
+ }
+
+ }
+
+ static boolean isUnix() {
+ return File.separatorChar == '/';
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java
new file mode 100644
index 0000000..47fd179
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/DomainEditor.java
@@ -0,0 +1,687 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.nio.charset.Charset;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class DomainEditor {
+
+ private static final Logger LOGGER = Logger.getLogger("payara-eecommon");
+ private static final String HTTP_PROXY_HOST = "-Dhttp.proxyHost=";
+ private static final String HTTP_PROXY_PORT = "-Dhttp.proxyPort=";
+ private static final String HTTPS_PROXY_HOST = "-Dhttps.proxyHost=";
+ private static final String HTTPS_PROXY_PORT = "-Dhttps.proxyPort=";
+ private static final String HTTP_PROXY_NO_HOST = "-Dhttp.nonProxyHosts=";
+
+ private static String SAMPLE_DATASOURCE = "jdbc/sample"; //NOI18N
+ private static String SAMPLE_CONNPOOL = "SamplePool"; //NOI18N
+
+ private static String NBPROFILERNAME = "NetBeansProfiler"; //NOI18N
+
+ private static String CONST_USER = "User"; // NOI18N
+ private static String CONST_PASSWORD = "Password"; // NOI18N
+ private static String CONST_URL = "URL"; // NOI18N
+ private static String CONST_LOWER_DATABASE_NAME = "databaseName"; // NOI18N
+ private static String CONST_LOWER_PORT_NUMBER = "portNumber"; // NOI18N
+ private static String CONST_DATABASE_NAME = "DatabaseName"; // NOI18N
+ private static String CONST_PORT_NUMBER = "PortNumber"; // NOI18N
+ private static String CONST_SID = "SID"; // NOI18N
+ private static String CONST_SERVER_NAME = "serverName"; // NOI18N
+ private static String CONST_DRIVER_CLASS = "driverClass"; // NOI18N
+ static private String CONST_NAME = "name"; // NOI18N
+ static private String CONST_VALUE = "value"; // NOI18N
+ static private String CONST_DS_CLASS = "datasource-classname"; // NOI18N
+ static private String CONST_RES_TYPE = "res-type"; // NOI18N
+ static private String CONST_JVM_OPTIONS = "jvm-options"; // NOI18N
+ static private String CONST_DERBY_CONN_ATTRS = "connectionAttributes"; // NOI18N
+ static private String CONST_JNDINAME = "jndi-name"; // NOI18N
+ static private String CONST_PROP = "property"; // NOI18N
+ static private String CONST_POOLNAME = "pool-name"; // NOI18N
+ static private String CONST_ENABLED = "enabled"; // NOI18N
+ static private String CONST_OBJTYPE = "object-type"; // NOI18N
+ static private String CONST_JDBC = "jdbc-resource"; // NOI18N
+ static private String CONST_CP = "jdbc-connection-pool"; // NOI18N
+ static private String CONST_AO = "admin-object-resource"; // NOI18N
+ static private String XML_ENTITY = "<?xml version=\"1.0\" encoding=\"{0}\"?>";
+
+ private String dmLoc;
+ private String dmName;
+
+ /**
+ * Creates a new instance of DomainEditor
+ * @param dm Deployment Manager of Target Server
+ */
+ public DomainEditor(String domainLocation, String domainName) {
+ this.dmLoc = domainLocation;
+ this.dmName = domainName;
+ }
+
+ /**
+ * Get the location of the server's domain.xml
+ * @return String representing path to domain.xml
+ */
+ public String getDomainLocation(){
+ String domainScriptFilePath = dmLoc+"/" + dmName + "/config/domain.xml"; //NOI18N
+ return domainScriptFilePath;
+ }
+
+ /**
+ * Get Document Object representing the domain.xml
+ * @return Document object representing given domain.xml
+ */
+ public Document getDomainDocument(){
+ String domainLoc = getDomainLocation();
+
+ // Load domain.xml
+ Document domainScriptDocument = getDomainDocument(domainLoc);
+ return domainScriptDocument;
+ }
+
+ /**
+ * Get Document Object representing the domain.xml
+ * @param domainLoc Location of domain.xml
+ * @return Document object representing given domain.xml
+ */
+ public Document getDomainDocument(String domainLoc){
+ // Load domain.xml
+ Document domainScriptDocument = loadDomainScriptFile(domainLoc);
+ return domainScriptDocument;
+ }
+
+ /**
+ * Perform server instrumentation for profiling
+ * @param domainDoc Document object representing domain.xml
+ * @param nativeLibraryPath Native Library Path
+ * @param jvmOptions Values for jvm-options to enable profiling
+ * @return returns true if server is ready for profiling
+ */
+ public boolean addProfilerElements(Document domainDoc, String nativeLibraryPath, String[] jvmOptions){
+ String domainPath = getDomainLocation();
+
+ // Remove any previously defined 'profiler' element(s)
+ removeProfiler(domainDoc);
+
+ // If no 'profiler' element needs to be defined, the existing one is simply removed (by the code above)
+ // (This won't happen for NetBeans Profiler, but is a valid scenario)
+ // Otherwise new 'profiler' element is inserted according to provided parameters
+ if (nativeLibraryPath != null || jvmOptions != null) {
+
+ // Create "profiler" element
+ Element profilerElement = domainDoc.createElement("profiler");//NOI18N
+ profilerElement.setAttribute("enabled", "true");//NOI18N
+ profilerElement.setAttribute(CONST_NAME, NBPROFILERNAME);//NOI18N
+ if (nativeLibraryPath != null) {
+ profilerElement.setAttribute("native-library-path", nativeLibraryPath);//NOI18N
+ }
+
+ // Create "jvm-options" element
+ if (jvmOptions != null) {
+ for (int i = 0; i < jvmOptions.length; i++) {
+ Element jvmOptionsElement = domainDoc.createElement(CONST_JVM_OPTIONS);
+ Text tt = domainDoc.createTextNode(formatJvmOption(jvmOptions[i]));
+ jvmOptionsElement.appendChild(tt);
+ profilerElement.appendChild(jvmOptionsElement);
+ }
+ }
+
+ // Find the "java-config" element
+ NodeList javaConfigNodeList = domainDoc.getElementsByTagName("java-config");
+ if (javaConfigNodeList == null || javaConfigNodeList.getLength() == 0) {
+ LOGGER.log(Level.INFO,
+ "Cannot find 'java-config' section in domain config file {0}",
+ domainPath);
+ return false;
+ }
+
+ // Insert the "profiler" element as a first child of "java-config" element
+ Node javaConfigNode = javaConfigNodeList.item(0);
+ if (javaConfigNode.getFirstChild() != null)
+ javaConfigNode.insertBefore(profilerElement, javaConfigNode.getFirstChild());
+ else
+ javaConfigNode.appendChild(profilerElement);
+
+ }
+ // Save domain.xml
+ return saveDomainScriptFile(domainDoc, domainPath);
+ }
+
+ /**
+ * Remove server instrumentation to disable profiling
+ * @param domainDoc Document object representing domain.xml
+ * @return true if profiling support has been removed
+ */
+ public boolean removeProfilerElements(Document domainDoc){
+ boolean eleRemoved = removeProfiler(domainDoc);
+ if(eleRemoved){
+ // Save domain.xml
+ return saveDomainScriptFile(domainDoc, getDomainLocation());
+ }else{
+ //no need to save.
+ return true;
+ }
+ }
+
+ private boolean removeProfiler(Document domainDoc){
+ // Remove any previously defined 'profiler' element(s)
+ NodeList profilerElementNodeList = domainDoc.getElementsByTagName("profiler");//NOI18N
+ if (profilerElementNodeList != null && profilerElementNodeList.getLength() > 0){
+ Vector<Node> nodes = new Vector<Node>(); //temp storage for the nodes to delete
+ //we only want to delete the NBPROFILERNAME nodes.
+ // otherwise, see bug # 77026
+ for (int i = 0; i < profilerElementNodeList.getLength(); i++) {
+ Node n= profilerElementNodeList.item(i);
+ Node a= n.getAttributes().getNamedItem(CONST_NAME);//NOI18N
+ if ((a!=null)&&(a.getNodeValue().equals(NBPROFILERNAME))){//NOI18N
+ nodes.add(n);
+ }
+ }
+ for(int i=0; i<nodes.size(); i++){
+ Node nd = nodes.get(i);
+ nd.getParentNode().removeChild(nd);
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ public String[] getHttpProxyOptions(){
+ List<String> httpProxyOptions = new ArrayList<String>();
+ Document domainDoc = getDomainDocument();
+ NodeList javaConfigNodeList = domainDoc.getElementsByTagName("java-config");
+ if (javaConfigNodeList == null || javaConfigNodeList.getLength() == 0) {
+ return httpProxyOptions.toArray(new String[httpProxyOptions.size()]);
+ }
+
+ NodeList jvmOptionNodeList = domainDoc.getElementsByTagName(CONST_JVM_OPTIONS);
+ for(int i=0; i<jvmOptionNodeList.getLength(); i++){
+ Node nd = jvmOptionNodeList.item(i);
+ if(nd.hasChildNodes()) {
+ Node childNode = nd.getFirstChild();
+ String childValue = childNode.getNodeValue();
+ if(childValue.indexOf(HTTP_PROXY_HOST) != -1
+ || childValue.indexOf(HTTP_PROXY_PORT) != -1
+ || childValue.indexOf(HTTPS_PROXY_HOST) != -1
+ || childValue.indexOf(HTTPS_PROXY_PORT) != -1
+ || childValue.indexOf(HTTP_PROXY_NO_HOST) != -1){
+ httpProxyOptions.add(childValue);
+ }
+ }
+ }
+
+ String[] opts = new String[httpProxyOptions.size()];
+ return httpProxyOptions.toArray(opts);
+
+ }
+
+ public boolean setHttpProxyOptions(String[] httpProxyOptions){
+ Document domainDoc = getDomainDocument();
+ NodeList javaConfigNodeList = domainDoc.getElementsByTagName("java-config");
+ if (javaConfigNodeList == null || javaConfigNodeList.getLength() == 0) {
+ return false;
+ }
+
+ //Iterates through the existing proxy attributes and deletes them
+ removeProxyOptions(domainDoc, javaConfigNodeList.item(0));
+
+ //Add new set of proxy options
+ for(int j=0; j<httpProxyOptions.length; j++){
+ String option = httpProxyOptions[j];
+ Element jvmOptionsElement = domainDoc.createElement(CONST_JVM_OPTIONS);
+ Text proxyOption = domainDoc.createTextNode(option);
+ jvmOptionsElement.appendChild(proxyOption);
+ javaConfigNodeList.item(0).appendChild(jvmOptionsElement);
+ }
+
+ return saveDomainScriptFile(domainDoc, getDomainLocation(), false);
+ }
+
+ private boolean removeProxyOptions(Document domainDoc, Node javaConfigNode){
+ NodeList jvmOptionNodeList = domainDoc.getElementsByTagName(CONST_JVM_OPTIONS);
+
+ Vector<Node> nodes = new Vector<Node>();
+ for(int i=0; i<jvmOptionNodeList.getLength(); i++){
+ Node nd = jvmOptionNodeList.item(i);
+ if(nd.hasChildNodes()) {
+ Node childNode = nd.getFirstChild();
+ String childValue = childNode.getNodeValue();
+ if(childValue.indexOf(HTTP_PROXY_HOST) != -1
+ || childValue.indexOf(HTTP_PROXY_PORT) != -1
+ || childValue.indexOf(HTTPS_PROXY_HOST) != -1
+ || childValue.indexOf(HTTPS_PROXY_PORT) != -1
+ || childValue.indexOf(HTTP_PROXY_NO_HOST) != -1){
+ nodes.add(nd);
+ }
+ }
+ }
+ for(int i=0; i<nodes.size(); i++){
+ javaConfigNode.removeChild(nodes.get(i));
+ }
+
+ return saveDomainScriptFile(domainDoc, getDomainLocation(), false);
+ }
+
+ /*
+ * Creates Document instance from domain.xml
+ * @param domainScriptFilePath Path to domain.xml
+ */
+ private Document loadDomainScriptFile(String domainScriptFilePath) {
+ InputStreamReader reader = null;
+ try {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ dbFactory.setValidating(false);
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ dBuilder.setEntityResolver(new InnerResolver());
+ reader = new FileReader(new File(domainScriptFilePath));
+ InputSource source = new InputSource(reader);
+ return dBuilder.parse(source);
+ } catch (Exception e) {
+ LOGGER.log(Level.WARNING,
+ "Unable to parse domain config file {0}",
+ domainScriptFilePath);
+ return null;
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, "Cannot close reader for {0}: {1}",
+ new String[] {domainScriptFilePath, ex.getLocalizedMessage()});
+ }
+ }
+ }
+ }
+
+ static class InnerResolver implements EntityResolver {
+ private final Charset charset;
+ InnerResolver() {
+ charset = Charset.defaultCharset();
+ }
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ String xmlEntity = MessageFormat.format(XML_ENTITY, charset.name());
+ StringReader reader = new StringReader(xmlEntity);
+ InputSource source = new InputSource(reader);
+ source.setPublicId(publicId);
+ source.setSystemId(systemId);
+ return source;
+ }
+ }
+ private boolean saveDomainScriptFile(Document domainScriptDocument, String domainScriptFilePath) {
+ return saveDomainScriptFile(domainScriptDocument, domainScriptFilePath, true);
+ }
+ /*
+ * Saves Document instance to domain.xml
+ * @param domainScriptDocument Document representing the xml
+ * @param domainScriptFilePath Path to domain.xml
+ */
+ private boolean saveDomainScriptFile(Document domainScriptDocument, String domainScriptFilePath, boolean indent) {
+ boolean result = false;
+ OutputStreamWriter domainXmlWriter = null;
+ final Charset charset = Charset.defaultCharset();
+ try {
+ domainXmlWriter = new OutputStreamWriter(new FileOutputStream(domainScriptFilePath), charset.name());
+ try {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ if(indent) {
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ }
+
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
+ if(domainScriptDocument.getDoctype() != null) {
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, domainScriptDocument.getDoctype().getPublicId());
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, domainScriptDocument.getDoctype().getSystemId());
+ }
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+
+ DOMSource domSource = new DOMSource(domainScriptDocument);
+ StreamResult streamResult = new StreamResult(domainXmlWriter);
+
+ transformer.transform(domSource, streamResult);
+ result = true;
+ } catch (Exception e) {
+ LOGGER.log(Level.WARNING,
+ "Unable to save domain config file {0}",
+ domainScriptFilePath);
+ result = false;
+ }
+ } catch (IOException ioex) {
+ LOGGER.log(Level.INFO,
+ "Cannot create output stream for domain config file {0}",
+ domainScriptFilePath);
+ result = false;
+ } finally {
+ try {
+ if (domainXmlWriter != null) {
+ domainXmlWriter.close();
+ }
+ } catch (IOException ioex2) {
+ LOGGER.log(Level.INFO,
+ "Cannot close output stream for {0}",
+ domainScriptFilePath);
+ }
+ }
+
+ return result;
+ }
+
+ // Converts -agentpath:"C:\Program Files\lib\profileragent.dll=\"C:\Program Files\lib\"",5140
+ // to -agentpath:C:\Program Files\lib\profileragent.dll="C:\Program Files\lib",5140 (AS 8.1 and AS 8.2)
+ // or to "-agentpath:C:\Program Files\lib\profileragent.dll=\"C:\Program Files\lib\",5140" (Payara or AS 9.0)
+ private String formatJvmOption(String jvmOption) {
+ // only jvmOption containing \" needs to be formatted
+ if (jvmOption.indexOf("\"") != -1) { // NOI18N
+ // special handling for -agentpath
+ if (jvmOption.indexOf("\\\"") != -1 && jvmOption.indexOf("-agentpath") != -1 ){ // NOI18N
+ // Modification for AS 8.1, 8.2, initial modification for AS 9.0, Payara
+ // Converts -agentpath:"C:\Program Files\lib\profileragent.dll=\"C:\Program Files\lib\"",5140
+ // to -agentpath:C:\Program Files\lib\profileragent.dll="C:\Program Files\lib",5140
+ String modifiedOption = jvmOption.replaceAll("\\\\\"", "#"); // replace every \" by #
+ modifiedOption = modifiedOption.replaceAll("\\\"", ""); // delete all "
+ modifiedOption = modifiedOption.replaceAll("#", "\""); // replace every # by "
+
+ // Modification for AS 9.0, Payara should be done only if native launcher isn't used,
+ // otherwise will cause server startup failure. It seems that currently native launcher is used
+ // for starting the servers from the IDE.
+ // boolean usingNativeLauncher = false;
+ String osType=System.getProperty("os.name");//NOI18N
+ if ((osType.startsWith("Mac OS"))){//no native for mac of glassfish
+ // if (!usingNativeLauncher) {
+
+ // Modification for AS 9.0, Payara
+ // Converts -agentpath:C:\Program Files\lib\profileragent.dll="C:\Program Files\lib",5140
+ // "-agentpath:C:\Program Files\lib\profileragent.dll=\"C:\Program Files\lib\",5140"
+
+ modifiedOption = "\"" + modifiedOption.replaceAll("\\\"", "\\\\\"") + "\"";
+
+ }
+
+ // return correctly formatted jvmOption
+ return modifiedOption;
+ } else {
+ return jvmOption.replace('"', ' ');
+ }
+ }
+ // return original jvmOption
+ return jvmOption;
+ }
+
+ static final String[] sysDatasources = {"jdbc/__TimerPool", "jdbc/__CallFlowPool"}; //NOI18N
+
+
+ public HashMap<String,Map> getSunDatasourcesFromXml(){
+ HashMap<String,Map> dSources = new HashMap<String,Map>();
+ Document domainDoc = getDomainDocument();
+ if (domainDoc != null) {
+ HashMap<String,NamedNodeMap> dsMap = getDataSourcesAttrMap(domainDoc);
+ HashMap<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
+ dsMap.keySet().removeAll(Arrays.asList(sysDatasources));
+ String[] ds = dsMap.keySet().toArray(new String[dsMap.size()]);
+
+ for (int i = 0; i < ds.length; i++) {
+ String jndiName = ds[i];
+ NamedNodeMap dsAttrMap = dsMap.get(jndiName);
+
+ String poolName = dsAttrMap.getNamedItem(CONST_POOLNAME).getNodeValue();
+ dSources.put(jndiName, getPoolValues(cpMap, poolName));
+ } // for each jdbc-resource
+ }
+ return dSources;
+ }
+
+ private HashMap<String,String> getPoolValues(HashMap cpMap, String poolName) {
+ HashMap<String,String> pValues = new HashMap<String,String>();
+ Node cpNode = (Node) cpMap.get(poolName);
+ NamedNodeMap cpAttrMap = cpNode.getAttributes();
+ Node dsClassName = cpAttrMap.getNamedItem(CONST_DS_CLASS);
+ Node resType = cpAttrMap.getNamedItem(CONST_RES_TYPE);
+
+ //Get property values
+ Element cpElement = (Element) cpNode;
+ NodeList propsNodeList = cpElement.getElementsByTagName(CONST_PROP);
+
+ //Cycle through each property element
+ HashMap map = new HashMap();
+ for (int j = 0; j < propsNodeList.getLength(); j++) {
+ Node propNode = propsNodeList.item(j);
+ NamedNodeMap propsMap = propNode.getAttributes();
+ String mkey = propsMap.getNamedItem(CONST_NAME).getNodeValue();
+ String mkeyValue = propsMap.getNamedItem(CONST_VALUE).getNodeValue();
+ if (mkey.equalsIgnoreCase(CONST_USER)) {
+ pValues.put(CONST_USER, mkeyValue);
+ } else if (mkey.equalsIgnoreCase(CONST_PASSWORD)) {
+ pValues.put(CONST_PASSWORD, mkeyValue);
+ } else if (mkey.equalsIgnoreCase(CONST_URL)) {
+ pValues.put(CONST_URL, mkeyValue);
+ } else if (mkey.equalsIgnoreCase(CONST_SERVER_NAME)) {
+ pValues.put(CONST_SERVER_NAME, mkeyValue);
+ } else {
+ map.put(mkey, mkeyValue);
+ }
+ } // connection-pool properties
+
+ pValues.put(CONST_LOWER_DATABASE_NAME, (String) map.get(CONST_LOWER_DATABASE_NAME));
+ pValues.put(CONST_PORT_NUMBER, (String) map.get(CONST_PORT_NUMBER));
+ pValues.put(CONST_LOWER_PORT_NUMBER, (String) map.get(CONST_LOWER_PORT_NUMBER));
+ pValues.put(CONST_DATABASE_NAME, (String) map.get(CONST_DATABASE_NAME));
+ pValues.put(CONST_SID, (String) map.get(CONST_SID));
+ pValues.put(CONST_DRIVER_CLASS, (String) map.get(CONST_DRIVER_CLASS));
+ pValues.put(CONST_DERBY_CONN_ATTRS, (String) map.get(CONST_DERBY_CONN_ATTRS));
+ if (dsClassName != null) {
+ pValues.put("dsClassName", dsClassName.getNodeValue());
+ }
+ if (resType != null) {
+ pValues.put("resType", resType.getNodeValue());
+ }
+ return pValues;
+ }
+
+ public HashMap<String,Map> getConnPoolsFromXml(){
+ HashMap<String,Map> pools = new HashMap<String,Map>();
+ Document domainDoc = getDomainDocument();
+ if (domainDoc != null) {
+ HashMap<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
+
+ String[] cp = cpMap.keySet().toArray(new String[cpMap.size()]);
+ for (int i = 0; i < cp.length; i++) {
+ String name = cp[i];
+ pools.put(name, getPoolValues(cpMap, name));
+ }
+ }
+ return pools;
+ }
+
+ private HashMap<String,NamedNodeMap> getDataSourcesAttrMap(Document domainDoc){
+ HashMap<String,NamedNodeMap> dataSourceMap = new HashMap<String,NamedNodeMap>();
+ updateWithSampleDataSource(domainDoc);
+ NodeList dataSourceNodeList = domainDoc.getElementsByTagName(CONST_JDBC);
+ for(int i=0; i<dataSourceNodeList.getLength(); i++){
+ Node dsNode = dataSourceNodeList.item(i);
+ NamedNodeMap dsAttrMap = dsNode.getAttributes();
+ String jndiName = dsAttrMap.getNamedItem(CONST_JNDINAME).getNodeValue();
+ dataSourceMap.put(jndiName, dsAttrMap);
+ }
+ return dataSourceMap;
+ }
+
+ public void createSampleDatasource(){
+ Document domainDoc = getDomainDocument();
+ if (domainDoc != null) {
+ updateWithSampleDataSource(domainDoc);
+ }
+ }
+
+ private boolean updateWithSampleDataSource(Document domainDoc){
+ boolean sampleExists = false;
+ NodeList dataSourceNodeList = domainDoc.getElementsByTagName(CONST_JDBC);
+ for(int i=0; i<dataSourceNodeList.getLength(); i++){
+ Node dsNode = dataSourceNodeList.item(i);
+ NamedNodeMap dsAttrMap = dsNode.getAttributes();
+ String jndiName = dsAttrMap.getNamedItem(CONST_JNDINAME).getNodeValue();
+ if(jndiName.equals(SAMPLE_DATASOURCE)) {
+ sampleExists = true;
+ }
+ }
+ if(!sampleExists) {
+ return createSampleDatasource(domainDoc);
+ }
+ return true;
+ }
+
+ private boolean createSampleDatasource(Document domainDoc){
+ NodeList resourcesNodeList = domainDoc.getElementsByTagName("resources");
+ NodeList serverNodeList = domainDoc.getElementsByTagName("server");
+ if (resourcesNodeList == null || resourcesNodeList.getLength() == 0 ||
+ serverNodeList == null || serverNodeList.getLength() == 0) {
+ return true;
+ }
+ Node resourcesNode = resourcesNodeList.item(0);
+
+ Map<String,Node> cpMap = getConnPoolsNodeMap(domainDoc);
+ if(! cpMap.containsKey(SAMPLE_CONNPOOL)){
+ if (cpMap.isEmpty()) {
+ LOGGER.log(Level.INFO,
+ "Cannot create sample datasource {0}",
+ SAMPLE_DATASOURCE);
+ return false;
+ }
+ Node oldNode = cpMap.values().iterator().next();
+ Node cpNode = oldNode.cloneNode(false);
+ NamedNodeMap cpAttrMap = cpNode.getAttributes();
+ if(cpAttrMap.getNamedItem(CONST_NAME) != null) {
+ cpAttrMap.getNamedItem(CONST_NAME).setNodeValue(SAMPLE_CONNPOOL);
+ }
+ if(cpAttrMap.getNamedItem(CONST_DS_CLASS) != null) {
+ cpAttrMap.getNamedItem(CONST_DS_CLASS).setNodeValue("org.apache.derby.jdbc.ClientDataSource"); //N0I18N
+ }
+ if(cpAttrMap.getNamedItem(CONST_RES_TYPE) != null) {
+ cpAttrMap.getNamedItem(CONST_RES_TYPE).setNodeValue("javax.sql.DataSource"); //N0I18N
+ }
+ HashMap<String, String> poolProps = new HashMap<String, String>();
+ poolProps.put(CONST_SERVER_NAME, "localhost"); //N0I18N
+ poolProps.put(CONST_PASSWORD, "app"); //N0I18N
+ poolProps.put(CONST_USER, "app"); //N0I18N
+ poolProps.put(CONST_DATABASE_NAME, "sample"); //N0I18N
+ poolProps.put(CONST_PORT_NUMBER, "1527"); //N0I18N
+ poolProps.put(CONST_URL, "jdbc:derby://localhost:1527/sample"); //N0I18N
+
+ Object[] propNames = poolProps.keySet().toArray();
+ for(int i=0; i<propNames.length; i++){
+ String keyName = (String)propNames[i];
+ Element propElement = domainDoc.createElement(CONST_PROP); //N0I18N
+ propElement.setAttribute(CONST_NAME, keyName);
+ propElement.setAttribute(CONST_VALUE, poolProps.get(keyName)); //N0I18N
+ cpNode.appendChild(propElement);
+ }
+ resourcesNode.appendChild(cpNode);
+ }
+
+ Element dsElement = domainDoc.createElement(CONST_JDBC); //N0I18N
+ dsElement.setAttribute(CONST_JNDINAME, SAMPLE_DATASOURCE); //N0I18N
+ dsElement.setAttribute(CONST_POOLNAME, SAMPLE_CONNPOOL); //N0I18N
+ dsElement.setAttribute(CONST_OBJTYPE, "user"); //N0I18N
+ dsElement.setAttribute(CONST_ENABLED, "true"); //N0I18N
+
+ // Insert the ds __Sample as a first child of "resources" element
+ if (resourcesNode.getFirstChild() != null)
+ resourcesNode.insertBefore(dsElement, resourcesNode.getFirstChild());
+ else
+ resourcesNode.appendChild(dsElement);
+
+ //<resource-ref enabled="true" ref="jdbc/__default"/>
+ Element dsResRefElement = domainDoc.createElement("resource-ref"); //N0I18N
+ dsResRefElement.setAttribute("ref", SAMPLE_DATASOURCE); //N0I18N
+ dsResRefElement.setAttribute(CONST_ENABLED, "true"); //N0I18N
+ // Insert the ds reference __Sample as last child of "server" element
+ Node serverNode = serverNodeList.item(0);
+ if (serverNode.getLastChild() != null)
+ serverNode.insertBefore(dsResRefElement, serverNode.getLastChild());
+ else
+ serverNode.appendChild(dsResRefElement);
+
+ return saveDomainScriptFile(domainDoc, getDomainLocation());
+ }
+
+ private HashMap<String,Node> getConnPoolsNodeMap(Document domainDoc){
+ HashMap<String,Node> connPoolMap = new HashMap<String,Node>();
+ NodeList connPoolNodeList = domainDoc.getElementsByTagName(CONST_CP);
+ for(int i=0; i<connPoolNodeList.getLength(); i++){
+ Node cpNode = connPoolNodeList.item(i);
+ NamedNodeMap cpAttrMap = cpNode.getAttributes();
+ String cpName = cpAttrMap.getNamedItem(CONST_NAME).getNodeValue();
+ connPoolMap.put(cpName, cpNode);
+ }
+ return connPoolMap;
+ }
+
+ public HashMap<String,String> getAdminObjectResourcesFromXml(){
+ HashMap<String,String> aoResources = new HashMap<String,String>();
+ Document domainDoc = getDomainDocument();
+ if (domainDoc != null) {
+ NodeList adminObjectNodeList = domainDoc.getElementsByTagName(CONST_AO);
+ for (int i = 0; i < adminObjectNodeList.getLength(); i++) {
+ Node aoNode = adminObjectNodeList.item(i);
+ NamedNodeMap aoAttrMap = aoNode.getAttributes();
+ String jndiName = aoAttrMap.getNamedItem(CONST_JNDINAME).getNodeValue();
+
+ Node type = aoAttrMap.getNamedItem(CONST_RES_TYPE);
+ if (type != null){
+ aoResources.put(jndiName, type.getNodeValue());
+ }
+ }
+ }
+ return aoResources;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ExecSupport.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ExecSupport.java
new file mode 100644
index 0000000..685e90d
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ExecSupport.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import org.openide.ErrorManager;
+import org.openide.windows.InputOutput;
+import org.openide.windows.OutputWriter;
+
+public class ExecSupport {
+
+ /** Creates a new instance of ExecSupport */
+ ExecSupport() {
+ }
+
+ /**
+ * Redirect the standard output and error streams of the child
+ * process to an output window.
+ */
+ void displayProcessOutputs(final Process child, String displayName, String initialMessage)
+ throws IOException, InterruptedException {
+ // Get a tab on the output window. If this client has been
+ // executed before, the same tab will be returned.
+ InputOutput io = org.openide.windows.IOProvider.getDefault().getIO(displayName, false);
+ OutputWriter ow = io.getOut();
+ try {
+ io.getOut().reset();
+ } catch (IOException e) {
+ // not a critical error, continue
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+// io.select();
+ ow.println(initialMessage);
+ final Thread[] copyMakers = new Thread[3];
+ (copyMakers[0] = new OutputCopier(new InputStreamReader(child.getInputStream()), ow, true)).start();
+ (copyMakers[1] = new OutputCopier(new InputStreamReader(child.getErrorStream()), io.getErr(), true)).start();
+ (copyMakers[2] = new OutputCopier(io.getIn(), new OutputStreamWriter(child.getOutputStream()), true)).start();
+ new Thread() {
+
+ @Override
+ public void run() {
+ try {
+ child.waitFor();
+ Thread.sleep(2000); // time for copymakers
+
+ } catch (InterruptedException e) {
+ } finally {
+ try {
+ copyMakers[0].interrupt();
+ copyMakers[1].interrupt();
+ copyMakers[2].interrupt();
+ } catch (Exception e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ }
+ }
+ }.start();
+ }
+
+ /** This thread simply reads from given Reader and writes read chars to given Writer. */
+ public static class OutputCopier extends Thread {
+ final Writer os;
+ final Reader is;
+ /** while set to false at streams that writes to the OutputWindow it must be
+ * true for a stream that reads from the window.
+ */
+ final boolean autoflush;
+ private boolean done = false;
+
+ public OutputCopier(Reader is, Writer os, boolean b) {
+ this.os = os;
+ this.is = is;
+ autoflush = b;
+ }
+
+ /* Makes copy. */
+ @Override
+ public void run() {
+ int read;
+ char[] buff = new char[256];
+ try {
+ while ((read = read(is, buff, 0, 256)) > 0x0) {
+ if (os != null) {
+ os.write(buff, 0, read);
+ if (autoflush) {
+ os.flush();
+ }
+ }
+ }
+ } catch (IOException | InterruptedException ex) {
+ }
+ }
+
+ @Override
+ public void interrupt() {
+ super.interrupt();
+ done = true;
+ }
+
+ private int read(Reader is, char[] buff, int start, int count) throws InterruptedException, IOException {
+
+ while (!is.ready() && !done) {
+ sleep(100);
+ }
+ return is.read(buff, start, count);
+ }
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/FindJSPServletHelper.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/FindJSPServletHelper.java
new file mode 100644
index 0000000..1795895
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/FindJSPServletHelper.java
@@ -0,0 +1,73 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// </editor-fold>
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import org.openide.util.Parameters;
+
+public class FindJSPServletHelper {
+
+ /** Creates a new instance of FindJSPServletImpl */
+ private FindJSPServletHelper() {
+ }
+
+ static public String getServletResourcePath(String moduleContextPath, String jspResourcePath) {
+ Parameters.notWhitespace("jspResourcePath", jspResourcePath);
+ String s = getServletPackageName(jspResourcePath) + '/' +
+ getServletClassName(jspResourcePath) + ".java";// NOI18N
+ return s;
+ }
+
+ // After Apace donation, should use org.apache.jasper utilities in
+ // JspUtil and JspCompilationContext
+ static private String getServletPackageName(String jspUri) {
+ String jspBasePackageName = "org/apache/jsp";//NOI18N
+ int iSep = jspUri.lastIndexOf('/');
+ String packageName = (iSep > 0) ? jspUri.substring(0, iSep) : "";//NOI18N
+ if (packageName.length() == 0) {
+ return jspBasePackageName;
+ }
+ return jspBasePackageName + "/" + packageName.substring(1);//NOI18N
+
+ }
+
+ // After Apace donation, should use org.apache.jasper utilities in
+ // JspUtil and JspCompilationContext
+ static private String getServletClassName(String jspUri) {
+ int iSep = jspUri.lastIndexOf('/') + 1;
+ String className = jspUri.substring(iSep);
+ StringBuilder modClassName = new StringBuilder("");//NOI18N
+ for (int i = 0; i < className.length(); i++) {
+ char c = className.charAt(i);
+ if (c == '.') {
+ modClassName.append('_');
+ } else {
+ modClassName.append(c);
+ }
+ }
+ return modClassName.toString();
+ }
+
+ public static String getServletEncoding(String moduleContextPath, String jspResourcePath) {
+ return "UTF8"; // NOI18N
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelper.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelper.java
new file mode 100644
index 0000000..1dc4546
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelper.java
@@ -0,0 +1,553 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
+import org.netbeans.modules.j2ee.dd.api.web.Filter;
+import org.netbeans.modules.j2ee.dd.api.web.FilterMapping;
+import org.netbeans.modules.j2ee.dd.api.common.InitParam;
+import org.netbeans.modules.j2ee.dd.api.web.WebApp;
+import org.openide.modules.ModuleInfo;
+import org.openide.util.Lookup;
+import org.openide.util.LookupListener;
+import org.openide.util.LookupEvent;
+import org.openide.ErrorManager;
+import org.openide.modules.InstalledFileLocator;
+import org.xml.sax.SAXException;
+import org.netbeans.modules.schema2beans.Common;
+import org.netbeans.modules.schema2beans.BaseBean;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+
+public class HttpMonitorHelper {
+
+ // monitor module enable status data
+ private static final String MONITOR_MODULE_NAME="org.netbeans.modules.web.monitor"; //NOI18N
+ private static ModuleInfo httpMonitorInfo;
+ private static ModuleSpy monitorSpy;
+ private static Lookup.Result res;
+ private static MonitorInfoListener monitorInfoListener;
+ private static MonitorLookupListener monitorLookupListener;
+
+ // data for declaration in web.xml
+ private static final String MONITOR_FILTER_NAME = "HTTPMonitorFilter"; //NOI18N
+ private static final String MONITOR_FILTER_CLASS = "org.netbeans.modules.web.monitor.server.MonitorFilter"; //NOI18N
+ private static final String MONITOR_FILTER_PATTERN = "/*"; //NOI18N
+ private static final String MONITOR_INTERNALPORT_PARAM_NAME = "netbeans.monitor.ide"; //NOI18N
+
+ public static boolean synchronizeMonitor(String domainLoc, String domainName, boolean monitorFlag, String... others) throws FileNotFoundException, IOException, SAXException {
+ boolean monitorModuleAvailable = isMonitorEnabled();
+ boolean shouldInstall = monitorModuleAvailable && monitorFlag;
+ // find the web.xml file
+ File webXML = getDefaultWebXML(domainLoc, domainName);
+ if (webXML == null) {
+ return false;
+ }
+ WebApp webApp = DDProvider.getDefault().getDDRoot(webXML);
+ if (webApp == null) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, new Exception(""));
+ return false;
+ }
+ boolean needsSave = false;
+ boolean needRestart = false;
+ boolean result;
+ try {
+ if (shouldInstall) {
+ needRestart = addMonitorJars(domainLoc,domainName,others);
+ result = changeFilterMonitor(webApp, true);
+ needsSave = needsSave || result;
+ result = specifyFilterPortParameter(webApp);
+ needsSave = needsSave || result;
+ } else {
+ result = changeFilterMonitor(webApp, false);
+ needsSave = needsSave || result;
+ }
+ } catch (ClassNotFoundException cnfe) {
+ needsSave = false;
+ ErrorManager.getDefault().notify(ErrorManager.ERROR, cnfe);
+ }
+ if (needsSave) {
+ OutputStream os = new FileOutputStream(webXML);
+ try {
+ webApp.write(os);
+ } finally {
+ os.close();
+ }
+ }
+ return needRestart;
+ }
+
+ // Workaround to eliminate Glassfih issue 8609
+ // https://glassfish.dev.java.net/issues/show_bug.cgi?id=8609
+ // Workaround may be removed when GF issue 8609 is fixed
+ // visible for unit testing only
+ //
+ static File getDefaultWebXML(String domainLoc, String domainName) {
+ String loc = domainLoc+"/"+domainName+"/config/default-web.xml"; // NOI18N
+ File webXML = new File(loc);
+
+ if (webXML.exists()) {
+ String backupLoc = domainLoc+"/"+domainName+"/config/default-web.xml.orig"; // NOI18N
+ File backupXml = new File(backupLoc);
+ if (!backupXml.exists()) {
+ try {
+ copy(webXML,backupXml);
+ createCopyAndUpgrade(backupXml, webXML);
+ } catch (FileNotFoundException fnfe) {
+ Logger.getLogger("payara-eecommon").log(Level.WARNING, "This file existed a few milliseconds ago: "+ webXML.getAbsolutePath(), fnfe);
+ } catch (IOException ioe) {
+ if (backupXml.exists()) {
+ backupXml.delete();
+ Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to backup data from "+webXML.getAbsolutePath(), ioe);
+ } else {
+ Logger.getLogger("payara-eecommon").log(Level.WARNING,"failed to create backup file "+backupXml.getAbsolutePath(), ioe);
+ }
+ }
+ }
+ return webXML.exists() ? webXML : null;
+ }
+ return null;
+ }
+
+ // visible for unit testing only
+ //
+ static void createCopyAndUpgrade(File webXML, File newWebXML) {
+ BufferedReader fr= null;
+ BufferedWriter fw= null;
+ boolean deleteNew = true;
+ try {
+ fr = new BufferedReader(new InputStreamReader(new FileInputStream(webXML),"ISO-8859-1"));
+ fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newWebXML),"ISO-8859-1"));
+ while (true) {
+ String line = fr.readLine();
+ if (line == null)
+ break;
+ if (line.startsWith("<!DOCTYPE")) {
+ while (!line.startsWith("<web-app")) {
+ line = fr.readLine();
+ }
+ fw.write("<web-app version=\"2.4\" xmlns=\"http://java.sun.com/xml/ns/j2ee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">");
+ fw.newLine();
+ }
+ else {
+ fw.write(line);
+ fw.newLine();
+ }
+ }
+ deleteNew = false;
+ fw.close();
+ fw = null;
+ fr.close();
+ fr = null;
+ } catch (FileNotFoundException fnfe) {
+ Logger.getLogger("payara-eecommon").log(Level.WARNING, "This file existed a few milliseconds ago: "+ webXML.getAbsolutePath());
+ } catch (Exception e) {
+ if (null != fw && deleteNew) {
+ if (!newWebXML.delete()) {
+ Logger.getLogger("payara-eecommon").log(Level.WARNING, "hack to eliminate GF bug 8609 failed and left bogus file: {0}", newWebXML.getAbsolutePath());
+ }
+ }
+ Logger.getLogger("payara-eecommon").log(Level.WARNING, "hack to eliminate GF bug 8609 failed", e);
+ } finally {
+ if (null != fw) {
+ try {
+ fw.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, "close of fw failed: "+ newWebXML.getAbsolutePath(), ioe);
+ }
+ }
+ if (null != fr) {
+ try {
+ fr.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, "close of fr failed: "+ webXML.getAbsolutePath(), ioe); }
+ }
+ }
+ }
+
+ private static boolean addMonitorJars(String domainLoc, String domainName, String... others) throws FileNotFoundException, IOException {
+ String loc = domainLoc+"/"+domainName;
+ File instDir = new File(loc);
+ boolean retVal = copyFromIDEInstToDir("modules/ext/org-netbeans-modules-web-httpmonitor.jar" , instDir, "lib/org-netbeans-modules-web-httpmonitor.jar"); // NOI18N
+ for (String anOther : others) {
+ int lastSlash = anOther.lastIndexOf("/");
+ if (lastSlash > -1) {
+ String jarName = anOther.substring(lastSlash+1);
+ retVal = retVal && copyFromIDEInstToDir(anOther , instDir, "lib/"+jarName); // NOI18N
+ }
+ }
+ return retVal;
+ }
+
+ // visible for unit testing
+ //
+ static boolean changeFilterMonitor(WebApp webApp,boolean full) throws ClassNotFoundException {
+ boolean filterWasChanged=false;
+ if (full) { // adding monitor filter/filter-mapping element
+ boolean isFilter=false;
+ Filter[] filters = webApp.getFilter();
+ for(int i=0;i<filters.length;i++) {
+ if (filters[i].getFilterName().equals(MONITOR_FILTER_NAME)){
+ isFilter=true;
+ break;
+ }
+ }
+ if (!isFilter) {
+ Filter filter = (Filter)webApp.createBean("Filter"); //NOI18N
+ filter.setFilterName(MONITOR_FILTER_NAME);
+ filter.setFilterClass(MONITOR_FILTER_CLASS);
+ webApp.addFilter(filter);
+ filterWasChanged=true;
+ }
+
+ boolean isMapping=false;
+ FilterMapping[] maps = webApp.getFilterMapping();
+ for(int i=0;i<maps.length;i++) {
+ if (maps[i].getFilterName().equals(MONITOR_FILTER_NAME)){
+ isMapping=true;
+ break;
+ }
+ }
+ if (!isMapping) {
+ FilterMapping filterMapping = (FilterMapping)webApp.createBean("FilterMapping"); //NOI18N
+
+ // setting the dispatcher values even for Servlet2.3 web.xml
+ String[] dispatcher = new String[] {"REQUEST","FORWARD","INCLUDE","ERROR"}; //NOI18N
+ try {
+ filterMapping.setDispatcher(dispatcher);
+ } catch (org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.FINER,"ignorable and ignoring",ex);
+ ((BaseBean)filterMapping).createProperty("dispatcher", // NOI18N
+ "Dispatcher", // NOI18N
+ Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY,
+ java.lang.String.class);
+ ((BaseBean)filterMapping).setValue("Dispatcher",dispatcher); // NOI18N
+ }
+
+ filterMapping.setFilterName(MONITOR_FILTER_NAME);
+ filterMapping.setUrlPattern(MONITOR_FILTER_PATTERN);
+ webApp.addFilterMapping(filterMapping);
+ filterWasChanged=true;
+ }
+ //}
+ } else { // removing monitor filter/filter-mapping element
+ FilterMapping[] maps = webApp.getFilterMapping();
+ for(int i=0;i<maps.length;i++) {
+
+ if (maps[i].getFilterName().equals(MONITOR_FILTER_NAME)){
+ webApp.removeFilterMapping(maps[i]);
+ filterWasChanged=true;
+ break;
+ }
+ }
+ Filter[] filters = webApp.getFilter();
+ for(int i=0;i<filters.length;i++) {
+ if (filters[i].getFilterName().equals(MONITOR_FILTER_NAME)){
+ webApp.removeFilter(filters[i]);
+ filterWasChanged=true;
+ break;
+ }
+ }
+ }
+ return filterWasChanged;
+ }
+
+ /** Finds a file inside the IDE installation, given a slash-separated
+ * path relative to the IDE installation. Takes into account the fact that
+ * modules may have been installed by Autoupdate, and reside in the user
+ * home directory.
+ * @param instRelPath file path relative to the inst dir, delimited by '/'
+ * @return file containing the file, or null if it does not exist.
+ */
+ private static File findInstallationFile(String instRelPath) {
+ return InstalledFileLocator.getDefault().locate(instRelPath, null, false);
+ }
+
+ private static boolean copyFromIDEInstToDir(String sourceRelPath, File copyTo, String targetRelPath) throws FileNotFoundException, IOException {
+ File targetFile = findFileUnderBase(copyTo, targetRelPath);
+ File sourceFile = findInstallationFile(sourceRelPath);
+ if (sourceFile != null && sourceFile.exists()) {
+ File targetParent = targetFile.getParentFile();
+ if (!targetParent.exists()) {
+ targetParent.mkdirs();
+ }
+ if (!targetFile.exists() || sourceFile.length() != targetFile.length()) {
+ copy(sourceFile, targetFile);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static void copy(File file1, File file2) throws FileNotFoundException, IOException {
+ BufferedInputStream bis = null;
+ BufferedOutputStream bos = null;
+ try {
+ bis = new BufferedInputStream(new FileInputStream(file1));
+ bos = new BufferedOutputStream(new FileOutputStream(file2));
+ int b;
+ while((b=bis.read())!=-1)bos.write(b);
+ } finally {
+ if (null != bis) {
+ try {
+ bis.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.FINEST,"bis", ioe);
+ }
+ }
+ if (null != bos) {
+ try {
+ bos.close();
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-eecommon").log(Level.FINEST,"bos", ioe);
+ }
+ }
+ }
+ }
+
+ private static File findFileUnderBase(File base, String fileRelPath) {
+ if (fileRelPath.startsWith("/")) { // NOI18N
+ fileRelPath = fileRelPath.substring(1);
+ }
+ fileRelPath = fileRelPath.replace('/', File.separatorChar);
+ return new File(base, fileRelPath);
+ }
+
+ // visible for unit testing only
+ //
+ /** Inserts or and updates in the Monitor Filter element the parameter
+ * which tells the Monitor the number of the internal port,
+ * depending on whether the integration mode is full or minimal
+ * @param webApp deployment descriptor in which to do the changes
+ * @return true if the default deployment descriptor was modified
+ */
+ static boolean specifyFilterPortParameter(WebApp webApp) throws ClassNotFoundException {
+ Filter[] filters = webApp.getFilter();
+ Filter myFilter = null;
+ for(int i=0; i<filters.length; i++) {
+ if (MONITOR_FILTER_NAME.equals(filters[i].getFilterName())) {
+ myFilter = filters[i];
+ break;
+ }
+ }
+ // see if we found it
+ if (myFilter == null) {
+ return false;
+ }
+
+ // look for the parameter
+ InitParam[] params = myFilter.getInitParam();
+ InitParam myParam = null;
+ for(int i=0; i<params.length; i++) {
+ if (MONITOR_INTERNALPORT_PARAM_NAME.equals(params[i].getParamName())) {
+ myParam = params[i];
+ break;
+ }
+ }
+
+ // host name acts as the parameter name
+ String correctParamValue = getLocalHost() + ":" + getInternalServerPort(); // NOI18N
+
+ // insert or correct the param
+ if (myParam == null) {
+ // add it
+ InitParam init = (InitParam)myFilter.createBean("InitParam"); //NOI18N
+ init.setParamName(MONITOR_INTERNALPORT_PARAM_NAME);
+ init.setParamValue(correctParamValue);
+ myFilter.addInitParam(init);
+ return true;
+ }
+ else {
+ // check whether the value is correct
+ if (correctParamValue.equals(myParam.getParamValue())) {
+ // no need to change
+ return false;
+ }
+ else {
+ // change
+ myParam.setParamValue(correctParamValue);
+ return true;
+ }
+ }
+
+ } // end of specifyFilterPortParameter
+
+ private static String getLocalHost() {
+ // just return 127.0.0.1, other values don't seem to work reliably
+ return "127.0.0.1"; // NOI18N
+ /**
+ try {
+ return InetAddress.getLocalHost().getHostName();
+ }
+ catch (UnknownHostException e) {
+ return "127.0.0.1"; // NOI18N
+ }
+ */
+ }
+
+ private static URL getSampleHTTPServerURL() {
+ FileObject fo = FileUtil.getConfigFile("HTTPServer_DUMMY");
+ if (fo == null) {
+ return null;
+ }
+ URL u = URLMapper.findURL(fo, URLMapper.NETWORK);
+ return u;
+ }
+
+ private static String getInternalServerPort() {
+ //URL u = HttpServer.getRepositoryRoot();
+ URL u = getSampleHTTPServerURL();
+ if (u != null) {
+ return Integer.toString(u.getPort()); // NOI18N
+ }
+ else {
+ return "8082"; // NOI18N
+ }
+ }
+
+
+ private static void startModuleSpy (final ModuleSpy spy) {
+ // trying to hang a listener on monitor module
+ res = Lookup.getDefault().lookup(new Lookup.Template<ModuleInfo>(ModuleInfo.class));
+ java.util.Iterator it = res.allInstances ().iterator ();
+ final String moduleId = spy.getModuleId();
+ // boolean found = false;
+ while (it.hasNext ()) {
+ org.openide.modules.ModuleInfo mi = (ModuleInfo)it.next ();
+ if (mi.getCodeName ().startsWith(moduleId)) {
+ httpMonitorInfo=mi;
+ spy.setEnabled(mi.isEnabled());
+ monitorInfoListener = new MonitorInfoListener(spy);
+ httpMonitorInfo.addPropertyChangeListener(monitorInfoListener);
+ // found=true;
+ break;
+ }
+ }
+ // hanging a listener to the lookup result
+ monitorLookupListener = new MonitorLookupListener(spy,httpMonitorInfo);
+ res.addLookupListener(monitorLookupListener);
+ }
+
+ private static class ModuleSpy {
+ private boolean enabled;
+ private String moduleId;
+
+ public ModuleSpy (String moduleId) {
+ this.moduleId=moduleId;
+ }
+ public void setModuleId(String moduleId){
+ this.moduleId=moduleId;
+ }
+ public void setEnabled(boolean enabled){
+ this.enabled=enabled;
+ }
+ public boolean isEnabled(){
+ return enabled;
+ }
+ public String getModuleId(){
+ return moduleId;
+ }
+ }
+
+ static synchronized boolean isMonitorEnabled(){
+ if (monitorSpy==null) {
+ monitorSpy = new ModuleSpy(MONITOR_MODULE_NAME);
+ startModuleSpy(monitorSpy);
+ }
+ return monitorSpy.isEnabled();
+ }
+
+ // PENDING - who should call this?
+ void removeListeners() {
+ if (httpMonitorInfo!=null) {
+ httpMonitorInfo.removePropertyChangeListener(monitorInfoListener);
+ }
+ if (res!=null) {
+ res.removeLookupListener(monitorLookupListener);
+ }
+ }
+
+ private static class MonitorInfoListener implements java.beans.PropertyChangeListener {
+ ModuleSpy spy;
+ MonitorInfoListener(ModuleSpy spy) {
+ this.spy=spy;
+ }
+
+ @Override
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals("enabled")){ // NOI18N
+ spy.setEnabled(((Boolean)evt.getNewValue()).booleanValue());
+ }
+ }
+ }
+
+ private static class MonitorLookupListener implements LookupListener {
+
+ ModuleSpy spy;
+ ModuleInfo httpMonitorInfo;
+ MonitorLookupListener(ModuleSpy spy, ModuleInfo httpMonitorInfo) {
+ this.spy=spy;
+ this.httpMonitorInfo=httpMonitorInfo;
+ }
+
+ @Override
+ public void resultChanged(LookupEvent lookupEvent) {
+ java.util.Iterator it = res.allInstances ().iterator ();
+ boolean moduleFound=false;
+ while (it.hasNext ()) {
+ ModuleInfo mi = (ModuleInfo)it.next ();
+ if (mi.getCodeName ().startsWith(spy.getModuleId())) {
+ spy.setEnabled(mi.isEnabled());
+ if (httpMonitorInfo==null) {
+ httpMonitorInfo=mi;
+ monitorInfoListener = new MonitorInfoListener(spy);
+ httpMonitorInfo.addPropertyChangeListener(monitorInfoListener);
+ }
+ moduleFound=true;
+ break;
+ }
+ }
+ if (!moduleFound) {
+ if (httpMonitorInfo!=null) {
+ httpMonitorInfo.removePropertyChangeListener(monitorInfoListener);
+ httpMonitorInfo=null;
+ spy.setEnabled(false);
+ }
+ }
+ }
+
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/JDBCDriverDeployHelper.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/JDBCDriverDeployHelper.java
new file mode 100644
index 0000000..e9b11b9
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/JDBCDriverDeployHelper.java
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
+import javax.enterprise.deploy.spi.status.ClientConfiguration;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.j2ee.common.ClasspathUtil;
+import org.netbeans.modules.j2ee.common.DatasourceHelper;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+public class JDBCDriverDeployHelper {
+
+ static public ProgressObject getProgressObject(File driverLoc, List listOfURLS) {
+ return new JDBCDriversProgressObject(driverLoc, listOfURLS);
+ }
+
+ /**
+ * Add JDBC drivers URLs into given List of URL objects.
+ *
+ * @param drivers Target ULR list where to add drivers.
+ * @param jdbcDrivers JDBC drivers to be searched for URLs.
+ */
+ static private void addDriversURLs(List<URL> drivers, JDBCDriver[] jdbcDrivers) {
+ for (JDBCDriver jdbcDriver : jdbcDrivers) {
+ URL[] allUrls = jdbcDriver.getURLs();
+ for (int i = 0; i < allUrls.length; i++) {
+ URL driverUrl = allUrls[i];
+ String strUrl = driverUrl.toString();
+ if (strUrl.contains("nbinst:/")) { // NOI18N
+ FileObject fo = URLMapper.findFileObject(driverUrl);
+ if (fo != null) {
+ URL localURL = URLMapper.findURL(fo, URLMapper.EXTERNAL);
+ if (localURL != null) {
+ drivers.add(localURL);
+ }
+ }
+ } else {
+ drivers.add(driverUrl);
+ }
+ }
+ } //JDBCDriver
+ }
+
+ /**
+ * Returns a list of jdbc drivers that need to be deployed.
+ *
+ * @param driverLocs JDBC drivers locations (server library directories).
+ * @param datasources Server data sources from server resources files.
+ * @return List of JDBC drivers URLs to be deployed.
+ */
+ static public List<URL> getMissingDrivers(File[] driverLocs, Set<Datasource> datasources) {
+ List<URL> drivers = new ArrayList<URL>();
+ for (Datasource datasource : datasources) {
+ String className = datasource.getDriverClassName();
+ if (null != className) {
+ boolean exists = false;
+ for (int j = 0; j < driverLocs.length; j++) {
+ File driverLoc = driverLocs[j];
+ if (driverLoc != null && driverLoc.exists()) {
+ Collection<File> driversLocation = Arrays.asList(driverLoc.listFiles(new Utils.JarFileFilter()));
+ try {
+ exists = ClasspathUtil.containsClass(driversLocation, className);
+ } catch (IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
+ }
+ if (exists) {
+ break;
+ }
+ } else {
+ Logger.getLogger("payara-eecommon").finer("Invalid directory for driver deployment");
+ }
+ }
+ if (!exists) {
+ List<DatabaseConnection> databaseConnections = DatasourceHelper.findDatabaseConnections(datasource);
+ JDBCDriver[] jdbcDrivers;
+
+ // Use matching configured database connections to find library for resource driver class.
+ if (databaseConnections != null && databaseConnections.size() > 0) {
+ for (DatabaseConnection databaseConnection : databaseConnections) {
+ JDBCDriver connDriver = databaseConnection.getJDBCDriver();
+ if (connDriver != null) {
+ jdbcDrivers = new JDBCDriver[]{connDriver};
+ } else {
+ // old fashioned way - fallback
+ String driverClass = databaseConnection.getDriverClass();
+ jdbcDrivers = JDBCDriverManager.getDefault().getDrivers(driverClass);
+ }
+ addDriversURLs(drivers, jdbcDrivers);
+ }
+ // Will try to find library for resource driver class if there is no database connection
+ // configured for data source. This is fallback option.
+ } else {
+ jdbcDrivers = JDBCDriverManager.getDefault().getDrivers(datasource.getDriverClassName());
+ addDriversURLs(drivers, jdbcDrivers);
+ }
+ } //If
+ }
+ }
+ return drivers;
+ }
+
+ static private class JDBCDriversProgressObject implements ProgressObject, Runnable {
+
+ private final ProgressEventSupport eventSupport;
+ private final File driverLoc;
+ private List jdbcDriverURLs;
+
+ public JDBCDriversProgressObject(File driverLoc, List jdbcDriverURLs) {
+ eventSupport = new ProgressEventSupport(this); //JDBCDriverDeployHelper.this);
+ String msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "MSG_CheckMissingDrivers");
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, msg, StateType.RUNNING));
+ this.driverLoc = driverLoc;
+ this.jdbcDriverURLs = jdbcDriverURLs;
+ }
+
+ public void run() {
+ String msg;
+ if (jdbcDriverURLs.size() > 0) {
+ boolean success = true;
+ for (int i = 0; i < jdbcDriverURLs.size(); i++) {
+ URL jarUrl = (URL) jdbcDriverURLs.get(i);
+ File libsDir = driverLoc;
+ try {
+ File toJar = new File(libsDir, new File(jarUrl.toURI()).getName());
+ try {
+ BufferedInputStream is = new BufferedInputStream(jarUrl.openStream());
+ try {
+ msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "MSG_DeployDriver", toJar.getPath());
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, msg, StateType.RUNNING));
+ BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(toJar));
+ try {
+ FileUtil.copy(is, os);
+ } finally {
+ if (null != os)
+ try {
+ os.close();
+ } catch (IOException ioe) {
+
+ }
+ }
+ } finally {
+ if (null != is)
+ try {
+ is.close();
+ } catch (IOException ioe) {
+
+ }
+ }
+ } catch (IOException e) {
+ Logger.getLogger(this.getClass().getName()).log(Level.FINER,"",e);
+ msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "ERR_DeployDriver", toJar.getPath(), libsDir.getPath());
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, msg, StateType.FAILED));
+ success = false;
+ continue;
+ }
+ } catch (URISyntaxException | RuntimeException ex) {
+ Logger.getLogger(this.getClass().getName()).log(Level.FINER,"",ex);
+ msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "ERR_DeployDriver", jarUrl, libsDir.getPath());
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, msg, StateType.FAILED));
+ success = false;
+ continue;
+ }
+ } //for
+ msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "MSG_DeployDriverComplete");
+ if (!success) {
+ msg = NbBundle.getMessage(JDBCDriverDeployHelper.class, "ERR_DeployDriverFailed");
+ }
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, msg, success ? StateType.COMPLETED : StateType.FAILED)); // NOI18N
+ } else {
+ eventSupport.fireHandleProgressEvent(null, ProgressEventSupport.createStatus(ActionType.EXECUTE, CommandType.DISTRIBUTE, "", StateType.COMPLETED)); // NOI18N
+ }
+ }
+
+ public DeploymentStatus getDeploymentStatus() {
+ return eventSupport.getDeploymentStatus();
+ }
+
+ public TargetModuleID[] getResultTargetModuleIDs() {
+ return new TargetModuleID[0];
+ }
+
+ public ClientConfiguration getClientConfiguration(TargetModuleID targetModuleID) {
+ return null;
+ }
+
+ public boolean isCancelSupported() {
+ return false;
+ }
+
+ public void cancel() throws OperationUnsupportedException {
+ throw new OperationUnsupportedException("Cancel is not supported"); // NOI18N
+ }
+
+ public boolean isStopSupported() {
+ return false;
+ }
+
+ public void stop() throws OperationUnsupportedException {
+ throw new OperationUnsupportedException("Stop is not supported"); // NOI18N
+ }
+
+ public void addProgressListener(ProgressListener progressListener) {
+ eventSupport.addProgressListener(progressListener);
+ }
+
+ public void removeProgressListener(ProgressListener progressListener) {
+ eventSupport.removeProgressListener(progressListener);
+ }
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/LogHyperLinkSupport.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/LogHyperLinkSupport.java
new file mode 100644
index 0000000..49f5df3
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/LogHyperLinkSupport.java
@@ -0,0 +1,547 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.utils.StringPrefixTree;
+import org.netbeans.api.java.classpath.GlobalPathRegistry;
+import org.netbeans.api.java.classpath.GlobalPathRegistryEvent;
+import org.netbeans.api.java.classpath.GlobalPathRegistryListener;
+import org.openide.ErrorManager;
+import org.openide.cookies.EditorCookie;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectNotFoundException;
+import org.openide.text.Annotation;
+import org.openide.text.Line;
+import org.openide.util.NbBundle;
+import org.openide.windows.OutputEvent;
+import org.openide.windows.OutputListener;
+
+/**
+ * <code>LogSupport</code> class for creating links in the output window.
+ *
+ * @author Stepan Herold
+ */
+public class LogHyperLinkSupport {
+
+ private Map<Link, Link> links = Collections.synchronizedMap(new HashMap<Link, Link>());
+ private Annotation errAnnot;
+
+ /**
+ * Return a link which implements <code>OutputListener</code> interface. Link
+ * is then used to represent a link in the output window. This class also
+ * handles error annotations which are shown after a line is clicked.
+ *
+ * @return link which implements <code>OutputListener</code> interface. Link
+ * is then used to represent a link in the output window.
+ */
+ public Link getLink(String errorMsg, String path, int line) {
+ Link newLink = new Link(errorMsg, path, line);
+ Link cachedLink = links.get(newLink);
+ if (cachedLink != null) {
+ return cachedLink;
+ }
+ links.put(newLink, newLink);
+ return newLink;
+ }
+
+ /**
+ * Detach error annotation.
+ */
+ public void detachAnnotation() {
+ if (errAnnot != null) {
+ errAnnot.detach();
+ }
+ }
+
+ /**
+ * <code>LineInfo</code> is used to store info about the parsed line.
+ */
+ public static class LineInfo {
+
+ private String path;
+ private int line;
+ private String message;
+ private boolean error;
+ private boolean accessible;
+
+ /**
+ * <code>LineInfo</code> is used to store info about the parsed line.
+ *
+ * @param path path to file
+ * @param line line number where the error occurred
+ * @param message error message
+ * @param error represents the line an error?
+ * @param accessible is the file accessible?
+ */
+ public LineInfo(String path, int line, String message, boolean error, boolean accessible) {
+ this.path = path;
+ this.line = line;
+ this.message = message;
+ this.error = error;
+ this.accessible = accessible;
+ }
+
+ public String path() {
+ return path;
+ }
+
+ public int line() {
+ return line;
+ }
+
+ public String message() {
+ return message;
+ }
+
+ public boolean isError() {
+ return error;
+ }
+
+ public boolean isAccessible() {
+ return accessible;
+ }
+
+ @Override
+ public String toString() {
+ return "path=" + path + " line=" + line + " message=" + message + " isError=" + error + " isAccessible=" + accessible;
+ }
+ }
+
+ /**
+ * Error annotation.
+ */
+ static class ErrorAnnotation extends Annotation {
+
+ private String shortDesc = null;
+
+ public ErrorAnnotation(String desc) {
+ shortDesc = desc;
+ }
+
+ @Override
+ public String getAnnotationType() {
+ return "org-netbeans-modules-j2ee-sunserver"; // NOI18N
+ }
+
+ @Override
+ public String getShortDescription() {
+ return shortDesc;
+ }
+ }
+
+ /**
+ * <code>Link</code> is used to create a link in the output window. To create
+ * a link use the <code>getLink</code> method of the <code>LogSupport</code>
+ * class. This prevents from memory vast by returning already existing instance,
+ * if one with such values exists.
+ */
+ public class Link implements OutputListener {
+
+ private String msg;
+ private String path;
+ private int line;
+ private int hashCode = 0;
+
+ Link(String msg, String path, int line) {
+ this.msg = msg;
+ this.path = path;
+ this.line = line;
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ int result = 17;
+ result = 37 * result + line;
+ result = 37 * result + (path != null ? path.hashCode() : 0);
+ result = 37 * result + (msg != null ? msg.hashCode() : 0);
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Link) {
+ Link anotherLink = (Link) obj;
+ if (((msg != null && msg.equals(anotherLink.msg)) || msg == anotherLink.msg) &&
+ ((path != null && path.equals(anotherLink.path)) || path == anotherLink.path) &&
+ line == anotherLink.line) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * If the link is clicked, required file is opened in the editor and an
+ * <code>ErrorAnnotation</code> is attached.
+ */
+ @Override
+ public void outputLineAction(OutputEvent ev) {
+ FileObject sourceFile = GlobalPathRegistry.getDefault().findResource(path);
+ if (sourceFile == null) {
+ sourceFile = FileUtil.toFileObject(FileUtil.normalizeFile(new File(path)));
+ }
+ DataObject dataObject = null;
+ if (sourceFile != null) {
+ try {
+ dataObject = DataObject.find(sourceFile);
+ } catch (DataObjectNotFoundException ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+ if (dataObject != null) {
+ EditorCookie editorCookie
+ = dataObject.getLookup().lookup(EditorCookie.class);
+ if (editorCookie == null) {
+ return;
+ }
+ editorCookie.open();
+ Line errorLine;
+ try {
+ errorLine = editorCookie.getLineSet().getCurrent(line - 1);
+ } catch (IndexOutOfBoundsException ex) {
+ return;
+ }
+ if (errAnnot != null) {
+ errAnnot.detach();
+ }
+ String errorMsg = msg;
+ if (errorMsg == null || errorMsg.length() == 0) { //NOI18N
+ errorMsg = NbBundle.getMessage(Link.class, "MSG_ExceptionOccurred");
+ }
+ errAnnot = new ErrorAnnotation(errorMsg);
+ errAnnot.attach(errorLine);
+ errAnnot.moveToFront();
+ errorLine.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
+ }
+ }
+
+ /**
+ * If a link is cleared, error annotation is detached and link cache is
+ * clared.
+ */
+ @Override
+ public void outputLineCleared(OutputEvent ev) {
+ if (errAnnot != null) {
+ errAnnot.detach();
+ }
+ if (!links.isEmpty()) {
+ links.clear();
+ }
+ }
+
+ @Override
+ public void outputLineSelected(OutputEvent ev) {
+ }
+ }
+
+ /**
+ * Support class for context log line analyzation and for creating links in
+ * the output window.
+ */
+ public static class AppServerLogSupport extends LogHyperLinkSupport {
+
+ /**
+ * Search for class in global class registry and cache known search
+ * results.
+ * <p/>
+ * Search results are stored in prefix tree based structure to speed up
+ * text matching as much as possible.
+ * <i>Known drawback:</i> Cache does not implement any kind of dirty
+ * flags so search won't find newly added classes and if will keep
+ * finding removed classes.
+ */
+ private static class PathAccess {
+
+ /** Particular source file search result to be cached. */
+ private static class ClassAccess {
+
+ /** Is source file accessible in NetBeans? */
+ boolean accessible;
+
+ /** Source file path from full class name (including package).
+ */
+ String path;
+
+ /**
+ * Creates an instance of particular source file search result.
+ * <p/>
+ * @param accessible Is source file accessible in NetBeans?
+ * @param path Source file path from full class name (including
+ * package).
+ */
+ ClassAccess(boolean accessible, String path) {
+ this.accessible = accessible;
+ this.path = path;
+ }
+ }
+
+ /**
+ * Event listener for being notified of changes in the set of
+ * available paths.
+ */
+ private static class PathRegistryListener
+ implements GlobalPathRegistryListener {
+
+ /**
+ * Called when some paths are added.
+ * <p/>
+ * Only applies to the first copy of a path that is added.
+ * <p/>
+ * @param event An event giving details.
+ */ @Override
+ public void pathsAdded(GlobalPathRegistryEvent event) {
+ synchronized (accessCache) {
+ accessCache.clear();
+ }
+ }
+
+ /**
+ * Called when some paths are removed.
+ * <p/>
+ * Only applies to the last copy of a path that is removed.
+ * <p/>
+ * @param event An event giving details.
+ */
+ @Override
+ public void pathsRemoved(GlobalPathRegistryEvent event) {
+ synchronized (accessCache) {
+ accessCache.clear();
+ }
+ }
+
+ }
+
+ /** Classes search results cache.
+ * <p/>
+ * Shared data structure which is not thread safe. Accessing code
+ * should use locking on this cache instance.
+ */
+ private static final StringPrefixTree<ClassAccess> accessCache
+ = new StringPrefixTree<ClassAccess>(true);
+
+ /** NetBeans global class path registry. */
+ private final GlobalPathRegistry globalPathRegistry;
+
+ /** Payara server installation root. */
+ private final String serverRoot;
+
+ /** Payara server application context. */
+ private final String appContext;
+
+ /**
+ * Creates an instance of global class registry cached search.
+ * <p/>
+ * @param globalPathRegistry NetBeans global class path registry.
+ * @param serverRoot Payara server installation root.
+ * @param appContext Payara server application context.
+ */
+ PathAccess(final GlobalPathRegistry globalPathRegistry,
+ final String serverRoot, final String appContext) {
+ this.globalPathRegistry = globalPathRegistry;
+ this.serverRoot = serverRoot;
+ this.appContext = appContext;
+ this.globalPathRegistry.addGlobalPathRegistryListener(
+ new PathRegistryListener());
+ }
+
+ /**
+ * Search for class in global class registry and cache known search
+ * results.
+ * <p/>
+ * Search results are stored in prefix tree based structure
+ * to speed up text matching as much as possible.
+ * <p/>
+ * <i>Known drawback:</i> Cache does not implement any kind of dirty
+ * flags so search won't find newly added classes and if will keep
+ * finding removed classes.
+ * <p/>
+ * @param className
+ * @return
+ */
+ ClassAccess find(String className) {
+ ClassAccess result;
+ synchronized(accessCache) {
+ result = accessCache.match(className);
+ }
+ if (result == null) {
+ String path = className.replace('.', '/') + ".java";
+ boolean accessible;
+ if (className.startsWith("org.apache.jsp.")
+ && appContext != null) {
+ String contextPath = appContext.equals("/")
+ ? "/_" // hande ROOT context
+ : appContext;
+ path = serverRoot + contextPath + "/" + path;
+ accessible = new File(path).exists();
+ } else {
+ FileObject resource
+ = globalPathRegistry.findResource(path);
+ accessible = resource != null;
+ }
+ synchronized(accessCache) {
+ result = accessCache.match(className);
+ if (result == null) {
+ result = new ClassAccess(accessible, path);
+ accessCache.add(className, result);
+ }
+ }
+ }
+ return result;
+ }
+
+ }
+
+ /** Payara server application context. */
+ private String context;
+
+ private String prevMessage = null;
+ private static final String STANDARD_CONTEXT = "StandardContext["; // NOI18N
+ private static final int STANDARD_CONTEXT_LENGTH = STANDARD_CONTEXT.length();
+
+ /** NetBeans global class path registry. */
+ private final GlobalPathRegistry globalPathReg;
+
+ /** Support to search for class in global class registry and cache known
+ * search results. */
+ private final PathAccess pathAccess;
+
+ public AppServerLogSupport(String catalinaWork, String webAppContext) {
+ context = webAppContext;
+ globalPathReg = GlobalPathRegistry.getDefault();
+ pathAccess = new PathAccess(
+ globalPathReg, catalinaWork, webAppContext);
+ }
+
+ public LineInfo analyzeLine(String logLine) {
+ String path = null;
+ int line = -1;
+ String message = null;
+ boolean error = false;
+ boolean accessible = false;
+
+ logLine = logLine.trim();
+ int lineLength = logLine.length();
+
+ // look for unix file links (e.g. /foo/bar.java:51: 'error msg')
+ if (lineLength > 0 && '/' == logLine.charAt(0)) {
+ error = true;
+ int colonIdx = logLine.indexOf(':');
+ if (colonIdx > -1) {
+ path = logLine.substring(0, colonIdx);
+ accessible = true;
+ if (lineLength > colonIdx) {
+ int nextColonIdx = logLine.indexOf(':', colonIdx + 1);
+ if (nextColonIdx > -1 && nextColonIdx > colonIdx) {
+ String lineNum = logLine.substring(colonIdx + 1, nextColonIdx);
+ try {
+ line = Integer.valueOf(lineNum).intValue();
+ } catch (NumberFormatException ex) {
+ accessible = true;
+ // ignore it
+ //ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, nfe);
+ }
+ if (lineLength > nextColonIdx) {
+ message = logLine.substring(nextColonIdx + 1, lineLength);
+ }
+ }
+ }
+ }
+ } // look for windows file links (e.g. c:\foo\bar.java:51: 'error msg')
+ else if (lineLength > 3 && Character.isLetter(logLine.charAt(0)) && (logLine.charAt(1) == ':') && (logLine.charAt(2) == '\\')) {
+ error = true;
+ int secondColonIdx = logLine.indexOf(':', 2);
+ if (secondColonIdx > -1) {
+ path = logLine.substring(0, secondColonIdx);
+ accessible = true;
+ if (lineLength > secondColonIdx) {
+ int thirdColonIdx = logLine.indexOf(':', secondColonIdx + 1);
+ if (thirdColonIdx > -1 && thirdColonIdx > secondColonIdx) {
+ String lineNum = logLine.substring(secondColonIdx + 1, thirdColonIdx);
+ try {
+ line = Integer.valueOf(lineNum).intValue();
+ } catch (NumberFormatException ex) { // ignore it
+ accessible = true;
+ //ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, nfe);
+ }
+ if (lineLength > thirdColonIdx) {
+ message = logLine.substring(thirdColonIdx + 1, lineLength);
+ }
+ }
+ }
+ }
+ } // look for stacktrace links (e.g. at java.lang.Thread.run(Thread.java:595)
+ // at t.HyperlinkTest$1.run(HyperlinkTest.java:24))
+ else if (logLine.startsWith("at ") && lineLength > 3) { // NOI18N
+ error = true;
+ int parenthIdx = logLine.indexOf('(');
+ if (parenthIdx > 2) {
+ String classWithMethod = logLine.substring(3, parenthIdx);
+ int lastDotIdx = classWithMethod.lastIndexOf('.');
+ if (lastDotIdx > -1) {
+ int lastParenthIdx = logLine.lastIndexOf(')');
+ int lastColonIdx = logLine.lastIndexOf(':');
+ if (lastParenthIdx > -1 && lastColonIdx > -1 && lastParenthIdx > lastColonIdx) {
+ String lineNum = logLine.substring(lastColonIdx + 1, lastParenthIdx);
+ try {
+ line = Integer.valueOf(lineNum).intValue();
+ } catch (NumberFormatException ex) { // ignore it
+ //ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, nfe);
+ error = true;
+ }
+ message = prevMessage;
+ }
+ int firstDolarIdx = classWithMethod.indexOf('$'); // > -1 for inner classes
+ String className = classWithMethod.substring(0, firstDolarIdx > -1 ? firstDolarIdx : lastDotIdx);
+
+ PathAccess.ClassAccess access
+ = pathAccess.find(className);
+ accessible = access.accessible;
+ path = access.path;
+ }
+ }
+ } // every other message treat as normal info message
+ else {
+ prevMessage = logLine;
+ // try to get context, if stored
+ int stdContextIdx = logLine.indexOf(STANDARD_CONTEXT);
+ int lBracketIdx = -1;
+ if (stdContextIdx > -1) {
+ lBracketIdx = stdContextIdx + STANDARD_CONTEXT_LENGTH;
+ }
+ int rBracketIdx = logLine.indexOf(']');
+ if (lBracketIdx > -1 && rBracketIdx > -1 && rBracketIdx > lBracketIdx) {
+ context = logLine.substring(lBracketIdx, rBracketIdx);
+ }
+ }
+ return new LineInfo(path, line, message, error, accessible);
+ }
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ProgressEventSupport.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ProgressEventSupport.java
new file mode 100644
index 0000000..c198eb8
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/ProgressEventSupport.java
@@ -0,0 +1,129 @@
+// <editor-fold defaultstate="collapsed" desc=" License Header ">
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//</editor-fold>
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import org.netbeans.modules.payara.eecommon.Status;
+import java.util.Vector;
+
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+
+import org.openide.util.RequestProcessor;
+
+/**
+ * This is a utility class that can be used by ProgressObject's,
+ * You can use an instance of this class as a member field
+ * of your ProgressObject and delegate various work to it.
+ */
+public class ProgressEventSupport {
+
+ /** Source object. */
+ private Object obj;
+
+ private Vector<ProgressListener> listeners;
+
+ private DeploymentStatus status;
+
+ private TargetModuleID tmID;
+
+ /**
+ * Constructs a <code>ProgressEventSupport</code> object.
+ *
+ * @param o Source for any events.
+ */
+ public ProgressEventSupport (Object o) {
+ if (o == null) {
+ throw new NullPointerException ();
+ }
+ obj = o;
+ }
+
+ /** Add a ProgressListener to the listener list. */
+ public synchronized void addProgressListener (ProgressListener lsnr) {
+ boolean notify = false;
+ if (listeners == null) {
+ listeners = new java.util.Vector<ProgressListener>();
+ }
+ listeners.addElement(lsnr);
+ if (status != null && !status.isRunning ()) {
+ notify = true;
+ }
+ if (notify) {
+ // not to miss completion event
+ RequestProcessor.getDefault ().post (new Runnable () {
+ public void run () {
+ fireHandleProgressEvent (tmID, status);
+ }
+ });
+ }
+ }
+
+ /** Remove a ProgressListener from the listener list. */
+ public synchronized void removeProgressListener (ProgressListener lsnr) {
+ if (listeners == null) {
+ return;
+ }
+ listeners.removeElement(lsnr);
+ }
+
+ /** Report event to any registered listeners. */
+ public void fireHandleProgressEvent (TargetModuleID targetModuleID,
+ DeploymentStatus sCode) {
+ ProgressEvent evt = new ProgressEvent (obj, targetModuleID, sCode);
+ status = sCode;
+ tmID = targetModuleID;
+
+ Vector targets = null;
+ synchronized (this) {
+ if (listeners != null) {
+ targets = (Vector) listeners.clone();
+ }
+ }
+
+ if (targets != null) {
+ for (int i = 0; i < targets.size(); i++) {
+ ProgressListener target = (ProgressListener)targets.elementAt(i);
+ target.handleProgressEvent (evt);
+ }
+ }
+ }
+
+ /** Returns last DeploymentStatus notified by {@@link fireHandleProgressEvent}
+ */
+ public synchronized DeploymentStatus getDeploymentStatus () {
+ return status;
+ }
+
+ public synchronized void clearProgressListener() {
+ listeners = null;
+ }
+
+ public static DeploymentStatus createStatus(ActionType type, CommandType command, String msg, StateType state) {
+ return new Status(type,command,msg,state);
+ }
+}
+
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/UrlData.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/UrlData.java
new file mode 100644
index 0000000..d9c01a8
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/UrlData.java
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * For converting NetBeans DB Urls to their component parts or back.
+ *
+ * @author Peter Williams
+ */
+public class UrlData {
+
+ // Replaced Unicode safe character classes with ASCII equivalents to
+ // avoid JDK bug 5088563, for which a fix is not available on Mac as of
+ // this writing - !PW 7/31/08
+ private static String DBURL_PATTERN =
+ "((?:[^:\\n]+:){2,3})" + // prefix (mandatory)
+ "(?://|@|([^ \\t]+)@)" + // alternate db name (optional)
+ "([^:;/\\\\ \\t]+)" + // hostname (mandatory)
+ "(?:\\\\([^ \\t:/;]+)|)" + // instance name (optional)
+ "(?::([0-9]+)|)" + // port (optional)
+ "(?:(?:/|:)([^:/;?&]+)|)((?:(?:;|\\?|&|:)" + // database (optional)
+ "(?:[^;&]+)|)+)"; // delimited properties (optional)
+
+
+ // Indices for regular expression match capture blocks
+ private static final int DB_PREFIX = 0;
+ private static final int DB_ALT_DBNAME = 1;
+ private static final int DB_HOST = 2;
+ private static final int DB_INSTANCE_NAME = 3;
+ private static final int DB_PORT = 4;
+ private static final int DB_PRIMARY_DBNAME = 5;
+ private static final int DB_PROPERTIES = 6;
+ private static final int NUM_PARTS = 7;
+
+ private static Pattern urlPattern = Pattern.compile(DBURL_PATTERN);
+
+ private final String url;
+ private final String [] parts = new String[NUM_PARTS];
+ private final Map<String, String> props = new LinkedHashMap<String, String>();
+
+ public UrlData(String newUrl) {
+ url = newUrl;
+ parseUrl();
+ }
+
+ public UrlData(final String prefix, final String host, final String port,
+ final String dbname, String sid) {
+ this(prefix, host, port, dbname, null, null, parseProperties(sid));
+ }
+
+ public UrlData(final String prefix, final String host, final String port,
+ final String dbname, Map<String, String> properties) {
+ this(prefix, host, port, dbname, null, null, properties);
+ }
+
+ public UrlData(final String prefix, final String host, final String port,
+ final String dbname, final String altdbname, final String instancename,
+ Map<String, String> properties) {
+
+ parts[DB_PREFIX] = prefix;
+ parts[DB_ALT_DBNAME] = altdbname;
+ parts[DB_HOST] = host;
+ parts[DB_INSTANCE_NAME] = instancename;
+ parts[DB_PORT] = port;
+ parts[DB_PRIMARY_DBNAME] = dbname;
+ parts[DB_PROPERTIES] = null; // reconstruct?
+ props.putAll(properties);
+ url = constructUrl();
+ }
+
+ private void parseUrl() {
+ Logger.getLogger("payara-eecommon").log(Level.FINEST, "Parsing DB Url: " + url);
+ Matcher matcher = urlPattern.matcher(url);
+ if(matcher.matches()) {
+ for(int i = 1; i <= matcher.groupCount(); i++) {
+ String part = matcher.group(i);
+ Logger.getLogger("payara-eecommon").log(Level.FINEST, " Part " + i + " is " + part);
+ parts[i-1] = part;
+ }
+ props.putAll(parseProperties(parts[DB_PROPERTIES]));
+ } else {
+ Logger.getLogger("payara-eecommon").log(Level.FINE, "Url parsing failed for " + url);
+ }
+ }
+
+ private static Map<String, String> parseProperties(final String data) {
+ Map<String, String> result = new LinkedHashMap<String, String>();
+ if(data != null && data.length() > 0) {
+ String [] properties = data.split("[;?&:]");
+ for(int i = 0; i < properties.length; i++) {
+ if(properties[i] != null && properties[i].length() > 0) {
+ int eqIndex = properties[i].indexOf("=");
+ if(eqIndex != -1) {
+ result.put(properties[i].substring(0, eqIndex), properties[i].substring(eqIndex+1));
+ } else {
+ // not sure if we should keep this. Possibly invalid property
+ result.put(properties[i], "");
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * package protected for testing purposes only.
+ */
+ String constructUrl() {
+ StringBuilder builder = new StringBuilder(256);
+ builder.append(parts[DB_PREFIX]);
+
+ if(notEmpty(parts[DB_ALT_DBNAME])) {
+ builder.append(parts[DB_ALT_DBNAME]);
+ builder.append('@');
+ } else if("jdbc:oracle:thin:".equals(parts[DB_PREFIX])) {
+ builder.append('@');
+ } else {
+ // most formats
+ builder.append("//"); // NOI18N
+ }
+
+ builder.append(parts[DB_HOST]);
+
+ if(notEmpty(parts[DB_INSTANCE_NAME])) {
+ builder.append('\\');
+ builder.append(parts[DB_INSTANCE_NAME]);
+ }
+
+ if(notEmpty(parts[DB_PORT])) {
+ builder.append(':'); // NOI18N
+ builder.append(parts[DB_PORT]);
+ }
+
+ if(notEmpty(parts[DB_PRIMARY_DBNAME])) {
+ if("jdbc:oracle:thin:".equals(parts[DB_PREFIX])) {
+ builder.append(':'); // NOI18N
+ } else {
+ builder.append('/'); // NOI18N
+ }
+ builder.append(parts[DB_PRIMARY_DBNAME]);
+ }
+
+ char propertyInitialSeparator = ';';
+ char propertySeparator = ';';
+ if("jdbc:mysql:".equals(parts[DB_PREFIX])) {
+ propertyInitialSeparator = '?';
+ propertySeparator = '&';
+ } else if("jdbc:informix-sqli:".equals(parts[DB_PREFIX])) {
+ propertyInitialSeparator = ':';
+ }
+
+ Set<Map.Entry<String, String>> entries = props.entrySet();
+ Iterator<Map.Entry<String, String>> entryIterator = entries.iterator();
+ if(entryIterator.hasNext()) {
+ builder.append(propertyInitialSeparator);
+ Map.Entry<String, String> entry = entryIterator.next();
+ builder.append(entry.getKey());
+ String value = entry.getValue();
+ if(notEmpty(value)) {
+ builder.append('=');
+ builder.append(value);
+ }
+ }
+
+ while(entryIterator.hasNext()) {
+ builder.append(propertySeparator);
+ Map.Entry<String, String> entry = entryIterator.next();
+ builder.append(entry.getKey());
+ String value = entry.getValue();
+ if(notEmpty(value)) {
+ builder.append('=');
+ builder.append(value);
+ }
+ }
+
+ return builder.toString();
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getPrefix() {
+ return parts[DB_PREFIX];
+ }
+
+ public String getHostName() {
+ return parts[DB_HOST];
+ }
+
+ public String getPort() {
+ return parts[DB_PORT];
+ }
+
+ public String getInstanceName() {
+ return parts[DB_INSTANCE_NAME];
+ }
+
+ public String getDatabaseName() {
+ String dbname = parts[DB_PRIMARY_DBNAME];
+ if(dbname == null) {
+ dbname = parts[DB_ALT_DBNAME];
+ if(dbname == null) {
+ dbname = props.get("databaseName");
+ if(dbname == null) {
+ dbname = props.get("databasename");
+ if(dbname == null) {
+ dbname = props.get("SID");
+ if(dbname == null) {
+ dbname = props.get("database name");
+ }
+ }
+ }
+ }
+ }
+ return dbname;
+ }
+
+ public String getAlternateDBName() {
+ return parts[DB_ALT_DBNAME];
+ }
+
+ public String getSid() {
+ return props.get("SID");
+ }
+
+ public Map<String, String> getProperties() {
+ return Collections.unmodifiableMap(props);
+ }
+
+ private static boolean notEmpty(String s) {
+ return s != null && s.length() > 0;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Utils.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Utils.java
new file mode 100644
index 0000000..514f861
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/Utils.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper;
+import org.netbeans.modules.j2ee.dd.api.common.RootInterface;
+import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Utility class for common procedures
+ *
+ * @author Peter Williams
+ */
+public final class Utils {
+
+ private Utils() {
+ }
+
+ public static final boolean notEmpty(String testedString) {
+ return (testedString != null) && (testedString.length() > 0);
+ }
+
+ public static final boolean strEmpty(String testedString) {
+ return testedString == null || testedString.length() == 0;
+ }
+
+ public static final boolean strEquals(String one, String two) {
+ boolean result = false;
+
+ if(one == null) {
+ result = (two == null);
+ } else {
+ if(two == null) {
+ result = false;
+ } else {
+ result = one.equals(two);
+ }
+ }
+ return result;
+ }
+
+ public static final boolean strEquivalent(String one, String two) {
+ boolean result = false;
+
+ if(strEmpty(one) && strEmpty(two)) {
+ result = true;
+ } else if(one != null && two != null) {
+ result = one.equals(two);
+ }
+
+ return result;
+ }
+
+ public final static int strCompareTo(String one, String two) {
+ int result;
+
+ if(one == null) {
+ if(two == null) {
+ result = 0;
+ } else {
+ result = -1;
+ }
+ } else {
+ if(two == null) {
+ result = 1;
+ } else {
+ result = one.compareTo(two);
+ }
+ }
+
+ return result;
+ }
+
+ public static String computeModuleID(J2eeModule module, File dir, String fallbackExt) {
+ String moduleID = null;
+ FileObject fo = null;
+ try {
+ fo = module.getContentDirectory();
+ if (null != fo) {
+ moduleID = ProjectUtils.getInformation(FileOwnerQuery.getOwner(fo)).getDisplayName();
+ }
+ } catch (IOException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.FINER, null, ex);
+ }
+
+ if (null == moduleID || moduleID.trim().length() < 1) {
+ J2eeModuleHelper j2eeModuleHelper = J2eeModuleHelper.getSunDDModuleHelper(module.getType());
+ if(j2eeModuleHelper != null) {
+ RootInterface rootDD = j2eeModuleHelper.getStandardRootDD(module);
+ if(rootDD != null) {
+ try {
+ moduleID = rootDD.getDisplayName(null);
+ } catch (VersionNotSupportedException ex) {
+ // ignore, handle as null below.
+ }
+ }
+ }
+ }
+ if (null != dir && null != fallbackExt) {
+ if (null == moduleID || moduleID.trim().length() < 1) {
+ moduleID = simplifyModuleID(dir.getParentFile().getParentFile().getName(), fallbackExt);
+ } else {
+ moduleID = simplifyModuleID(moduleID, fallbackExt);
+ }
+ }
+
+ return moduleID;
+ }
+
+ private static String simplifyModuleID(String candidateID, String fallbackExt) {
+ String moduleID = null;
+
+ if (candidateID == null) {
+ moduleID = "_default_" + fallbackExt;
+ } else if (candidateID.equals("")) {
+ moduleID = "_default_" + fallbackExt;
+ }
+
+ if (null == moduleID) {
+ moduleID = candidateID.replace(' ', '_');
+ if (moduleID.startsWith("/")) {
+ moduleID = moduleID.substring(1);
+ }
+
+ // This moduleID will be later used to construct file path,
+ // replace the illegal characters in file name
+ // \ / : * ? " < > | with _
+ moduleID = moduleID.replace('\\', '_').replace('/', '_');
+ moduleID = moduleID.replace('*', '_');
+ moduleID = moduleID.replace('?', '_').replace('"', '_');
+ moduleID = moduleID.replace('<', '_').replace('>', '_');
+ moduleID = moduleID.replace('|', '_');
+
+ // This moduleID will also be used to construct an ObjectName
+ // to register the module, so replace additional special
+ // characters , = used in property parsing with -
+ moduleID = moduleID.replace(',', '_').replace('=', '_');
+ }
+
+ return moduleID;
+ }
+
+ public static class JarFileFilter implements FileFilter {
+ @Override
+ public boolean accept(File f) {
+ return ((! f.isDirectory()) && f.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")); //NOI18N
+ }
+ }
+
+ public static FileObject getSunDDFromProjectsModuleVersion(J2eeModule mod, String sunDDFileName) {
+ FileObject retVal;
+ String suffix = "-java_ee_5/";
+ if (null != mod) {
+ String modVer = mod.getModuleVersion();
+ J2eeModule.Type t = mod.getType();
+ // ejb 2.0, 2.1, 3.0, 3.1
+ // web 2.3, 2.4, 2.5, 3.0
+ // appcli 1.3, 1.4, 5.0, 6.0
+ // ear 1.3, 1.4, 5, 6
+ if (modVer.equals("6") || modVer.equals("6.0") || modVer.endsWith("1.6") || modVer.equals("3.1")) {
+ suffix = "-java_ee_6/";
+ } else if (modVer.equals("3.0")) {
+ if (J2eeModule.Type.WAR.equals(t)) {
+ suffix = "-java_ee_6/";
+ }
+ } else if (modVer.equals("1.4") || modVer.equals("2.4") || modVer.equals("2.1")) {
+ suffix = "-j2ee_1_4/";
+ } else if (modVer.equals("2.0") || modVer.equals("2.3") || modVer.equals("1.3")) {
+ suffix = "-j2ee_1_3/";
+ }
+ }
+ String resource = "org-netbeans-modules-payara-eecommon-ddtemplates" + suffix + sunDDFileName; // NOI18N
+ retVal = FileUtil.getConfigFile(resource);
+
+ return retVal;
+ }
+
+ public static String getInstanceReleaseID(J2eeModuleProvider jmp) {
+ String retVal = "bogusID";
+ try {
+ String sid = jmp.getServerInstanceID();
+
+ if (null != sid) {
+ retVal = sid.replaceFirst(".*\\]deployer:", "").replaceFirst("\\:.*$", ""); // NOI18N
+ }
+ } catch (NullPointerException npe) {
+ Logger.getLogger("payara").log(Level.WARNING,
+ "could not get valid InstanceReleaseID from {0}", jmp.getServerInstanceID());
+ }
+ return retVal;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/VerifierSupport.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/VerifierSupport.java
new file mode 100644
index 0000000..e3cefbe
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/VerifierSupport.java
@@ -0,0 +1,925 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.EventObject;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellRenderer;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Appclient;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Application;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Connector;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Ejb;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Failed;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.NotApplicable;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Passed;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.StaticVerification;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Test;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Warning;
+import org.netbeans.modules.j2ee.sun.dd.impl.verifier.Web;
+import org.openide.DialogDisplayer;
+import org.openide.ErrorManager;
+import org.openide.NotifyDescriptor;
+import org.openide.util.NbBundle;
+import org.openide.windows.Mode;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
+
+/**
+ * Main TopComponent to display the output of the Sun J2EE Verifier Tool from an archive file.
+ * @author ludo
+ */
+public class VerifierSupport extends TopComponent {
+
+ /** Local logger. */
+ private static final Logger LOGGER
+ = Logger.getLogger("payara-eecommon");
+
+ String _archiveName;
+
+ final static int FAIL = 0;
+ final static int WARN = 1;
+ final static int ALL = 2;
+
+ static String allString = NbBundle.getMessage(VerifierSupport.class,"All_Results"); // NOI18N
+ static String failString = NbBundle.getMessage(VerifierSupport.class,"Failures_Only"); //NOI18N
+ static String warnString = NbBundle.getMessage(VerifierSupport.class,"Failures_and_Warnings_only"); //NOI18N
+
+ // Strings used for 508 compliance
+ static String radioButtonName =NbBundle.getMessage(VerifierSupport.class,"Radio_Button"); // NOI18N
+ static String radioButtonDesc = NbBundle.getMessage(VerifierSupport.class,"RadioButtonToSelect"); // NOI18N
+ static String panelName =NbBundle.getMessage(VerifierSupport.class,"Panel"); // NOI18N
+ static String panelDesc =NbBundle.getMessage(VerifierSupport.class,"VerifierPanel"); //NOI18N
+
+ JRadioButton allButton ;
+ JRadioButton failButton ;
+ JRadioButton warnButton ;
+ RadioListener myListener ;
+ //what shoudl be displayed:ALL, FAIL, WARN
+ int statusLeveltoDisplay = ALL;//by default
+ boolean verifierIsStillRunning = true; //needed for the ui to know if a status message has to be printed or not...
+ JPanel controlPanel;
+ JPanel resultPanel;
+ JTable table ;
+ DefaultTableModel tableModel;
+ ListSelectionListener tableSelectionListener;
+ JScrollPane tableScrollPane;
+ JScrollPane textScrollPane;
+ JTextArea detailText;
+
+ private static String STATUS_LIT = "Status"; // NOI18N
+
+ final String[] columnNames = {
+ NbBundle.getMessage(VerifierSupport.class,STATUS_LIT),
+ NbBundle.getMessage(VerifierSupport.class,"Test_Description"), // NOI18N
+ NbBundle.getMessage(VerifierSupport.class,"Result")}; // NOI18N
+ private Vector passResults = new Vector();
+ private Vector failResults = new Vector();
+ private Vector errorResults = new Vector();
+ private Vector warnResults = new Vector();
+ private Vector naResults = new Vector();
+ private Vector notImplementedResults = new Vector();
+ private Vector notRunResults = new Vector();
+ private Vector defaultResults = new Vector();
+
+ /**
+ * Prepare Java VM environment for verifier execution.
+ * <p/>
+ * @param env Process builder environment <code>Map</code>.
+ * @param javaHome Java SE to run verifier.
+ */
+ private static void setJavaEnvironment(Map<String,String> env,
+ final String javaHome) {
+ // Java VM home stored in environment variable JAVA_HOME
+ env.put(JavaUtils.JAVA_HOME_ENV, javaHome);
+ }
+
+ /**
+ * Run Payara verifier tool.
+ * <p/>
+ * @param fileName
+ * @param outs
+ * @param server Payara server instance.
+ * @param javaHome Java SE to run verifier.
+ */
+ public static void launchVerifier(final String fileName,
+ final OutputStream outs, final PayaraServer server,
+ final String javaHome) {
+
+ final String embeddedStaticShellJar
+ = ServerUtils.getEmbeddedStaticShellJar(server.getServerHome());
+ final String verifierJar
+ = ServerUtils.getVerifierJar(server.getServerHome());
+ final String javaHelpJar
+ = ServerUtils.getJavaHelpJar(server.getServerHome());
+ final String javaVmExe = JavaUtils.javaVmExecutableFullPath(javaHome);
+ final File embeddedStaticShellJarFile = new File(embeddedStaticShellJar);
+ final File verifierJarFile = new File(verifierJar);
+ final File javaHelpJarFile = new File(javaHelpJar);
+ final File file = new File(fileName);
+ final File dir = file.getParentFile();
+
+ File javaVmFile = new File(javaVmExe);
+ // JAR files to execute verifier must exist.
+ if (!embeddedStaticShellJarFile.exists() || !verifierJarFile.exists()
+ || !javaHelpJarFile.exists() || !javaVmFile.exists()) {
+ if (!verifierJarFile.exists()) {
+ NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(VerifierSupport.class, "MSG_INSTALL_VERIFIER")); // NOI18N
+ DialogDisplayer.getDefault().notify(nd);
+ }
+ return;
+ }
+
+ // Build verifier execution arguments.
+ String verifierArgs[] = {"-ra", "-d" , "\"" + dir.getAbsolutePath() + "\"", "\"" + fileName + "\""}; // NOI18N
+ StringBuilder sb = new StringBuilder();
+ sb.append(JavaUtils.VM_CLASSPATH_OPTION).append(" \""); // NOI18N
+ sb.append(embeddedStaticShellJar).append(File.pathSeparatorChar);
+ sb.append(verifierJar).append(File.pathSeparatorChar);
+ sb.append(javaHelpJar);
+ sb.append("\" "); // NOI18N
+ sb.append(ServerUtils.VERIFIER_MAIN_CLASS);
+ for (String arg : verifierArgs) {
+ sb.append(' '); // NOI18N
+ sb.append(arg);
+ }
+ String[] args = OsUtils.parseParameters(javaVmExe, sb.toString());
+
+ final VerifierSupport verifierSupport = new VerifierSupport(fileName);
+
+// String installRoot = irf.getAbsolutePath();
+
+ try {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ verifierSupport.initUI();
+ verifierSupport.showInMode();
+ }
+ });
+ ProcessBuilder pb = new ProcessBuilder(args);
+ Process process;
+ setJavaEnvironment(pb.environment(), javaHome);
+ LOGGER.log(Level.INFO, "Running Payara Verifier Tool: {0} {1}",
+ new Object[] {javaVmExe, sb.toString()});
+ process = pb.start();
+
+ System.out.println(NbBundle.getMessage(VerifierSupport.class,
+ "running_", javaVmExe, sb.toString()));
+ //
+ // Attach to the process's stdout, and ignore what comes back.
+ //
+ final Thread[] copyMakers = new Thread[2];
+ OutputStreamWriter oss = null;
+ if (outs != null) {
+ oss = new OutputStreamWriter(outs);
+ }
+ (copyMakers[0] = new ExecSupport.OutputCopier(new InputStreamReader(process.getInputStream()), oss, true)).start();
+ (copyMakers[1] = new ExecSupport.OutputCopier(new InputStreamReader(process.getErrorStream()), oss, true)).start();
+ try {
+ process.waitFor();
+ Thread.sleep(1000); // time for copymakers
+ } catch (InterruptedException e) {
+ } finally {
+ try {
+ copyMakers[0].interrupt();
+ copyMakers[1].interrupt();
+ } catch (Exception e) {
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ String onlyJarFile = file.getName();
+ File ff = new File(dir, onlyJarFile+".xml"); // NOI18N
+ org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error err = null;
+ if (!ff.exists()) {
+ err = StaticVerification.createGraph().newError();
+ err.setErrorName(NbBundle.getMessage(VerifierSupport.class,"ERR_PARSING_OUTPUT")); // NOI18N
+ err.setErrorDescription(NbBundle.getMessage(VerifierSupport.class,"ERR_NO_OUTPUT_TO_PARSE", ff));
+ verifierSupport.saveErrorResultsForDisplay( err);
+ verifierSupport.verifierIsStillRunning = false;// we are done
+ verifierSupport.updateDisplay();
+ return;
+ }
+ FileInputStream in = null;
+ StaticVerification sv = null;
+ try {
+ in = new FileInputStream(ff);
+
+ sv = StaticVerification.createGraph(in); // this can throw a RT exception
+ err = sv.getError();
+ if (err!=null){
+ verifierSupport.saveErrorResultsForDisplay( err);
+
+ }
+ Ejb e = sv.getEjb();
+ if (e!=null){
+ Failed fail= e.getFailed();
+ if (fail!=null){
+ Test t[] =fail.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveFailResultsForDisplay( t[i]);
+ }
+ }
+ Warning w= e.getWarning();
+ if (w!=null){
+ Test t[] =w.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveWarnResultsForDisplay( t[i]);
+ }
+ }
+ Passed p= e.getPassed();
+ if (p!=null){
+ Test t[] =p.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.savePassResultsForDisplay(t[i]);
+ }
+ }
+ NotApplicable na= e.getNotApplicable();
+ if (na!=null){
+ Test t[] =na.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveNaResultsForDisplay( t[i]);
+ }
+ }
+ }
+ Web we = sv.getWeb();
+ if (we!=null){
+ Failed fail= we.getFailed();
+ if (fail!=null){
+ Test t[] =fail.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveFailResultsForDisplay(t[i]);
+ }
+ }
+ Warning w= we.getWarning();
+ if (w!=null){
+ Test t[] =w.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveWarnResultsForDisplay(t[i]);
+ }
+ }
+ Passed p= we.getPassed();
+ if (p!=null){
+ Test t[] =p.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.savePassResultsForDisplay(t[i]);
+ }
+ }
+ NotApplicable na= we.getNotApplicable();
+ if (na!=null){
+ Test t[] =na.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveNaResultsForDisplay(t[i]);
+ }
+ }
+ }
+ Appclient ac = sv.getAppclient();
+ if (ac!=null){
+ Failed fail= ac.getFailed();
+ if (fail!=null){
+ Test t[] =fail.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveFailResultsForDisplay(t[i]);
+ }
+ }
+ Warning w= ac.getWarning();
+ if (w!=null){
+ Test t[] =w.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveWarnResultsForDisplay(t[i]);
+ }
+ }
+ Passed p= ac.getPassed();
+ if (p!=null){
+ Test t[] =p.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.savePassResultsForDisplay(t[i]);
+ }
+ }
+ NotApplicable na= ac.getNotApplicable();
+ if (na!=null){
+ Test t[] =na.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveNaResultsForDisplay(t[i]);
+ }
+ }
+ }
+ Application app = sv.getApplication();
+ if (app!=null){
+ Failed fail= app.getFailed();
+ if (fail!=null){
+ Test t[] =fail.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveFailResultsForDisplay(t[i]);
+ }
+ }
+ Warning w= app.getWarning();
+ if (w!=null){
+ Test t[] =w.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveWarnResultsForDisplay(t[i]);
+ }
+ }
+ Passed p= app.getPassed();
+ if (p!=null){
+ Test t[] =p.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.savePassResultsForDisplay(t[i]);
+ }
+ }
+ NotApplicable na= app.getNotApplicable();
+ if (na!=null){
+ Test t[] =na.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveNaResultsForDisplay(t[i]);
+ }
+ }
+ }
+ Connector rar = sv.getConnector();
+ if (rar!=null){
+ Failed fail= rar.getFailed();
+ if (fail!=null){
+ Test t[] =fail.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveFailResultsForDisplay(t[i]);
+ }
+ }
+ Warning w= rar.getWarning();
+ if (w!=null){
+ Test t[] =w.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveWarnResultsForDisplay(t[i]);
+ }
+ }
+ Passed p= rar.getPassed();
+ if (p!=null){
+ Test t[] =p.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.savePassResultsForDisplay(t[i]);
+ }
+ }
+ NotApplicable na= rar.getNotApplicable();
+ if (na!=null){
+ Test t[] =na.getTest();
+ for (int i=0;i<t.length ;i++){
+ verifierSupport.saveNaResultsForDisplay(t[i]);
+ }
+ }
+ }
+ } catch (RuntimeException rte) {
+ err = StaticVerification.createGraph().newError();
+ err.setErrorName(NbBundle.getMessage(VerifierSupport.class,"ERR_PARSING_OUTPUT")); // NOI18N
+ err.setErrorDescription(rte.getMessage());
+ if (rte.getMessage().indexOf("error-name") > -1) {
+ // TODO do the reparse, correct error-name and error-description
+ // currently, tell user to look in the output window
+ err.setErrorDescription(NbBundle.getMessage(VerifierSupport.class,"READ_OUTPUT_WINDOW")); // NOI18N
+ }
+ verifierSupport.saveErrorResultsForDisplay( err);
+ } catch (IOException ioe){
+ ioe.printStackTrace();
+ err = StaticVerification.createGraph().newError();
+ err.setErrorName(NbBundle.getMessage(VerifierSupport.class,"ERR_PARSING_OUTPUT")); // NOI18N
+ err.setErrorDescription(ioe.getMessage());
+ verifierSupport.saveErrorResultsForDisplay( err);
+ } finally {
+ if (null != in) {
+ try {
+ in.close();
+ } catch (IOException ioe) {
+ // I cannot do anything here...
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe);
+ }
+ }
+ }
+ verifierSupport.verifierIsStillRunning = false;// we are done
+ verifierSupport.updateDisplay();
+ }
+
+ /** Creates a new instance of VerifierOuput
+ * @param archiveName
+ */
+ public VerifierSupport(String archiveName) {
+ _archiveName = archiveName;
+ }
+
+ /**
+ *
+ */
+ public void initUI(){
+ setLayout(new BorderLayout());
+ setName(NbBundle.getMessage(VerifierSupport.class,"LBL_Verifier", //NOI18N
+ new File(_archiveName).getName()));
+ createResultsPanel();
+ add(resultPanel);
+
+ }
+
+ /**
+ * Called when the object is opened. Add the GUI.
+ * @todo Trigger source listening on window getting VISIBLE instead
+ * of getting opened.
+ */
+ @Override
+ protected void componentOpened() {
+ }
+
+ /** Called when the window is closed. Cleans up. */
+ @Override
+ protected void componentClosed() {
+ clearResults();
+ table.getSelectionModel().removeListSelectionListener(tableSelectionListener);
+
+ allButton.removeActionListener(myListener);
+ failButton.removeActionListener(myListener);
+ warnButton.removeActionListener(myListener);
+ remove(resultPanel);
+ resultPanel =null;
+ table=null;
+ allButton = null;
+ failButton = null;
+ warnButton=null;
+ myListener =null;
+ tableSelectionListener = null;
+ }
+
+ @Override
+ public int getPersistenceType() {
+ return TopComponent.PERSISTENCE_NEVER;
+ }
+
+ /**
+ * Shows the TC in the output mode and activates it.
+ */
+ public void showInMode() {
+ if (!isOpened()) {
+ Mode mode = WindowManager.getDefault().findMode("output"); // NOI18N
+ if (mode != null) {
+ mode.dockInto(this);
+ }
+ }
+ open();
+ requestVisible();
+ requestActive();
+ }
+
+ @Override
+ protected String preferredID() {
+ return NbBundle.getMessage(VerifierSupport.class,"verifierID");//NOI18N
+ }
+
+ private void createResultsPanel() {
+ resultPanel = new JPanel();
+ resultPanel.setLayout(new BorderLayout());
+ resultPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
+ _archiveName));
+
+ // 508 compliance
+ resultPanel.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Panel")); // NOI18N
+ resultPanel.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_panel")); // NOI18N
+
+ // set up result table
+ tableModel = new DefaultTableModel(columnNames, 0);
+ table = new JTable(tableModel) {
+ @Override
+ public Component prepareRenderer(TableCellRenderer renderer,
+ int rowIndex, int vColIndex) {
+ Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
+ if (c instanceof JComponent) {
+ JComponent jc = (JComponent)c;
+ jc.setToolTipText((String)getValueAt(rowIndex, vColIndex));
+ }
+ return c;
+ }
+ };
+
+ // 508 for JTable
+ table.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Table")); // NOI18N
+ table.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_table_of_items"));//NOI18N
+ table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ tableScrollPane = new JScrollPane(table);
+ Object [] row = {NbBundle.getMessage(VerifierSupport.class,"Wait"),NbBundle.getMessage(VerifierSupport.class,"Running_Verifier_Tool..."),NbBundle.getMessage(VerifierSupport.class,"Running...") }; // NOI18N
+ tableModel.addRow(row);
+ //table.sizeColumnsToFit(0);
+ // 508 for JScrollPane
+ tableScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
+ tableScrollPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VerifierSupport.class,"ScrollArea")); // NOI18N
+ sizeTableColumns();
+ // make the cells uneditable
+ JTextField field = new JTextField();
+ // 508 for JTextField
+ field.getAccessibleContext().setAccessibleName(
+ NbBundle.getMessage(VerifierSupport.class,"Text_Field")); // NOI18N
+ field.getAccessibleContext().setAccessibleDescription(
+ NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_field")); // NOI18N
+ table.setDefaultEditor(Object.class, new DefaultCellEditor(field) {
+ @Override
+ public boolean isCellEditable(EventObject anEvent) {
+ return false;
+ }
+ });
+ // add action listener to table to show details
+ tableSelectionListener = new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e){
+ if (!e.getValueIsAdjusting()){
+ if(table.getSelectionModel().isSelectedIndex(e.getLastIndex())){
+ setDetailText( table.getModel().getValueAt(e.getLastIndex(),1)+
+ "\n"+table.getModel().getValueAt(e.getLastIndex(),2));//NOI18N
+ }else if(table.getSelectionModel().isSelectedIndex(e.getFirstIndex())){
+ setDetailText(table.getModel().getValueAt(e.getFirstIndex(),1)+
+ "\n"+table.getModel().getValueAt(e.getFirstIndex(),2));//NOI18N
+ }
+ }
+ }
+ };
+ table.getSelectionModel().addListSelectionListener(tableSelectionListener);
+
+ // create detail text area
+ detailText = new JTextArea(4,50);
+ // 508 for JTextArea
+ detailText.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Text_Area")); // NOI18N
+ detailText.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"This_is_a_text_area"));//NOI18N
+ detailText.setEditable(false);
+ textScrollPane = new JScrollPane(detailText);
+ // 508 for JScrollPane
+ textScrollPane.getAccessibleContext().setAccessibleName( NbBundle.getMessage(VerifierSupport.class,"Scroll_Pane")); // NOI18N
+ textScrollPane.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(VerifierSupport.class,"ScrollListPane"));//NOI18N
+ textScrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), NbBundle.getMessage(VerifierSupport.class,"Detail:")));// NOI18N
+
+ //add the components to the panel
+ createControlPanel();
+
+ //Create a split pane with the two scroll panes in it.
+ JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ tableScrollPane, textScrollPane);
+ splitPane.setOneTouchExpandable(true);
+ splitPane.setDividerLocation(150);
+
+ //Provide minimum sizes for the two components in the split pane
+ Dimension minimumSize = new Dimension(100, 50);
+ tableScrollPane.setMinimumSize(minimumSize);
+ textScrollPane.setMinimumSize(minimumSize);
+
+ resultPanel.add("North", controlPanel); //NOI18N
+ resultPanel.add("Center", splitPane); // NOI18N
+ }
+
+ /**
+ * @return the verifierIsStillRunning
+ */
+ public boolean isVerifierIsStillRunning() {
+ return verifierIsStillRunning;
+ }
+
+ /**
+ * @param verifierIsStillRunning the verifierIsStillRunning to set
+ */
+ public void setVerifierIsStillRunning(boolean verifierIsStillRunning) {
+ this.verifierIsStillRunning = verifierIsStillRunning;
+ }
+
+ class RadioListener implements ActionListener {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (verifierIsStillRunning){
+ if(e.getSource() == allButton){
+ statusLeveltoDisplay = ALL;
+ }
+ if(e.getSource() == failButton){
+ statusLeveltoDisplay = FAIL;
+ }
+ if(e.getSource() == warnButton){
+ statusLeveltoDisplay = WARN;
+ }
+
+ return; // we need to wait!
+ }
+ if(e.getSource() == allButton){
+ statusLeveltoDisplay = ALL;
+ if ((getPassResultsForDisplay().size() > 0) ||
+ (getFailResultsForDisplay().size() > 0) ||
+ (getErrorResultsForDisplay().size() > 0) ||
+ (getWarnResultsForDisplay().size() > 0) ||
+ (getNaResultsForDisplay().size() > 0) ||
+ (getNotImplementedResultsForDisplay().size() > 0) ||
+ (getNotRunResultsForDisplay().size() > 0) ||
+ (getDefaultResultsForDisplay().size() > 0)) {
+ updateDisplay();
+ } else {
+ clearResults();
+ }
+ }
+ if(e.getSource() == failButton){
+ statusLeveltoDisplay = FAIL;
+ if (getFailResultsForDisplay().size() > 0 || getErrorResultsForDisplay().size() > 0) {
+ updateDisplay();
+ } else {
+ clearResults();
+ }
+ }
+ if(e.getSource() == warnButton){
+ statusLeveltoDisplay = WARN;
+ if ((getFailResultsForDisplay().size() > 0) ||
+ (getErrorResultsForDisplay().size() > 0) ||
+ (getWarnResultsForDisplay().size() > 0)) {
+ updateDisplay();
+ } else {
+ clearResults();
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param details
+ */
+ public void setDetailText(String details) {
+ detailText.setText(details);
+ JScrollBar scrollBar = textScrollPane.getVerticalScrollBar();
+ if (scrollBar != null){
+ scrollBar.setValue(0);
+ }
+ }
+
+ /**
+ *
+ */
+ public void clearResults() {
+ //clear the table
+ tableModel = new DefaultTableModel(columnNames, 0);
+ table.setModel(tableModel);
+ sizeTableColumns();
+ //clear the detail text
+ setDetailText("");
+ }
+
+ void sizeTableColumns() {
+ table.getColumn(NbBundle.getMessage(VerifierSupport.class,STATUS_LIT)).setPreferredWidth(40);
+ table.getColumn(NbBundle.getMessage(VerifierSupport.class,"Test_Description")).setPreferredWidth(300);// NOI18N
+ table.getColumn(NbBundle.getMessage(VerifierSupport.class,"Result")).setPreferredWidth(300);//NOI18N
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+ }
+
+ /**
+ * This is the control panel of the Verifier GUI
+ */
+ private void createControlPanel() {
+ allButton = new JRadioButton();
+ org.openide.awt.Mnemonics.setLocalizedText(allButton, allString); // NOI18N
+ failButton = new JRadioButton();
+ org.openide.awt.Mnemonics.setLocalizedText(failButton, failString); // NOI18N
+ warnButton = new JRadioButton();
+ org.openide.awt.Mnemonics.setLocalizedText(warnButton, warnString); // NOI18N
+ controlPanel = new JPanel();
+
+ // 508 for this panel
+ controlPanel.getAccessibleContext().setAccessibleName(panelName);
+ controlPanel.getAccessibleContext().setAccessibleDescription(panelDesc);
+ allButton.getAccessibleContext().setAccessibleName(radioButtonName);
+ allButton.getAccessibleContext().setAccessibleDescription(radioButtonDesc);
+ failButton.getAccessibleContext().setAccessibleName(radioButtonName);
+ failButton.getAccessibleContext().setAccessibleDescription(radioButtonDesc);
+ warnButton.getAccessibleContext().setAccessibleName(radioButtonName);
+ warnButton.getAccessibleContext().setAccessibleDescription(radioButtonDesc);
+
+ controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.Y_AXIS));
+
+ // set-up the radio buttons.
+ allButton.setActionCommand(allString);
+ allButton.setSelected(true);
+ failButton.setActionCommand(failString);
+ warnButton.setActionCommand(warnString);
+
+ // Group the radio buttons.
+ ButtonGroup group = new ButtonGroup();
+ group.add(allButton);
+ group.add(failButton);
+ group.add(warnButton);
+
+ // Put the radio buttons in a column in a panel
+ JPanel radioPanel = new JPanel();
+ // 508 for this panel
+ radioPanel.getAccessibleContext().setAccessibleName(panelName);
+ radioPanel.getAccessibleContext().setAccessibleDescription(panelDesc);
+ radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.X_AXIS));
+ JLabel d = new JLabel(
+ NbBundle.getMessage(VerifierSupport.class,"DisplayLabel")); // NOI18N
+ d.setVerticalAlignment(SwingConstants.BOTTOM);
+ // 508 compliance for the JLabel
+ d.getAccessibleContext().setAccessibleName(
+ NbBundle.getMessage(VerifierSupport.class,"Label")); // NOI18N
+ d.getAccessibleContext().setAccessibleDescription(
+ NbBundle.getMessage(VerifierSupport.class,"This_is_a_label")); // NOI18N
+ radioPanel.add(d);
+ radioPanel.add(allButton);
+ radioPanel.add(failButton);
+ radioPanel.add(warnButton);
+
+ // Add the controls to the Panel
+ controlPanel.add(radioPanel);
+
+ // Register a listener for the report level radio buttons.
+ myListener = new RadioListener();
+ allButton.addActionListener(myListener);
+ failButton.addActionListener(myListener);
+ warnButton.addActionListener(myListener);
+ }
+
+ private void updateTableRows(String type, Vector results) {
+ // update display approriately
+ for (int i = 0; i < results.size(); i++) {
+ Test t = ((Test)results.elementAt(i));
+ Object [] row = {type, t.getTestAssertion(), t.getTestDescription()};
+ tableModel.addRow(row);
+ }
+ //table.sizeColumnsToFit(0);
+ }
+
+ private void updateDisplayAll(){
+ updateDisplayFail();
+ updateDisplayWarn();
+ updateDisplayPass();
+ updateDisplayNa();
+ updateDisplayNotImplemented();
+ updateDisplayNotRun();
+ updateDisplayDefault();
+ updateDisplayError();
+ }
+
+ private void updateDisplayPass(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Pass"),getPassResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayFail(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Fail"),getFailResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayError(){
+ Vector errors = getErrorResultsForDisplay();
+ for (int i = 0; i < errors.size(); i++) {
+ org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error t = ((org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error)errors.elementAt(i));
+ Object [] row = {NbBundle.getMessage(VerifierSupport.class,"Error"), // NOI18N
+ t.getErrorName(),t.getErrorDescription() };
+ tableModel.addRow(row);
+
+ }
+ //table.sizeColumnsToFit(0);
+ }
+
+ private void updateDisplayWarn(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Warning"),getWarnResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayNa(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Not_Applicable"),getNaResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayNotImplemented(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Not_Implemented"),getNotImplementedResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayNotRun(){
+ updateTableRows(NbBundle.getMessage(VerifierSupport.class,"Not_Run"),getNotRunResultsForDisplay()); // NOI18N
+ }
+
+ private void updateDisplayDefault(){
+ updateTableRows("???",getDefaultResultsForDisplay()); // NOI18N
+ }
+
+ /**
+ *
+ */
+ public void updateDisplay(){
+ // update display approriately
+ clearResults();
+ if (statusLeveltoDisplay == ALL){
+ updateDisplayAll();
+ }
+ if (statusLeveltoDisplay == FAIL){
+ updateDisplayError();
+ updateDisplayFail();
+ }
+ if (statusLeveltoDisplay == WARN){
+ updateDisplayError();
+ updateDisplayFail();
+ updateDisplayWarn();
+ }
+ }
+
+ public void savePassResultsForDisplay(Test r){
+ passResults.addElement(r);
+ }
+
+ public void saveWarnResultsForDisplay(Test r){
+ warnResults.addElement(r);
+ }
+
+ public void saveFailResultsForDisplay(Test r){
+ failResults.addElement(r);
+ }
+
+ /**
+ *
+ * @param r
+ */
+ public void saveErrorResultsForDisplay(org.netbeans.modules.j2ee.sun.dd.impl.verifier.Error r){
+ errorResults.addElement(r);
+ }
+
+ public void saveNaResultsForDisplay(Test r){
+ naResults.addElement(r);
+ }
+
+ public Vector getPassResultsForDisplay(){
+ return passResults;
+ }
+
+ public Vector getWarnResultsForDisplay(){
+ return warnResults;
+ }
+
+ public Vector getFailResultsForDisplay(){
+ return failResults;
+ }
+
+ public Vector getErrorResultsForDisplay(){
+ return errorResults;
+ }
+
+ public Vector getNaResultsForDisplay(){
+ return naResults;
+ }
+
+ public Vector getNotImplementedResultsForDisplay(){
+ return notImplementedResults;
+ }
+
+ public Vector getNotRunResultsForDisplay(){
+ return notRunResults;
+ }
+
+ public Vector getDefaultResultsForDisplay(){
+ return defaultResults;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/XmlFileCreator.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/XmlFileCreator.java
new file mode 100644
index 0000000..ea31374
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/XmlFileCreator.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.IOException;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Class that allows proper creation of an XML file via FileSystem.AtomicAction.
+ * Otherwise, there is a risk that the wrong data loader will catch the file
+ * after it's created, but before the DOCTYPE or schema header is written.
+ *
+ * @author Peter Williams
+ */
+public class XmlFileCreator implements FileSystem.AtomicAction {
+
+ private final FileObject source;
+ private final FileObject destFolder;
+ private final String name;
+ private final String ext;
+ private FileObject result;
+
+ public XmlFileCreator(final FileObject source, final FileObject destFolder,
+ final String name, final String ext) {
+ this.source = source;
+ this.destFolder = destFolder;
+ this.name = name;
+ this.ext = ext;
+ this.result = null;
+ }
+
+ public void run() throws IOException {
+ result = FileUtil.copyFile(source, destFolder, name, ext);
+ }
+
+ public FileObject getResult() {
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/AppClientVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/AppClientVersion.java
new file mode 100644
index 0000000..628defb
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/AppClientVersion.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+
+/**
+ * Enumerated types for Application Client Version
+ *
+ * @author Peter Williams
+ */
+public final class AppClientVersion extends J2EEBaseVersion {
+
+ /** Represents application-client version 1.3
+ */
+ public static final AppClientVersion APP_CLIENT_1_3 = new AppClientVersion(
+ "1.3", 1300, // NOI18N
+ "1.3", 1300 // NOI18N
+ );
+
+ /** Represents application-client version 1.4
+ */
+ public static final AppClientVersion APP_CLIENT_1_4 = new AppClientVersion(
+ "1.4", 1400, // NOI18N
+ "1.4", 1400 // NOI18N
+ );
+
+ /** Represents application-client version 5.0
+ */
+ public static final AppClientVersion APP_CLIENT_5_0 = new AppClientVersion(
+ "5.0", 5000, // NOI18N
+ "5.0", 5000 // NOI18N
+ );
+
+
+ /** Represents application-client version 6.0
+ */
+ public static final AppClientVersion APP_CLIENT_6_0 = new AppClientVersion(
+ "6.0", 6000, // NOI18N
+ "6.0", 6000 // NOI18N
+ );
+ /** -----------------------------------------------------------------------
+ * Implementation
+ */
+
+ /** Creates a new instance of AppClientVersion
+ */
+ private AppClientVersion(String version, int nv, String specVersion, int nsv) {
+ super(version, nv, specVersion, nsv);
+ }
+
+ /** Comparator implementation that works only on AppClientVersion objects
+ *
+ * @param obj AppClientVersion to compare with.
+ * @return -1, 0, or 1 if this version is less than, equal to, or greater
+ * than the version passed in as an argument.
+ * @throws ClassCastException if obj is not a AppClientVersion object.
+ */
+ public int compareTo(Object obj) {
+ AppClientVersion target = (AppClientVersion) obj;
+ return numericCompare(target);
+ }
+
+ public static AppClientVersion getAppClientVersion(String version) {
+ AppClientVersion result = APP_CLIENT_6_0;
+
+ if(APP_CLIENT_1_3.toString().equals(version)) {
+ result = APP_CLIENT_1_3;
+ } else if(APP_CLIENT_1_4.toString().equals(version)) {
+ result = APP_CLIENT_1_4;
+ } else if(APP_CLIENT_5_0.toString().equals(version)) {
+ result = APP_CLIENT_5_0;
+ }
+
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ApplicationVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ApplicationVersion.java
new file mode 100644
index 0000000..bf6b0e9
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ApplicationVersion.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+
+/**
+ * Enumerated types for Application Version
+ *
+ * @author Peter Williams
+ */
+public final class ApplicationVersion extends J2EEBaseVersion {
+
+ /** Represents application version 1.3
+ */
+ public static final ApplicationVersion APPLICATION_1_3 = new ApplicationVersion(
+ "1.3", 1300, // NOI18N
+ "1.3", 1300 // NOI18N
+ );
+
+ /** Represents application version 1.4
+ */
+ public static final ApplicationVersion APPLICATION_1_4 = new ApplicationVersion(
+ "1.4", 1400, // NOI18N
+ "1.4", 1400 // NOI18N
+ );
+
+ /** Represents application version 5.0
+ */
+ public static final ApplicationVersion APPLICATION_5_0 = new ApplicationVersion(
+ "5.0", 5000, // NOI18N
+ "5.0", 5000 // NOI18N
+ );
+
+ /** Represents application version 6.0
+ */
+ public static final ApplicationVersion APPLICATION_6_0 = new ApplicationVersion(
+ "6.0", 6000, // NOI18N
+ "6.0", 6000 // NOI18N
+ );
+
+ /** -----------------------------------------------------------------------
+ * Implementation
+ */
+
+ /** Creates a new instance of ApplicationVersion
+ */
+ private ApplicationVersion(String version, int nv, String specVersion, int nsv) {
+ super(version, nv, specVersion, nsv);
+ }
+
+ /** Comparator implementation that works only on ApplicationVersion objects
+ *
+ * @param obj ApplicationVersion to compare with.
+ * @return -1, 0, or 1 if this version is less than, equal to, or greater
+ * than the version passed in as an argument.
+ * @throws ClassCastException if obj is not a ApplicationVersion object.
+ */
+ public int compareTo(Object obj) {
+ ApplicationVersion target = (ApplicationVersion) obj;
+ return numericCompare(target);
+ }
+
+ public static ApplicationVersion getApplicationVersion(String version) {
+ ApplicationVersion result = null;
+
+ if(APPLICATION_1_3.toString().equals(version)) {
+ result = APPLICATION_1_3;
+ } else if(APPLICATION_1_4.toString().equals(version)) {
+ result = APPLICATION_1_4;
+ } else if(APPLICATION_5_0.toString().equals(version)) {
+ result = APPLICATION_5_0;
+ } else if(APPLICATION_6_0.toString().equals(version)) {
+ result = APPLICATION_6_0;
+ }
+
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/Bundle.properties b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/Bundle.properties
new file mode 100644
index 0000000..76c78f0
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/Bundle.properties
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Error messages used by payara configuration for binding api's.
+ERR_ExceptionBindingResourceRef={0} while trying to bind a datasource reference.
+ERR_ExceptionReadingResourceRef={0} while trying to find a jndi name for a datasource.
+ERR_ExceptionBindingEjbRef={0} while trying to bind an EJB reference.
+ERR_ExceptionReadingEjb={0} while trying to find a jndi name for an ejb.
+ERR_ExceptionBindingMdb={0} while trying to bind a Message Destination Resource.
+
+# Errors about server installs and versioning
+ERR_NoServerInstallLocation=Unable to determine installation location from target server instance ''{0}''. Check value of j2ee.server.instance in private.properties.
+ERR_UnidentifiedTargetServer=Cannot identify version of target application server. Defaulting to ''{0}'' for descriptor files.
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/DescriptorListener.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/DescriptorListener.java
new file mode 100644
index 0000000..5a64c2b
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/DescriptorListener.java
@@ -0,0 +1,863 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.eecommon.api.Utils;
+import org.netbeans.modules.j2ee.dd.api.common.CommonDDBean;
+import org.netbeans.modules.j2ee.dd.api.common.EjbRef;
+import org.netbeans.modules.j2ee.dd.api.common.MessageDestination;
+import org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef;
+import org.netbeans.modules.j2ee.dd.api.common.PortComponentRef;
+import org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef;
+import org.netbeans.modules.j2ee.dd.api.common.ResourceRef;
+import org.netbeans.modules.j2ee.dd.api.common.RootInterface;
+import org.netbeans.modules.j2ee.dd.api.common.SecurityRole;
+import org.netbeans.modules.j2ee.dd.api.common.ServiceRef;
+import org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans;
+import org.netbeans.modules.j2ee.dd.api.ejb.Entity;
+import org.netbeans.modules.j2ee.dd.api.ejb.EntityAndSession;
+import org.netbeans.modules.j2ee.dd.api.ejb.MessageDriven;
+import org.netbeans.modules.j2ee.dd.api.ejb.Session;
+import org.netbeans.modules.j2ee.dd.api.webservices.PortComponent;
+import org.netbeans.modules.j2ee.dd.api.webservices.ServiceImplBean;
+import org.netbeans.modules.j2ee.dd.api.webservices.WebserviceDescription;
+import org.netbeans.modules.j2ee.dd.api.webservices.Webservices;
+import org.openide.util.RequestProcessor;
+import org.openide.util.WeakListeners;
+
+
+/** Listens for changes made in the standard and webservice descriptor files.
+ *
+ * Responses configure certain key default properties in the corresponding
+ * SJSAS descriptor file as needed for zero-configuration.
+ *
+ * For example:
+ * JNDI names for J2EE 1.4 EJB's with remote interfaces
+ * Endpoint URI for EJB hosted web services.
+ *
+ * This system also monitors the event stream for certain delete/create event
+ * pairs that actually represent beans being renamed or otherwise changed in
+ * some way.
+ *
+ * @author Peter Williams
+ */
+public class DescriptorListener implements PropertyChangeListener {
+
+ private final PayaraConfiguration config;
+ private RootInterface stdRootDD = null;
+ private PropertyChangeListener stdRootDDWeakListener = null;
+ private RootInterface wsRootDD = null;
+ private PropertyChangeListener wsRootDDWeakListener = null;
+
+ private static final int EVENT_DELAY = 100;
+ private PropertyChangeEvent lastEvent = null;
+ private final Object lastEventMonitor = new Object();
+ private final RequestProcessor.Task lastEventTask =
+ RequestProcessor.getDefault().create(new Runnable() {
+ public void run() {
+ synchronized (lastEventMonitor) {
+ if(lastEvent != null) {
+ processEvent(lastEvent);
+ lastEvent = null;
+ }
+ }
+ }
+ }, true);
+
+
+ public DescriptorListener(final PayaraConfiguration sdc) {
+ config = sdc;
+ }
+
+ public void addListener(final RootInterface rootDD) {
+ PropertyChangeListener weakListener = WeakListeners.propertyChange(this, rootDD);
+
+ if(rootDD instanceof Webservices) {
+ if(wsRootDD != null && wsRootDDWeakListener != null) {
+ wsRootDD.removePropertyChangeListener(wsRootDDWeakListener);
+ }
+ wsRootDD = rootDD;
+ wsRootDDWeakListener = weakListener;
+ } else {
+ if(stdRootDD != null && stdRootDDWeakListener != null) {
+ stdRootDD.removePropertyChangeListener(stdRootDDWeakListener);
+ }
+ stdRootDD = rootDD;
+ stdRootDDWeakListener = weakListener;
+ }
+
+ rootDD.addPropertyChangeListener(weakListener);
+ }
+
+ public void removeListener(final RootInterface rootDD) {
+ if(wsRootDD == rootDD) {
+ wsRootDD.removePropertyChangeListener(wsRootDDWeakListener);
+ wsRootDDWeakListener = null;
+ wsRootDD = null;
+ } else if(stdRootDD == rootDD) {
+ stdRootDD.removePropertyChangeListener(stdRootDDWeakListener);
+ stdRootDDWeakListener = null;
+ stdRootDD = null;
+ }
+ }
+
+ public void removeListeners() {
+ if(stdRootDD != null) {
+ removeListener(stdRootDD);
+ }
+ if(wsRootDD != null) {
+ removeListener(wsRootDD);
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ synchronized (lastEventMonitor) {
+ Logger.getLogger("payara-eecommon").log(Level.FINEST, "RAW EVENT: " + evt.getPropertyName() +
+ ", old = " + evt.getOldValue() + ", new = " + evt.getNewValue() +
+ ", source = " + evt.getSource());
+
+ if(lastEvent != null) {
+ // Cancel scheduled task. If this were to return false (already run/running)
+ // then one of the following must be true:
+ //
+ // (a) the task finished, but then lastEvent == null and we can't get here in
+ // in the first place.
+ //
+ // (b) the task started, but this thread grabbed the lastEventMonitor first
+ // in which case the task will be stalled until this block completes
+ // and then lastEvent will be null in the task and the task will
+ // do nothing (so it doesn't matter that we couldn't cancel it.)
+ //
+ lastEventTask.cancel();
+
+ if(!isCreateBeanEvent(evt) || !isVeiledRenameEvent(lastEvent, evt) ||
+ !processAsChangeNameEvent(lastEvent, evt)) {
+ processEvent(lastEvent);
+ processEvent(evt);
+ }
+
+ lastEvent = null;
+ } else {
+ if(isDeleteBeanEvent(evt)) {
+ // store delete bean event and return.
+ lastEvent = evt;
+ lastEventTask.schedule(EVENT_DELAY);
+ } else {
+ processEvent(evt);
+ }
+ }
+ }
+ }
+
+ private boolean isDeleteBeanEvent(PropertyChangeEvent evt) {
+ return evt.getOldValue() instanceof CommonDDBean && evt.getNewValue() == null;
+ }
+
+ private boolean isCreateBeanEvent(PropertyChangeEvent evt) {
+ return evt.getOldValue()== null && evt.getNewValue() instanceof CommonDDBean;
+ }
+
+ private boolean isVeiledRenameEvent(PropertyChangeEvent deleteEvent, PropertyChangeEvent createEvent) {
+ // Check for different event source
+ if(deleteEvent.getSource() != createEvent.getSource()) {
+ return false;
+ }
+
+ // Check for different bean type
+ if(!deleteEvent.getOldValue().getClass().equals(createEvent.getNewValue().getClass())) {
+ return false;
+ }
+
+ // Check for different bean path
+ if(!xcompare(deleteEvent.getPropertyName(), createEvent.getPropertyName())) {
+ return false;
+ }
+
+ // FIXME Should check bean properties (except for name).
+
+ return true;
+ }
+
+ private boolean processAsChangeNameEvent(PropertyChangeEvent deleteEvent, PropertyChangeEvent createEvent) {
+ boolean result = false;
+ // swap old bean pointer for new bean.
+ // change name field.
+ CommonDDBean newBean = (CommonDDBean) createEvent.getNewValue();
+ NameVisitor nameVisitor = getNameVisitor(newBean);
+ if(nameVisitor != null) {
+ CommonDDBean oldBean = (CommonDDBean) deleteEvent.getOldValue();
+ String oldName = nameVisitor.getName(oldBean);
+ String newName = nameVisitor.getName(newBean);
+
+ // If names are not the same, assume this is a name change event.
+ if(!Utils.strEquals(oldName, newName)) {
+ PropertyChangeEvent changeEvent = new PropertyChangeEvent(newBean, createEvent.getPropertyName() + nameVisitor.getNameProperty(), oldName, newName);
+
+ Logger.getLogger("payara-eecommon").log(Level.FINE, "processing delete/create sequence as change name event.");
+ processEvent(changeEvent);
+ result = true;
+ }
+ } else {
+ Logger.getLogger("payara-eecommon").log(Level.FINE, "No support for delete/create sequence from type " + newBean.getClass().getSimpleName());
+ }
+
+ return result;
+ }
+
+ private void processEvent(PropertyChangeEvent evt) {
+ Logger.getLogger("payara-eecommon").log(Level.FINER, "PROCESSED EVENT: " + evt.getPropertyName() +
+ ", old = " + evt.getOldValue() + ", new = " + evt.getNewValue() +
+ ", source = " + evt.getSource());
+
+ String xpath = makeXpath(evt.getPropertyName());
+
+ BeanVisitor visitor = handlerCache.get(xpath);
+ if(visitor != null) {
+ Object oldValue = evt.getOldValue();
+ Object newValue = evt.getNewValue();
+
+ if(oldValue == null) {
+ if(newValue instanceof CommonDDBean) {
+ // !PW FIXME check type on getSource().
+ visitor.beanCreated(config, xpath, (CommonDDBean) evt.getSource(), (CommonDDBean) newValue);
+ } else if(newValue != null) {
+ visitor.fieldCreated(config, xpath, (CommonDDBean) evt.getSource(), newValue);
+ }
+ } else if(newValue == null) {
+ if(oldValue instanceof CommonDDBean) {
+ visitor.beanDeleted(config, xpath, (CommonDDBean) evt.getSource(), (CommonDDBean) oldValue);
+ } else if(oldValue != null) {
+ visitor.fieldDeleted(config, xpath, (CommonDDBean) evt.getSource(), oldValue);
+ }
+ } else {
+ if(oldValue instanceof CommonDDBean && newValue instanceof CommonDDBean) {
+ visitor.beanChanged(config, xpath, (CommonDDBean) evt.getSource(), (CommonDDBean) oldValue, (CommonDDBean) newValue);
+ } else if(oldValue != null && newValue != null) {
+ visitor.fieldChanged(config, xpath, (CommonDDBean) evt.getSource(), oldValue, newValue);
+ }
+ }
+ }
+// else {
+// // FIXME performance could be better w/ some form of sorted set lookup.
+// int minKeyLength = xpath.length() + 1;
+// for(String key: handlerCache.keySet()) {
+// if(key.length() > minKeyLength && key.startsWith(xpath)) {
+// // locate proper child bean(s) and fire correct event.
+// String subKeyGroup = key.substring(minKeyLength);
+// Logger.getLogger("payara-eecommon").log(Level.FINEST, "Child bean: " + subKeyGroup);
+//
+// String [] subKeys = subKeyGroup.split("/");
+//
+// if(subKeys != null && subKeys.length > 0) {
+// try {
+//
+// Object oldValue = evt.getOldValue();
+// Object newValue = evt.getNewValue();
+//
+// CommonDDBean sourceBean = null;
+// boolean createEvent = true;
+// if(oldValue == null && newValue instanceof CommonDDBean) {
+// sourceBean = (CommonDDBean) newValue;
+// } else if(newValue == null && oldValue instanceof CommonDDBean) {
+// sourceBean = (CommonDDBean) oldValue;
+// createEvent = false;
+// }
+//
+// if(sourceBean != null) {
+// for(String subKey: subKeys) {
+// Method subKeyGetter = sourceBean.getClass().getDeclaredMethod("get" + subKey, (Class) null);
+// if (subKeyGetter != null) {
+// Object beanCandidate = subKeyGetter.invoke(sourceBean, (Object) null);
+//// if (beanCandidate instanceof CommonDDBean []) {
+//// CommonDDBean [] beanArray = (CommonDDBean []) beanCandidate;
+//// // handle each bean
+//// } else if (beanCandidate instanceof CommonDDBean) {
+//// CommonDDBean bean = (CommonDDBean) beanCandidate;
+//// }
+// if (beanCandidate instanceof CommonDDBean) {
+// CommonDDBean [] tmp = new CommonDDBean[1];
+// tmp[0] = (CommonDDBean) beanCandidate;
+// beanCandidate = tmp;
+// }
+//
+// if (beanCandidate instanceof CommonDDBean []) {
+// CommonDDBean [] beanArray = (CommonDDBean []) beanCandidate;
+// // handle each bean
+// for(int i = 0; i < beanArray.length; i++) {
+//
+// }
+// }
+// }
+// }
+// }
+// } catch (IllegalAccessException ex) {
+// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+// } catch (IllegalArgumentException ex) {
+// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+// } catch (InvocationTargetException ex) {
+// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+// } catch (NoSuchMethodException ex) {
+// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+// } catch (SecurityException ex) {
+// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+// }
+// }
+// }
+// }
+//
+// }
+ }
+
+ /** Convert a property event string into a pseudo absolute xpath.
+ *
+ * For example,
+ * "/EjbJar/EnterpriseBeans/Session.12ei0"
+ * is converted to
+ * "/EjbJar/EnterpriseBeans/Session"
+ *
+ * The proper xpath would have been
+ * "/ejb-jar/enterprise-beans/session"
+ *
+ * However, by leaving the string mixed case with no hyphens, it's a little
+ * easier to convert back to property get/set methods, which we need to do
+ * for xpaths that don't have visitor mappings themselves, but contain
+ * children that do.
+ *
+ * For example:
+ * /Webservices contains /Webservices/WebserviceDescription/PortComponent
+ */
+ private String makeXpath(String ddpath) {
+ StringBuilder xpathBuilder = new StringBuilder(ddpath.length());
+ int len = ddpath.length();
+
+ for(int i = 0; i < len; i++ ) {
+ char c = ddpath.charAt(i);
+ if(c == '.') {
+ while(++i < len && (c = ddpath.charAt(i)) != '/') {
+ // skip these.
+ }
+ }
+ if(i < len) {
+ xpathBuilder.append(c);
+ }
+ }
+
+ return xpathBuilder.toString();
+ }
+
+ /** Quickly compare two property event strings to see if they represent
+ * the same xpath -- requires ignoring any embedded object id's.
+ *
+ * For example, these two events should match, since they differ only by
+ * the id of the generating Session object.
+ * /EjbJar/EnterpriseBeans/Session.12ei0
+ * /EjbJar/EnterpriseBeans/Session.13f
+ */
+ private static boolean xcompare(String a, String b) {
+ boolean result = true;
+ int alen = a.length();
+ int blen = b.length();
+ int i = 0, j = 0;
+
+ for(; i < alen && j < blen; i++, j++) {
+ char aa = a.charAt(i);
+ char bb = b.charAt(j);
+
+ if(aa == bb) {
+ if(aa == '.') {
+ // skip contents following dot for both strings.
+ boolean aslash = false, bslash = false;
+
+ while(++i < alen) {
+ if(a.charAt(i) == '/') {
+ aslash = true;
+ break;
+ }
+ }
+
+ while(++j < blen) {
+ if(b.charAt(j) == '/') {
+ bslash = true;
+ break;
+ }
+ }
+
+ if(aslash != bslash) {
+ result = false;
+ break;
+ }
+ }
+ } else {
+ result = false;
+ break;
+ }
+ }
+
+ if(result && (i < alen || j < blen)) {
+ result = false;
+ }
+
+ return result;
+ }
+
+ private static WeakHashMap<Class, WeakReference<NameVisitor>> visitorCache =
+ new WeakHashMap<Class, WeakReference<NameVisitor>>();
+
+ public static synchronized NameVisitor getNameVisitor(CommonDDBean bean) {
+ NameVisitor result = null;
+ Class beanClass = bean.getClass();
+ WeakReference<NameVisitor> ref = visitorCache.get(beanClass);
+ if(ref != null) {
+ result = ref.get();
+ }
+ if(result == null) {
+ result = createNameVisitor(bean);
+ if(result != null) {
+ visitorCache.put(beanClass, new WeakReference<NameVisitor>(result));
+ }
+ }
+ return result;
+ }
+
+ private static final List<NameVisitorFactory> nameVisitorFactories =
+ new CopyOnWriteArrayList<NameVisitorFactory>();
+
+ static {
+ nameVisitorFactories.add(new BasicNameVisitorFactory());
+ }
+
+ public static void addNameVisitorFactory(NameVisitorFactory factory) {
+ nameVisitorFactories.add(factory);
+ }
+
+ private static final NameVisitor createNameVisitor(CommonDDBean bean) {
+ NameVisitor result = null;
+ for(NameVisitorFactory factory: nameVisitorFactories) {
+ result = factory.createNameVisitor(bean);
+ if(result != null) {
+ break;
+ }
+ }
+ return result;
+ }
+
+ public static interface NameVisitorFactory {
+
+ public NameVisitor createNameVisitor(CommonDDBean bean);
+
+ }
+
+ private static final class BasicNameVisitorFactory implements NameVisitorFactory {
+
+ public NameVisitor createNameVisitor(CommonDDBean bean) {
+ NameVisitor result = null;
+
+ if(bean instanceof Session) {
+ result = new SessionBeanVisitor();
+ } else if(bean instanceof MessageDriven) {
+ result = new MDBeanVisitor();
+ } else if(bean instanceof Entity) {
+ result = new EntityBeanVisitor();
+ } else if(bean instanceof EjbRef) {
+ result = new EjbRefVisitor();
+ } else if(bean instanceof MessageDestinationRef) {
+ result = new MessageDestinationRefVisitor();
+ } else if(bean instanceof ResourceEnvRef) {
+ result = new ResourceEnvRefVisitor();
+ } else if(bean instanceof ResourceRef) {
+ result = new ResourceRefVisitor();
+ } else if(bean instanceof ServiceRef) {
+ result = new ServiceRefVisitor();
+ } else if(bean instanceof MessageDestination) {
+ result = new MessageDestinationVisitor();
+ } else if(bean instanceof SecurityRole) {
+ result = new SecurityRoleVisitor();
+ } else if(bean instanceof PortComponent) {
+ result = new PortComponentVisitor();
+ } else if(bean instanceof PortComponentRef) {
+ result = new PortComponentRefVisitor();
+ }
+
+ return result;
+ }
+
+ }
+
+ public static interface NameVisitor {
+ public String getName(CommonDDBean bean);
+ public String getNameProperty();
+ }
+
+ // Three types of ejbs
+ public static class SessionBeanVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((Session) bean).getEjbName();
+ }
+ public String getNameProperty() {
+ return "/" + Session.EJB_NAME;
+ }
+ }
+
+ public static class MDBeanVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((MessageDriven) bean).getEjbName();
+ }
+ public String getNameProperty() {
+ return "/" + MessageDriven.EJB_NAME;
+ }
+ }
+
+ public static class EntityBeanVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((Entity) bean).getEjbName();
+ }
+ public String getNameProperty() {
+ return "/" + Entity.EJB_NAME;
+ }
+ }
+
+ // All the common reference types
+ public static class EjbRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((EjbRef) bean).getEjbRefName();
+ }
+ public String getNameProperty() {
+ return "/" + EjbRef.EJB_REF_NAME;
+ }
+ }
+
+ public static class MessageDestinationRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((MessageDestinationRef) bean).getMessageDestinationRefName();
+ }
+ public String getNameProperty() {
+ return "/" + MessageDestinationRef.MESSAGE_DESTINATION_REF_NAME;
+ }
+ }
+
+ public static class ResourceEnvRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((ResourceEnvRef) bean).getResourceEnvRefName();
+ }
+ public String getNameProperty() {
+ return "/" + ResourceEnvRef.RESOURCE_ENV_REF_NAME;
+ }
+ }
+
+ public static class ResourceRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((ResourceRef) bean).getResRefName();
+ }
+ public String getNameProperty() {
+ return "/" + ResourceRef.RES_REF_NAME;
+ }
+ }
+
+ public static class ServiceRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((ServiceRef) bean).getServiceRefName();
+ }
+ public String getNameProperty() {
+ return "/" + ServiceRef.SERVICE_REF_NAME;
+ }
+ }
+
+ public static class PortComponentRefVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((PortComponentRef) bean).getServiceEndpointInterface();
+ }
+ public String getNameProperty() {
+ return "/" + PortComponentRef.SERVICE_ENDPOINT_INTERFACE;
+ }
+ }
+
+ public static class PortComponentVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((PortComponent) bean).getPortComponentName();
+ }
+ public String getNameProperty() {
+ return "/" + PortComponent.PORT_COMPONENT_NAME;
+ }
+ }
+
+ // Message destination
+ public static class MessageDestinationVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((MessageDestination) bean).getMessageDestinationName();
+ }
+ public String getNameProperty() {
+ return "/" + MessageDestination.MESSAGE_DESTINATION_NAME;
+ }
+ }
+
+ // Security
+ public static class SecurityRoleVisitor implements NameVisitor {
+ public String getName(CommonDDBean bean) {
+ return ((SecurityRole) bean).getRoleName();
+ }
+ public String getNameProperty() {
+ return "/" + SecurityRole.ROLE_NAME;
+ }
+ }
+
+ private static Map<String, BeanVisitor> handlerCache =
+ new HashMap<String, BeanVisitor>(37);
+
+ static {
+ initBeanVisitorMap();
+ }
+
+ // !PW FIXME this ought to be synchronized somehow, but I don't think it's
+ // required and this method is only ever called from one place for one thing.
+ public static void addBeanVisitorMappings(Map<String, BeanVisitor> mappings) {
+ handlerCache.putAll(mappings);
+ }
+
+ private static void initBeanVisitorMap() {
+ EntityAndSessionVisitor entitySessionVisitor = new EntityAndSessionVisitor();
+ EntityAndSessionRemoteVisitor entitySessionRemoteVisitor = new EntityAndSessionRemoteVisitor();
+ handlerCache.put("/EjbJar/EnterpriseBeans", entitySessionVisitor);
+ handlerCache.put("/EjbJar/EnterpriseBeans/Session", entitySessionVisitor);
+ handlerCache.put("/EjbJar/EnterpriseBeans/Session/Remote", entitySessionRemoteVisitor);
+ handlerCache.put("/EjbJar/EnterpriseBeans/Entity", entitySessionVisitor);
+ handlerCache.put("/EjbJar/EnterpriseBeans/Entity/Remote", entitySessionRemoteVisitor);
+// handlerCache.put("/EjbJar/EnterpriseBeans/MessageDriven", new MessageDrivenVisitor());
+
+ WebserviceDescriptionBeanVisitor wsDescVisitor = new WebserviceDescriptionBeanVisitor();
+ handlerCache.put("/Webservices/WebserviceDescription", wsDescVisitor);
+ handlerCache.put("/Webservices/WebserviceDescription/PortComponent", wsDescVisitor);
+ }
+
+ public static interface BeanVisitor {
+ public void beanCreated(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean newDD);
+ public void beanDeleted(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean oldDD);
+ public void beanChanged(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean oldDD, CommonDDBean newDD);
+ public void fieldCreated(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object newValue);
+ public void fieldDeleted(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object oldValue);
+ public void fieldChanged(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object oldValue, Object newValue);
+ }
+
+ public static abstract class AbstractBeanVisitor implements BeanVisitor {
+ public void beanCreated(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean newDD) {
+ }
+ public void beanDeleted(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean oldDD) {
+ }
+ public void beanChanged(PayaraConfiguration config, String xpath,
+ CommonDDBean sourceDD, CommonDDBean oldDD, CommonDDBean newDD) {
+ }
+ public void fieldCreated(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object newValue) {
+ }
+ public void fieldDeleted(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object oldValue) {
+ }
+ public void fieldChanged(PayaraConfiguration config, String xpath,
+ Object sourceDD, Object oldValue, Object newValue) {
+ }
+ }
+
+ public static final class WebserviceDescriptionBeanVisitor extends AbstractBeanVisitor {
+
+ @Override
+ public void beanCreated(final PayaraConfiguration config, final String xpath,
+ final CommonDDBean sourceDD, final CommonDDBean newDD) {
+ if(newDD instanceof WebserviceDescription) {
+ webserviceDescriptionUpdated(config, (WebserviceDescription) newDD,
+ PayaraConfiguration.ChangeOperation.CREATE);
+ } else if(newDD instanceof PortComponent) {
+ portComponentUpdated(config, (PortComponent) newDD,
+ PayaraConfiguration.ChangeOperation.CREATE);
+ }
+ }
+
+ @Override
+ public void beanDeleted(final PayaraConfiguration config, final String xpath,
+ final CommonDDBean sourceDD, final CommonDDBean oldDD) {
+ if(oldDD instanceof WebserviceDescription) {
+ webserviceDescriptionUpdated(config, (WebserviceDescription) oldDD,
+ PayaraConfiguration.ChangeOperation.DELETE);
+ } else if(oldDD instanceof PortComponent) {
+ portComponentUpdated(config, (PortComponent) oldDD,
+ PayaraConfiguration.ChangeOperation.DELETE);
+ }
+ }
+
+ private void webserviceDescriptionUpdated(final PayaraConfiguration config,
+ final WebserviceDescription wsDescDD, final PayaraConfiguration.ChangeOperation operation) {
+ PortComponent [] portDDs = wsDescDD.getPortComponent();
+
+ if(portDDs != null && portDDs.length > 0) {
+ for(PortComponent portDD : portDDs) {
+ if(portDD != null) {
+ portComponentUpdated(config, portDD, operation);
+ }
+ }
+ }
+ }
+
+ private void portComponentUpdated(final PayaraConfiguration config,
+ final PortComponent portDD, final PayaraConfiguration.ChangeOperation operation) {
+ String portName = portDD.getPortComponentName();
+ String linkName = getLinkName(portDD);
+
+ if(Utils.notEmpty(portName) && Utils.notEmpty(linkName)) {
+ config.updateDefaultEjbEndpointUri(linkName, portName, operation);
+ }
+ }
+
+ private String getLinkName(final PortComponent portDD) {
+ String result = null;
+ ServiceImplBean sib = portDD.getServiceImplBean();
+ if(sib != null) {
+ result = sib.getServletLink();
+ if(result == null) {
+ result = sib.getEjbLink();
+ }
+ }
+ return result;
+ }
+
+ }
+
+ public static class EntityAndSessionVisitor extends AbstractBeanVisitor {
+
+ @Override
+ public void beanCreated(final PayaraConfiguration config, final String xpath,
+ final CommonDDBean sourceDD, final CommonDDBean newDD) {
+ if(newDD instanceof EntityAndSession) {
+ entitySessionUpdated(config, (EntityAndSession) newDD,
+ PayaraConfiguration.ChangeOperation.CREATE);
+ } else if(newDD instanceof EnterpriseBeans) {
+ enterpriseBeansUpdated(config, (EnterpriseBeans) newDD,
+ PayaraConfiguration.ChangeOperation.CREATE);
+ }
+ }
+
+ @Override
+ public void beanDeleted(PayaraConfiguration config, String xpath, CommonDDBean sourceDD, CommonDDBean oldDD) {
+ if(oldDD instanceof EntityAndSession) {
+ entitySessionUpdated(config, (EntityAndSession) oldDD,
+ PayaraConfiguration.ChangeOperation.DELETE);
+ } else if(oldDD instanceof EnterpriseBeans) {
+ enterpriseBeansUpdated(config, (EnterpriseBeans) oldDD,
+ PayaraConfiguration.ChangeOperation.DELETE);
+ }
+ }
+
+ private void enterpriseBeansUpdated(final PayaraConfiguration config,
+ final EnterpriseBeans ebDD, final PayaraConfiguration.ChangeOperation operation) {
+ Session [] sessionDDs = ebDD.getSession();
+ if(sessionDDs != null && sessionDDs.length > 0) {
+ for(Session sessionDD : sessionDDs) {
+ if(sessionDD != null) {
+ entitySessionUpdated(config, sessionDD, operation);
+ }
+ }
+ }
+ Entity [] entityDDs = ebDD.getEntity();
+ if(entityDDs != null && entityDDs.length > 0) {
+ for(Entity entityDD : entityDDs) {
+ if(entityDD != null) {
+ entitySessionUpdated(config, entityDD, operation);
+ }
+ }
+ }
+ }
+
+ private void entitySessionUpdated(final PayaraConfiguration config,
+ final EntityAndSession ejbDD, final PayaraConfiguration.ChangeOperation operation) {
+ String ejbName = ejbDD.getEjbName();
+ String remote = ejbDD.getRemote();
+
+ if(Utils.notEmpty(ejbName) &&
+ (operation == PayaraConfiguration.ChangeOperation.DELETE || Utils.notEmpty(remote))) {
+ config.updateDefaultEjbJndiName(ejbName, "ejb/", operation);
+ }
+ }
+
+ }
+
+ public static final class EntityAndSessionRemoteVisitor extends AbstractBeanVisitor {
+
+ @Override
+ public void fieldCreated(PayaraConfiguration config, String xpath, Object sourceDD, Object newValue) {
+ remoteFieldUpdated(config, (EntityAndSession) sourceDD, (String) newValue,
+ PayaraConfiguration.ChangeOperation.CREATE);
+ }
+
+ @Override
+ public void fieldDeleted(PayaraConfiguration config, String xpath, Object sourceDD, Object newValue) {
+ remoteFieldUpdated(config, (EntityAndSession) sourceDD, null,
+ PayaraConfiguration.ChangeOperation.DELETE);
+ }
+
+ private void remoteFieldUpdated(PayaraConfiguration config, EntityAndSession ejbDD,
+ String remote, PayaraConfiguration.ChangeOperation operation) {
+ String ejbName = ejbDD.getEjbName();
+
+ if(Utils.notEmpty(ejbName) &&
+ (operation == PayaraConfiguration.ChangeOperation.DELETE || Utils.notEmpty(remote))) {
+ config.updateDefaultEjbJndiName(ejbName, "ejb/", operation);
+ }
+ }
+
+ }
+
+ public static final class MessageDrivenVisitor extends AbstractBeanVisitor {
+
+ @Override
+ public void beanCreated(PayaraConfiguration config, String xpath, CommonDDBean sourceDD, CommonDDBean newDD) {
+ mdbUpdated(config, (MessageDriven) newDD, PayaraConfiguration.ChangeOperation.CREATE);
+ }
+
+ @Override
+ public void beanDeleted(PayaraConfiguration config, String xpath, CommonDDBean sourceDD, CommonDDBean oldDD) {
+ mdbUpdated(config, (MessageDriven) oldDD, PayaraConfiguration.ChangeOperation.DELETE);
+ }
+
+ private void mdbUpdated(PayaraConfiguration config, MessageDriven mdbDD,
+ PayaraConfiguration.ChangeOperation operation) {
+ String ejbName = mdbDD.getEjbName();
+
+ if(Utils.notEmpty(ejbName)) {
+ config.updateDefaultEjbJndiName(ejbName, "jms/", operation);
+ }
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/EjbJarVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/EjbJarVersion.java
new file mode 100644
index 0000000..91d8075
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/EjbJarVersion.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+
+/**
+ * Enumerated types for EjbJar Version
+ *
+ * @author Peter Williams
+ */
+public final class EjbJarVersion extends J2EEBaseVersion {
+
+ /** Represents ejbjar version 2.0
+ */
+ public static final EjbJarVersion EJBJAR_2_0 = new EjbJarVersion(
+ "2.0", 2000, // NOI18N
+ "1.3", 1300 // NOI18N
+ );
+
+ /** Represents ejbjar version 2.1
+ */
+ public static final EjbJarVersion EJBJAR_2_1 = new EjbJarVersion(
+ "2.1", 2101, // NOI18N
+ "1.4", 1400 // NOI18N
+ );
+
+ /** Represents ejbjar version 3.0
+ */
+ public static final EjbJarVersion EJBJAR_3_0 = new EjbJarVersion(
+ "3.0", 3000, // NOI18N
+ "5.0", 5000 // NOI18N
+ );
+
+ /** Represents ejbjar version 3.0
+ */
+ public static final EjbJarVersion EJBJAR_3_1 = new EjbJarVersion(
+ "3.1", 3100, // NOI18N
+ "6.0", 6000 // NOI18N
+ );
+ /** -----------------------------------------------------------------------
+ * Implementation
+ */
+
+ /** Creates a new instance of EjbJarVersion
+ */
+ private EjbJarVersion(String moduleVersion, int nv, String specVersion, int nsv) {
+ super(moduleVersion, nv, specVersion, nsv);
+ }
+
+ /** Comparator implementation that works only on EjbJarVersion objects
+ *
+ * @param obj EjbJarVersion to compare with.
+ * @return -1, 0, or 1 if this version is less than, equal to, or greater
+ * than the version passed in as an argument.
+ * @throws ClassCastException if obj is not a EjbJarVersion object.
+ */
+ public int compareTo(Object obj) {
+ EjbJarVersion target = (EjbJarVersion) obj;
+ return numericCompare(target);
+ }
+
+ public static EjbJarVersion getEjbJarVersion(String version) {
+ EjbJarVersion result = null;
+
+ if(EJBJAR_2_0.toString().equals(version)) {
+ result = EJBJAR_2_0;
+ } else if(EJBJAR_2_1.toString().equals(version)) {
+ result = EJBJAR_2_1;
+ } else if(EJBJAR_3_0.toString().equals(version)) {
+ result = EJBJAR_3_0;
+ } else if(EJBJAR_3_1.toString().equals(version)) {
+ result = EJBJAR_3_1;
+ }
+
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/FolderListener.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/FolderListener.java
new file mode 100644
index 0000000..d4165d9
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/FolderListener.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.openide.filesystems.FileAttributeEvent;
+import org.openide.filesystems.FileChangeListener;
+import org.openide.filesystems.FileEvent;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileRenameEvent;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class FolderListener implements FileChangeListener {
+
+ public static FileChangeListener createListener(File key, FileObject folder, J2eeModule.Type type) {
+ return new FolderListener(key, folder, type);
+ }
+
+ private final File configKey;
+ private final String [] targets;
+
+ private FolderListener(File key, FileObject folder, J2eeModule.Type type) {
+ configKey = key;
+ if(type == J2eeModule.Type.WAR) {
+ targets = new String [] { "web.xml", "webservices.xml" };
+ } else if(type == J2eeModule.Type.EJB) {
+ targets = new String [] { "ejb-jar.xml", "webservices.xml" };
+ } else if(type == J2eeModule.Type.EAR) {
+ targets = new String [] { "application.xml" };
+ } else if(type == J2eeModule.Type.CAR) {
+ targets = new String [] { "application-client.xml" };
+ } else {
+ Logger.getLogger("payara-eecommon").log(Level.WARNING, "Unsupported module type: " + type);
+ targets = new String [0];
+ }
+
+ folder.addFileChangeListener(this);
+ }
+
+ public void fileFolderCreated(FileEvent fe) {
+ }
+
+ public void fileDataCreated(FileEvent fe) {
+ FileObject fo = fe.getFile();
+ for(String target: targets) {
+ if(target.equals(fo.getNameExt())) {
+ PayaraConfiguration config = PayaraConfiguration.getConfiguration(configKey);
+ if(config != null) {
+ config.addDescriptorListener(fo);
+ }
+ }
+ }
+ }
+
+ public void fileChanged(FileEvent fe) {
+ }
+
+ public void fileDeleted(FileEvent fe) {
+ }
+
+ public void fileRenamed(FileRenameEvent fe) {
+ }
+
+ public void fileAttributeChanged(FileAttributeEvent fe) {
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEBaseVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEBaseVersion.java
new file mode 100644
index 0000000..0cb9d4e
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEBaseVersion.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+
+
+/**
+ * Base class to relate enumerated types of various J2EE/JavaEE versions.
+ *
+ * @author Peter Williams
+ */
+public abstract class J2EEBaseVersion implements Comparable {
+
+ /** -----------------------------------------------------------------------
+ * Implementation
+ */
+ // This is the module version id, string and numeric form.
+ private final String j2eeModuleVersion; // e.g. "2.5" (servlet 2.5), "3.0" (ejb 3.0), etc.
+ private final int numericModuleVersion;
+
+ // This is the j2ee/javaee spec version, string and numeric form.
+ private final int numericSpecVersion;
+
+
+ /** Creates a new instance of J2EEBaseVersion
+ */
+ protected J2EEBaseVersion(String moduleVersion, int nv, String specVersion, int nsv) {
+ j2eeModuleVersion = moduleVersion;
+ numericModuleVersion = nv;
+ numericSpecVersion = nsv;
+ }
+
+ /** The string representation of this version.
+ *
+ * @return String representing the module specification version, e.g. servlet 2.x
+ * ejb-jar 2.x, etc.
+ */
+ @Override
+ public String toString() {
+ return j2eeModuleVersion;
+ }
+
+ /** Compare the j2ee/javaee spec version of this instance with another (as
+ * opposed to comparing the module type version.
+ *
+ * @param target Version object to compare with
+ * @return -1, 0, 1 if this spec version is less than, equal to, or greater than
+ * the target version.
+ */
+ public int compareSpecification(J2EEBaseVersion target) {
+ if(numericSpecVersion < target.numericSpecVersion) {
+ return -1;
+ } else if(numericSpecVersion > target.numericSpecVersion) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ /** For use by derived class to compare numeric versions. Derived class
+ * should ensure target is the appropriate type before invoking this method
+ * to compare the version numbers themselves.
+ *
+ * @param target Version object to compare with
+ * @return -1, 0, 1 if this module version is less than, equal to, or greater than
+ * the target version.
+ */
+ protected int numericCompare(J2EEBaseVersion target) {
+ if(numericModuleVersion < target.numericModuleVersion) {
+ return -1;
+ } else if(numericModuleVersion > target.numericModuleVersion) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public static J2EEBaseVersion getVersion(J2eeModule.Type moduleType, String moduleVersion) {
+ J2EEBaseVersion version = null;
+ if(J2eeModule.Type.WAR.equals(moduleType)) {
+ version = ServletVersion.getServletVersion(moduleVersion);
+ } else if(J2eeModule.Type.EJB.equals(moduleType)) {
+ version = EjbJarVersion.getEjbJarVersion(moduleVersion);
+ } else if(J2eeModule.Type.EAR.equals(moduleType)) {
+ version = ApplicationVersion.getApplicationVersion(moduleVersion);
+ } else if(J2eeModule.Type.CAR.equals(moduleType)) {
+ version = AppClientVersion.getAppClientVersion(moduleVersion);
+ }
+ return version;
+ }
+
+ /*
+ public static J2EEBaseVersion getJ2EEVersion(String version) {
+ J2EEBaseVersion result = null;
+
+
+ if(J2EE_1_3.toString().equals(version)) {
+ result = J2EE_1_3;
+ } else if(J2EE_1_4.toString().equals(version)) {
+ result = J2EE_1_4;
+ }
+
+ return result;
+ }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (null == obj) {
+ return false;
+ }
+ if (this.getClass().isInstance(obj)) {
+ return compareTo(obj) == 0;
+ }
+ return false;
+ }
+
+
+ @Override
+ public int hashCode() {
+ return numericSpecVersion;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEVersion.java
new file mode 100644
index 0000000..2ddf7cf
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2EEVersion.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+/**
+ * Enumerated types for various J2EE versions.
+ *
+ * Be careful with the compareTo method of this class. It is there for comparing
+ * like versions (e.g. servlet 2.3 versus 2.4) only, but there is no type safety
+ * to prevent doing dumb things like comparing J2EE 1.4 with servlet 2.3.
+ *
+ * Perhaps I can think of a better design in the next version.
+ *
+ * @author Peter Williams
+ */
+public final class J2EEVersion extends J2EEBaseVersion {
+
+ /**
+ * Represents J2EE version 1.3
+ */
+ public static final J2EEVersion J2EE_1_3 = new J2EEVersion(
+ "1.3", 1300, // NOI18N
+ "1.3", 1300); // NOI18N
+
+ /**
+ * Represents J2EE version 1.4
+ */
+ public static final J2EEVersion J2EE_1_4 = new J2EEVersion(
+ "1.4", 1400, // NOI18N
+ "1.4", 1400); // NOI18N
+
+ /**
+ * Represents JavaEE version 5.0
+ */
+ public static final J2EEVersion JAVAEE_5_0 = new J2EEVersion(
+ "5.0", 5000, // NOI18N
+ "5.0", 5000); // NOI18N
+
+ /**
+ * Represents JavaEE version 6.0
+ */
+ public static final J2EEVersion JAVAEE_6_0 = new J2EEVersion(
+ "6.0", 6000, // NOI18N
+ "6.0", 6000); // NOI18N
+
+ /**
+ * Represents JavaEE version 7.0
+ */
+ public static final J2EEVersion JAVAEE_7_0 = new J2EEVersion(
+ "7.0", 7000, // NOI18N
+ "7.0", 7000); // NOI18N
+
+ /**
+ * Represents JavaEE version 8.0
+ */
+ public static final J2EEVersion JAVAEE_8_0 = new J2EEVersion(
+ "8.0", 8000, // NOI18N
+ "8.0", 8000); // NOI18N
+
+ /**
+ * -----------------------------------------------------------------------
+ * Implementation
+ */
+ /**
+ * Creates a new instance of J2EEVersion
+ */
+ private J2EEVersion(String version, int nv, String specVersion, int nsv) {
+ super(version, nv, specVersion, nsv);
+ }
+
+ /**
+ * Comparator implementation that works only on J2EEVersion objects
+ *
+ * @param obj J2EEVersion to compare with.
+ * @return -1, 0, or 1 if this version is less than, equal to, or greater
+ * than the version passed in as an argument.
+ * @throws ClassCastException if obj is not a J2EEVersion object.
+ */
+ public int compareTo(Object obj) {
+ J2EEVersion target = (J2EEVersion) obj;
+ return numericCompare(target);
+ }
+
+ public static J2EEVersion getJ2EEVersion(String version) {
+ J2EEVersion result = null;
+
+ if (J2EE_1_3.toString().equals(version)) {
+ result = J2EE_1_3;
+ } else if (J2EE_1_4.toString().equals(version)) {
+ result = J2EE_1_4;
+ } else if (JAVAEE_5_0.toString().equals(version)) {
+ result = JAVAEE_5_0;
+ } else if (JAVAEE_6_0.toString().equals(version)) {
+ result = JAVAEE_6_0;
+ } else if(JAVAEE_7_0.toString().equals(version)) {
+ result = JAVAEE_7_0;
+ } else if(JAVAEE_8_0.toString().equals(version)) {
+ result = JAVAEE_8_0;
+ }
+
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2eeModuleHelper.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2eeModuleHelper.java
new file mode 100644
index 0000000..c4fd9f1
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/J2eeModuleHelper.java
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.j2ee.dd.api.common.RootInterface;
+import org.netbeans.modules.j2ee.dd.api.webservices.Webservices;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Java EE module helper.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public abstract class J2eeModuleHelper {
+
+ /** Web application meta data directory. */
+ public static final String WEB_INF = JavaEEModule.WEB_INF;
+
+ /** GlassFish specific meta data file for version 1 and 2. */
+ public static final String GF_WEB_XML_V1
+ = WEB_INF + File.separatorChar + "sun-web.xml";
+
+ /** GlassFish specific meta data file for version 3 and 4. */
+ public static final String GF_WEB_XML_V2
+ = WEB_INF + File.separatorChar + "glassfish-web.xml";
+
+ /**
+ * Payara specific meta data file.
+ */
+ public static final String PAYARA_WEB_XML_V4
+ = WEB_INF + File.separatorChar + "payara-web.xml";
+
+ private static final Map<Object, J2eeModuleHelper> helperMap;
+ private static final Map<Object, J2eeModuleHelper> gfhelperMap;
+
+ static {
+ Map<Object, J2eeModuleHelper> map = new HashMap<>();
+ map.put(J2eeModule.Type.WAR, new WebDDHelper());
+ map.put(J2eeModule.Type.EJB, new EjbDDHelper());
+ map.put(J2eeModule.Type.EAR, new EarDDHelper());
+ map.put(J2eeModule.Type.CAR, new ClientDDHelper());
+ helperMap = Collections.unmodifiableMap(map);
+ map = new HashMap<>();
+ map.put(J2eeModule.Type.WAR, new WebDDHelper(PAYARA_WEB_XML_V4, GF_WEB_XML_V2));
+ map.put(J2eeModule.Type.EJB, new EjbDDHelper("META-INF/glassfish-ejb-jar.xml", "META-INF/glassfish-cmp-mappings.xml"));
+ map.put(J2eeModule.Type.EAR, new EarDDHelper("META-INF/glassfish-application.xml", null));
+ map.put(J2eeModule.Type.CAR, new ClientDDHelper("META-INF/glassfish-application-client.xml",null));
+ gfhelperMap = Collections.unmodifiableMap(map);
+ }
+
+ /**
+ * Check for <code>WEB-INF/payara-web.xml</code> in Java EE module.
+ *
+ * @param module
+ * @return Value of <code>true</code> when
+ * <code>WEB-INF/payara-web.xml</code> exists and is readable or
+ * <code>false</code> otherwise.
+ */
+ public static boolean isPayaraWeb(final J2eeModule module) {
+ File webXml = module.getDeploymentConfigurationFile(PAYARA_WEB_XML_V4);
+ return webXml.canRead();
+ }
+
+ /**
+ * Check for <code>WEB-INF/glassfish-web.xml</code> in Java EE module.
+ *
+ * @param module
+ * @return Value of <code>true</code> when
+ * <code>WEB-INF/glassfish-web.xml</code> exists and is readable or
+ * <code>false</code> otherwise.
+ */
+ public static boolean isGlassFishWeb(final J2eeModule module) {
+ File webXml = module.getDeploymentConfigurationFile(GF_WEB_XML_V2);
+ return webXml.canRead();
+ }
+
+ public static final J2eeModuleHelper getSunDDModuleHelper(Object type) {
+ return helperMap.get(type);
+ }
+
+ public static final J2eeModuleHelper getPayaraDDModuleHelper(Object type) {
+ return gfhelperMap.get(type);
+ }
+
+ public static final J2eeModuleHelper getWsModuleHelper(String primaryDDName) {
+ return new WebServerDDHelper(primaryDDName);
+ }
+
+ private final Object moduleType;
+ private final String standardDDName;
+ private final String webserviceDDName;
+ private final String primaryDDName;
+ private final String secondaryDDName;
+
+ private J2eeModuleHelper(
+ Object moduleType,
+ String standardDDName,
+ String webserviceDDName,
+ String primaryDDName,
+ String secondaryDDName) {
+ this.moduleType = moduleType;
+ this.standardDDName = standardDDName;
+ this.webserviceDDName = webserviceDDName;
+ this.primaryDDName = primaryDDName;
+ this.secondaryDDName = secondaryDDName;
+ }
+
+ public Object getJ2eeModule() {
+ return moduleType;
+ }
+
+ public String getStandardDDName() {
+ return standardDDName;
+ }
+
+ public String getWebserviceDDName() {
+ return webserviceDDName;
+ }
+
+ public String getPrimaryDDName() {
+ return primaryDDName;
+ }
+
+ public String getSecondaryDDName() {
+ return secondaryDDName;
+ }
+
+ public File getPrimaryDDFile(J2eeModule module) {
+ return primaryDDName != null ?
+ module.getDeploymentConfigurationFile(primaryDDName) : null;
+ }
+
+ public File getSecondaryDDFile(J2eeModule module) {
+ return secondaryDDName != null ?
+ module.getDeploymentConfigurationFile(secondaryDDName) : null;
+ }
+
+ public RootInterface getStandardRootDD(J2eeModule module) {
+ RootInterface stdRootDD = null;
+ if (standardDDName != null) {
+ File ddFile = module.getDeploymentConfigurationFile(standardDDName);
+ if (ddFile.exists()) {
+ FileUtil.normalizeFile(ddFile);
+ FileObject ddFO = FileUtil.toFileObject(ddFile);
+ try {
+ stdRootDD = getStandardRootDD(ddFO);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ return stdRootDD;
+ }
+
+ public Webservices getWebServicesRootDD(J2eeModule module) {
+ Webservices wsRootDD = null;
+ if (webserviceDDName != null) {
+ File ddFile = module.getDeploymentConfigurationFile(webserviceDDName);
+ if (ddFile.exists()) {
+ FileObject ddFO = FileUtil.toFileObject(ddFile);
+ try {
+ wsRootDD = org.netbeans.modules.j2ee.dd.api.webservices.DDProvider.getDefault().getDDRoot(ddFO);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-eecommon").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ }
+ return wsRootDD;
+ }
+
+ protected abstract RootInterface getStandardRootDD(FileObject ddFO) throws IOException;
+
+ protected abstract ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion);
+
+ public static class WebDDHelper extends J2eeModuleHelper {
+
+ private WebDDHelper() {
+ this(GF_WEB_XML_V1, null);
+ }
+
+ private WebDDHelper(String dd1, String dd2) {
+ super(J2eeModule.WAR, J2eeModule.WEB_XML, J2eeModule.WEBSERVICES_XML,
+ dd1, dd2);
+ }
+
+ @Override
+ protected RootInterface getStandardRootDD(final FileObject ddFO) throws IOException {
+ return org.netbeans.modules.j2ee.dd.api.web.DDProvider.getDefault().getDDRoot(ddFO);
+ }
+
+ @Override
+ protected ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion) {
+ ASDDVersion result = defaultVersion;
+ ServletVersion servletVersion = ServletVersion.getServletVersion(j2eeModuleVersion);
+ if (ServletVersion.SERVLET_2_4.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ } else if (ServletVersion.SERVLET_2_5.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_9_0;
+ } else if (ServletVersion.SERVLET_3_0.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ return result;
+ }
+
+ }
+
+ public static class WebServerDDHelper extends J2eeModuleHelper {
+
+ private WebServerDDHelper(String primaryDDName) {
+ super(J2eeModule.WAR, J2eeModule.WEB_XML, J2eeModule.WEBSERVICES_XML,
+ primaryDDName, null);
+ }
+
+ @Override
+ protected RootInterface getStandardRootDD(final FileObject ddFO) throws IOException {
+ return org.netbeans.modules.j2ee.dd.api.web.DDProvider.getDefault().getDDRoot(ddFO);
+ }
+
+ @Override
+ protected ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion) {
+ ASDDVersion result = defaultVersion;
+ ServletVersion servletVersion = ServletVersion.getServletVersion(j2eeModuleVersion);
+ if (ServletVersion.SERVLET_2_4.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ } else if (ServletVersion.SERVLET_2_5.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_9_0;
+ } else if (ServletVersion.SERVLET_3_0.equals(servletVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ return result;
+ }
+
+ }
+
+
+ public static class EjbDDHelper extends J2eeModuleHelper {
+
+ private EjbDDHelper() {
+ this("META-INF/sun-ejb-jar.xml", "META-INF/sun-cmp-mappings.xml");
+ }
+
+ private EjbDDHelper(String dd1, String dd2) {
+ super(J2eeModule.EJB, "ejb-jar.xml", "webservices.xml",
+ dd1,dd2);
+ }
+
+ @Override
+ protected RootInterface getStandardRootDD(final FileObject ddFO) throws IOException {
+ return org.netbeans.modules.j2ee.dd.api.ejb.DDProvider.getDefault().getDDRoot(ddFO);
+ }
+
+ @Override
+ protected ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion) {
+ ASDDVersion result = defaultVersion;
+ EjbJarVersion ejbJarVersion = EjbJarVersion.getEjbJarVersion(j2eeModuleVersion);
+ if (EjbJarVersion.EJBJAR_2_1.equals(ejbJarVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ } else if (EjbJarVersion.EJBJAR_3_0.equals(ejbJarVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_9_0;
+ } else if (EjbJarVersion.EJBJAR_3_1.equals(ejbJarVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ return result;
+ }
+
+ }
+
+ public static class EarDDHelper extends J2eeModuleHelper {
+
+ private EarDDHelper() {
+ this("META-INF/sun-application.xml", null);
+ }
+
+ private EarDDHelper(String dd1, String dd2) {
+ super(J2eeModule.EAR, "application.xml", null, dd1, dd2);
+ }
+
+ @Override
+ protected RootInterface getStandardRootDD(final FileObject ddFO) throws IOException {
+ return org.netbeans.modules.j2ee.dd.api.application.DDProvider.getDefault().getDDRoot(ddFO);
+ }
+
+ @Override
+ protected ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion) {
+ ASDDVersion result = defaultVersion;
+ ApplicationVersion applicationVersion = ApplicationVersion.getApplicationVersion(j2eeModuleVersion);
+ if (ApplicationVersion.APPLICATION_1_4.equals(applicationVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ } else if (ApplicationVersion.APPLICATION_5_0.equals(applicationVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_9_0;
+ } else if (ApplicationVersion.APPLICATION_6_0.equals(applicationVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ return result;
+ }
+
+ }
+
+ public static class ClientDDHelper extends J2eeModuleHelper {
+
+ private ClientDDHelper() {
+ this("META-INF/sun-application-client.xml", null);
+ }
+
+ private ClientDDHelper(String dd1, String dd2) {
+ super(J2eeModule.CLIENT, "application-client.xml", null, dd1, dd2);
+ }
+
+ @Override
+ protected RootInterface getStandardRootDD(final FileObject ddFO) throws IOException {
+ return org.netbeans.modules.j2ee.dd.api.client.DDProvider.getDefault().getDDRoot(ddFO);
+ }
+
+ @Override
+ protected ASDDVersion getMinASVersion(String j2eeModuleVersion, ASDDVersion defaultVersion) {
+ ASDDVersion result = defaultVersion;
+ AppClientVersion appClientVersion = AppClientVersion.getAppClientVersion(j2eeModuleVersion);
+ if (AppClientVersion.APP_CLIENT_1_4.equals(appClientVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ } else if (AppClientVersion.APP_CLIENT_5_0.equals(appClientVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_9_0;
+ } else if (AppClientVersion.APP_CLIENT_6_0.equals(appClientVersion)) {
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ return result;
+ }
+
+ }
+
+
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/JavaEEModule.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/JavaEEModule.java
new file mode 100644
index 0000000..c291ff8
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/JavaEEModule.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.shared.ModuleType;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+
+// This is J2eeModule.Type rewritten as Enum. I could not modify original class
+// because it's API.
+/**
+ * Java EE module types.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum JavaEEModule {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Client application archive. */
+ CAR(ModuleType.CAR),
+ /** Enterprise application archive */
+ EAR(ModuleType.EAR),
+ /** Enterprise Java bean archive. */
+ EJB(ModuleType.EJB),
+ /** Connector archive. */
+ RAR(ModuleType.RAR),
+ /** Web application archive. */
+ WAR(ModuleType.WAR);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara Java EE common module Logger. */
+ private static final Logger LOGGER = Logger.getLogger("payara-eecommon");
+
+ /** JavaEEModule version enumeration length. */
+ public static final int length = JavaEEModule.values().length;
+
+ /** Name of web application configuration directory. */
+ public static final String WEB_INF = "WEB-INF";
+
+ /** Name of java archive manifest directory. */
+ public static final String META_INF = "META-INF";
+
+ /** {@link J2eeModule.Type} to {@link JavaEEModule} conversion map. */
+ private static final Map<J2eeModule.Type, JavaEEModule> j2eeModuleTypeToValue
+ = new HashMap<J2eeModule.Type, JavaEEModule>(2*length);
+
+ // Initialize J2eeModule.Type to JavaEEModule conversion map.
+ static {
+ j2eeModuleTypeToValue.put(J2eeModule.Type.CAR, CAR);
+ j2eeModuleTypeToValue.put(J2eeModule.Type.EAR, EAR);
+ j2eeModuleTypeToValue.put(J2eeModule.Type.EJB, EJB);
+ j2eeModuleTypeToValue.put(J2eeModule.Type.RAR, RAR);
+ j2eeModuleTypeToValue.put(J2eeModule.Type.WAR, WAR);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Java EE module configuration directory (e.g. {@code "META-INF"}).
+ * This is just {@link J2eeModule.Type} shortcut.
+ * <p/>
+ * @param type {@link J2eeModule.Type} instance of Java EE module type.
+ * @return Java EE module configuration directory for known Java EE
+ * module type or {@code null} when provided Java EE module type
+ * is not known.
+ */
+ public static final String getConfigDir(J2eeModule.Type type) {
+ JavaEEModule configDir = JavaEEModule.toValue(type);
+ return type != null ? configDir.getConfigDir() : null;
+ }
+
+ /**
+ * Convert {@link J2eeModule.Type} to {@link JavaEEModule}.
+ * <p/>
+ * @param type {@link ModuleType} value to be converted.
+ * @return {@link J2eeModule.Type} value corresponding to provided
+ * {@link ModuleType} value.
+ */
+ @SuppressWarnings("deprecation")
+ public static JavaEEModule toValue(final J2eeModule.Type type) {
+ return j2eeModuleTypeToValue.get(type);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java EE module type. */
+ private final ModuleType moduleType;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE module type.
+ * <p/>
+ * @param moduleType Java EE module type.
+ */
+ private JavaEEModule(final ModuleType moduleType) {
+ this.moduleType = moduleType;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get stored {@link ModuleType} value.
+ * <p/>
+ * @return Stored {@link ModuleType} value.
+ */
+ private ModuleType getModuleType() {
+ return moduleType;
+ }
+
+ /**
+ * Get Java EE module configuration directory (e.g. {@code "META-INF"}).
+ * <p/>
+ * @return Java EE module configuration directory.
+ */
+ public String getConfigDir() {
+ switch (this) {
+ case CAR:
+ case EAR:
+ case EJB:
+ case RAR:
+ return META_INF;
+ case WAR:
+ return WEB_INF;
+ default:
+ throw new IllegalArgumentException("Unknown Java EE module type.");
+ }
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfiguration.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfiguration.java
new file mode 100644
index 0000000..1682732
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfiguration.java
@@ -0,0 +1,1673 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.WeakHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.j2ee.dd.api.webservices.Webservices;
+import org.netbeans.modules.payara.eecommon.api.Utils;
+import org.netbeans.modules.payara.eecommon.api.XmlFileCreator;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination.Type;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ContextRootConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.DatasourceConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.EjbResourceConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.MessageDestinationConfiguration;
+import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
+import org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion;
+import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
+import org.netbeans.modules.j2ee.sun.dd.api.DDProvider;
+import org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDProvider;
+import org.netbeans.modules.j2ee.sun.dd.api.RootInterface;
+import org.netbeans.modules.j2ee.sun.dd.api.client.SunApplicationClient;
+import org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef;
+import org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef;
+import org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef;
+import org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceEndpoint;
+import org.netbeans.modules.j2ee.sun.dd.api.ejb.Ejb;
+import org.netbeans.modules.j2ee.sun.dd.api.ejb.EnterpriseBeans;
+import org.netbeans.modules.j2ee.sun.dd.api.ejb.MdbConnectionFactory;
+import org.netbeans.modules.j2ee.sun.dd.api.ejb.SunEjbJar;
+import org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.openide.util.Pair;
+import org.openide.util.RequestProcessor;
+
+/**
+ * Basic Java EE server configuration API support for V2, V3 and V4 plugins.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public abstract class PayaraConfiguration implements
+ ContextRootConfiguration,
+ EjbResourceConfiguration,
+ MessageDestinationConfiguration,
+ DatasourceConfiguration {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara Java EE common module Logger. */
+ private static final Logger LOGGER = Logger.getLogger("payara-eecommon");
+
+ /** Payara resource file suffix is {@code .xml}. */
+ private static final String RESOURCE_FILES_SUFFIX = ".xml";
+
+ /** List of base file names containing server resources:<ul>
+ * <li><i>[0]</i> points to current name used since GlassFich v3.</li>
+ * <li><i>[1]</i> points to old name used before GlassFich v3.</li>
+ * <ul>*/
+ static final String[] RESOURCE_FILES = {
+ "glassfish-resources" + RESOURCE_FILES_SUFFIX,
+ "sun-resources" + RESOURCE_FILES_SUFFIX
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create resource file path fragment for given Java EE module.
+ * <i>Internal helper method.</i>
+ * <p/>
+ * @param module Java EE module (project).
+ * @param fileName Resources file name.
+ * @return Resource file path fragment for given Java EE module.
+ */
+ private static String resourceFilePath(final J2eeModule module,final String fileName) {
+ String configDir = JavaEEModule.getConfigDir(module.getType());
+ if (configDir == null) {
+ throw new IllegalArgumentException("Unknown Java EE module type.");
+ }
+ return OsUtils.joinPaths(configDir, fileName);
+ }
+
+ /**
+ * Get existing {@code RESOURCE_FILES} array indexes for provided Payara
+ * server version.
+ * <br/>
+ * <i>Internal {@link #getExistingResourceFile(J2eeModule, PayaraVersion)
+ * helper method.</i>
+ * <p/>
+ * @param version Payara server version.
+ * @return An array of {@code RESOURCE_FILES} array indexes pointing
+ * to resource files to search for.
+ */
+ private static int[] versionToResourceFilesIndexes(
+ final PayaraVersion version) {
+ // All files for unknown version.
+ if (version == null) {
+ return new int[]{0,1};
+ }
+ // glassfish-resources.xml for v4
+ if (PayaraVersion.ge(version, PayaraVersion.PF_4_1_144)) {
+ return new int[]{0};
+ } else {
+ // sun-resources.xml for older
+ return new int[]{1};
+ }
+ }
+
+ /**
+ * Get new {@code RESOURCE_FILES} array index for provided Payara
+ * server version.
+ * <p/>
+ * @param version Payara server version.
+ * @return An {@code RESOURCE_FILES} array index pointing
+ * to resource file to be created.
+ */
+ private static int versionToNewResourceFilesIndex(
+ final PayaraVersion version) {
+ // glassfish-resources.xml is returned for versions 3.1 and higher
+ // or as default for unknown version.
+ if (version == null
+ || PayaraVersion.ge(version, PayaraVersion.PF_4_1_144)) {
+ return 0;
+ } else {
+ // sun-resources.xml is returned for old versions
+ return 1;
+ }
+ }
+
+ /**
+ * Get existing Payara resources file name.
+ * Payara resources file depends on server version and used storage.
+ * GlassFish v3 supports old {@code sun-resources.xml} together with new
+ * {@code glassfish-resources.xml}. Payara v4 supports only
+ * new {@code glassfish-resources.xml} file.
+ * Those files can be found in server configuration directory (to be included
+ * into target project archive) or in server resources directory (won't be
+ * included into target project archive).
+ * Search works with following priorities:<ul>
+ * <li><i>GlassFish v2:</i> Only {@code sun-resources.xml} is checked.</li>
+ * <li><i>GlassFish v3:</i> {@code glassfish-resources.xml} is checked first,
+ * {@code sun-resources.xml} as fallback.</li>
+ * <li><i>Payara v4:</i> Only {@code glassfish-resources.xml} is checked.</li>
+ * <li><i>Configuration directory</i> is checked first, <i>resources directory</i>
+ * as fallback.</li>
+ * </ul>
+ *
+ * @param module Java EE module (project).
+ * @param version Resources file names depend on Payara server version.
+ * @return Existing Payara resources file together with boolean flag
+ * indicating whether this is application scoped resource or
+ * {@code null} when no resources file was found.
+ */
+ public static final Pair<File, Boolean> getExistingResourceFile(
+ final J2eeModule module, final PayaraVersion version) {
+ // RESOURCE_FILES indexes to search for.
+ final int[] indexes = versionToResourceFilesIndexes(version);
+ for (int index : indexes) {
+ // Check configuration directory first.
+ final String name = resourceFilePath(module, RESOURCE_FILES[index]);
+ File file = module.getDeploymentConfigurationFile(name);
+ if (file != null && file.isFile() && file.canRead()) {
+ return Pair.of(file, true);
+ }
+ // Check resources directory as a fallback.
+ file = new File(module.getResourceDirectory(), RESOURCE_FILES[index]);
+ if (file.isFile() && file.canRead()) {
+ return Pair.of(file, false);
+ }
+
+ file = new File(module.getResourceDirectory(), "glassfish-resources");
+ if (file.isFile() && file.canRead()) {
+ return Pair.of(file, false);
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Get new Payara resources file name for creation.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param version Resources file names depend on Payara server version.
+ * @return Payara resources file to be created.
+ */
+ public static final Pair<File, Boolean> getNewResourceFile(
+ final J2eeModule module, final PayaraVersion version) {
+ final int index = versionToNewResourceFilesIndex(version);
+ if (PayaraVersion.lt(version, PayaraVersion.PF_4_1_144)) {
+ return Pair.of(new File(module.getResourceDirectory(), RESOURCE_FILES[index]), false);
+ }
+ final String name = resourceFilePath(module, RESOURCE_FILES[index]);
+ return Pair.of(module.getDeploymentConfigurationFile(name), true);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ protected final J2eeModule module;
+ protected final J2eeModuleHelper moduleHelper;
+ protected final File primaryDD;
+ protected final File secondaryDD;
+ protected DescriptorListener descriptorListener;
+ /** Payara server version. */
+ protected PayaraVersion version;
+ private ASDDVersion appServerVersion;
+ private ASDDVersion minASVersion;
+ private ASDDVersion maxASVersion;
+ private boolean deferredAppServerChange;
+ private final String defaultcr;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE server configuration API support.
+ * {@link J2eeModuleHelper} instance is added depending on Java EE module type.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param version Payara server version.
+ * @throws ConfigurationException when there is a problem with Java EE server
+ * configuration initialization.
+ */
+ protected PayaraConfiguration(
+ final J2eeModule module, final PayaraVersion version
+ ) throws ConfigurationException {
+ this(module, J2eeModuleHelper.getSunDDModuleHelper(module.getType()), version);
+ }
+
+ /**
+ * Creates an instance of Java EE server configuration API support with existing
+ * {@link J2eeModuleHelper} instance.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param moduleHelper Already existing {@link J2eeModuleHelper} instance.
+ * @param version Payara server version.
+ * @throws ConfigurationException when there is a problem with Java EE server
+ * configuration initialization.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ protected PayaraConfiguration(
+ final J2eeModule module, final J2eeModuleHelper moduleHelper,
+ final PayaraVersion version
+ ) throws ConfigurationException {
+ this.module = module;
+ this.moduleHelper = moduleHelper;
+ this.version = version;
+ if(moduleHelper != null) {
+ this.primaryDD = moduleHelper.getPrimaryDDFile(module);
+ this.secondaryDD = moduleHelper.getSecondaryDDFile(module);
+ } else {
+ throw new ConfigurationException("Unsupported module type: " + module.getType()); // NOI18N
+ }
+
+ if (null == primaryDD) {
+ throw new ConfigurationException("No primaryDD for module type: " + module.getType()); // NOI18N
+ }
+
+ try {
+
+ if (null == primaryDD.getParentFile()) {
+ throw new ConfigurationException("module is not initialized completely"); // NOI18N
+ }
+ addConfiguration(primaryDD, this);
+ if (primaryDD.getName().endsWith("-web.xml")) { // NOI18N
+ String path = primaryDD.getParent().
+ replaceAll("[\\\\/]web[\\\\/]WEB-INF", ""). // NOI18N
+ replaceAll("[\\\\/]src[\\\\/]main[\\\\/]webapp[\\\\/]WEB-INF", ""); // NOI18N
+ int dex = path.lastIndexOf(File.separatorChar);
+ if (dex < 0) {
+ defaultcr = null;
+ } else {
+ defaultcr = "/"+path.substring(dex+1);
+ }
+
+ } else {
+ defaultcr = null;
+ }
+
+ // Default to 8.1 in new beans. This is set by the bean parser
+ // in the appropriate root type, if reading from existing file(s).
+ this.appServerVersion = ASDDVersion.SUN_APPSERVER_8_1;
+ this.deferredAppServerChange = false;
+ J2eeModule.Type mt = module.getType();
+ String moduleVersion = module.getModuleVersion();
+
+ minASVersion = computeMinASVersion(moduleVersion);
+ maxASVersion = computeMaxASVersion();
+ appServerVersion = maxASVersion;
+
+ J2EEBaseVersion j2eeVersion = J2EEBaseVersion.getVersion(mt, moduleVersion);
+ boolean isPreJavaEE6 = (j2eeVersion != null) ?
+ (J2EEVersion.JAVAEE_5_0.compareSpecification(j2eeVersion) >= 0) : false;
+ if (isPreJavaEE6) {
+ // not supported
+ }
+ } catch (RuntimeException ex) {
+ removeConfiguration(primaryDD);
+ ConfigurationException ce = new ConfigurationException(primaryDD.getAbsolutePath(), ex);
+ throw ce;
+ }
+ }
+
+ @Deprecated
+ public PayaraConfiguration() {
+ throw new UnsupportedOperationException("JSR-88 configuration not supported.");
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public void dispose() {
+ if(descriptorListener != null) {
+ descriptorListener.removeListeners();
+ descriptorListener = null;
+ }
+
+ PayaraConfiguration storedCfg = getConfiguration(primaryDD);
+ if (storedCfg != this) {
+ LOGGER.log(Level.INFO,
+ "Stored DeploymentConfiguration ({0}) instance not the one being disposed of ({1}).",
+ new Object[]{storedCfg, this});
+ }
+
+ if (storedCfg != null) {
+ removeConfiguration(primaryDD);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Appserver version support
+ // ------------------------------------------------------------------------
+ private ASDDVersion computeMinASVersion(String j2eeModuleVersion) {
+ return moduleHelper.getMinASVersion(
+ j2eeModuleVersion, ASDDVersion.SUN_APPSERVER_7_0);
+ }
+
+ private ASDDVersion computeMaxASVersion() {
+ // This is min of (current server target, 9.0) so if we can figure out the
+ // target server, use that, otherwise, use 9.0.
+ ASDDVersion result = getTargetAppServerVersion();
+ if (result == null) {
+ if (primaryDD.getName().startsWith("glassfish-"))
+ result = ASDDVersion.SUN_APPSERVER_10_1;
+ else
+ result = ASDDVersion.SUN_APPSERVER_10_0;
+ LOGGER.log(Level.WARNING,
+ NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_UnidentifiedTargetServer", result.toString())); // NOI18N
+ }
+ return result;
+ }
+
+ public ASDDVersion getMinASVersion() {
+ return minASVersion;
+ }
+
+ public ASDDVersion getMaxASVersion() {
+ return maxASVersion;
+ }
+
+ /** Get the AppServer version to be used for saving deployment descriptors.
+ * Note that this is different than the version of the connected target
+ * application server (which can be queried by the appropriate method on
+ * SunONEDeploymentConfiguration.)
+ *
+ * @return ASDDVersion enum for the appserver version
+ */
+ public ASDDVersion getAppServerVersion() {
+ return appServerVersion;
+ }
+
+ /** Set the AppServer version to be used for saving deployment descriptors.
+ * This version should be greater or equal to "minASVersion" and lesser or
+ * equal to "maxASVersion", as specified by the configuration, otherwise an
+ * IllegalArgumentException will be thrown.
+ *
+ * @param asVersion enum for the appserver version (cannot be null)
+ */
+ public void setAppServerVersion(ASDDVersion asVersion) {
+ if (asVersion.compareTo(getMinASVersion()) < 0) {
+ throw new IllegalArgumentException(asVersion.toString() +
+ " is lower than required minimum version " + getMinASVersion().toString());
+ }
+
+ if (asVersion.compareTo(getMaxASVersion()) > 0) {
+ throw new IllegalArgumentException(asVersion.toString() +
+ " is higher than required maximum version " + getMaxASVersion().toString());
+ }
+
+ if (!asVersion.equals(appServerVersion) || deferredAppServerChange) {
+ appServerVersion = asVersion;
+// ConfigurationStorage localStorage = getStorage();
+// if (localStorage != null) {
+ deferredAppServerChange = false;
+// localStorage.setChanged();
+// }
+ }
+ }
+
+ /** Set the AppServer version to be used for saving deployment descriptors.
+ *
+ * This method is only for use by the DConfigBean tree, used to set the version
+ * while the configuration is being loaded (and thus should not and cannot be
+ * saved, which the public version would do.) Instead, this changes the version
+ * and marks the change unsaved. The version passed in here is the version
+ * actually found in the descriptor file as specified by the DOCTYPE, hence
+ * no range validation. What recourse to take if the version found is actually
+ * outside the "valid range" is as yet an unsupported scenario.
+ *
+ * @param asVersion enum for the appserver version.
+ */
+ void internalSetAppServerVersion(ASDDVersion asVersion) {
+ if (!asVersion.equals(appServerVersion)) {
+ appServerVersion = asVersion;
+ deferredAppServerChange = true;
+ }
+ }
+
+ // !PW FIXME replace these with more stable version of equivalent functionality
+ // once Vince or j2eeserver crew can implement a good api for this.
+ // this code will NOT work for remote servers.
+ private static String [] serverIds = {
+ "pfv3ee6",
+ "pfv4ee7",
+ "pfv5ee8"
+ };
+
+ protected ASDDVersion getTargetAppServerVersion() {
+ ASDDVersion result = null;
+ J2eeModuleProvider provider = getProvider(primaryDD.getParentFile());
+ if (null == provider) {
+ return result;
+ }
+ String serverType = Utils.getInstanceReleaseID(provider); // provider.getServerInstanceID();
+// [/tools/glassfish_b35]deployer:pfv5ee8:localhost:4948, serverType: J2EE
+ if (Arrays.asList(serverIds).contains(serverType)) {
+ // NOI18N
+ String instance = provider.getServerInstanceID();
+ if (Utils.notEmpty(instance)) {
+ try {
+ String asInstallPath = instance.substring(1, instance.indexOf("]deployer:"));
+ if (asInstallPath.contains(File.pathSeparator))
+ asInstallPath = asInstallPath.substring(0, asInstallPath.indexOf(File.pathSeparator));
+ File asInstallFolder = new File(asInstallPath);
+ if (asInstallFolder.exists()) {
+ result = getInstalledAppServerVersion(asInstallFolder);
+ }
+ } catch (IndexOutOfBoundsException ex) {
+ // Can't identify server install folder.
+ LOGGER.log(Level.WARNING, NbBundle.getMessage(PayaraConfiguration.class, "ERR_NoServerInstallLocation", instance)); // NOI18N
+ } catch (NullPointerException ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ } else if ("SUNWebserver7".equals(serverType)) {
+ // NOI18N
+ result = ASDDVersion.SUN_APPSERVER_8_1;
+ }
+
+ return result;
+ }
+
+ protected ASDDVersion getInstalledAppServerVersion(File asInstallFolder) {
+ return getInstalledAppServerVersionFromDirectory(asInstallFolder);
+ }
+
+ static ASDDVersion getInstalledAppServerVersionFromDirectory(File asInstallFolder) {
+ File dtdFolder = new File(asInstallFolder, "lib/dtds/"); // NOI18N
+ if (dtdFolder.exists()) {
+ if (new File(dtdFolder, "payara-web-app_4.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_10_1;
+ }
+ if (new File(dtdFolder, "glassfish-web-app_3_0-1.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_10_1;
+ }
+ if (new File(dtdFolder, "sun-web-app_3_0-0.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_10_0;
+ }
+ if (new File(dtdFolder, "sun-domain_1_3.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_9_0;
+ }
+ if (new File(dtdFolder, "sun-domain_1_2.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_9_0;
+ }
+ if (new File(dtdFolder, "sun-domain_1_1.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_8_1;
+ }
+ if (new File(dtdFolder, "sun-domain_1_0.dtd").exists()) {
+ return ASDDVersion.SUN_APPSERVER_7_0;
+ }
+ }
+
+ return null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Access to V2/V3 specific information. Allows for graceful deprecation
+ // of unsupported features (e.g. CMP, etc.)
+ // ------------------------------------------------------------------------
+
+ protected void createDefaultSunDD(File sunDDFile) throws IOException {
+ FileObject sunDDTemplate = Utils.getSunDDFromProjectsModuleVersion(module, sunDDFile.getName()); //FileUtil.getConfigFile(resource);
+ if (sunDDTemplate != null) {
+ FileObject configFolder = FileUtil.createFolder(sunDDFile.getParentFile());
+ FileSystem fs = configFolder.getFileSystem();
+ XmlFileCreator creator = new XmlFileCreator(sunDDTemplate, configFolder, sunDDTemplate.getName(), sunDDTemplate.getExt());
+ fs.runAtomicAction(creator);
+ }
+ }
+
+ public J2eeModule getJ2eeModule() {
+ return module;
+ }
+
+ public J2EEBaseVersion getJ2eeVersion() {
+ return J2EEBaseVersion.getVersion(module.getType(), module.getModuleVersion());
+ }
+
+ final public org.netbeans.modules.j2ee.dd.api.common.RootInterface getStandardRootDD() {
+ org.netbeans.modules.j2ee.dd.api.common.RootInterface stdRootDD = null;
+ J2eeModuleHelper j2eeModuleHelper = J2eeModuleHelper.getSunDDModuleHelper(module.getType());
+ if(j2eeModuleHelper != null) {
+ stdRootDD = j2eeModuleHelper.getStandardRootDD(module);
+ }
+ return stdRootDD;
+ }
+
+ final public Webservices getWebServicesRootDD() {
+ Webservices wsRootDD = null;
+ J2eeModuleHelper j2eeModuleHelper = J2eeModuleHelper.getSunDDModuleHelper(module.getType());
+ if(j2eeModuleHelper != null) {
+ wsRootDD = j2eeModuleHelper.getWebServicesRootDD(module);
+ }
+ return wsRootDD;
+ }
+
+ public <T> MetadataModel<T> getMetadataModel(Class<T> type) {
+ return module.getMetadataModel(type);
+ }
+
+ /** !PW FIXME web free form project does not implement J2eeModulePrvoider so
+ * this method will fail for that project type. This method is used for:
+ *
+ * * Getting the server instance id => install location for determining
+ * server version.
+ * * Getting the deployment manager => accessing the ResourceConfigurator
+ * and CMP Mapper (V2 only).
+ *
+ */
+ protected J2eeModuleProvider getProvider(File file) {
+ J2eeModuleProvider provider = null;
+ if (file != null) {
+ file = FileUtil.normalizeFile(file);
+ FileObject fo = FileUtil.toFileObject(file);
+ if (fo != null) {
+ Project project = FileOwnerQuery.getOwner(fo);
+ if (project != null) {
+ org.openide.util.Lookup lookup = project.getLookup();
+ provider = lookup.lookup(J2eeModuleProvider.class);
+ }
+ } else {
+ File parent = file.getParentFile();
+ if (parent != null) {
+ provider = getProvider(parent);
+ }
+ }
+ }
+ return provider;
+ }
+
+ // ------------------------------------------------------------------------
+ // J2EE 1.4 Automatic Descriptor updating support.
+ //
+ // Exposed as api outside this package only because CMP related change
+ // listeners need to be injected from j2ee.sun.ddui module and handled
+ // by SunONEDeploymentConfiguration instances only.
+ // ------------------------------------------------------------------------
+ public enum ChangeOperation { CREATE, DELETE };
+
+ void updateDefaultEjbJndiName(final String ejbName, final String prefix, final ChangeOperation op) {
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, op == ChangeOperation.CREATE);
+
+ if(primaryDDFO != null) {
+ boolean changed = false;
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if(eb == null && op == ChangeOperation.CREATE) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+
+ if(eb != null) {
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if(ejb == null && op == ChangeOperation.CREATE) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(ejbName);
+ eb.addEjb(ejb);
+ }
+
+ if(ejb != null) {
+ assert ejbName.equals(ejb.getEjbName());
+
+ String defaultJndiName = ejbName.startsWith(prefix) ? ejbName : (prefix + ejbName);
+ if(op == ChangeOperation.CREATE && Utils.strEmpty(ejb.getJndiName())) {
+ ejb.setJndiName(defaultJndiName);
+ changed = true;
+ } else if(op == ChangeOperation.DELETE && Utils.strEquals(defaultJndiName, ejb.getJndiName())) {
+ ejb.setJndiName(null);
+ if(ejb.isTrivial(Ejb.EJB_NAME)) {
+ eb.removeEjb(ejb);
+ if(eb.isTrivial(null)) {
+ sunEjbJar.setEnterpriseBeans(null);
+ }
+ }
+ changed = true;
+ }
+ }
+ }
+ }
+
+ if(changed) {
+ ddRoot.write(primaryDDFO);
+ }
+ }
+ } catch(IOException ex) {
+ handleEventRelatedIOException(ex);
+ } catch(Exception ex) {
+ handleEventRelatedException(ex);
+ }
+ }
+
+ /**
+ * Set a default Endpoint Address URI for the specified ejb hosted endpoint.
+ */
+ void updateDefaultEjbEndpointUri(final String linkName, final String portName, final ChangeOperation op) {
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+
+ if(primaryDDFO != null) {
+ boolean changed = false;
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if(eb == null && op == ChangeOperation.CREATE) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+
+ if(eb != null) {
+ Ejb ejb = findNamedBean(eb, linkName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if(ejb == null && op == ChangeOperation.CREATE) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(linkName);
+ eb.addEjb(ejb);
+ }
+
+ if(ejb != null) {
+ assert linkName.equals(ejb.getEjbName());
+
+ WebserviceEndpoint endpoint = findNamedBean(ejb, portName, Ejb.WEBSERVICE_ENDPOINT,
+ WebserviceEndpoint.PORT_COMPONENT_NAME);
+ if(endpoint == null && op == ChangeOperation.CREATE) {
+ endpoint = ejb.newWebserviceEndpoint();
+ endpoint.setPortComponentName(portName);
+ ejb.addWebserviceEndpoint(endpoint);
+ }
+
+ if(endpoint != null) {
+ assert portName.equals(endpoint.getPortComponentName());
+
+ if(op == ChangeOperation.CREATE && Utils.strEmpty(endpoint.getEndpointAddressUri())) {
+ String defaultUri = portName;
+ endpoint.setEndpointAddressUri(defaultUri);
+ changed = true;
+ } else if(op == ChangeOperation.DELETE) {
+ endpoint.setEndpointAddressUri(null);
+ if(endpoint.isTrivial(WebserviceEndpoint.PORT_COMPONENT_NAME)) {
+ ejb.removeWebserviceEndpoint(endpoint);
+ if(ejb.isTrivial(Ejb.EJB_NAME)) {
+ eb.removeEjb(ejb);
+ if(eb.isTrivial(null)) {
+ sunEjbJar.setEnterpriseBeans(null);
+ }
+ }
+ }
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+
+ if(changed) {
+ ddRoot.write(primaryDDFO);
+ }
+ }
+ } catch(IOException ex) {
+ handleEventRelatedIOException(ex);
+ } catch(Exception ex) {
+ handleEventRelatedException(ex);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // J2EE Server API implementations
+ // ------------------------------------------------------------------------
+
+ // ------------------------------------------------------------------------
+ // Implementation of ContextRootConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public String getContextRoot() throws ConfigurationException {
+ // assume the return value will be the default CR
+ String contextRoot = defaultcr;
+ if (J2eeModule.Type.WAR.equals(module.getType())) {
+ try {
+ RootInterface rootDD = getPayaraDDRoot(false);
+ if (rootDD instanceof SunWebApp) {
+ // read the value of CR out of the DD file.
+ contextRoot = ((SunWebApp) rootDD).getContextRoot();
+ if((contextRoot != null) && (contextRoot.equals("/"))) { //NOI18N
+ contextRoot = ""; //NOI18N
+ } else if (null == contextRoot) {
+ // if there wasn't a value for context-root in the file... use the default
+ contextRoot = defaultcr;
+ }
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.WARNING, ex.getLocalizedMessage(), ex);
+ String defaultMessage = " retrieving context-root from sun-web.xml";
+ displayError(ex, defaultMessage);
+ }
+ } else {
+ LOGGER.log(Level.WARNING,
+ "PayaraConfiguration.getContextRoot() invoked on incorrect module type: {0}",
+ module.getType());
+ }
+ return contextRoot;
+ }
+
+ private static final RequestProcessor RP = new RequestProcessor("PayaraConfiguration.setContextRoot");
+
+ @Override
+ public void setContextRoot(final String contextRoot) throws ConfigurationException {
+ try {
+ if (J2eeModule.Type.WAR.equals(module.getType())) {
+ if (null != defaultcr && defaultcr.equals(contextRoot)) {
+ // remove the context-root entry from the DD file... if it exists
+ final FileObject sunDDFO = getPayaraDD(primaryDD, false);
+ if (null != sunDDFO) {
+ // remove the context-root element from the file
+ RP.post(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (sunDDFO != null) {
+ RootInterface rootDD = PayaraDDProvider.getDefault().getDDRoot(sunDDFO);
+ if (rootDD instanceof SunWebApp) {
+ SunWebApp swa = (SunWebApp) rootDD;
+ swa.setContextRoot(null);
+ swa.write(sunDDFO);
+ }
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ String defaultMessage = " trying set context-root in sun-web.xml";
+ displayError(ex, defaultMessage);
+ } catch (Exception ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ String defaultMessage = " trying set context-root in sun-web.xml";
+ displayError(ex, defaultMessage);
+ }
+ }
+ });
+ }
+ } else {
+ // create the DD file and set the value of the context-root element
+ final FileObject sunDDFO = getPayaraDD(primaryDD, true);
+ RP.post(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (sunDDFO != null) {
+ RootInterface rootDD = PayaraDDProvider.getDefault().getDDRoot(sunDDFO);
+ if (rootDD instanceof SunWebApp) {
+ SunWebApp swa = (SunWebApp) rootDD;
+ if (contextRoot == null || contextRoot.trim().length() == 0) {
+ swa.setContextRoot("/"); //NOI18N
+ } else {
+ swa.setContextRoot(contextRoot);
+ }
+ swa.write(sunDDFO);
+ }
+ }
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ String defaultMessage = " trying set context-root in sun-web.xml";
+ displayError(ex, defaultMessage);
+ } catch (Exception ex) {
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ String defaultMessage = " trying set context-root in sun-web.xml";
+ displayError(ex, defaultMessage);
+ }
+ }
+ });
+ }
+ } else {
+ LOGGER.log(Level.WARNING, // NOI18N
+ "PayaraConfiguration.setContextRoot() invoked on incorrect module type: {0}", // NOI18N
+ module.getType());
+ }
+ } catch (IOException ex) {
+ throw new ConfigurationException("", ex); // NOI18N
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Implementation of DatasourceConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public abstract Set<Datasource> getDatasources() throws ConfigurationException;
+
+ @Override
+ public abstract boolean supportsCreateDatasource();
+
+ @Override
+ public abstract Datasource createDatasource(String jndiName, String url,
+ String username, String password, String driver)
+ throws UnsupportedOperationException, ConfigurationException, DatasourceAlreadyExistsException;
+
+ @Override
+ public void bindDatasourceReference(String referenceName, String jndiName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(referenceName) || Utils.strEmpty(jndiName)) {
+ return;
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ ResourceRef ref = findNamedBean(ddRoot, referenceName, SunWebApp.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (ref != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(ref.getResRefName());
+ ref.setJndiName(jndiName);
+ } else {
+ // add new resource-ref
+ if (ddRoot instanceof SunWebApp) {
+ ref = ((SunWebApp) ddRoot).newResourceRef();
+ } else if (ddRoot instanceof SunApplicationClient) {
+ ref = ((SunApplicationClient) ddRoot).newResourceRef();
+ }
+ if (null != ref) {
+ ref.setResRefName(referenceName);
+ ref.setJndiName(jndiName);
+ ddRoot.addValue(SunWebApp.RESOURCE_REF, ref);
+ }
+ }
+
+ // if changes, save file.
+ ddRoot.write(primaryDDFO);
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ @Override
+ public void bindDatasourceReferenceForEjb(String ejbName, String ejbType,
+ String referenceName, String jndiName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(ejbName) || Utils.strEmpty(ejbType) ||
+ Utils.strEmpty(referenceName) || Utils.strEmpty(jndiName)) {
+ return;
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb == null) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb == null) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(ejbName);
+ eb.addEjb(ejb);
+ }
+
+ ResourceRef ref = findNamedBean(ejb, referenceName, Ejb.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (ref != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(ref.getResRefName());
+ ref.setJndiName(jndiName);
+ } else {
+ // add new resource-ref
+ ref = ejb.newResourceRef();
+ ref.setResRefName(referenceName);
+ ref.setJndiName(jndiName);
+ ejb.addValue(Ejb.RESOURCE_REF, ref);
+ }
+
+ // if changes, save file.
+ sunEjbJar.write(primaryDDFO);
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ @Override
+ public String findDatasourceJndiName(String referenceName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(referenceName)) {
+ return null;
+ }
+
+ String jndiName = null;
+ try {
+ RootInterface ddRoot = getPayaraDDRoot(false);
+ ResourceRef ref = findNamedBean(ddRoot, referenceName, SunWebApp.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (ref != null) {
+ // get jndi name of existing reference.
+ assert referenceName.equals(ref.getResRefName());
+ jndiName = ref.getJndiName();
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+
+ return jndiName; }
+
+ @Override
+ public String findDatasourceJndiNameForEjb(String ejbName, String referenceName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(ejbName) || Utils.strEmpty(referenceName)) {
+ return null;
+ }
+
+ String jndiName = null;
+ try {
+ RootInterface ddRoot = getPayaraDDRoot(false);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb != null) {
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb != null) {
+ ResourceRef ref = findNamedBean(ejb, referenceName, Ejb.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (ref != null) {
+ // get jndi name of existing reference.
+ assert referenceName.equals(ref.getResRefName());
+ jndiName = ref.getJndiName();
+ }
+ }
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingResourceRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+
+ return jndiName;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Implementation of EjbResourceConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public String findJndiNameForEjb(String ejbName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(ejbName)) {
+ return null;
+ }
+
+ String jndiName = null;
+ try {
+ RootInterface ddRoot = getPayaraDDRoot(false);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb != null) {
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb != null) {
+ // get jndi name of existing reference.
+ assert ejbName.equals(ejb.getEjbName());
+ jndiName = ejb.getJndiName();
+ }
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingEjb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionReadingEjb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+
+ return jndiName;
+ }
+
+ @Override
+ public void bindEjbReference(String referenceName, String jndiName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(referenceName) || Utils.strEmpty(jndiName)) {
+ return;
+ }
+
+ // Version > 2.4, then return, but we can't compare directly against 2.4
+ // because FP formats are not exact.
+ //
+ // !PW this appears to be overloaded logic in that it's differentiating
+ // servlet 2.4 from servlet 2.5 and also appclient 1.4 from appclient 5.0,
+ // hence the odd usage of "2.45" in the comparison.
+ //
+ try {
+ if (Double.parseDouble(module.getModuleVersion()) > 2.45) {
+ return;
+ }
+ } catch(NumberFormatException ex) {
+ LOGGER.log(Level.WARNING, ex.getLocalizedMessage(), ex);
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ EjbRef ref = findNamedBean(ddRoot, referenceName, SunWebApp.EJB_REF, EjbRef.EJB_REF_NAME);
+ if (ref != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(ref.getEjbRefName());
+ ref.setJndiName(jndiName);
+ } else {
+ // add new ejb-ref
+ if (ddRoot instanceof SunWebApp) {
+ ref = ((SunWebApp) ddRoot).newEjbRef();
+ } else if (ddRoot instanceof SunApplicationClient) {
+ ref = ((SunApplicationClient) ddRoot).newEjbRef();
+ }
+ if (ref != null) {
+ ref.setEjbRefName(referenceName);
+ ref.setJndiName(jndiName);
+ ddRoot.addValue(SunWebApp.EJB_REF, ref);
+ }
+ }
+
+ // if changes, save file.
+ ddRoot.write(primaryDDFO);
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingEjbRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingEjbRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ @Override
+ public void bindEjbReferenceForEjb(String ejbName, String ejbType, String referenceName,
+ String jndiName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(ejbName) || Utils.strEmpty(ejbType) ||
+ Utils.strEmpty(referenceName) || Utils.strEmpty(jndiName)) {
+ return;
+ }
+
+ // Version > 2.1, then return, but we can't compare directly against 2.1
+ // because FP formats are not exact.
+ try {
+ if (Double.parseDouble(module.getModuleVersion()) > 2.15) {
+ return;
+ }
+ } catch(NumberFormatException ex) {
+ LOGGER.log(Level.WARNING, ex.getLocalizedMessage(), ex);
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb == null) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb == null) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(ejbName);
+ eb.addEjb(ejb);
+ }
+
+ EjbRef ref = findNamedBean(ejb, referenceName, Ejb.EJB_REF, EjbRef.EJB_REF_NAME);
+ if (ref != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(ref.getEjbRefName());
+ ref.setJndiName(jndiName);
+ } else {
+ // add new ejb-ref
+ ref = ejb.newEjbRef();
+ ref.setEjbRefName(referenceName);
+ ref.setJndiName(jndiName);
+ ejb.addValue(Ejb.EJB_REF, ref);
+ }
+
+ // if changes, save file.
+ sunEjbJar.write(primaryDDFO);
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingEjbRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingEjbRef", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Implementation of MessageDestinationConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public abstract Set<MessageDestination> getMessageDestinations() throws ConfigurationException;
+
+ @Override
+ public abstract boolean supportsCreateMessageDestination();
+
+ @Override
+ public abstract MessageDestination createMessageDestination(String name, Type type)
+ throws UnsupportedOperationException, ConfigurationException;
+
+ @Override
+ public void bindMdbToMessageDestination(String mdbName, String name, Type type) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(mdbName) || Utils.strEmpty(name)) {
+ return;
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ if (ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb == null) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+ Ejb ejb = findNamedBean(eb, mdbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb == null) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(mdbName);
+ eb.addEjb(ejb);
+ }
+ ejb.setJndiName(name);
+ String factory = name + "Factory"; //NOI18N
+ MdbConnectionFactory connFactory = ejb.newMdbConnectionFactory();
+ connFactory.setJndiName(factory);
+ ejb.setMdbConnectionFactory(connFactory);
+// /* I think the following is not needed. These entries are being created through
+// * some other path - Peter
+// */
+// org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination destination =
+// findNamedBean(eb, mdbName, EnterpriseBeans.MESSAGE_DESTINATION,
+// org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination.JNDI_NAME);
+// if (destination == null) {
+// destination = eb.newMessageDestination();
+// destination.setJndiName(name);
+// eb.addMessageDestination(destination);
+// }
+ // if changes, save file.
+ ddRoot.write(primaryDDFO);
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ @Override
+ public String findMessageDestinationName(String mdbName) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(mdbName)) {
+ return null;
+ }
+
+ String destinationName = null;
+ try {
+ RootInterface ddRoot = getPayaraDDRoot(false);
+ if(ddRoot instanceof SunEjbJar) {
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb != null) {
+ Ejb ejb = findNamedBean(eb, mdbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb != null) {
+ assert mdbName.equals(ejb.getEjbName());
+ destinationName = ejb.getJndiName();
+ }
+ }
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ return destinationName;
+ }
+
+ @Override
+ public void bindMessageDestinationReference(String referenceName, String connectionFactoryName,
+ String destName, Type type) throws ConfigurationException {
+ // validation
+ if (Utils.strEmpty(referenceName) || Utils.strEmpty(connectionFactoryName) || Utils.strEmpty(destName)) {
+ return;
+ }
+
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ MessageDestinationRef destRef = findNamedBean(ddRoot, referenceName,
+ SunWebApp.MESSAGE_DESTINATION_REF, MessageDestinationRef.MESSAGE_DESTINATION_REF_NAME);
+ if (destRef != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(destRef.getMessageDestinationRefName());
+ destRef.setJndiName(referenceName);
+ } else {
+ // add new resource-ref
+ if (ddRoot instanceof SunWebApp) {
+ destRef = ((SunWebApp) ddRoot).newMessageDestinationRef();
+ } else if (ddRoot instanceof SunApplicationClient) {
+ destRef = ((SunApplicationClient) ddRoot).newMessageDestinationRef();
+ }
+ if (null != destRef) {
+ destRef.setJndiName(referenceName);
+ destRef.setMessageDestinationRefName(referenceName);
+ ddRoot.addValue(SunWebApp.MESSAGE_DESTINATION_REF, destRef);
+ }
+ }
+
+ ResourceRef factoryRef = findNamedBean(ddRoot, connectionFactoryName,
+ SunWebApp.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (factoryRef != null) {
+ // set jndi name of existing reference.
+ assert connectionFactoryName.equals(factoryRef.getResRefName());
+ factoryRef.setJndiName(connectionFactoryName);
+ } else {
+ // add new resource-ref
+ if (ddRoot instanceof SunWebApp) {
+ factoryRef = ((SunWebApp) ddRoot).newResourceRef();
+ } else if (ddRoot instanceof SunApplicationClient) {
+ factoryRef = ((SunApplicationClient) ddRoot).newResourceRef();
+ }
+ if (null != factoryRef) {
+ factoryRef.setResRefName(connectionFactoryName);
+ factoryRef.setJndiName(connectionFactoryName);
+ ddRoot.addValue(SunWebApp.RESOURCE_REF, factoryRef);
+ }
+ }
+
+ // if changes, save file.
+ ddRoot.write(primaryDDFO);
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ @Override
+ public void bindMessageDestinationReferenceForEjb(String ejbName, String ejbType, String referenceName,
+ String connectionFactoryName, String destName, Type type) throws ConfigurationException {
+ try {
+ FileObject primaryDDFO = getPayaraDD(primaryDD, true);
+ if (primaryDDFO != null) {
+ RootInterface ddRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ SunEjbJar sunEjbJar = (SunEjbJar) ddRoot;
+ EnterpriseBeans eb = sunEjbJar.getEnterpriseBeans();
+ if (eb == null) {
+ eb = sunEjbJar.newEnterpriseBeans();
+ sunEjbJar.setEnterpriseBeans(eb);
+ }
+ Ejb ejb = findNamedBean(eb, ejbName, EnterpriseBeans.EJB, Ejb.EJB_NAME);
+ if (ejb == null) {
+ ejb = eb.newEjb();
+ ejb.setEjbName(ejbName);
+ eb.addEjb(ejb);
+ }
+ if ((org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.SESSION.equals(ejbType)) ||
+ (org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.ENTITY.equals(ejbType))) {
+ org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef ref =
+ findNamedBean(ejb, connectionFactoryName, Ejb.RESOURCE_REF, ResourceRef.RES_REF_NAME);
+ if (ref != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(ref.getResRefName());
+ ref.setJndiName(connectionFactoryName);
+ } else {
+ // add new resource-ref
+ ref = ejb.newResourceRef();
+ ref.setResRefName(connectionFactoryName);
+ ref.setJndiName(connectionFactoryName);
+ ejb.addResourceRef(ref);
+ }
+
+ MessageDestinationRef destRef = findNamedBean(ejb, referenceName,
+ Ejb.MESSAGE_DESTINATION_REF, MessageDestinationRef.MESSAGE_DESTINATION_REF_NAME);
+ if (destRef != null) {
+ // set jndi name of existing reference.
+ assert referenceName.equals(destRef.getMessageDestinationRefName());
+ destRef.setJndiName(referenceName);
+ } else {
+ destRef = ejb.newMessageDestinationRef();
+ destRef.setJndiName(referenceName);
+ destRef.setMessageDestinationRefName(referenceName);
+ ejb.addMessageDestinationRef(destRef);
+ }
+ } else if(org.netbeans.modules.j2ee.dd.api.ejb.EnterpriseBeans.MESSAGE_DRIVEN.equals(ejbType)){
+ ejb.setJndiName(referenceName);
+ MdbConnectionFactory connFactory = ejb.newMdbConnectionFactory();
+ connFactory.setJndiName(connectionFactoryName);
+ ejb.setMdbConnectionFactory(connFactory);
+ org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination destination =
+ findNamedBean(eb, referenceName, EnterpriseBeans.MESSAGE_DESTINATION,
+ org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination.JNDI_NAME);
+ if (destination == null) {
+ destination = eb.newMessageDestination();
+ destination.setJndiName(referenceName);
+ eb.addMessageDestination(destination);
+ }
+ }
+ // if changes, save file.
+ ddRoot.write(primaryDDFO);
+ }
+ } catch (IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ } catch (Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ String message = NbBundle.getMessage(PayaraConfiguration.class,
+ "ERR_ExceptionBindingMdb", ex.getClass().getSimpleName()); // NOI18N
+ throw new ConfigurationException(message, ex);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of DeploymentPlanConfiguration.
+ //
+ // save(OutputStream) is renamed due to conflict with JSR-88 method
+ // DeploymentConfiguration.save(OutputStream). Differentiation between
+ // these two methods is performed by ModuleConfigurationImpl class.
+ // ------------------------------------------------------------------------
+ public void saveConfiguration(OutputStream outputStream) throws ConfigurationException {
+ try {
+ if (this.module.getType().equals(J2eeModule.Type.WAR)) {
+ // copy sun-web.xml to stream directly.
+ FileObject configFO = FileUtil.toFileObject(primaryDD);
+ if(configFO != null) {
+ RootInterface rootDD = PayaraDDProvider.getDefault().getDDRoot(configFO);
+ rootDD.write(outputStream);
+ }
+ } else {
+ LOGGER.log(Level.WARNING,
+ "Deployment plan not supported in PayaraConfiguration.save()");
+ }
+ } catch(Exception ex) {
+ throw new ConfigurationException(ex.getMessage(), ex);
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Internal implementation methods.
+ // ------------------------------------------------------------------------
+
+ /* ------------------------------------------------------------------------
+ * Default descriptor file creation, root interface retrieval
+ */
+ // This method is only useful for reading the model. If the model is to
+ // be modified and rewritten to disk, you'll need the FileObject it was
+ // retrieved from as well.
+ protected RootInterface getPayaraDDRoot(boolean create) throws IOException {
+ RootInterface payaraDDRoot = null;
+ FileObject primaryDDFO = getPayaraDD(primaryDD, create);
+ if (primaryDDFO != null) {
+ payaraDDRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ } else {
+ FileObject secondaryDDFO = getPayaraDD(secondaryDD, create);
+ if (secondaryDDFO != null) {
+ payaraDDRoot = DDProvider.getDefault().getDDRoot(secondaryDDFO);
+ }
+ }
+ return payaraDDRoot;
+ }
+
+ public RootInterface getPayaraDDRoot(File payaraDD, boolean create) throws IOException {
+ RootInterface payaraDDRoot = null;
+ FileObject primaryDDFO = getPayaraDD(payaraDD, create);
+ if (primaryDDFO != null) {
+ payaraDDRoot = PayaraDDProvider.getDefault().getDDRoot(primaryDDFO);
+ }
+ return payaraDDRoot;
+ }
+
+ protected FileObject getPayaraDD(File payaraDDFile, boolean create) throws IOException {
+ if (!payaraDDFile.exists()) {
+ if (create) {
+ createDefaultSunDD(payaraDDFile);
+ } else {
+ return null;
+ }
+ }
+ return FileUtil.toFileObject(payaraDDFile);
+ }
+
+ protected void displayError(Exception ex, String defaultMessage) {
+ String message = ex.getLocalizedMessage();
+ if(message == null || message.length() == 0) {
+ message = ex.getClass().getSimpleName() + defaultMessage;
+ }
+ final NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
+ message, NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notifyLater(msg);
+ }
+
+ // Could have beanProp & nameProp in db indexed by Class<T>
+ protected <T extends CommonDDBean> T findNamedBean(
+ CommonDDBean parentDD, String referenceName, /*Class<T> c,*/ String beanProp, String nameProp) {
+ T result = null;
+ @SuppressWarnings("unchecked")
+ T[] beans = (T[]) parentDD.getValues(beanProp);
+ if (beans != null) {
+ for (int i = 0; i < beans.length; i++) {
+ String name = (String) beans[i].getValue(nameProp);
+ if (referenceName.equals(name)) {
+ result = beans[i];
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ void addDescriptorListener(FileObject target) {
+ // Note: We don't use target to locate the genuine descriptor file. We
+ // lookup the descriptor file through proper channels and add a listener
+ // to that result (which 99% of the time ought to be the same as what was
+ // passed in here. But there's that pesky 1% case.... bleah.)
+ addDescriptorListener("webservices.xml".equals(target.getNameExt()) ?
+ getWebServicesRootDD() : getStandardRootDD());
+ }
+
+ private void addDescriptorListener(org.netbeans.modules.j2ee.dd.api.common.RootInterface rootDD) {
+ if(rootDD != null) {
+ descriptorListener.addListener(rootDD);
+ }
+ }
+
+ protected void handleEventRelatedIOException(IOException ex) {
+ // This is a legitimate exception that could occur, such as a problem
+ // writing the changed descriptor to disk.
+ // !PW FIXME notify user
+ // RR = could do handleEventRelatedException(ex) instead
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ protected void handleEventRelatedException(Exception ex) {
+ // This would probably be a runtime exception due to a bug, but we
+ // must trap it here so it doesn't cause trouble upstream.
+ // We handle it the same as above for now.
+ // !PW FIXME should we notify here, or just log?
+ LOGGER.log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ // ------------------------------------------------------------------------
+ // !PW FIXME workaround for linking sun descriptor file DataObjects w/ the
+ // correct Deployment Configuration object. Key is primary File for configuration.
+ // ------------------------------------------------------------------------
+ private static final Object configurationMonitor = new Object();
+ private static final WeakHashMap<File, WeakReference<PayaraConfiguration>> configurationMap =
+ new WeakHashMap<File, WeakReference<PayaraConfiguration>>();
+
+ public static void addConfiguration(File key, PayaraConfiguration config) {
+ synchronized(configurationMonitor) {
+ configurationMap.put(key, new WeakReference<PayaraConfiguration>(config));
+ }
+ }
+
+ public static void removeConfiguration(File key) {
+ synchronized(configurationMonitor) {
+ configurationMap.remove(key);
+ }
+ }
+
+ public static PayaraConfiguration getConfiguration(File key) {
+ PayaraConfiguration config = null;
+ WeakReference<PayaraConfiguration> ref = null;
+ synchronized(configurationMonitor) {
+ ref = configurationMap.get(key);
+ }
+ if (ref != null) {
+ config = ref.get();
+ }
+ return config;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ServletVersion.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ServletVersion.java
new file mode 100644
index 0000000..a032d95
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/api/config/ServletVersion.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+
+/**
+ * Enumerated types for Servlet Version
+ *
+ * @author Peter Williams
+ */
+public final class ServletVersion extends J2EEBaseVersion {
+
+ /** Represents servlet version 2.3
+ */
+ public static final ServletVersion SERVLET_2_3 = new ServletVersion(
+ "2.3", 2300, // NOI18N
+ "1.3", 1300 // NOI18N
+ );
+
+ /** Represents servlet version 2.4
+ */
+ public static final ServletVersion SERVLET_2_4 = new ServletVersion(
+ "2.4", 2401, // NOI18N
+ "1.4", 1400 // NOI18N
+ );
+
+ /** Represents servlet version 2.5
+ */
+ public static final ServletVersion SERVLET_2_5 = new ServletVersion(
+ "2.5", 2500, // NOI18N
+ "5.0", 5000 // NOI18N
+ );
+
+ /** Represents servlet version 3.0
+ */
+ public static final ServletVersion SERVLET_3_0 = new ServletVersion(
+ "3.0", 3000, // NOI18N
+ "6.0", 6000 // NOI18N
+ );
+
+ /** -----------------------------------------------------------------------
+ * Implementation
+ */
+
+ /** Creates a new instance of ServletVersion
+ */
+ private ServletVersion(String version, int nv, String specVersion, int nsv) {
+ super(version, nv, specVersion, nsv);
+ }
+
+ /** Comparator implementation that works only on ServletVersion objects
+ *
+ * @param obj ServletVersion to compare with.
+ * @return -1, 0, or 1 if this version is less than, equal to, or greater
+ * than the version passed in as an argument.
+ * @throws ClassCastException if obj is not a ServletVersion object.
+ */
+ public int compareTo(Object obj) {
+ ServletVersion target = (ServletVersion) obj;
+ return numericCompare(target);
+ }
+
+ public static ServletVersion getServletVersion(String version) {
+ ServletVersion result = null;
+
+ if(SERVLET_2_3.toString().equals(version)) {
+ result = SERVLET_2_3;
+ } else if(SERVLET_2_4.toString().equals(version)) {
+ result = SERVLET_2_4;
+ } else if(SERVLET_2_5.toString().equals(version)) {
+ result = SERVLET_2_5;
+ } else if(SERVLET_3_0.toString().equals(version)) {
+ result = SERVLET_3_0;
+ }
+
+ return result;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/impl/web/model_4/package-info.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/impl/web/model_4/package-info.java
new file mode 100644
index 0000000..fa755a2
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/impl/web/model_4/package-info.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+@Schema2Beans(
+ schema = "../../../resources/payara-web-app_4.dtd",
+ schemaType = DTD,
+ mddFile = "../../../resources/payara-web-app_4.mdd",
+ outputType = TRADITIONAL_BASEBEAN,
+ docRoot = "payara-web-app",
+ useInterfaces = true,
+ attrProp = true,
+ java5 = true
+)
+package org.netbeans.modules.payara.eecommon.dd.impl.web.model_4;
+
+import org.netbeans.modules.schema2beans.Schema2Beans;
+import static org.netbeans.modules.schema2beans.Schema2Beans.OutputType.TRADITIONAL_BASEBEAN;
+import static org.netbeans.modules.schema2beans.Schema2Beans.SchemaType.DTD;
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/Bundle.properties b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/Bundle.properties
new file mode 100644
index 0000000..d9f32e7
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/Bundle.properties
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+PayaraResolver=payara-* Deployment Descriptor File
+
+CTL_SourceTabCaption=XML
+CTL_JmsTabCaption=Messaging
+CTL_OverviewTabCaption=General
+CTL_SecurityTabCaption=Security
+CTL_ServletsTabCaption=Servlets
+CTL_WebServiceTabCaption=Web Services
+CTL_EnvTabCaption=Environment
+CTL_EjbTabCaption=EJB
+
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDProvider.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDProvider.java
new file mode 100644
index 0000000..67da267
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDProvider.java
@@ -0,0 +1,1018 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.loader;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion;
+import org.netbeans.modules.j2ee.sun.dd.api.DDException;
+import org.netbeans.modules.j2ee.sun.dd.api.DDProvider;
+import org.netbeans.modules.j2ee.sun.dd.api.RootInterface;
+import org.netbeans.modules.j2ee.sun.dd.api.app.SunApplication;
+import org.netbeans.modules.j2ee.sun.dd.api.client.SunApplicationClient;
+import org.netbeans.modules.j2ee.sun.dd.api.ejb.SunEjbJar;
+import org.netbeans.modules.j2ee.sun.dd.api.serverresources.Resources;
+import org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp;
+import org.netbeans.modules.j2ee.sun.dd.impl.DTDRegistry;
+import org.netbeans.modules.j2ee.sun.dd.impl.RootInterfaceImpl;
+import org.netbeans.modules.j2ee.sun.dd.impl.app.SunApplicationProxy;
+import org.netbeans.modules.j2ee.sun.dd.impl.client.SunApplicationClientProxy;
+import org.netbeans.modules.j2ee.sun.dd.impl.common.DDProviderDataObject;
+import org.netbeans.modules.j2ee.sun.dd.impl.common.SunBaseBean;
+import org.netbeans.modules.j2ee.sun.dd.impl.ejb.SunEjbJarProxy;
+import org.netbeans.modules.j2ee.sun.dd.impl.serverresources.ResourcesProxy;
+import org.netbeans.modules.j2ee.sun.dd.impl.web.SunWebAppProxy;
+import org.netbeans.modules.schema2beans.Common;
+import org.netbeans.modules.schema2beans.GraphManager;
+import org.netbeans.modules.schema2beans.Schema2BeansException;
+import org.netbeans.modules.schema2beans.Schema2BeansRuntimeException;
+import org.netbeans.modules.xml.api.EncodingUtil;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileChangeAdapter;
+import org.openide.filesystems.FileEvent;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectNotFoundException;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Provides access to Deployment Descriptor root objects.
+ *
+ * @author Peter Williams
+ * @author Nitya Doraisamy
+ * @author Gaurav Gupta
+ */
+public final class PayaraDDProvider {
+
+ public static final String PAYARA_WEBAPP_4_DTD_PUBLIC_ID = "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN";
+
+ public static final String VERSION_4 = "4";
+
+ private static final PayaraDDProvider INSTANCE = new PayaraDDProvider();
+
+ private static final DDProvider ddProvider = DDProvider.getDefault();
+
+ private PayaraDDProvider() {
+ }
+
+ /**
+ * Accessor method for DDProvider singleton
+ *
+ * @return DDProvider object
+ */
+ public static PayaraDDProvider getDefault() {
+ return INSTANCE;
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is source representing the sun-ejb-jar.xml file
+ * @return Ejb object - root of the deployment descriptor bean graph
+ */
+ public SunEjbJar getEjbDDRoot(InputSource is) throws IOException, SAXException {
+ DDParse parse = new DDParse(is);
+ SunEjbJar ejbRoot = createEjbJar(parse);
+ SunEjbJarProxy proxy = new SunEjbJarProxy(ejbRoot, ejbRoot.getVersion().toString());
+ setErrorStatus(proxy, parse);
+ return proxy;
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is source representing the sun-web.xml file
+ * @return Web object - root of the deployment descriptor bean graph
+ */
+ public SunWebApp getWebDDRoot(InputSource is) throws IOException, SAXException, DDException {
+ return processWebAppParseTree(new DDParse(is));
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is stream representing the sun-web.xml file
+ * @return Web object - root of the deployment descriptor bean graph
+ */
+ public SunWebApp getWebDDRoot(InputStream is) throws IOException, SAXException, DDException {
+ return processWebAppParseTree(new DDParse(is));
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param doc XML document representing the sun-web.xml file
+ * @return Web object - root of the deployment descriptor bean graph
+ */
+ public SunWebApp getWebDDRoot(Document doc) throws DDException {
+ return processWebAppParseTree(new DDParse(doc, null));
+ }
+
+ private SunWebApp processWebAppParseTree(DDParse parse) throws DDException {
+ SunWebApp webRoot = createWebApp(parse);
+ SunWebAppProxy proxy = new SunWebAppProxy(webRoot, webRoot.getVersion().toString());
+ setErrorStatus(proxy, parse);
+ return proxy;
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is source representing the sun-application.xml file
+ * @return Application object - root of the deployment descriptor bean graph
+ */
+ public SunApplication getAppDDRoot(InputSource is) throws IOException, SAXException {
+ DDParse parse = new DDParse(is);
+ SunApplication appRoot = createApplication(parse);
+ SunApplicationProxy proxy = new SunApplicationProxy(appRoot, appRoot.getVersion().toString());
+ setErrorStatus(proxy, parse);
+ return proxy;
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is source representing the sun-application-client.xml file
+ * @return Application object - root of the deployment descriptor bean graph
+ */
+ public SunApplicationClient getAppClientDDRoot(InputSource is) throws IOException, SAXException {
+ DDParse parse = new DDParse(is);
+ SunApplicationClient appClientRoot = createApplicationClient(parse);
+ SunApplicationClientProxy proxy = new SunApplicationClientProxy(appClientRoot, appClientRoot.getVersion().toString());
+ setErrorStatus(proxy, parse);
+ return proxy;
+ }
+
+ private static void setErrorStatus(RootInterfaceImpl rootProxy, DDParse parse) {
+ SAXParseException error = parse.getWarning();
+ rootProxy.setError(error);
+ if (error != null) {
+ rootProxy.setStatus(RootInterface.STATE_INVALID_PARSABLE);
+ } else {
+ rootProxy.setStatus(RootInterface.STATE_VALID);
+ }
+ }
+
+ final private Map<Object, RootInterface> ddMap = new WeakHashMap<Object, RootInterface>();
+ private Map<FileObject, DDProviderDataObject> dObjMap = new WeakHashMap<FileObject, DDProviderDataObject>();
+
+ /**
+ * This method retrieves the root of the XML DOM for a sun-* deployment
+ * descriptor file.
+ *
+ * Caveat: Calling code should hold a strong reference to the FileObject
+ * used in this call for as long as the RootInterface is needed. Otherwise,
+ * it is possible that the DataObject managing the XML graph will be GC'd If
+ * this happens, subsequent reads & writes to the graph will be invalid
+ * and/or throw unexpected exceptions and there is a risk of dataloss.
+ *
+ * @param fo FileObject of sun descriptor file for desired graph
+ * @return Root of XML DOM, if any, for this descriptor file.
+ * @throws java.io.IOException if there is a problem reading the file.
+ */
+ public RootInterface getDDRoot(FileObject fo) throws IOException {
+ RootInterface rootProxy;
+ if (fo == null) {
+ return null;
+ }
+
+ try {
+ DataObject dataObject = DataObject.find(fo);
+ if (dataObject instanceof DDProviderDataObject) {
+ rootProxy = getDDRoot0((DDProviderDataObject) dataObject, fo);
+ if (rootProxy != null) {
+ return rootProxy;
+ }
+ }
+ } catch (DataObjectNotFoundException e) {
+ return ddProvider.getDDRoot(fo); // should not occur
+ }
+
+ synchronized (ddMap) {
+ rootProxy = ddMap.get(fo);
+ if (rootProxy != null) {
+ return rootProxy;
+ }
+ }
+
+ // XXX Where should this listener be removed? Isn't removed anywhere presently.
+ fo.addFileChangeListener(new SunDDFileChangeListener());
+
+ InputStream is = null;
+ try {
+ is = fo.getInputStream();
+ DDParse parse = new DDParse(is);
+ RootInterface tmpRootProxy = parse.createProxy();
+
+ synchronized (ddMap) {
+ rootProxy = ddMap.get(fo);
+ if (rootProxy == null) {
+ rootProxy = tmpRootProxy;
+ ddMap.put(fo, rootProxy);
+ }
+ }
+ } catch (Schema2BeansException | Schema2BeansRuntimeException | SAXException | IOException ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+
+ return rootProxy != null ? rootProxy : ddProvider.getDDRoot(fo);
+ }
+
+ private RootInterface getDDRoot0(final DDProviderDataObject ddProviderDataObject, final FileObject refFO) throws IOException {
+ RootInterface rootProxy = null;
+ synchronized (ddMap) {
+ rootProxy = ddMap.get(ddProviderDataObject);
+ if (rootProxy == null) {
+ try {
+ rootProxy = getDDRoot(ddProviderDataObject.createReader());
+ if (rootProxy != null) {
+ ddMap.put(ddProviderDataObject, rootProxy);
+ }
+ } catch (Schema2BeansException | Schema2BeansRuntimeException | SAXException | IOException ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+
+ if (rootProxy != null) {
+ dObjMap.put(refFO, ddProviderDataObject);
+ }
+ }
+
+ return rootProxy;
+ }
+
+ public RootInterface getDDRoot(Reader reader) throws IOException, SAXException, Schema2BeansException {
+ return getDDRoot(new InputSource(reader));
+ }
+
+ public RootInterface getDDRoot(InputSource inputSource) throws IOException, SAXException, Schema2BeansException {
+ return getDDRoot(inputSource, null);
+ }
+
+ private RootInterface getDDRoot(Reader reader, String defaultPublicId)
+ throws IOException, SAXException, Schema2BeansException {
+ return getDDRoot(new InputSource(reader), defaultPublicId);
+ }
+
+ private RootInterface getDDRoot(InputSource inputSource, String defaultPublicId) throws IOException, SAXException, Schema2BeansException {
+ // TODO j2ee providers can have a proxy here w/ bogus impl that stores the SAX
+ // Exception. Do we need to do that, or can we throw it direct to the caller?
+ DDParse parse = new DDParse(inputSource, defaultPublicId);
+ return parse.createProxy();
+ }
+
+ private static class VersionInfo {
+
+ private Class implClass;
+ private Class proxyClass;
+ private String publicId;
+ private String systemId;
+
+ public VersionInfo(Class implClass, Class proxyClass, String publicId, String systemId) {
+ this.implClass = implClass;
+ this.proxyClass = proxyClass;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ }
+
+ public Class getImplClass() {
+ return implClass;
+ }
+
+ public Class getProxyClass() {
+ return proxyClass;
+ }
+
+ public String getPublicId() {
+ return publicId;
+ }
+
+ public String getSystemId() {
+ return systemId;
+ }
+ }
+
+ final private static Map<Class, Map<String, VersionInfo>> apiToVersionMap = new HashMap<Class, Map<String, VersionInfo>>(11);
+ final private static Map<String, VersionInfo> sunWebAppVersionMap = new HashMap<String, VersionInfo>(11);
+ final private static Map<String, VersionInfo> sunEjbJarVersionMap = new HashMap<String, VersionInfo>(11);
+ final private static Map<String, VersionInfo> sunApplicationVersionMap = new HashMap<String, VersionInfo>(11);
+ final private static Map<String, VersionInfo> sunAppClientVersionMap = new HashMap<String, VersionInfo>(11);
+ final private static Map<String, VersionInfo> sunResourcesVersionMap = new HashMap<String, VersionInfo>(11);
+
+ static {
+ sunWebAppVersionMap.put(SunWebApp.VERSION_2_3_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.SUN_WEBAPP_230_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_230_DTD_SYSTEM_ID
+ ));
+ sunWebAppVersionMap.put(SunWebApp.VERSION_2_4_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.SUN_WEBAPP_240_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_240_DTD_SYSTEM_ID
+ ));
+ sunWebAppVersionMap.put(SunWebApp.VERSION_2_4_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.SUN_WEBAPP_241_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_241_DTD_SYSTEM_ID
+ ));
+ sunWebAppVersionMap.put(SunWebApp.VERSION_2_5_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.SUN_WEBAPP_250_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_250_DTD_SYSTEM_ID
+ ));
+ sunWebAppVersionMap.put(SunWebApp.VERSION_3_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_3_0_0.SunWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.SUN_WEBAPP_300_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_300_DTD_SYSTEM_ID
+ ));
+ sunWebAppVersionMap.put(SunWebApp.VERSION_3_0_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.web.model_3_0_1.GlassFishWebApp.class, SunWebAppProxy.class,
+ DTDRegistry.GLASSFISH_WEBAPP_301_DTD_PUBLIC_ID, DTDRegistry.GLASSFISH_WEBAPP_301_DTD_SYSTEM_ID
+ ));
+
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_2_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_0_0.SunEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.SUN_EJBJAR_200_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_200_DTD_SYSTEM_ID
+ ));
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_2_1_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_1_0.SunEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.SUN_EJBJAR_210_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_210_DTD_SYSTEM_ID
+ ));
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_2_1_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_1_1.SunEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.SUN_EJBJAR_211_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_211_DTD_SYSTEM_ID
+ ));
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_3_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_0_0.SunEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.SUN_EJBJAR_300_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_300_DTD_SYSTEM_ID
+ ));
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_3_1_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_1_0.SunEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.SUN_EJBJAR_310_DTD_PUBLIC_ID, DTDRegistry.SUN_EJBJAR_310_DTD_SYSTEM_ID
+ ));
+ sunEjbJarVersionMap.put(SunEjbJar.VERSION_3_1_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_1_1.GlassFishEjbJar.class, SunEjbJarProxy.class,
+ DTDRegistry.GLASSFISH_EJBJAR_311_DTD_PUBLIC_ID, DTDRegistry.GLASSFISH_EJBJAR_311_DTD_SYSTEM_ID
+ ));
+
+ sunApplicationVersionMap.put(SunApplication.VERSION_1_3_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.app.model_1_3_0.SunApplication.class, SunApplicationProxy.class,
+ DTDRegistry.SUN_APPLICATION_130_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_130_DTD_SYSTEM_ID
+ ));
+ sunApplicationVersionMap.put(SunApplication.VERSION_1_4_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.app.model_1_4_0.SunApplication.class, SunApplicationProxy.class,
+ DTDRegistry.SUN_APPLICATION_140_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_140_DTD_SYSTEM_ID
+ ));
+ sunApplicationVersionMap.put(SunApplication.VERSION_5_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.app.model_5_0_0.SunApplication.class, SunApplicationProxy.class,
+ DTDRegistry.SUN_APPLICATION_50_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_50_DTD_SYSTEM_ID
+ ));
+ sunApplicationVersionMap.put(SunApplication.VERSION_6_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.app.model_6_0_0.SunApplication.class, SunApplicationProxy.class,
+ DTDRegistry.SUN_APPLICATION_60_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_60_DTD_SYSTEM_ID
+ ));
+ sunApplicationVersionMap.put(SunApplication.VERSION_6_0_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.app.model_6_0_1.GlassFishApplication.class, SunApplicationProxy.class,
+ DTDRegistry.GLASSFISH_APPLICATION_601_DTD_PUBLIC_ID, DTDRegistry.GLASSFISH_APPLICATION_601_DTD_SYSTEM_ID
+ ));
+
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_1_3_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_3_0.SunApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.SUN_APPCLIENT_130_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_130_DTD_SYSTEM_ID
+ ));
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_1_4_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_4_0.SunApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.SUN_APPCLIENT_140_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_140_DTD_SYSTEM_ID
+ ));
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_1_4_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_4_1.SunApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.SUN_APPCLIENT_141_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_141_DTD_SYSTEM_ID
+ ));
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_5_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_5_0_0.SunApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.SUN_APPCLIENT_50_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_50_DTD_SYSTEM_ID
+ ));
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_6_0_0, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_6_0_0.SunApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.SUN_APPCLIENT_60_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_60_DTD_SYSTEM_ID
+ ));
+ sunAppClientVersionMap.put(SunApplicationClient.VERSION_6_0_1, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.client.model_6_0_1.GlassFishApplicationClient.class, SunApplicationClientProxy.class,
+ DTDRegistry.GLASSFISH_APPCLIENT_601_DTD_PUBLIC_ID, DTDRegistry.GLASSFISH_APPCLIENT_601_DTD_SYSTEM_ID
+ ));
+
+ sunResourcesVersionMap.put(Resources.VERSION_1_3, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.serverresources.model.Resources.class, ResourcesProxy.class,
+ DTDRegistry.SUN_RESOURCE_13_DTD_PUBLIC_ID, DTDRegistry.SUN_RESOURCE_13_DTD_SYSTEM_ID
+ ));
+
+ sunResourcesVersionMap.put(Resources.VERSION_1_5, new VersionInfo(
+ org.netbeans.modules.j2ee.sun.dd.impl.serverresources.model.Resources.class, ResourcesProxy.class,
+ DTDRegistry.GLASSFISH_RESOURCE_15_DTD_PUBLIC_ID, DTDRegistry.GLASSFISH_RESOURCE_15_DTD_SYSTEM_ID
+ ));
+
+ apiToVersionMap.put(org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp.class, sunWebAppVersionMap);
+ apiToVersionMap.put(org.netbeans.modules.j2ee.sun.dd.api.ejb.SunEjbJar.class, sunEjbJarVersionMap);
+ apiToVersionMap.put(org.netbeans.modules.j2ee.sun.dd.api.app.SunApplication.class, sunApplicationVersionMap);
+ apiToVersionMap.put(org.netbeans.modules.j2ee.sun.dd.api.client.SunApplicationClient.class, sunAppClientVersionMap);
+ apiToVersionMap.put(org.netbeans.modules.j2ee.sun.dd.api.serverresources.Resources.class, sunResourcesVersionMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ public RootInterface newGraph(Class rootType, String version) {
+ RootInterface result = null;
+ SunBaseBean graphRoot = null;
+ Class graphRootClass = null;
+
+ Map<String, VersionInfo> versionMap = apiToVersionMap.get(rootType);
+ if (versionMap != null) {
+ VersionInfo vInfo = versionMap.get(version);
+ if (vInfo != null) {
+ try {
+ // Formerly invoked static 'createGraph()' method, but that is merely a wrapper
+ // for the default constructor so we'll call it directly.
+ graphRoot = (SunBaseBean) vInfo.getImplClass().newInstance();
+ graphRoot.graphManager().setDoctype(vInfo.getPublicId(), vInfo.getSystemId());
+
+ Class proxyClass = vInfo.getProxyClass();
+ Constructor proxyConstructor = proxyClass.getConstructor(new Class[]{rootType, String.class});
+ result = (RootInterface) proxyConstructor.newInstance(new Object[]{graphRoot, version});
+ } catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex) {
+ // These five exceptions will be caught and logged either in StorageBeanFactory static
+ // initializer or in Base.addToGraphs(). They all represent some type of coding error
+ // on our part and should not occur under normal conditions (unless there is a bug).
+ throw new RuntimeException(ex.getMessage(), ex); // Programmer error
+ }
+ } else {
+ throw new IllegalStateException("No version information for " + version + " of type " + rootType.getName());
+ }
+ } else {
+ throw new IllegalStateException("No version map for " + rootType.getName());
+ }
+
+ return result;
+ }
+
+ private static SunEjbJar createEjbJar(DDParse parse) {
+ SunEjbJar jar = null;
+ String version = parse.getVersion();
+ if (SunEjbJar.VERSION_3_1_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_1_1.GlassFishEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunEjbJar.VERSION_3_1_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_1_0.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunEjbJar.VERSION_3_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_0_0.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunEjbJar.VERSION_2_1_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_1_1.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunEjbJar.VERSION_2_1_0.equals(version)) {//ludo fix that!!!2.1.0 below
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_1_0.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunEjbJar.VERSION_2_0_0.equals(version)) {//ludo fix that!!!2.1.0 below
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_2_0_0.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } //LUDO CHANGE LATER!!!
+ else {
+ //What should we do there? ludo throws somethig or try with 3.0.0? FIXTIT
+ return new org.netbeans.modules.j2ee.sun.dd.impl.ejb.model_3_0_0.SunEjbJar(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ }
+
+ // return jar;
+ }
+
+ private static SunWebApp createWebApp(DDParse parse) throws DDException {
+ SunWebApp webRoot = null;
+ String version = parse.getVersion();
+ if (SunWebApp.VERSION_3_0_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_3_0_1.GlassFishWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunWebApp.VERSION_3_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_3_0_0.SunWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunWebApp.VERSION_2_5_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunWebApp.VERSION_2_4_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunWebApp.VERSION_2_4_0.equals(version)) { //ludo fix that!!!2_4_0 below
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunWebApp.VERSION_2_3_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else {
+ throw new DDException(
+ MessageFormat.format(ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/dd/api/Bundle").getString("MSG_UnknownWebXml"), new Object[]{version}));
+ }
+
+ }
+
+ private static SunApplication createApplication(DDParse parse) {
+ SunApplication app = null;
+ String version = parse.getVersion();
+ if (SunApplication.VERSION_6_0_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.app.model_6_0_1.GlassFishApplication(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplication.VERSION_6_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.app.model_6_0_0.SunApplication(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplication.VERSION_5_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.app.model_5_0_0.SunApplication(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplication.VERSION_1_4_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.app.model_1_4_0.SunApplication(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplication.VERSION_1_3_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.app.model_1_3_0.SunApplication(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ }
+
+ return app;
+ }
+
+ private static SunApplicationClient createApplicationClient(DDParse parse) {
+ SunApplicationClient appClient = null;
+ String version = parse.getVersion();
+ if (SunApplicationClient.VERSION_6_0_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_6_0_1.GlassFishApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplicationClient.VERSION_6_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_6_0_0.SunApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplicationClient.VERSION_5_0_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_5_0_0.SunApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplicationClient.VERSION_1_4_1.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_4_1.SunApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplicationClient.VERSION_1_4_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_4_0.SunApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (SunApplicationClient.VERSION_1_3_0.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.client.model_1_3_0.SunApplicationClient(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ }
+
+ return appClient;
+ }
+
+ /**
+ * Returns the root of Resources bean graph for java.io.File object.
+ *
+ * @param doc XML document representing the .sun-resource file
+ */
+ public Resources getResourcesGraph(String version) {
+ Resources resourcesRoot = (Resources) newGraph(Resources.class, version);
+ ResourcesProxy proxy = new ResourcesProxy(resourcesRoot);
+ return proxy;
+ }
+
+ /**
+ * Returns the root of Resources bean graph for java.io.File object.
+ *
+ * @param doc XML document representing the .sun-resource file
+ */
+ public Resources getResourcesGraph(InputStream in) throws IOException, SAXException {
+ return getResourcesRoot(new InputSource(in));
+ }
+
+ /**
+ * Returns the root of deployment descriptor bean graph for java.io.File
+ * object.
+ *
+ * @param is source representing the sun-application.xml file
+ * @return Application object - root of the deployment descriptor bean graph
+ */
+ public Resources getResourcesRoot(InputSource is) throws IOException, SAXException {
+ ResourcesProxy proxy = null;
+ DDParse parse = new DDParse(is);
+ Resources appRoot = createResources(parse);
+ if (appRoot == null) {
+ proxy = new ResourcesProxy(appRoot);
+ } else {
+ proxy = new ResourcesProxy(appRoot, appRoot.getVersion().toString());
+ }
+ setErrorStatus(proxy, parse);
+ return proxy;
+ }
+
+ private static Resources createResources(DDParse parse) {
+ Resources app = null;
+ String version = parse.getVersion();
+ if (Resources.VERSION_1_5.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.serverresources.model_1_5.Resources(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ } else if (Resources.VERSION_1_3.equals(version)) {
+ return new org.netbeans.modules.j2ee.sun.dd.impl.serverresources.model.Resources(parse.getDocument(), Common.NO_DEFAULT_VALUES);
+ }
+
+ return app;
+ }
+
+ private class SunDDFileChangeListener extends FileChangeAdapter {
+
+ @Override
+ public void fileChanged(FileEvent evt) {
+ FileObject fo = evt.getFile();
+ try {
+ synchronized (ddMap) {
+ RootInterface rootProxy = ddMap.get(fo);
+ if (rootProxy != null) {
+ InputStream inputStream = null;
+ try {
+ inputStream = fo.getInputStream();
+ String encoding = EncodingUtil.detectEncoding(new BufferedInputStream(inputStream));
+ if (encoding == null) {
+ encoding = "UTF8";
+ }
+ merge(rootProxy, new InputStreamReader(inputStream, encoding));
+// merge(rootProxy, fo);
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+ }
+ }
+ } catch (IOException ex) {
+ ErrorManager.getDefault().notify(ex);
+ }
+ }
+ }
+
+ private String getPublicIdFromImpl(RootInterfaceImpl rootProxyImpl) {
+ String result = null;
+
+ GraphManager gm = rootProxyImpl.graphManager();
+ if (gm != null) {
+ Document d = gm.getXmlDocument();
+ if (d != null) {
+ DocumentType dt = d.getDoctype();
+ if (dt != null) {
+ result = dt.getPublicId();
+ }
+ }
+ }
+
+ return result;
+ }
+
+ // TODO this method will get refactored as I find new requirements...
+ // TODO RootInterfaceImpl not being related to RootInterface makes this code
+ // rather messy. Maybe we can fix that somehow?
+ public void merge(RootInterface rootProxy, Reader reader) {
+ RootInterfaceImpl rootProxyImpl = (RootInterfaceImpl) rootProxy;
+ try {
+ String oldPublicId = getPublicIdFromImpl(rootProxyImpl);
+ RootInterface newRootProxy = getDDRoot(reader, oldPublicId);
+ RootInterfaceImpl newRootProxyImpl = (RootInterfaceImpl) newRootProxy;
+
+ // If we can't parse, keep the old tree, but migrate the new parse state.
+ if (newRootProxy == null) {
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ rootProxyImpl.setError(null);
+ } else if (newRootProxy.getStatus() == RootInterface.STATE_INVALID_UNPARSABLE) {
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ rootProxyImpl.setError(newRootProxyImpl.getError());
+ } else {
+ // If doctype changed, just use the new tree.
+ // TODO do we need a special event for this?
+
+ // Otherwise, try to merge the new tree with the old one.
+ rootProxy.merge(newRootProxy, RootInterface.MERGE_UPDATE);
+ rootProxyImpl.setStatus(newRootProxy.getStatus());
+ rootProxyImpl.setError(newRootProxyImpl.getError());
+ }
+ } catch (DOMException | Schema2BeansException ex) {
+ // Received when DOCTYPE is changing through illegal states.
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ rootProxyImpl.setError(new SAXParseException(null, null, ex));
+ } catch (SAXParseException ex) {
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ rootProxyImpl.setError(ex);
+ } catch (SAXException ex) {
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ if (ex.getException() instanceof SAXParseException) {
+ rootProxyImpl.setError((SAXParseException) ex.getException());
+ } else {
+ rootProxyImpl.setError(new SAXParseException(null, null, ex));
+ }
+ }catch (IOException ex) {
+ rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+ // cbw if the state of the xml file transitions from parsable to
+ // unparsable this could be due to a user change or cvs change.
+ // We would like to still receive events when the file is restored
+ // to normal so lets not set the original to null here but wait
+ // until the file becomes parsable again to do a merge.
+ // rootProxyImpl.setOriginal(null);
+ }
+// } catch(Schema2BeansRuntimeException ex){ // see #70286
+// rootProxyImpl.setStatus(RootInterface.STATE_INVALID_UNPARSABLE);
+// rootProxyImpl.setError(new SAXParseException(null, null, ex));
+
+ }
+
+ /**
+ * @param rootDD Graph to obtain the version for.
+ * @return ASDDVersion for the current graph or null if it cannot be
+ * determined.
+ * @deprecated
+ */
+ public static ASDDVersion getASDDVersion(RootInterface rootDD) {
+ return getASDDVersion(rootDD, null);
+ }
+
+ /**
+ * @param rootDD Graph to obtain the version for.
+ * @param default ASDDVersion to return in case true version is unavailable
+ * or unknown.
+ * @return ASDDVersion for the current graph or null if it cannot be
+ * determined.
+ */
+ public static ASDDVersion getASDDVersion(RootInterface rootDD, ASDDVersion defaultVersion) {
+ ASDDVersion version = null;
+
+ if (rootDD instanceof RootInterfaceImpl) {
+ RootInterfaceImpl rootDDImpl = (RootInterfaceImpl) rootDD;
+ version = rootDDImpl.getASDDVersion();
+ }
+
+ return version != null ? version : defaultVersion;
+ }
+
+ private static class SunDDResolver implements EntityResolver {
+
+ static volatile SunDDResolver resolver;
+
+ static SunDDResolver getInstance() {
+ if (resolver == null) {
+ synchronized (SunDDResolver.class) {
+ if (resolver == null) {
+ resolver = new SunDDResolver();
+ }
+ }
+ }
+ return resolver;
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) {
+ InputSource source = null;
+
+ DocTypeInfo info = publicIdToInfoMap.get(publicId);
+ if (info != null) {
+ String resource = info.getResourceDtd();
+ java.net.URL url = this.getClass().getResource(resource);
+ source = new InputSource(url.toString());
+ }
+
+ return source;
+ }
+ }
+
+ private static class SunDDErrorHandler implements ErrorHandler {
+
+ private int errorType = -1;
+ SAXParseException error;
+
+ @Override
+ public void warning(SAXParseException sAXParseException) throws SAXException {
+ if (errorType < 0) {
+ errorType = 0;
+ error = sAXParseException;
+ }
+ //throw sAXParseException;
+ }
+
+ @Override
+ public void error(SAXParseException sAXParseException) throws SAXException {
+ if (errorType < 1) {
+ errorType = 1;
+ error = sAXParseException;
+ }
+ //throw sAXParseException;
+ }
+
+ @Override
+ public void fatalError(SAXParseException sAXParseException) throws SAXException {
+ errorType = 2;
+ throw sAXParseException;
+ }
+
+ public int getErrorType() {
+ return errorType;
+ }
+
+ public SAXParseException getError() {
+ return error;
+ }
+ }
+
+ /**
+ * Parsed SJSAS deployment descriptor file including errors and/or version
+ * thereof.
+ */
+ private static class DDParse {
+
+ private Document document;
+ private SAXParseException saxException;
+ private String version;
+ private DocTypeInfo documentInfo;
+
+ public DDParse(InputStream is) throws SAXException, IOException {
+ this(new InputSource(is));
+ }
+
+ public DDParse(Reader reader) throws SAXException, IOException {
+ this(new InputSource(reader));
+ }
+
+ public DDParse(InputSource is) throws SAXException, IOException {
+ this(is, null);
+ }
+
+ public DDParse(InputSource is, String defaultPublicId) throws SAXException, IOException {
+ try {
+ SunDDErrorHandler errorHandler = new SunDDErrorHandler();
+ DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder parser = parserFactory.newDocumentBuilder();
+ parser.setErrorHandler(errorHandler);
+ parser.setEntityResolver(SunDDResolver.getInstance());
+ Document d = parser.parse(is);
+ initialize(d, errorHandler.getError(), defaultPublicId);
+ } catch (NullPointerException | ParserConfigurationException ex) {
+ throw new SAXException(ex.getMessage());
+ }
+ }
+
+ public DDParse(Document d, SAXParseException saxEx) {
+ initialize(d, saxEx, null);
+ }
+
+ private void initialize(Document d, SAXParseException saxEx, String defaultPublicId) {
+ document = d;
+ saxException = saxEx;
+ documentInfo = null;
+ // TODO Handle default version better.
+ version = "unknown"; // NOI18N
+
+ // first check the doc type to see if there is one
+ DocumentType dt = document.getDoctype();
+ if (dt != null) {
+ documentInfo = publicIdToInfoMap.get(dt.getPublicId());
+ } else if (defaultPublicId != null) {
+ documentInfo = publicIdToInfoMap.get(defaultPublicId);
+ }
+
+ if (documentInfo != null) {
+ version = documentInfo.getVersion();
+ }
+ }
+
+ /**
+ * @return document from last parse
+ */
+ public Document getDocument() {
+ return document;
+ }
+
+ /**
+ * @return proxy object for parsed bean tree.
+ */
+ public RootInterface createProxy() throws Schema2BeansException, Schema2BeansRuntimeException {
+ RootInterface result = null;
+
+ if (documentInfo != null) {
+ try {
+ RootInterface implDD = documentInfo.createImplementation(document);
+ RootInterfaceImpl proxyDD = documentInfo.createProxy(implDD);
+ proxyDD.setError(saxException);
+ proxyDD.setStatus(saxException != null ? RootInterface.STATE_INVALID_PARSABLE : RootInterface.STATE_VALID);
+ result = proxyDD.getRootInterface();
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException ex) {
+ // These five exceptions must be caught and logged by a higher caller.
+ // They all represent some type of coding error on our part and should not
+ // occur under normal conditions (unless there is a bug).
+ throw new RuntimeException(ex.getMessage(), ex); // Programmer error
+ } catch (InvocationTargetException ex) {
+ // If the document is parsable (well-formed XML), but not valid
+ // then the constructor will throw a schema2beans exception because
+ // the document does not match the schema2beans graph. This arrives
+ // here as an InvocationTargetException because of our use of reflection
+ // to construct the schema2beans graphs.
+ Throwable cause = ex;
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+
+ if (cause instanceof Schema2BeansException) {
+ throw (Schema2BeansException) cause;
+ }
+
+ if (cause instanceof Schema2BeansRuntimeException) {
+ throw (Schema2BeansRuntimeException) cause;
+ }
+
+ throw new RuntimeException(ex.getMessage(), ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @return version string.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @return validation error encountered during the parse
+ */
+ public SAXParseException getWarning() {
+ return saxException;
+ }
+ }
+
+ private static class DocTypeInfo {
+
+ private final String version;
+ private final Class proxyClass;
+ private final Class interfaceClass;
+ private final Class implClass;
+ private final String resourceDtd;
+
+ public DocTypeInfo(final String version, final Class proxyClass,
+ final Class interfaceClass, final Class implClass, final String resourceDtd) {
+ this.version = version;
+ this.proxyClass = proxyClass;
+ this.interfaceClass = interfaceClass;
+ this.implClass = implClass;
+ this.resourceDtd = resourceDtd;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getResourceDtd() {
+ return resourceDtd;
+ }
+
+ public RootInterface createImplementation(Document doc)
+ throws InstantiationException, IllegalAccessException, IllegalArgumentException,
+ InvocationTargetException, NoSuchMethodException {
+ Constructor implCtor = implClass.getConstructor(org.w3c.dom.Node.class, int.class);
+ return (RootInterface) implCtor.newInstance(doc, Common.NO_DEFAULT_VALUES);
+ }
+
+ public RootInterfaceImpl createProxy(RootInterface original)
+ throws InstantiationException, IllegalAccessException, IllegalArgumentException,
+ InvocationTargetException, NoSuchMethodException {
+ Constructor proxyCtor = proxyClass.getConstructor(interfaceClass, String.class);
+ return (RootInterfaceImpl) proxyCtor.newInstance(interfaceClass.cast(original), version);
+ }
+ }
+
+ /* Maps DOCTYPE to { version, proxy class, impl class, dtd path } info.
+ */
+ final private static Map<String, DocTypeInfo> publicIdToInfoMap = new HashMap<String, DocTypeInfo>(37);
+
+ static {
+
+ publicIdToInfoMap.put(PAYARA_WEBAPP_4_DTD_PUBLIC_ID, new DocTypeInfo(
+ VERSION_4, SunWebAppProxy.class, SunWebApp.class,
+ org.netbeans.modules.payara.eecommon.dd.impl.web.model_4.PayaraWebApp.class,
+ "/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.dtd")); // NOI18N
+
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDType.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDType.java
new file mode 100644
index 0000000..b1a865d
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDDType.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.loader;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+
+/**
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+public final class PayaraDDType {
+
+ private static final String NAME_PAYARA_WEB_APP = "payara-web.xml"; // NOI18N
+ private static final String NAME_PAYARA_EJB_JAR = "payara-ejb-jar.xml"; // NOI18N
+ private static final String NAME_PAYARA_APPLICATION = "payara-application.xml"; // NOI18N
+ private static final String NAME_PAYARA_APP_CLIENT = "payara-application-client.xml"; // NOI18N
+ private static final String NAME_PAYARA_RESOURCE = "payara-resources.xml"; // NOI18N
+
+ public static final String NAME_WEBXML = "web.xml"; // NOI18N
+
+ // Type declarations for the different descriptor types.
+ public static final PayaraDDType DD_PAYARA_WEB_APP = new PayaraDDType(NAME_PAYARA_WEB_APP, J2eeModule.Type.WAR);
+ public static final PayaraDDType DD_PAYARA_EJB_JAR = new PayaraDDType(NAME_PAYARA_EJB_JAR, J2eeModule.Type.EJB);
+ public static final PayaraDDType DD_PAYARA_APP_CLIENT = new PayaraDDType(NAME_PAYARA_APP_CLIENT, J2eeModule.Type.CAR);
+ public static final PayaraDDType DD_PAYARA_APPLICATION = new PayaraDDType(NAME_PAYARA_APPLICATION, J2eeModule.Type.EAR);
+ public static final PayaraDDType DD_PAYARA_RESOURCE = new PayaraDDType(NAME_PAYARA_RESOURCE, null);
+
+
+ // Various indexes for finding a DDType object
+ private static final Map<String, PayaraDDType> fileToTypeMap = new HashMap<String, PayaraDDType>(11);
+
+ static {
+ fileToTypeMap.put(NAME_PAYARA_WEB_APP, DD_PAYARA_WEB_APP);
+// fileToTypeMap.put(NAME_PAYARA_EJB_JAR, DD_PAYARA_EJB_JAR);
+// fileToTypeMap.put(NAME_PAYARA_APP_CLIENT, DD_PAYARA_APP_CLIENT);
+// fileToTypeMap.put(NAME_PAYARA_APPLICATION, DD_PAYARA_APPLICATION);
+// fileToTypeMap.put(NAME_PAYARA_RESOURCE, DD_PAYARA_RESOURCE);
+ }
+
+ static final String PAYARA_MIME_TYPE_PREFIX = "text/x-dd-payara"; // noi18n
+
+ static final String WEB_MIME_TYPE_SUFFIX = "-web+xml"; // NOI18N
+ static final String EJB_MIME_TYPE_SUFFIX = "-ejb-jar+xml"; // NOI18N
+ static final String APP_MIME_TYPE_SUFFIX = "-application+xml"; // noi18n
+ static final String APP_CLI_MIME_TYPE_SUFFIX = "-app-client+xml"; // noi18n
+ static final String RSRC_MIME_TYPE_SUFFIX = "-resource+xml"; // noi18n
+
+ public static final String PAYARA_WEB_MIME_TYPE = PAYARA_MIME_TYPE_PREFIX + WEB_MIME_TYPE_SUFFIX;
+ public static final String PAYARA_EJB_MIME_TYPE = PAYARA_MIME_TYPE_PREFIX + EJB_MIME_TYPE_SUFFIX;
+ public static final String PAYARA_APP_MIME_TYPE = PAYARA_MIME_TYPE_PREFIX + APP_MIME_TYPE_SUFFIX;
+ public static final String PAYARA_APP_CLI_MIME_TYPE = PAYARA_MIME_TYPE_PREFIX + APP_CLI_MIME_TYPE_SUFFIX;
+ public static final String PAYARA_RSRC_MIME_TYPE = "text/x-payara" + RSRC_MIME_TYPE_SUFFIX;
+
+
+ private static final Map<String,String> fileToMimeSuffixMap = new HashMap<String,String>(8);
+
+ static {
+ fileToMimeSuffixMap.put(NAME_PAYARA_WEB_APP, WEB_MIME_TYPE_SUFFIX);
+// fileToMimeSuffixMap.put(NAME_PAYARA_EJB_JAR, EJB_MIME_TYPE_SUFFIX);
+// fileToMimeSuffixMap.put(NAME_PAYARA_APPLICATION, APP_MIME_TYPE_SUFFIX);
+// fileToMimeSuffixMap.put(NAME_PAYARA_APP_CLIENT, APP_CLI_MIME_TYPE_SUFFIX);
+// fileToMimeSuffixMap.put(NAME_PAYARA_RESOURCE, RSRC_MIME_TYPE_SUFFIX);
+ }
+
+ public static PayaraDDType getDDType(String fileName) {
+ return fileToTypeMap.get(fileName);
+ }
+
+
+ private final String descriptorName;
+ private final J2eeModule.Type moduleType;
+
+ private PayaraDDType(final String ddName, final J2eeModule.Type type) {
+ descriptorName = ddName;
+ moduleType = type;
+ }
+
+ public String getDescriptorFileName() {
+ return this.descriptorName;
+ }
+
+ public J2eeModule.Type getEditorModuleType() {
+ return moduleType;
+ }
+
+ String getDescriptorMimeTypeSuffix() {
+ return fileToMimeSuffixMap.get(descriptorName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj == null) {
+ return false;
+ }
+ if(obj == this) {
+ return true;
+ }
+ if(getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final PayaraDDType other = (PayaraDDType) obj;
+ if(!moduleType.equals(other.moduleType)) {
+ return false;
+ }
+ return descriptorName.equals(other.descriptorName);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 37 * hash + (descriptorName != null ? descriptorName.hashCode() : 0);
+ return hash;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataLoader.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataLoader.java
new file mode 100644
index 0000000..ad41238
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataLoader.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.loader;
+
+import java.io.IOException;
+import org.netbeans.modules.j2ee.sun.ddloaders.DDType;
+import org.netbeans.modules.j2ee.sun.ddloaders.SunDescriptorDataLoader;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_APP_CLI_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_APP_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_EJB_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_WEB_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_ACTION_PATH;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_MIME_TYPE;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
+import static org.openide.util.NbBundle.getMessage;
+
+/**
+ * Recognizes deployment descriptors of Payara descriptor files.
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+@DataObject.Registration(
+ displayName = "Bundle#PayaraResolver",
+ mimeType = DD_MIME_TYPE,
+ position = 1500
+)
+public class PayaraDescriptorDataLoader extends SunDescriptorDataLoader {
+
+ private static final String[] SUPPORTED_MIME_TYPES = {
+ PAYARA_WEB_MIME_TYPE,
+ PAYARA_EJB_MIME_TYPE,
+ PAYARA_APP_MIME_TYPE,
+ PAYARA_APP_CLI_MIME_TYPE
+ };
+
+ public PayaraDescriptorDataLoader() {
+ this(PayaraDescriptorDataObject.class.getName());
+ }
+
+ public PayaraDescriptorDataLoader(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String defaultDisplayName() {
+ return getMessage(PayaraDescriptorDataLoader.class, "PayaraResolver"); // NOI18N
+ }
+
+ @Override
+ protected String actionsContext() {
+ return DD_ACTION_PATH;
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ for (int i = 0; i < SUPPORTED_MIME_TYPES.length; i++) {
+ getExtensions().addMimeType(SUPPORTED_MIME_TYPES[i]);
+ }
+ }
+
+ @Override
+ protected FileObject findPrimaryFile(FileObject fo) {
+ FileObject result = null;
+ if (!fo.isFolder() && (PayaraDDType.getDDType(fo.getNameExt()) != null
+ || DDType.getDDType(fo.getNameExt()) != null)) {
+ result = fo;
+ }
+ return result;
+ }
+
+ @Override
+ protected MultiDataObject createMultiObject(FileObject primaryFile)
+ throws DataObjectExistsException, IOException {
+ return new PayaraDescriptorDataObject(primaryFile, this);
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataObject.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataObject.java
new file mode 100644
index 0000000..c0b1235
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/loader/PayaraDescriptorDataObject.java
@@ -0,0 +1,377 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.loader;
+
+import org.openide.ErrorManager;
+import org.openide.filesystems.*;
+import org.openide.loaders.DataObject;
+import org.openide.loaders.DataObjectExistsException;
+import java.io.IOException;
+import org.netbeans.core.spi.multiview.MultiViewElement;
+import org.netbeans.modules.j2ee.sun.dd.api.RootInterface;
+import org.netbeans.modules.j2ee.sun.dd.impl.RootInterfaceImpl;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.sun.ddloaders.SunDescriptorDataObject;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.appclient.SunAppClientOverviewMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.common.EnvironmentMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.common.SecurityRoleMappingMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.ejb.EjbMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.ejb.SunEjbOverviewMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.jms.JmsMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.web.ServletMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.web.SunWebOverviewMultiViewElement;
+import org.netbeans.modules.j2ee.sun.ddloaders.multiview.webservice.WebServiceMultiViewElement;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_APP_CLI_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_EJB_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDDType.PAYARA_WEB_MIME_TYPE;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_ACTION_PATH;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_ICON;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_MIME_TYPE;
+import org.netbeans.modules.schema2beans.Schema2BeansException;
+import org.netbeans.modules.schema2beans.Schema2BeansRuntimeException;
+import org.netbeans.modules.xml.multiview.XmlMultiViewElement;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.util.Lookup;
+import static org.openide.windows.TopComponent.PERSISTENCE_ONLY_OPENED;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Represents a DD object in the Repository.
+ *
+ * @author pfiala
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+@MIMEResolver.Registration(
+ displayName = "Bundle#PayaraResolver",
+ resource = "../../dd/resources/payara-dd-mime-resolver.xml",
+ position = 300
+)
+@DataObject.Registration(
+ displayName = "Bundle#PayaraResolver",
+ mimeType = DD_MIME_TYPE,
+ iconBase = DD_ICON,
+ position = 300
+)
+@ActionReferences({
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.EditAction"),
+ position = 200
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 300,
+ separatorAfter = 400
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 500
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 600
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "Edit", id = "org.openide.actions.PasteAction"),
+ position = 700,
+ separatorAfter = 800
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 900
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "Edit", id = "org.openide.actions.RenameAction"),
+ position = 950,
+ separatorAfter = 1000
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 1100,
+ separatorAfter = 1200
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "XML", id = "org.netbeans.modules.xml.tools.actions.CheckAction"),
+ position = 1300
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "XML", id = "org.netbeans.modules.xml.tools.actions.ValidateAction"),
+ position = 1400,
+ separatorAfter = 1500
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1600
+ ),
+ @ActionReference(
+ path = DD_ACTION_PATH,
+ id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1700
+ )
+})
+public class PayaraDescriptorDataObject extends SunDescriptorDataObject {
+
+ public static final String DD_ACTION_PATH = "Loaders/text/x-dd-payara/Actions";
+
+ public static final String DD_ICON = "org/netbeans/modules/payara/eecommon/dd/resources/DDDataIcon.gif";
+
+ public static final String DD_MIME_TYPE = "text/x-dd-payara-web+xml";
+
+ @Override
+ protected int getXMLMultiViewIndex() {
+ if (xmlIndex == 0) {
+ return super.getXMLMultiViewIndex();
+ }
+ return xmlIndex;
+ }
+
+ private final Object proxyMonitor = new Object();
+ private volatile RootInterfaceImpl ddRootProxy;
+ private final PayaraDDType descriptorType;
+ private final int xmlIndex;
+
+ public PayaraDescriptorDataObject(FileObject pf, PayaraDescriptorDataLoader loader) throws DataObjectExistsException {
+ super(pf, loader);
+ descriptorType = PayaraDDType.getDDType(pf.getNameExt());
+ if (descriptorType != null && descriptorType.equals(PayaraDDType.DD_PAYARA_WEB_APP)) {
+ xmlIndex = 6;
+ } else {
+ xmlIndex = 0;
+ }
+ }
+
+ @Override
+ public J2eeModule.Type getModuleType() {
+ return descriptorType.getEditorModuleType();
+ }
+
+ @Override
+ public RootInterface getDDRoot() {
+ return getDDRootImpl(true);
+ }
+
+ private RootInterface getDDRootImpl(final boolean notify) {
+ RootInterface localProxy;
+ synchronized (proxyMonitor) {
+ if (ddRootProxy == null) {
+ try {
+ parseDocument();
+ } catch (IOException ex) {
+ if (notify) {
+ notifyError(ex);
+ } else {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ }
+ }
+ localProxy = ddRootProxy != null ? ddRootProxy.getRootInterface() : null;
+ }
+ return localProxy;
+ }
+
+ @Override
+ protected void parseDocument() throws IOException {
+ PayaraDDProvider ddProvider = PayaraDDProvider.getDefault();
+ SAXParseException saxEx;
+ synchronized (proxyMonitor) {
+ if (ddRootProxy == null || !ddRootProxy.hasOriginal()) {
+ try {
+ RootInterfaceImpl newDDRoot = (RootInterfaceImpl) ddProvider.getDDRoot(getPrimaryFile());
+ ddRootProxy = newDDRoot;
+ } catch (IOException ex) {
+ ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
+ }
+ } else {
+ ddProvider.merge(ddRootProxy.getRootInterface(), createReader());
+ }
+ saxEx = ddRootProxy != null ? ddRootProxy.getError() : new SAXParseException("No proxy object found created by parser.", null);
+ }
+
+ setSaxError(saxEx);
+ }
+
+ @Override
+ protected void validateDocument() throws IOException {
+ try {
+ RootInterfaceImpl proxyImpl = (RootInterfaceImpl) PayaraDDProvider.getDefault().getDDRoot(createReader());
+ if (null != proxyImpl) {
+ setSaxError(proxyImpl.getError());
+ }
+ } catch (Schema2BeansException | Schema2BeansRuntimeException ex) {
+ setSaxError(new SAXException(ex));
+ } catch (SAXException ex) {
+ setSaxError(ex);
+ }
+ }
+
+ @Override
+ protected RootInterface getDDModel() {
+ return getDDRootImpl(false);
+ }
+
+ @Override
+ protected String getEditorMimeType() {
+ return PayaraDDType.PAYARA_MIME_TYPE_PREFIX + descriptorType.getDescriptorMimeTypeSuffix();
+ }
+
+ // x-web.xml specific MultiViewElement objects
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_web_over",
+ displayName = "#CTL_OverviewTabCaption",
+ position = 1
+ )
+ public static MultiViewElement createWebOverviewMultiViewElement(Lookup lookup) {
+ return new SunWebOverviewMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_web_servlet",
+ displayName = "#CTL_ServletsTabCaption",
+ position = 2
+ )
+ public static MultiViewElement createServletsMultiViewElement(Lookup lookup) {
+ return new ServletMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ // *-ejb-jar.xml MultiViewElement objects
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_EJB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_ejb_overview",
+ displayName = "#CTL_OverviewTabCaption",
+ position = 1
+ )
+ public static MultiViewElement createEjbOveriewMultiViewElement(Lookup lookup) {
+ return new SunEjbOverviewMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_EJB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_ejb_ejb",
+ displayName = "#CTL_EjbTabCaption",
+ position = 2
+ )
+ public static MultiViewElement createEjbMultiViewElement(Lookup lookup) {
+ return new EjbMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ // *-app-client.xml MultiViewElement objects
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_APP_CLI_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_app_cli_overview",
+ displayName = "#CTL_OverviewTabCaption",
+ position = 1
+ )
+ public static MultiViewElement createAppCliOverviewViewElement(Lookup lookup) {
+ return new SunAppClientOverviewMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ // Shared MultiViewElement objects
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_shared_security",
+ displayName = "#CTL_SecurityTabCaption",
+ position = 3
+ )
+ public static MultiViewElement createSecurityMultiViewSecurityElement(Lookup lookup) {
+ return new SecurityRoleMappingMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_shared_WS",
+ displayName = "#CTL_WebServiceTabCaption",
+ position = 5
+ )
+ public static MultiViewElement createServicesMultiViewElement(Lookup lookup) {
+ return new WebServiceMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_shared_jms",
+ displayName = "#CTL_JmsTabCaption",
+ position = 10
+ )
+ public static MultiViewElement createJmsMultiViewElement(Lookup lookup) {
+ return new JmsMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_shared_environment",
+ displayName = "#CTL_EnvTabCaption",
+ position = 15
+ )
+ public static MultiViewElement createEnvMultiViewEnvironmentElement(Lookup lookup) {
+ return new EnvironmentMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+ @MultiViewElement.Registration(
+ mimeType = PAYARA_WEB_MIME_TYPE,
+ iconBase = DD_ICON,
+ persistenceType = PERSISTENCE_ONLY_OPENED,
+ preferredID = "multiview_xml_payara_xml",
+ displayName = "#CTL_SourceTabCaption",
+ position = 20
+ )
+ public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
+ return new XmlMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/DDDataIcon.gif b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/DDDataIcon.gif
new file mode 100644
index 0000000..d97fe0a
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/DDDataIcon.gif
Binary files differ
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/PayaraDD.html b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/PayaraDD.html
new file mode 100644
index 0000000..7a55634
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/PayaraDD.html
@@ -0,0 +1,30 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ </head>
+ <body>
+ Creates default valid server specific deployment descriptor
+ for your Java EE module or application.
+ </body>
+</html>
+
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-dd-mime-resolver.xml b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-dd-mime-resolver.xml
new file mode 100644
index 0000000..af05600
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-dd-mime-resolver.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
+
+<MIME-resolver>
+
+ <!-- mime type definitions for payara-web descriptor file -->
+ <file>
+ <ext name="xml"/>
+ <resolver mime="text/x-dd-payara-web+xml">
+ <xml-rule>
+ <element name="payara-web-app"/>
+ </xml-rule>
+ </resolver>
+ </file>
+
+</MIME-resolver>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.dtd b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.dtd
new file mode 100644
index 0000000..ae07b39
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.dtd
@@ -0,0 +1,869 @@
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+-->
+
+<!--
+ XML DTD for Payara Application Server specific Jakarta EE web
+ deployment descriptor. This is a companion DTD to web-app_3_0.xsd
+ and web-common_3_0.xsd.
+
+ It must include a DOCTYPE of the following form:
+
+ <!DOCTYPE payara-web-app PUBLIC "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN" "https://docs.payara.fish/schemas/payara-web-app_4.dtd">
+
+-->
+
+<!ENTITY % boolean "(yes | no | on | off | 1 | 0 | true | false)">
+
+<!-- root element for vendor specific web application (module) configuration -->
+<!ELEMENT payara-web-app (context-root?, security-role-mapping*, servlet*, idempotent-url-pattern*, session-config?,
+ ejb-ref*, resource-ref*, resource-env-ref*, service-ref*,
+ message-destination-ref*, cache?, class-loader?,
+ jsp-config?, locale-charset-info?, parameter-encoding?,
+ property*, valve*, message-destination*, webservice-description*, scanning-exclude*, scanning-include*, whitelist-package*, keep-state?, version-identifier?, container-initializer-enabled?, jaxrs-roles-allowed-enabled?)>
+<!ATTLIST payara-web-app error-url CDATA ""
+ httpservlet-security-provider CDATA #IMPLIED>
+
+<!--
+ Idempotent URL Patterns
+ url-pattern URL Pattern of the idempotent requests
+ num-of-retries Specifies the number of times the Load Balancer will retry a request that is idempotent.
+-->
+<!ELEMENT idempotent-url-pattern EMPTY>
+<!ATTLIST idempotent-url-pattern url-pattern CDATA #REQUIRED
+ num-of-retries CDATA "-1">
+
+<!--
+ Context Root for the web application when the war file is a standalone module.
+ When the war module is part of the Jakarta EE Application, use the application.xml
+-->
+<!ELEMENT context-root (#PCDATA)>
+
+<!ELEMENT security-role-mapping (role-name, (principal-name | group-name)+)>
+<!ELEMENT role-name (#PCDATA)>
+
+<!ELEMENT principal-name (#PCDATA)>
+<!ATTLIST principal-name class-name CDATA #IMPLIED>
+<!ELEMENT group-name (#PCDATA)>
+
+<!ELEMENT servlet (servlet-name, principal-name?, webservice-endpoint*)>
+
+<!ELEMENT session-config (session-manager?, session-properties?, cookie-properties?)>
+
+<!ENTITY % persistence-type "(memory | file | custom | ha | s1ws60 | mmap | replicated)">
+
+<!ELEMENT session-manager (manager-properties?, store-properties?)>
+<!ATTLIST session-manager persistence-type CDATA "memory">
+
+<!ELEMENT manager-properties (property*)>
+<!ELEMENT store-properties (property*)>
+<!ELEMENT session-properties (property*)>
+<!ELEMENT cookie-properties (property*)>
+
+<!ELEMENT jndi-name (#PCDATA)>
+
+<!ELEMENT resource-env-ref (resource-env-ref-name, jndi-name)>
+<!ELEMENT resource-env-ref-name (#PCDATA)>
+
+<!ELEMENT resource-ref (res-ref-name, jndi-name, default-resource-principal?)>
+<!ELEMENT res-ref-name (#PCDATA)>
+
+<!ELEMENT default-resource-principal ( name, password)>
+
+<!--
+This node holds information about a logical message destination
+-->
+<!ELEMENT message-destination (message-destination-name, jndi-name)>
+
+<!--
+This node holds the name of a logical message destination
+-->
+<!ELEMENT message-destination-name (#PCDATA)>
+
+<!--
+message-destination-ref is used to directly bind a message destination reference
+to the jndi-name of a Queue,Topic, or some other physical destination. It should
+only be used when the corresponding message destination reference does not
+specify a message-destination-link to a logical message-destination.
+-->
+<!ELEMENT message-destination-ref (message-destination-ref-name, jndi-name)>
+
+<!--
+name of a message-destination reference.
+-->
+<!ELEMENT message-destination-ref-name (#PCDATA)>
+
+<!--
+This text nodes holds a name string.
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+This element holds password text.
+-->
+<!ELEMENT password (#PCDATA)>
+
+
+<!ELEMENT ejb-ref (ejb-ref-name, jndi-name)>
+<!ELEMENT ejb-ref-name (#PCDATA)>
+
+<!ENTITY % scope "(context.attribute | request.header | request.parameter |
+ request.cookie | request.attribute | session.attribute)">
+<!ENTITY % key-scope "(context.attribute | request.header | request.parameter |
+ request.cookie | session.id | session.attribute)">
+<!ENTITY % expr "(equals | greater | lesser | not-equals | in-range)">
+
+<!-- cache element configures the cache for web application. iAS 7.0 web container
+ supports one such cache object per application: i.e. <cache> is a sub element
+ of <ias-web-app>. A cache can have zero or more cache-mapping elements and
+ zero or more customizable cache-helper classes.
+
+ max-entries Maximum number of entries this cache may hold. [4096]
+ timeout-in-seconds Default timeout for the cache entries in seconds. [30]
+ enabled Is this cache enabled? [true]
+-->
+<!ELEMENT cache (cache-helper*, default-helper?, property*, cache-mapping*)>
+<!ATTLIST cache max-entries CDATA "4096"
+ timeout-in-seconds CDATA "30"
+ enabled %boolean; "true">
+
+<!-- cache-helper specifies customizable class which implements CacheHelper interface.
+
+ name Unique name for the helper class; this is referenced in
+ the cache-mapping elements (see below).
+ "default" is reserved for the built-in default helper.
+ class-name Fully qualified class name of the cache-helper; this class
+ must extend the com.sun.appserv.web.CacheHelper class.
+-->
+<!ELEMENT cache-helper (property*)>
+<!ATTLIST cache-helper name CDATA #REQUIRED
+ class-name CDATA #REQUIRED>
+
+<!--
+Default, built-in cache-helper properties
+-->
+<!ELEMENT default-helper (property*)>
+
+<!--
+cache-mapping element defines what to be cached, the key to be used, any other
+constraints to be applied and a customizable cache-helper to programmatically
+hook this information.
+-->
+<!ELEMENT cache-mapping ((servlet-name | url-pattern),
+ (cache-helper-ref |
+ (dispatcher*, timeout?, refresh-field?, http-method*, key-field*, constraint-field*)))>
+
+<!--
+servlet-name element defines a named servlet to which this caching is enabled.
+the specified name must be present in the web application deployment descriptor
+(web.xml)
+-->
+<!ELEMENT servlet-name (#PCDATA)>
+
+<!--
+url-pattern element specifies the url pattern to which caching is to be enabled.
+See Servlet 2.3 specification section SRV. 11.2 for the applicable patterns.
+-->
+<!ELEMENT url-pattern (#PCDATA)>
+
+<!--
+cache-helper-ref s a reference to the cache-helper used by this cache-mapping
+-->
+<!ELEMENT cache-helper-ref (#PCDATA)>
+
+<!--
+Specifies the RequestDispatcher methods for which caching is to be
+enabled on the target resource. Valid values are REQUEST, FORWARD, INCLUDE,
+and ERROR (default: REQUEST).
+See SRV.6.2.5 of the Servlet 2.4 Specification for more information.
+-->
+<!ELEMENT dispatcher (#PCDATA)>
+
+<!--
+timeout element defines the cache timeout in seconds applicable for this mapping.
+default is to use cache object's timeout. The timeout value is specified statically
+ere (e.g. <timeout> 60 </timeout> or dynamically via fields in the relevant scope.
+
+ name Name of the field where this timeout could be found
+ scope Scope of the field. default scope is request attribute.
+-->
+<!ELEMENT timeout (#PCDATA)>
+<!ATTLIST timeout name CDATA #IMPLIED
+ scope %scope; 'request.attribute'>
+
+<!--
+http-method specifies HTTP method eligible for caching default is GET.
+-->
+<!ELEMENT http-method (#PCDATA)>
+
+<!--
+specifies the request parameter name that triggers refresh. the cached entry
+is refreshed when there such a request parameter is set to "true"
+example:
+<cache-mapping>
+ <url-pattern> /quote </url-pattern>
+ <refresh-field name="refresh" scope="request.parameter"/>
+</cache-mapping>
+-->
+<!ELEMENT refresh-field EMPTY>
+<!ATTLIST refresh-field name CDATA #REQUIRED
+ scope %key-scope; 'request.parameter'>
+<!--
+key-field specifies a component of the key; container looks for the named
+field in the given scope to access the cached entry. Default is to use
+the Servlet Path (the path section that corresponds to the servlet mapping
+which activated this request). See Servlet 2.3 specification section SRV 4.4
+on Servlet Path.
+
+ name Name of the field to look for in the given scope
+ scope Scope of the field. default scope is request parameter.
+-->
+<!ELEMENT key-field EMPTY>
+<!ATTLIST key-field name CDATA #REQUIRED
+ scope %key-scope; 'request.parameter'>
+
+<!--
+constraint-field specifies a field whose value is used as a cacheability constraint.
+
+ name Name of the field to look for in the given scope
+ scope Scope of the field. Default scope is request parameter.
+ cache-on-match Should this constraint check pass, is the response cacheable?
+ Default is true (i.e. cache the response on success match).
+ Useful to turn off caching when there is an attribute in the
+ scope (e.g. don't cache when there is an attribute called UID
+ in the session.attribute scope).
+ cache-on-match-failure Should the constraint check fail, is response not cacheable?
+ Default is false (i.e. a failure in enforcing the constraint
+ would negate caching). Useful to turn on caching when the
+ an an attribute is not present (e.g. turn on caching
+ when there is no session or session attribute called UID).
+
+ Example 1: don't cache when there is a session attribute
+ <constraint-field name="UID" scope="session.attribute" cache-on-match="false">
+
+ Example 2: do cache only when there is no session attribute
+ <constraint-field name="UID" scope="session.attribute"
+ cache-on-match-failure="false">
+-->
+<!ELEMENT constraint-field (constraint-field-value*)>
+<!ATTLIST constraint-field name CDATA #REQUIRED
+ scope %scope; 'request.parameter'
+ cache-on-match %boolean; 'true'
+ cache-on-match-failure %boolean; 'false'>
+
+<!--
+value element specifies the applicable value and a matching expression for a constraint-field
+ match-expr Expression used to match the value. Default is 'equals'.
+
+ Example 1: cache when the category matches with any value other than a specific value
+ <constraint-field name="category" scope="request.parameter>
+ <value match-expr="equals" cache-on-match-failure="true">
+ bogus
+ </value>
+ </constraint-field>
+-->
+<!ELEMENT constraint-field-value (#PCDATA)>
+<!ATTLIST constraint-field-value match-expr %expr; 'equals'
+ cache-on-match %boolean; 'true'
+ cache-on-match-failure %boolean; 'false'>
+
+<!--
+ The class-loader element allows developers to customize the behaviour
+ of their web application's classloader.
+
+ attributes
+ extra-class-path List of comma-separated JAR files to be
+ added to the web application's class path
+ delegate If set to false, the delegation behavior
+ of the web application's classloader complies
+ with the Servlet 2.3 specification,
+ section 9.7.2, and gives preference to classes
+ and resources within the WAR file or the
+ extra-class-path over those higher up in the
+ classloader hierarchy, unless those classes or
+ resources are part of the Jakarta EE platform.
+ If set to its default value of true, classes
+ and resources residing in container-wide library
+ JAR files are loaded in preference to classes
+ and resources packaged within the WAR file or
+ specified on the extra-class-path.
+ dynamic-reload-interval Not supported. Included for backward
+ compatibility with previous Sun Java System
+ Web Server versions
+-->
+<!ELEMENT class-loader (property*)>
+<!ATTLIST class-loader extra-class-path CDATA #IMPLIED
+ delegate %boolean; 'true'
+ dynamic-reload-interval CDATA #IMPLIED >
+
+<!ELEMENT jsp-config (property*)>
+
+<!ELEMENT locale-charset-info (locale-charset-map+, parameter-encoding?)>
+<!ATTLIST locale-charset-info default-locale CDATA #IMPLIED>
+
+<!ELEMENT locale-charset-map (description?)>
+<!ATTLIST locale-charset-map locale CDATA #REQUIRED
+ agent CDATA #IMPLIED
+ charset CDATA #REQUIRED>
+
+<!ELEMENT parameter-encoding EMPTY>
+<!ATTLIST parameter-encoding form-hint-field CDATA #IMPLIED
+ default-charset CDATA #IMPLIED>
+
+<!--
+Syntax for supplying properties as name value pairs
+-->
+<!ELEMENT property (description?)>
+<!ATTLIST property name CDATA #REQUIRED
+ value CDATA #REQUIRED>
+
+<!ELEMENT description (#PCDATA)>
+
+<!--
+This text nodes holds a value string.
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!ELEMENT valve (description?, property*)>
+<!ATTLIST valve name CDATA #REQUIRED
+ class-name CDATA #REQUIRED>
+
+<!--
+ W E B S E R V I C E S
+-->
+<!--
+Runtime settings for a web service reference. In the simplest case,
+there is no runtime information required for a service ref. Runtime info
+is only needed in the following cases :
+ * to define the port that should be used to resolve a container-managed port
+ * to define default Stub/Call property settings for Stub objects
+ * to define the URL of a final WSDL document to be used instead of
+the one packaged with a service-ref
+-->
+<!ELEMENT service-ref ( service-ref-name, port-info*, call-property*, wsdl-override?, service-impl-class?, service-qname? )>
+
+<!--
+Coded name (relative to java:comp/env) for a service-reference
+-->
+<!ELEMENT service-ref-name ( #PCDATA )>
+
+<!--
+Information for a port within a service-reference.
+
+Either service-endpoint-interface or wsdl-port or both
+(service-endpoint-interface and wsdl-port) should be specified.
+
+If both are specified, wsdl-port represents the
+port the container should choose for container-managed port selection.
+
+The same wsdl-port value must not appear in
+more than one port-info entry within the same service-ref.
+
+If a particular service-endpoint-interface is using container-managed port
+selection, it must not appear in more than one port-info entry
+within the same service-ref.
+
+The optional message-security-binding element is used to customize the
+port to provider binding; either by binding the port to a specific provider
+or by providing a definition of the message security requirements to be
+enforced by the provider.
+
+-->
+<!ELEMENT port-info ( service-endpoint-interface?, wsdl-port?, stub-property*, call-property*, message-security-binding? )>
+
+<!--
+Fully qualified name of service endpoint interface
+-->
+<!ELEMENT service-endpoint-interface ( #PCDATA )>
+<!--
+Port used in port-info.
+-->
+<!ELEMENT wsdl-port ( namespaceURI, localpart )>
+
+<!--
+JAXRPC property values that should be set on a stub before it's returned to
+to the web service client. The property names can be any properties supported
+by the JAXRPC Stub implementation. See javadoc for javax.xml.rpc.Stub
+-->
+<!ELEMENT stub-property ( name, value )>
+
+<!--
+JAXRPC property values that should be set on a Call object before it's
+returned to the web service client. The property names can be any
+properties supported by the JAXRPC Call implementation. See javadoc
+for javax.xml.rpc.Call
+-->
+<!ELEMENT call-property ( name, value )>
+
+<!--
+This is a valid URL pointing to a final WSDL document. It is optional.
+If specified, the WSDL document at this URL will be used during
+deployment instead of the WSDL document associated with the
+service-ref in the standard deployment descriptor.
+
+Examples :
+
+ // available via HTTP
+ <wsdl-override>http://localhost:8000/myservice/myport?WSDL</wsdl-override>
+
+ // in a file
+ <wsdl-override>file:/home/user1/myfinalwsdl.wsdl</wsdl-override>
+
+-->
+<!ELEMENT wsdl-override ( #PCDATA )>
+
+<!--
+Name of generated service implementation class. This is not set by the
+deployer. It is derived during deployment.
+-->
+<!ELEMENT service-impl-class ( #PCDATA )>
+
+<!--
+The service-qname element declares the specific WSDL service
+element that is being refered to. It is not set by the deployer.
+It is derived during deployment.
+-->
+<!ELEMENT service-qname (namespaceURI, localpart)>
+
+<!--
+Runtime information about a web service.
+
+wsdl-publish-location is optionally used to specify
+where the final wsdl and any dependent files should be stored. This location
+resides on the file system from which deployment is initiated.
+
+-->
+<!ELEMENT webservice-description ( webservice-description-name, wsdl-publish-location? )>
+
+<!--
+Unique name of a webservice within a module
+-->
+<!ELEMENT webservice-description-name ( #PCDATA )>
+
+<!--
+file: URL of a directory to which a web-service-description's wsdl should be
+published during deployment. Any required files will be published to this
+directory, preserving their location relative to the module-specific
+wsdl directory(META-INF/wsdl or WEB-INF/wsdl).
+
+Example :
+
+ For an ejb.jar whose webservices.xml wsdl-file element contains
+ META-INF/wsdl/a/Foo.wsdl
+
+ <wsdl-publish-location>file:/home/user1/publish
+ </wsdl-publish-location>
+
+ The final wsdl will be stored in /home/user1/publish/a/Foo.wsdl
+
+-->
+<!ELEMENT wsdl-publish-location ( #PCDATA )>
+
+<!--
+Information about a web service endpoint.
+
+The optional message-security-binding element is used to customize the
+webservice-endpoint to provider binding; either by binding the
+webservice-endpoint to a specific provider or by providing a
+definition of the message security requirements to be enforced by the
+provider.
+
+When login-config is specified, a default message-security provider
+is not applied to the endpoint.
+-->
+<!ELEMENT webservice-endpoint ( port-component-name, endpoint-address-uri?, (login-config | message-security-binding)?, transport-guarantee?, service-qname?, tie-class?, servlet-impl-class?, debugging-enabled? )>
+
+<!--
+Unique name of a port component within a module
+-->
+<!ELEMENT port-component-name ( #PCDATA )>
+
+<!--
+Relative path combined with web server root to form fully qualified
+endpoint address for a web service endpoint. For servlet endpoints, this
+value is relative to the servlet's web application context root. In
+all cases, this value must be a fixed pattern(i.e. no "*" allowed).
+If the web service endpoint is a servlet that only implements a single
+endpoint has only one url-pattern, it is not necessary to set
+this value since the container can derive it from web.xml.
+-->
+<!ELEMENT endpoint-address-uri ( #PCDATA )>
+
+<!--
+The name of tie implementation class for a port-component. This is
+not specified by the deployer. It is derived during deployment.
+-->
+<!ELEMENT tie-class (#PCDATA)>
+
+<!--
+Optional authentication configuration for an EJB web service endpoint.
+Not needed for servet web service endpoints. Their security configuration
+is contained in the standard web application descriptor.
+-->
+<!ELEMENT login-config ( auth-method )>
+
+<!--
+The auth-method element is used to configure the authentication
+mechanism for the web application. As a prerequisite to gaining access
+to any web resources which are protected by an authorization
+constraint, a user must have authenticated using the configured
+mechanism.
+-->
+
+<!ELEMENT auth-method (#PCDATA)>
+
+<!--
+Name of application-written servlet impl class contained in deployed war.
+This is not set by the deployer. It is derived by the container
+during deployment.
+-->
+<!ELEMENT servlet-impl-class (#PCDATA)>
+
+<!--
+Specify whether or not the debugging servlet should be enabled for this
+Web Service endpoint.
+
+Supported values : "true" to debug the endpoint
+-->
+<!ELEMENT debugging-enabled (#PCDATA)>
+
+<!--
+The transport-guarantee element specifies that the communication
+between client and server should be NONE, INTEGRAL, or
+CONFIDENTIAL. NONE means that the application does not require any
+transport guarantees. A value of INTEGRAL means that the application
+requires that the data sent between the client and server be sent in
+such a way that it can't be changed in transit. CONFIDENTIAL means
+that the application requires that the data be transmitted in a
+fashion that prevents other entities from observing the contents of
+the transmission. In most cases, the presence of the INTEGRAL or
+CONFIDENTIAL flag will indicate that the use of SSL is required.
+-->
+
+<!ELEMENT transport-guarantee (#PCDATA)>
+
+<!--
+Runtime settings for a web service reference. In the simplest case,
+there is no runtime information required for a service ref. Runtime info
+is only needed in the following cases :
+ * to define the port that should be used to resolve a container-managed port
+ * to define default Stub/Call property settings for Stub objects
+ * to define the URL of a final WSDL document to be used instead of
+the one packaged with a service-ref
+-->
+
+<!--
+The localpart element indicates the local part of a QNAME.
+-->
+<!ELEMENT localpart (#PCDATA)>
+
+<!--
+The namespaceURI element indicates a URI.
+-->
+<!ELEMENT namespaceURI (#PCDATA)>
+
+<!--
+The message-layer entity is used to define the value of the
+auth-layer attribute of message-security-binding elements.
+
+Used in: message-security-binding
+-->
+<!ENTITY % message-layer "(SOAP)">
+
+<!--
+The message-security-binding element is used to customize the
+webservice-endpoint or port to provider binding; either by binding the
+webservice-endpoint or port to a specific provider or by providing a
+definition of the message security requirements to be enforced by the
+provider.
+
+These elements are typically NOT created as a result of the
+deployment of an application. They need only be created when the
+deployer or system administrator chooses to customize the
+webservice-endpoint or port to provider binding.
+
+The optional (repeating) message-security sub-element is used
+to accomplish the latter; in which case the specified
+message-security requirements override any defined with the
+provider.
+
+The auth-layer attribute identifies the message layer at which the
+message-security requirements are to be enforced.
+
+The optional provider-id attribute identifies the provider-config
+and thus the authentication provider that is to be used to satisfy
+the application specific message security requirements. If a value for
+the provider-id attribute is not specified, and a default
+provider is defined for the message layer, then it is used.
+if a value for the provider-id attribute is not specified, and a
+default provider is not defined at the layer, the authentication
+requirements defined in the message-security-binding are not
+enforced.
+
+Default:
+Used in: webservice-endpoint, port-info
+-->
+<!ELEMENT message-security-binding ( message-security* )>
+<!ATTLIST message-security-binding
+ auth-layer %message-layer; #REQUIRED
+ provider-id CDATA #IMPLIED >
+
+<!--
+The message-security element describes message security requirements
+that pertain to the request and response messages of the containing
+endpoint, or port
+
+When contained within a webservice-endpoint this element describes
+the message security requirements that pertain to the request and
+response messages of the containing endpoint. When contained within a
+port-info of a service-ref this element describes the message security
+requirements of the port of the referenced service.
+
+The one or more contained message elements define the methods or operations
+of the containing application, endpoint, or referenced service to which
+the message security requirements apply.
+
+Multiple message-security elements occur within a containing
+element when it is necessary to define different message
+security requirements for different messages within the encompassing
+context. In such circumstances, the peer elements should not overlap
+in the messages they pertain to. If there is any overlap in the
+identified messages, no message security requirements apply to
+the messages for which more than one message-security element apply.
+
+Also, no message security requirements apply to any messages of
+the encompassing context that are not identified by a message element.
+
+Default:
+Used in: webservice-endpoint, and port-info
+-->
+<!ELEMENT message-security ( message+, request-protection?, response-protection? )>
+
+<!--
+The message element identifies the methods or operations to which
+the message security requirements apply.
+
+The identified methods or operations are methods or operations of
+the resource identified by the context in which the message-security
+element is defined (e.g. the the resource identified by the
+service-qname of the containing webservice-endpoint or service-ref).
+
+An empty message element indicates that the security requirements
+apply to all the methods or operations of the identified resource.
+
+When operation-name is specified, the security
+requirements defined in the containing message-security
+element apply to all the operations of the endpoint
+with the specified (and potentially overloaded) operation name.
+
+Default:
+Used in: message-security
+-->
+<!ELEMENT message ( java-method? | operation-name? )>
+
+<!--
+The java-method element is used to identify a method (or methods
+in the case of an overloaded method-name) of the java class
+indicated by the context in which the java-method is contained.
+
+Default:
+Used in: message
+-->
+<!ELEMENT java-method ( method-name, method-params? )>
+
+<!--
+The operation-name element is used to identify the WSDL name of an
+operation of a web service.
+
+Default:
+Used in: message
+-->
+<!ELEMENT operation-name ( #PCDATA )>
+
+<!--
+The request-protection element describes the authentication requirements
+that apply to a request.
+
+The auth-source attribute defines a requirement for message layer
+sender authentication (e.g. username password) or content authentication
+(e.g. digital signature).
+
+The auth-recipient attribute defines a requirement for message
+layer authentication of the reciever of a message to its sender (e.g. by
+XML encryption).
+
+The before-content attribute value indicates that recipient
+authentication (e.g. encryption) is to occur before any
+content authentication (e.g. encrypt then sign) with respect
+to the target of the containing auth-policy.
+
+An absent request-protection element is the recommended shorthand
+for a request-protection element with unspecified values for both the
+auth-source and auth-recipient attributes.
+
+Default:
+Used in: message-security
+
+ * Expected evolution to support partial message protection:
+ *
+ * request-protection ( content-auth-policy* )
+ *
+ * If the request-protection element contains one or more
+ * content-auth-policy sub-elements, they define the authentication
+ * requirements to be applied to the identified request content. If multiple
+ * content-auth-policy sub-elements are defined, a request sender must
+ * satisfy the requirements independently, and in the specified order.
+ *
+ * The content-auth-policy element would be used to associate authentication
+ * requirements with the parts of the request or response object identified
+ * by the contained method-params or part-name-list sub-elements.
+ *
+ * The content-auth-policy element would be defined as follows:
+ *
+ * content-auth-policy ( method-params | part-name-list )
+ * ATTLIST content-auth-policy
+ * auth-source (sender | content) #IMPLIED
+ * auth-recipient (before-content | after-content) #IMPLIED
+ *
+ * The part-name-list and part-name elements would be defined as follows:
+ *
+ * part-name-list ( part-name* )
+ * part-name ( #PCDATA )
+ *
+-->
+<!ELEMENT request-protection EMPTY >
+<!ATTLIST request-protection
+ auth-source (sender | content) #IMPLIED
+ auth-recipient (before-content | after-content) #IMPLIED>
+
+<!--
+The response-protection element describes the authentication requirements
+that apply to a response.
+
+The auth-source attribute defines a requirement for message layer
+sender authentication (e.g. username password) or content authentication
+(e.g. digital signature).
+
+The auth-recipient attribute defines a requirement for message
+layer authentication of the reciever of a message to its sender (e.g. by
+XML encryption).
+
+The before-content attribute value indicates that recipient
+authentication (e.g. encryption) is to occur before any
+content authentication (e.g. encrypt then sign) with respect
+to the target of the containing auth-policy.
+
+An absent response-protection element is the recommended shorthand
+for a request-protection element with unspecified values for both the
+auth-source and auth-recipient attributes.
+
+Default:
+Used in: message-security
+
+ * Expected evolution to support partial message protection:
+ *
+ * response-protection ( content-auth-policy* )
+ *
+ * see request-protection element for more details
+ *
+-->
+<!ELEMENT response-protection EMPTY >
+<!ATTLIST response-protection
+ auth-source (sender | content) #IMPLIED
+ auth-recipient (before-content | after-content) #IMPLIED>
+
+<!--
+The method-name element contains the name of a service method of a web service
+implementation class.
+
+Used in: java-method
+-->
+<!ELEMENT method-name (#PCDATA)>
+<!--
+The method-params element contains a list of the fully-qualified Java
+type names of the method parameters.
+
+Used in: java-method
+-->
+<!ELEMENT method-params (method-param*)>
+
+<!--
+The method-param element contains the fully-qualified Java type name
+of a method parameter.
+
+Used in: method-params
+-->
+<!ELEMENT method-param (#PCDATA)>
+
+<!--
+Payara flag to include / exclude specific JARs for CDI scanning inside EAR files
+-->
+<!ELEMENT scanning-exclude (#PCDATA)>
+<!ELEMENT scanning-include (#PCDATA)>
+
+<!--
+Payara flag to enable / specify whitelist for extreme ClassLoader isolation
+-->
+<!ELEMENT whitelist-package (#PCDATA)>
+
+<!--
+Payara element to ignore the default support for the RolesAllowed annotation on JAX-RS resources.
+When this is disabled, RolesAllowed can still be activated by other means, e.g. by the Jersey
+specific method.
+-->
+<!ELEMENT jaxrs-roles-allowed-enabled (#PCDATA)>
+
+<!--
+The keep-state element indicates whether the state information should be
+preserved across redeployment.
+-->
+<!ELEMENT keep-state (#PCDATA)>
+
+<!--
+The version-identifier element contains the version information. The value is
+ retrieved at deployment.
+-->
+<!ELEMENT version-identifier (#PCDATA)>
+
+<!--
+Payara element to ignore servlet initializers
+-->
+<!ELEMENT container-initializer-enabled (#PCDATA)>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.mdd b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.mdd
new file mode 100644
index 0000000..8dc02db
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web-app_4.mdd
@@ -0,0 +1,525 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<metaDD>
+ <extends>org.netbeans.modules.j2ee.sun.dd.impl.common.SunBaseBean</extends>
+ <meta-element>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_3_0_0.SecurityRoleMapping</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_0.EjbRef</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_0.ResourceRef</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_0.ResourceEnvRef</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.ServiceRef</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.MessageDestination</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.WebserviceDescription</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_3_0_0.MessageDestinationRef</import>
+ <dtd-name>payara-web-app</dtd-name>
+ <bean-name>PayaraWebApp</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp</implements>
+ <user-code>
+ public void setVersion(java.math.BigDecimal value) {
+ }
+ public java.math.BigDecimal getVersion() {
+ return new java.math.BigDecimal("4");
+ }
+ public org.xml.sax.SAXParseException getError() {
+ return null;
+ }
+ public int getStatus() {
+ return STATE_VALID;
+ }
+ public boolean isEventSource(org.netbeans.modules.j2ee.sun.dd.api.RootInterface rootDD) {
+ return this == rootDD;
+ }
+ //Not in web_2_5-0
+ public void setMyClassLoader(boolean value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ public boolean isMyClassLoader() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ public void setMyClassLoaderExtraClassPath(java.lang.String value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ public java.lang.String getMyClassLoaderExtraClassPath() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ public void setMyClassLoaderDelegate(java.lang.String value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ public java.lang.String getMyClassLoaderDelegate() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
+ throw new org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException(getVersion().toString());
+ }
+ </user-code>
+ </meta-element>
+ <meta-element>
+ <dtd-name>context-root</dtd-name>
+ <bean-name>ContextRoot</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>security-role-mapping</dtd-name>
+ <bean-name>SecurityRoleMapping</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>servlet</dtd-name>
+ <bean-name>Servlet</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.Servlet</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>idempotent-url-pattern</dtd-name>
+ <bean-name>IdempotentUrlPattern</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>session-config</dtd-name>
+ <bean-name>SessionConfig</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.SessionConfig</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>ejb-ref</dtd-name>
+ <bean-name>EjbRef</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>resource-ref</dtd-name>
+ <bean-name>ResourceRef</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>resource-env-ref</dtd-name>
+ <bean-name>ResourceEnvRef</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>service-ref</dtd-name>
+ <bean-name>ServiceRef</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>message-destination-ref</dtd-name>
+ <bean-name>MessageDestinationRef</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>cache</dtd-name>
+ <bean-name>Cache</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.Cache</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>class-loader</dtd-name>
+ <bean-name>MyClassLoader</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.MyClassLoader</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>jsp-config</dtd-name>
+ <bean-name>JspConfig</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.JspConfig</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>locale-charset-info</dtd-name>
+ <bean-name>LocaleCharsetInfo</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.LocaleCharsetInfo</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>parameter-encoding</dtd-name>
+ <bean-name>ParameterEncoding</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>property</dtd-name>
+ <bean-name>WebProperty</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>valve</dtd-name>
+ <bean-name>Valve</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.Valve</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>message-destination</dtd-name>
+ <bean-name>MessageDestination</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>webservice-description</dtd-name>
+ <bean-name>WebserviceDescription</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>webservice-description-name</dtd-name>
+ <bean-name>WebserviceDescriptionName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>wsdl-publish-location</dtd-name>
+ <bean-name>WsdlPublishLocation</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>#PCDATA</dtd-name>
+ <bean-name>Pcdata</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>message-destination-name</dtd-name>
+ <bean-name>MessageDestinationName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>jndi-name</dtd-name>
+ <bean-name>JndiName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>description</dtd-name>
+ <bean-name>Description</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>EMPTY</dtd-name>
+ <bean-name>Empty</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>locale-charset-map</dtd-name>
+ <bean-name>LocaleCharsetMap</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.LocaleCharsetMap</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>cache-helper</dtd-name>
+ <bean-name>CacheHelper</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.CacheHelper</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>default-helper</dtd-name>
+ <bean-name>DefaultHelper</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.DefaultHelper</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>cache-mapping</dtd-name>
+ <bean-name>CacheMapping</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.CacheMapping</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>cache-helper-ref</dtd-name>
+ <bean-name>CacheHelperRef</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>dispatcher</dtd-name>
+ <bean-name>Dispatcher</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>timeout</dtd-name>
+ <bean-name>Timeout</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>refresh-field</dtd-name>
+ <bean-name>RefreshField</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>http-method</dtd-name>
+ <bean-name>HttpMethod</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>key-field</dtd-name>
+ <bean-name>KeyField</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>constraint-field</dtd-name>
+ <bean-name>ConstraintField</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.ConstraintField</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>constraint-field-value</dtd-name>
+ <bean-name>ConstraintFieldValue</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>servlet-name</dtd-name>
+ <bean-name>ServletName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>url-pattern</dtd-name>
+ <bean-name>UrlPattern</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>message-destination-ref-name</dtd-name>
+ <bean-name>MessageDestinationRefName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>service-ref-name</dtd-name>
+ <bean-name>ServiceRefName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>port-info</dtd-name>
+ <bean-name>PortInfo</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.PortInfo</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>call-property</dtd-name>
+ <bean-name>CallProperty</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.CallProperty</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>wsdl-override</dtd-name>
+ <bean-name>WsdlOverride</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>service-impl-class</dtd-name>
+ <bean-name>ServiceImplClass</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>service-qname</dtd-name>
+ <bean-name>ServiceQname</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.ServiceQname</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>namespaceURI</dtd-name>
+ <bean-name>NamespaceURI</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>localpart</dtd-name>
+ <bean-name>Localpart</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>name</dtd-name>
+ <bean-name>Name</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>value</dtd-name>
+ <bean-name>Value</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>service-endpoint-interface</dtd-name>
+ <bean-name>ServiceEndpointInterface</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>wsdl-port</dtd-name>
+ <bean-name>WsdlPort</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.WsdlPort</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>stub-property</dtd-name>
+ <bean-name>StubProperty</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.StubProperty</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>message-security-binding</dtd-name>
+ <bean-name>MessageSecurityBinding</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.MessageSecurityBinding</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>message-security</dtd-name>
+ <bean-name>MessageSecurity</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.MessageSecurity</implements>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>message</dtd-name>
+ <bean-name>Message</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.Message</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>request-protection</dtd-name>
+ <bean-name>RequestProtection</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>response-protection</dtd-name>
+ <bean-name>ResponseProtection</bean-name>
+ <wrapper-class>Boolean</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>java-method</dtd-name>
+ <bean-name>JavaMethod</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.JavaMethod</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>operation-name</dtd-name>
+ <bean-name>OperationName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>method-name</dtd-name>
+ <bean-name>MethodName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>method-params</dtd-name>
+ <bean-name>MethodParams</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.MethodParams</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>method-param</dtd-name>
+ <bean-name>MethodParam</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>resource-env-ref-name</dtd-name>
+ <bean-name>ResourceEnvRefName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>res-ref-name</dtd-name>
+ <bean-name>ResRefName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>default-resource-principal</dtd-name>
+ <bean-name>DefaultResourcePrincipal</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.DefaultResourcePrincipal</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>password</dtd-name>
+ <bean-name>Password</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>ejb-ref-name</dtd-name>
+ <bean-name>EjbRefName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>session-manager</dtd-name>
+ <bean-name>SessionManager</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.SessionManager</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>session-properties</dtd-name>
+ <bean-name>SessionProperties</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.SessionProperties</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>cookie-properties</dtd-name>
+ <bean-name>CookieProperties</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.CookieProperties</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>manager-properties</dtd-name>
+ <bean-name>ManagerProperties</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.ManagerProperties</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>store-properties</dtd-name>
+ <bean-name>StoreProperties</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.web.StoreProperties</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>principal-name</dtd-name>
+ <bean-name>PrincipalName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.LoginConfig</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.MessageSecurityBinding</import>
+ <import>org.netbeans.modules.j2ee.sun.dd.impl.common.model_2_1_1.ServiceQname</import>
+ <dtd-name>webservice-endpoint</dtd-name>
+ <bean-name>WebserviceEndpoint</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceEndpoint</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>port-component-name</dtd-name>
+ <bean-name>PortComponentName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>endpoint-address-uri</dtd-name>
+ <bean-name>EndpointAddressUri</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>transport-guarantee</dtd-name>
+ <bean-name>TransportGuarantee</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>tie-class</dtd-name>
+ <bean-name>TieClass</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>servlet-impl-class</dtd-name>
+ <bean-name>ServletImplClass</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>debugging-enabled</dtd-name>
+ <bean-name>DebuggingEnabled</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <skip-generation/>
+ <dtd-name>login-config</dtd-name>
+ <bean-name>LoginConfig</bean-name>
+ <implements>org.netbeans.modules.j2ee.sun.dd.api.common.LoginConfig</implements>
+ </meta-element>
+ <meta-element>
+ <dtd-name>auth-method</dtd-name>
+ <bean-name>AuthMethod</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>role-name</dtd-name>
+ <bean-name>RoleName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+ <meta-element>
+ <dtd-name>group-name</dtd-name>
+ <bean-name>GroupName</bean-name>
+ <wrapper-class>String</wrapper-class>
+ </meta-element>
+</metaDD>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web.xml b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web.xml
new file mode 100644
index 0000000..5ce3c65
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/resources/payara-web.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE payara-web-app PUBLIC "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN" "https://docs.payara.fish/schemas/payara-web-app_4.dtd">
+<payara-web-app error-url="">
+ <class-loader delegate="true"/>
+</payara-web-app>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/Bundle.properties b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/Bundle.properties
new file mode 100644
index 0000000..f0e1da7
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/Bundle.properties
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+LBL_Name=File &Name:
+ASCN_Name=File Name
+ASCD_Name=The name of the configuration file being created.
+LBL_Project=&Project:
+ASCN_Project=Project
+ASCD_Project=The name of the current project.
+LBL_Location=&Location:
+ASCN_Location=Location
+ASCD_Location=The location within the project where the file is being created.
+LBL_CreatedFile=&Created File:
+ASCN_CreatedFile=Created File
+ASCD_CreatedFile=The path name of the resulting file.
+
+LBL_CreatePayaraDeploymentDescriptor=Create Server Specific Deployment Descriptor
+ERR_NoJavaEEModuleType=Unable to determine Java EE module type for this project.
+ERR_FileExists={0} already exists.
+ERR_NoValidLocation=There is no valid location for {0}.
+ERR_FileCreationFailed=Unable to create {0} for unknown reason.
+ERR_TemplateNotFound=Unable to locate template for {0}.
+ERR_LocationNotFound=Location {0} not found or inaccessible.
+ERR_NoDeploymentConfiguration=Deployment Configuration for this project not found. Deployment descriptor version could not be set properly.
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.form b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.form
new file mode 100644
index 0000000..f7fc503
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.form
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="labelFileName">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="textFileName"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="LBL_Name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="textFileName">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCN_Name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCD_Name" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="labelProjectName">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="textProjectName"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="LBL_Project" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="textProjectName">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCN_Project" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCD_Project" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="labelLocation">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="textLocation"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="LBL_Location" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="textLocation">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCN_Location" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCD_Location" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="labelCreatedFile">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="textCreatedFile"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="LBL_CreatedFile" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="11" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JTextField" name="textCreatedFile">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCN_CreatedFile" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/j2ee/sun/share/configbean/templates/Bundle.properties" key="ASCD_CreatedFile" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </AccessibilityProperties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="11" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ <Component class="javax.swing.JLabel" name="filler1">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
+ </Constraint>
+ </Constraints>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.java
new file mode 100644
index 0000000..5dae9e9
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDVisualPanel.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.wizard;
+
+import java.io.File;
+import javax.swing.JPanel;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.payara.spi.Utils;
+
+/*
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+public final class PayaraDDVisualPanel extends JPanel {
+
+ private Project project;
+ private String payaraDDFileName;
+ private File payaraDDFile;
+ private File payaraDDLocation;
+
+ private static final String WEB_XML = "web.xml";
+
+ public PayaraDDVisualPanel() {
+ initComponents();
+ }
+
+ void setProject(final Project project) {
+ this.project = project;
+
+ // get list of config files for this module type
+ // figure out which ones exist already
+ //
+ Lookup lookup = project.getLookup();
+ J2eeModuleProvider provider = (J2eeModuleProvider) lookup.lookup(J2eeModuleProvider.class);
+ J2eeModule j2eeModule = provider.getJ2eeModule();
+ payaraDDFileName = getConfigFileName(j2eeModule,provider.getServerInstanceID());
+
+ // Calculate location:
+ payaraDDLocation = j2eeModule.getDeploymentConfigurationFile(WEB_XML).getParentFile();
+ payaraDDFile = new File(payaraDDLocation, payaraDDFileName);
+
+ // initialize visual components
+ textFileName.setText(payaraDDFileName); // NOI18N
+ textProjectName.setText(ProjectUtils.getInformation(project).getDisplayName());
+
+ File projectFolder = FileUtil.toFile(project.getProjectDirectory());
+ textLocation.setText((payaraDDLocation != null) ? getRelativePath(payaraDDLocation, projectFolder) : null);
+ // only fill 'created file' in if location is valid.
+ textCreatedFile.setText((payaraDDLocation != null) ? getRelativePath(payaraDDFile, projectFolder) : null);
+ }
+
+ String getFileName() {
+ return payaraDDFileName;
+ }
+
+ File getFile() {
+ return payaraDDFile;
+ }
+
+ File getSelectedLocation() {
+ return payaraDDLocation;
+ }
+
+ @Override
+ public String getName() {
+ return NbBundle.getMessage(PayaraDDVisualPanel.class, "LBL_CreatePayaraDeploymentDescriptor"); // NOI18N
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ java.awt.GridBagConstraints gridBagConstraints;
+
+ labelFileName = new javax.swing.JLabel();
+ textFileName = new javax.swing.JTextField();
+ labelProjectName = new javax.swing.JLabel();
+ textProjectName = new javax.swing.JTextField();
+ labelLocation = new javax.swing.JLabel();
+ textLocation = new javax.swing.JTextField();
+ labelCreatedFile = new javax.swing.JLabel();
+ textCreatedFile = new javax.swing.JTextField();
+ filler1 = new javax.swing.JLabel();
+
+ setLayout(new java.awt.GridBagLayout());
+
+ labelFileName.setLabelFor(textFileName);
+ org.openide.awt.Mnemonics.setLocalizedText(labelFileName, org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "LBL_Name")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ add(labelFileName, gridBagConstraints);
+
+ textFileName.setEditable(false);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
+ add(textFileName, gridBagConstraints);
+ textFileName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCN_Name")); // NOI18N
+ textFileName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCD_Name")); // NOI18N
+
+ labelProjectName.setLabelFor(textProjectName);
+ org.openide.awt.Mnemonics.setLocalizedText(labelProjectName, org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "LBL_Project")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
+ add(labelProjectName, gridBagConstraints);
+
+ textProjectName.setEditable(false);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
+ add(textProjectName, gridBagConstraints);
+ textProjectName.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCN_Project")); // NOI18N
+ textProjectName.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCD_Project")); // NOI18N
+
+ labelLocation.setLabelFor(textLocation);
+ org.openide.awt.Mnemonics.setLocalizedText(labelLocation, org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "LBL_Location")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
+ add(labelLocation, gridBagConstraints);
+
+ textLocation.setEditable(false);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
+ add(textLocation, gridBagConstraints);
+ textLocation.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCN_Location")); // NOI18N
+ textLocation.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCD_Location")); // NOI18N
+
+ labelCreatedFile.setLabelFor(textCreatedFile);
+ org.openide.awt.Mnemonics.setLocalizedText(labelCreatedFile, org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "LBL_CreatedFile")); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.insets = new java.awt.Insets(12, 0, 11, 0);
+ add(labelCreatedFile, gridBagConstraints);
+
+ textCreatedFile.setEditable(false);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 0);
+ add(textCreatedFile, gridBagConstraints);
+ textCreatedFile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCN_CreatedFile")); // NOI18N
+ textCreatedFile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PayaraDDVisualPanel.class, "ASCD_CreatedFile")); // NOI18N
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.weightx = 1.0;
+ gridBagConstraints.weighty = 1.0;
+ add(filler1, gridBagConstraints);
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel filler1;
+ private javax.swing.JLabel labelCreatedFile;
+ private javax.swing.JLabel labelFileName;
+ private javax.swing.JLabel labelLocation;
+ private javax.swing.JLabel labelProjectName;
+ private javax.swing.JTextField textCreatedFile;
+ private javax.swing.JTextField textFileName;
+ private javax.swing.JTextField textLocation;
+ private javax.swing.JTextField textProjectName;
+ // End of variables declaration//GEN-END:variables
+
+
+ // TODO avoid the hard coding that is done in here
+
+ private String getConfigFileName(J2eeModule j2eeModule,String serverInstanceID) {
+ String result = null;
+ Object moduleType = j2eeModule.getType();
+ if(J2eeModule.Type.WAR.equals(moduleType)) {
+ result = Utils.useGlassFishPrefix(serverInstanceID) ?
+ "payara-web.xml" : "glassfish-web.xml"; // NOI18N;
+ } else if(J2eeModule.Type.EJB.equals(moduleType)) {
+ result = Utils.useGlassFishPrefix(serverInstanceID) ?
+ "glassfish-ejb-jar.xml" : "sun-ejb-jar.xml"; // NOI18N
+ } else if(J2eeModule.Type.EAR.equals(moduleType)) {
+ result = Utils.useGlassFishPrefix(serverInstanceID) ?
+ "glassfish-application.xml" : "sun-application.xml"; // NOI18N
+ } else if(J2eeModule.Type.CAR.equals(moduleType)) {
+ result = Utils.useGlassFishPrefix(serverInstanceID) ?
+ "glassfish-application-client.xml" : "sun-application-client.xml"; // NOI18N
+ }
+ return result;
+ }
+
+ private static String getRelativePath(File file, File base) {
+ String basePath = base.getAbsolutePath();
+ String filePath = file.getAbsolutePath();
+
+ if(filePath.startsWith(basePath)) {
+ String prefix = "";
+ int baseIndex = basePath.lastIndexOf(File.separatorChar);
+ if(baseIndex < 0 || baseIndex >= filePath.length()) {
+ baseIndex = 0;
+ } else {
+ prefix = "..."; // only apply prefix if we're calculating a true substring.
+ }
+ return prefix + filePath.substring(baseIndex);
+ }
+ return filePath;
+ }
+
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardIterator.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardIterator.java
new file mode 100644
index 0000000..bc6c6f1
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardIterator.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.wizard;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.templates.TemplateRegistration;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.netbeans.modules.payara.eecommon.api.XmlFileCreator;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration;
+import static org.netbeans.modules.payara.eecommon.dd.loader.PayaraDescriptorDataObject.DD_ICON;
+
+/*
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+
+@TemplateRegistration(
+ folder = "PayaraResources",
+ displayName = "#PayaraDD",
+ iconBase = DD_ICON,
+ description = "/org/netbeans/modules/payara/eecommon/dd/resources/PayaraDD.html",
+ category = {"j2ee-types", "deployment-descriptor", "web-types"}
+)
+@NbBundle.Messages("PayaraDD=Payara Descriptor")
+public final class PayaraDDWizardIterator implements WizardDescriptor.InstantiatingIterator {
+
+ private int index;
+
+ private WizardDescriptor wizard;
+
+ private WizardDescriptor.Panel[] panels;
+
+ /**
+ * Initialize panels representing individual wizard's steps and sets
+ * various properties for them influencing wizard appearance.
+ */
+ private WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = new WizardDescriptor.Panel[] {
+ new PayaraDDWizardPanel()
+ };
+ String[] steps = createSteps();
+ for (int i = 0; i < panels.length; i++) {
+ Component c = panels[i].getComponent();
+ if (steps[i] == null) {
+ // Default step name to component name of panel. Mainly
+ // useful for getting the name of the target chooser to
+ // appear in the list of steps.
+ steps[i] = c.getName();
+ }
+ if (c instanceof JComponent) { // assume Swing components
+ JComponent jc = (JComponent) c;
+ // Sets step number of a component
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i)); // NOI18N
+ // Sets steps names for a panel
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); // NOI18N
+ // Turn on subtitle creation on each step
+ jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE); // NOI18N
+ // Show steps on the left side with the image on the background
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE); // NOI18N
+ // Turn on numbering of all steps
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE); // NOI18N
+ }
+ }
+ }
+ return panels;
+ }
+
+ @Override
+ public Set instantiate() throws IOException {
+ Set result = Collections.EMPTY_SET;
+ PayaraDDWizardPanel wizardPanel = (PayaraDDWizardPanel) panels[0];
+
+ File configDir = wizardPanel.getSelectedLocation();
+ FileObject configFolder = FileUtil.createFolder(configDir);
+ if(configFolder != null) {
+ String ddFileName = wizardPanel.getFileName();
+ Project project = wizardPanel.getProject();
+ J2eeModuleProvider mod = project.getLookup().lookup(J2eeModuleProvider.class);
+ if (null != mod) {
+ String cr = "/";
+ try {
+ cr = mod.getConfigSupport().getWebContextRoot();
+ } catch (ConfigurationException ex) {
+ Logger.getLogger(this.getClass().getName()).log(Level.INFO,"",ex);
+ }
+ FileObject payaraDDTemplate = getDDFromProjectsModuleVersion(mod.getJ2eeModule(), ddFileName);
+ if(payaraDDTemplate != null) {
+ FileSystem fs = configFolder.getFileSystem();
+ XmlFileCreator creator = new XmlFileCreator(payaraDDTemplate, configFolder,
+ payaraDDTemplate.getName(), payaraDDTemplate.getExt());
+ fs.runAtomicAction(creator);
+ FileObject payaraDDFO = creator.getResult();
+ if (payaraDDFO != null) {
+ PayaraConfiguration config
+ = PayaraConfiguration.getConfiguration(FileUtil.toFile(payaraDDFO));
+ if (config != null) {
+ // Set version of target configuration file we just saved to maximum supported version.
+ config.setAppServerVersion(config.getMaxASVersion());
+ if (null != cr) {
+ try {
+ config.setContextRoot(cr);
+ } catch (ConfigurationException ex) {
+ Logger.getLogger(this.getClass().getName()).log(Level.INFO, "", ex);
+ }
+ }
+ } else {
+ NotifyDescriptor nd = new NotifyDescriptor.Message(
+ NbBundle.getMessage(PayaraDDWizardIterator.class, "ERR_NoDeploymentConfiguration"), // NOI18N
+ NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(nd);
+ }
+ result = Collections.singleton(creator.getResult());
+ } else {
+ NotifyDescriptor nd = new NotifyDescriptor.Message(
+ NbBundle.getMessage(PayaraDDWizardIterator.class, "ERR_FileCreationFailed", ddFileName), // NOI18N
+ NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(nd);
+ }
+ }
+ }
+ } else {
+ NotifyDescriptor nd = new NotifyDescriptor.Message(
+ NbBundle.getMessage(PayaraDDWizardIterator.class,"ERR_LocationNotFound", configDir.getAbsolutePath()), // NOI18N
+ NotifyDescriptor.ERROR_MESSAGE);
+ DialogDisplayer.getDefault().notify(nd);
+ }
+ return result;
+ }
+
+ public static FileObject getDDFromProjectsModuleVersion(J2eeModule mod, String ddFileName) {
+ return FileUtil.getConfigFile("org-netbeans-modules-payara-eecommon-dd-templates/payara-web.xml");
+ }
+
+ @Override
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ @Override
+ public void uninitialize(WizardDescriptor wizard) {
+ panels = null;
+ }
+
+ @Override
+ public WizardDescriptor.Panel current() {
+ return getPanels()[index];
+ }
+
+ @Override
+ public String name() {
+ return index + 1 + ". from " + getPanels().length;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return index < getPanels().length - 1;
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ @Override
+ public void nextPanel() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ index++;
+ }
+
+ @Override
+ public void previousPanel() {
+ if (!hasPrevious()) {
+ throw new NoSuchElementException();
+ }
+ index--;
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ @Override
+ public void addChangeListener(ChangeListener l) {}
+ @Override
+ public void removeChangeListener(ChangeListener l) {}
+
+ // You could safely ignore this method. Is is here to keep steps which were
+ // there before this wizard was instantiated. It should be better handled
+ // by NetBeans Wizard API itself rather than needed to be implemented by a
+ // client code.
+ private String[] createSteps() {
+ String[] beforeSteps = null;
+ Object prop = wizard.getProperty(WizardDescriptor.PROP_CONTENT_DATA); // NOI18N
+ if (prop != null && prop instanceof String[]) {
+ beforeSteps = (String[]) prop;
+ }
+
+ if (beforeSteps == null) {
+ beforeSteps = new String[0];
+ }
+
+ String[] res = new String[(beforeSteps.length - 1) + panels.length];
+ for (int i = 0; i < res.length; i++) {
+ if (i < (beforeSteps.length - 1)) {
+ res[i] = beforeSteps[i];
+ } else {
+ res[i] = panels[i - beforeSteps.length + 1].getComponent().getName();
+ }
+ }
+ return res;
+ }
+}
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardPanel.java b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardPanel.java
new file mode 100644
index 0000000..e5b2d85
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/dd/wizard/PayaraDDWizardPanel.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.dd.wizard;
+
+import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.netbeans.api.project.Project;
+import org.netbeans.spi.project.ui.templates.support.Templates;
+
+/*
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+public class PayaraDDWizardPanel implements WizardDescriptor.Panel {
+
+ private final Set listeners = new HashSet(1);
+ private final PayaraDDVisualPanel component = new PayaraDDVisualPanel();
+ private WizardDescriptor wizardDescriptor;
+ private Project project;
+
+ public PayaraDDWizardPanel() {
+ component.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ fireChangeEvent();
+ }
+ });
+ }
+
+ File getSelectedLocation() {
+ return component.getSelectedLocation();
+ }
+
+ Project getProject() {
+ return project;
+ }
+
+ String getFileName() {
+ return component.getFileName();
+ }
+
+ @Override
+ public Component getComponent() {
+ return component;
+ }
+
+ @Override
+ public HelpCtx getHelp() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ public boolean isValid() {
+ String payaraDDFileName = component.getFileName();
+ if (payaraDDFileName == null) {
+ wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, // NOI18N
+ NbBundle.getMessage(PayaraDDWizardPanel.class, "ERR_NoJavaEEModuleType")); //NOI18N
+ return false;
+ }
+
+ File location = component.getSelectedLocation();
+ if (location == null) {
+ wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, // NOI18N
+ NbBundle.getMessage(PayaraDDWizardPanel.class, "ERR_NoValidLocation", payaraDDFileName)); //NOI18N
+ return false;
+ }
+
+ File payaraDDFile = component.getFile();
+ if (payaraDDFile.exists()) {
+ wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, // NOI18N
+ NbBundle.getMessage(PayaraDDWizardPanel.class, "ERR_FileExists", payaraDDFileName)); //NOI18N
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+
+ @Override
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ ((ChangeListener)it.next()).stateChanged(ev);
+ }
+ }
+
+ // You can use a settings object to keep track of state. Normally the
+ // settings object will be the WizardDescriptor, so you can use
+ // WizardDescriptor.getProperty & putProperty to store information entered
+ // by the user.
+ @Override
+ public void readSettings(Object settings) {
+ wizardDescriptor = (WizardDescriptor) settings;
+ if (project == null) {
+ project = Templates.getProject(wizardDescriptor);
+ component.setProject(project);
+ }
+ }
+
+ @Override
+ public void storeSettings(Object settings) {
+ }
+
+}
+
diff --git a/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/layer.xml b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/layer.xml
new file mode 100644
index 0000000..9af008d
--- /dev/null
+++ b/enterprise/payara.eecommon/src/org/netbeans/modules/payara/eecommon/layer.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
+<filesystem>
+ <folder name="Navigator">
+ <folder name="Panels">
+ <folder name="text">
+ <folder name="x-dd-payara-web+xml">
+ <file name="org-netbeans-modules-xml-text-navigator-XMLNavigatorPanel.instance"/>
+ </folder>
+ </folder>
+ </folder>
+ </folder>
+
+ <folder name="org-netbeans-modules-payara-eecommon-dd-templates">
+ <file name="payara-web.xml" url="dd/resources/payara-web.xml"/>
+ </folder>
+ <folder name="Templates">
+ <folder name="PayaraResources">
+ <attr name="position" intvalue="1800"/>
+ <attr name="displayName" bundlevalue="org.netbeans.modules.payara.eecommon.Bundle#PayaraResourcesFolder"/>
+ </folder>
+ </folder>
+</filesystem>
diff --git a/enterprise/payara.eecommon/test/unit/data/default-web.xml b/enterprise/payara.eecommon/test/unit/data/default-web.xml
new file mode 100644
index 0000000..292591a
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/data/default-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+</web-app>
+
diff --git a/enterprise/payara.eecommon/test/unit/data/domain1/config/default-web.xml b/enterprise/payara.eecommon/test/unit/data/domain1/config/default-web.xml
new file mode 100644
index 0000000..292591a
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/data/domain1/config/default-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+</web-app>
+
diff --git a/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/FindJspServletHelperTest.java b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/FindJspServletHelperTest.java
new file mode 100644
index 0000000..7a95f8f
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/FindJspServletHelperTest.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+
+import static org.junit.Assert.*;
+
+public class FindJspServletHelperTest {
+
+ public FindJspServletHelperTest() {
+ }
+
+ @org.junit.BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @org.junit.AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @org.junit.Before
+ public void setUp() throws Exception {
+ }
+
+ @org.junit.After
+ public void tearDown() throws Exception {
+ }
+
+ //test copied from
+ //j2ee.sun.appsrv81/test/unit/src/org/netbeans/modules/j2ee/sun/ide/j2ee/jsps/FindJSPServletImplTest.java
+ /**
+ * Test of getServletResourcePath method, of class FindJSPServletHelper.
+ *
+ */
+ @org.junit.Test
+ public void testGetServletResourcePath() {
+ System.out.println("getServletResourcePath");
+ String moduleContextPath = "";
+ String jspResourcePath = "/test/index.jsp";
+ String expResult = "org/apache/jsp/test/index_jsp.java";
+ String result = FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ assertEquals(expResult, result);
+ jspResourcePath = "/index.jsp";
+ expResult = "org/apache/jsp/index_jsp.java";
+ result = FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ assertEquals(expResult, result);
+ jspResourcePath = "index.jsp";
+ expResult = "org/apache/jsp/index_jsp.java";
+ result = FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ assertEquals(expResult, result);
+ jspResourcePath = "a";
+ expResult = "org/apache/jsp/a.java";
+ result = FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ assertEquals(expResult, result);
+ try {
+ jspResourcePath = "";
+ expResult = "";
+ result = FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ fail("should have triggered an exception");
+ } catch (IllegalArgumentException iae) {
+
+ }
+ }
+
+
+}
diff --git a/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelperTest.java b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelperTest.java
new file mode 100644
index 0000000..a5e25c7
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/HttpMonitorHelperTest.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import org.junit.Test;
+import org.netbeans.modules.j2ee.dd.api.web.DDProvider;
+import org.netbeans.modules.j2ee.dd.api.web.WebApp;
+import static org.junit.Assert.*;
+import org.openide.util.Utilities;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class HttpMonitorHelperTest {
+
+ public HttpMonitorHelperTest() {
+ }
+
+ @Test
+ public void testGetDefaultWebXML() throws SAXException, IOException, ClassNotFoundException {
+ System.out.println("getDefaultWebXML");
+ URL codebase = getClass().getProtectionDomain().getCodeSource().getLocation();
+ if (!codebase.getProtocol().equals("file")) { // NOI18N
+ throw new Error("Cannot find data directory from " + codebase); // NOI18N
+ }
+ File dataDir;
+ try {
+ dataDir = new File(Utilities.toFile(codebase.toURI()).getParentFile(), "data"); // NOI18N
+ } catch (URISyntaxException x) {
+ throw new Error(x);
+ }
+ String domainLoc = dataDir.getAbsolutePath();
+ String domainName = "domain1"; // NOI18N
+ File f = new File(domainLoc + "/" + domainName +"/config/default-web.xml.orig");
+ f.delete();
+ f = new File(domainLoc + "/" + domainName +"/config/default-web.xml");
+ WebApp webApp;
+ try {
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ } catch (IOException ioe) {
+ fail("Could not parse default-web.xml file");
+ }
+ // first pass
+ f = HttpMonitorHelper.getDefaultWebXML(domainLoc, domainName);
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ f = new File(domainLoc + "/" + domainName +"/config/default-web.xml");
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ // second pass
+ f = HttpMonitorHelper.getDefaultWebXML(domainLoc, domainName);
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ f = new File(domainLoc + "/" + domainName +"/config/default-web.xml");
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ HttpMonitorHelper.changeFilterMonitor(webApp, true);
+ HttpMonitorHelper.specifyFilterPortParameter(webApp);
+ HttpMonitorHelper.specifyFilterPortParameter(webApp);
+ HttpMonitorHelper.changeFilterMonitor(webApp, false);
+ f = new File(domainLoc + "/" + domainName +"/config/default-web.xml.orig");
+ try {
+ webApp = DDProvider.getDefault().getDDRoot(f);
+ } catch (IOException ioe) {
+ fail("Could not parse default-web.xml file");
+ }
+
+ }
+
+ /**
+ * Test of createCopyAndUpgrade method, of class HttpMonitorHelper.
+ */
+ @Test
+ public void testCreateCopyAndUpgrade() throws IOException, SAXException {
+ System.out.println("createCopyAndUpgrade");
+
+ // empty source and dest
+ File webXML = File.createTempFile("foo", "bar"); // NOI18N
+ File newWebXML = File.createTempFile("bar", "foo"); // NOI18N
+ newWebXML.delete();
+ HttpMonitorHelper.createCopyAndUpgrade(webXML, newWebXML);
+ assert newWebXML.exists();
+
+ // source doesn't exist
+ webXML.delete();
+ newWebXML.delete();
+ HttpMonitorHelper.createCopyAndUpgrade(webXML, newWebXML);
+ assert !newWebXML.exists();
+
+ // expected data in source
+ URL codebase = getClass().getProtectionDomain().getCodeSource().getLocation();
+ if (!codebase.getProtocol().equals("file")) { // NOI18N
+ throw new Error("Cannot find data directory from " + codebase); // NOI18N
+ }
+ File dataDir;
+ try {
+ dataDir = new File(Utilities.toFile(
+ codebase.toURI()).getParentFile(), "data"); // NOI18N
+ } catch (URISyntaxException x) {
+ throw new Error(x);
+ }
+ webXML = new File(dataDir,"default-web.xml"); // NOI18N
+ HttpMonitorHelper.createCopyAndUpgrade(webXML, newWebXML);
+ assert newWebXML.exists();
+ try {
+ WebApp webApp = DDProvider.getDefault().getDDRoot(webXML);
+ } catch (IOException ioe) {
+ fail("Could not parse default-web.xml file");
+ }
+// WebApp webApp = DDProvider.getDefault().getDDRoot(newWebXML);
+ newWebXML.delete();
+ }
+
+
+}
diff --git a/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/UrlDataTest.java b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/UrlDataTest.java
new file mode 100644
index 0000000..cfae5fb
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/UrlDataTest.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.eecommon.api;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class UrlDataTest {
+
+ public UrlDataTest() {
+ }
+
+ private static String [] urls = {
+ "jdbc:derby://localhost:1527/travel",
+ "jdbc:derby://localhost:1527/travel;create=true",
+ "jdbc:sun:sqlserver://localhost:1433;databaseName=sampledb",
+ "jdbc:sun:sqlserver://localhost:1433;databaseName=sampledb;create=true;foo=bar;bar=foo",
+ "jdbc:sun:sqlserver://localhost:1433;create=true;databaseName=sampledb;foo=bar;bar=foo",
+ "jdbc:sqlserver://localhost:1433",
+ "jdbc:sqlserver://localhost:1433/sampledb",
+ "jdbc:sqlserver://localhost\\instanceName:1433",
+ "jdbc:sqlserver://localhost\\instanceName:1433/sampledb",
+ "jdbc:sun:oracle://localhost:1521;SID=sampledb",
+ "jdbc:oracle:thin:@localhost:1521:sampledb",
+ "jdbc:oracle:thin:@localhost:sampledb",
+ "jdbc:oracle:thin:@localhost:1521",
+ "jdbc:mysql://localhost:3306/baza1250?autoReconnect=true&characterEncoding=cp1250&characterSetResults=cp1250",
+ "jdbc:postgresql://localhost:5432/sampledb",
+ "jdbc:weblogic:mssqlserver4:sampledb@localhost:1433",
+ "jdbc:informix-sqli://localhost:1530/sampledb:INFORMIXSERVER=informixinstancename",
+ "jdbc:datadirect:informix://localhost:1530;informixServer=informixinstancename;databaseName=sampledb",
+ "jdbc:as400://9.88.24.163",
+ "jdbc:as400://myiSeries;database name=IASP1"
+ };
+
+ /**
+ * Test of database URL parsing
+ */
+ @Test
+ public void testUrlParser() {
+ for(String url: urls) {
+ System.out.println("Parsing: " + url);
+ UrlData data = new UrlData(url);
+ assertEquals("Parsing " + url + " failed.", url, data.constructUrl());
+ }
+ }
+
+}
diff --git a/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/GFTestEEModuleImpl.java b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/GFTestEEModuleImpl.java
new file mode 100644
index 0000000..e43a06c
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/GFTestEEModuleImpl.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.Collections;
+import java.util.Iterator;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleImplementation2;
+import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Java EE module for Payara features tests.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class GFTestEEModuleImpl implements J2eeModuleImplementation2 {
+
+ private final FileObject appRoot;
+ private final File srcDir;
+ private final File configDir;
+ private final J2eeModule.Type moduleType;
+ private final String moduleVersion;
+
+ /** Creates a new instance of TestJ2eeModule
+ * @param appRoot Application root directory.
+ * @param moduleType Java EE module type.
+ * @param moduleVersion Java EE version.
+ */
+ public GFTestEEModuleImpl(
+ final FileObject appRoot, final J2eeModule.Type moduleType,
+ final String moduleVersion
+ ) {
+ this.appRoot = appRoot;
+ this.srcDir = new File(FileUtil.toFile(appRoot), "src");
+ this.configDir = new File(srcDir, "conf");
+ this.moduleType = moduleType;
+ this.moduleVersion = moduleVersion;
+ }
+
+ @Override
+ public FileObject getArchive() {
+ return null;
+ }
+
+ @Override
+ public Iterator<J2eeModule.RootedEntry> getArchiveContents() {
+ return Collections.<J2eeModule.RootedEntry>emptySet().iterator();
+ }
+
+ @Override
+ public FileObject getContentDirectory() {
+ return appRoot;
+ }
+
+ @Override
+ public J2eeModule.Type getModuleType() {
+ return moduleType;
+ }
+
+ @Override
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ @Override
+ public String getUrl() {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public File getResourceDirectory() {
+ return new File(FileUtil.toFile(appRoot), "setup");
+ }
+
+ @Override
+ public File getDeploymentConfigurationFile(String name) {
+ return new File(configDir, name);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public <T> MetadataModel<T> getMetadataModel(Class<T> type) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+}
diff --git a/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfigurationTest.java b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfigurationTest.java
new file mode 100644
index 0000000..8cbf25a
--- /dev/null
+++ b/enterprise/payara.eecommon/test/unit/src/org/netbeans/modules/payara/eecommon/api/config/PayaraConfigurationTest.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.eecommon.api.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleFactory;
+import org.netbeans.modules.payara.eecommon.api.config.JavaEEModule;
+import org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Pair;
+
+/**
+ * Payara Java EE server configuration API support tests.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraConfigurationTest extends NbTestCase {
+
+ private GFTestEEModuleImpl moduleImplCar;
+ private J2eeModule moduleCar;
+ private GFTestEEModuleImpl moduleImplEjb;
+ private J2eeModule moduleEjb;
+ private GFTestEEModuleImpl moduleImplEar;
+ private J2eeModule moduleEar;
+ private GFTestEEModuleImpl moduleImplWar;
+ private J2eeModule moduleWar;
+ private GFTestEEModuleImpl moduleImplRar;
+ private J2eeModule moduleRar;
+
+ public PayaraConfigurationTest(final String testName) {
+ super(testName);
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ final File dataDir = getDataDir();
+ final File rootFolder = new File(dataDir, "gfsample");
+ rootFolder.mkdirs();
+ final FileObject rootFolderFO = FileUtil.toFileObject(rootFolder);
+ moduleImplCar = new GFTestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.CAR, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ moduleCar = J2eeModuleFactory.createJ2eeModule(moduleImplCar);
+ moduleImplEjb = new GFTestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.EJB, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ moduleEjb = J2eeModuleFactory.createJ2eeModule(moduleImplEjb);
+ moduleImplEar = new GFTestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.EAR, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ moduleEar = J2eeModuleFactory.createJ2eeModule(moduleImplEar);
+ moduleImplRar = new GFTestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.RAR, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ moduleRar = J2eeModuleFactory.createJ2eeModule(moduleImplRar);
+ moduleImplWar = new GFTestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.WAR, Profile.JAVA_EE_7_WEB.toPropertiesString());
+ moduleWar = J2eeModuleFactory.createJ2eeModule(moduleImplWar);
+ }
+
+ @After
+ @Override
+ public void tearDown() {
+ // Pass everything to GC.
+ moduleImplCar = null;
+ moduleCar = null;
+ moduleImplEjb = null;
+ moduleEjb = null;
+ moduleImplEar = null;
+ moduleEar = null;
+ moduleImplRar = null;
+ moduleRar = null;
+ moduleImplWar = null;
+ moduleWar = null;
+ }
+
+ /**
+ * Test Java EE module directory structure for resource file.
+ * @throws NoSuchMethodException when there is a problem with reflection.
+ * @throws IllegalAccessException when there is a problem with reflection.
+ * @throws IllegalArgumentException when there is a problem with reflection.
+ * @throws InvocationTargetException when there is a problem with reflection.
+ */
+ @Test
+ public void testResourceFilePath()
+ throws NoSuchMethodException, IllegalAccessException,
+ IllegalArgumentException, InvocationTargetException {
+ final Method resourceFilePath = PayaraConfiguration.class.getDeclaredMethod(
+ "resourceFilePath", J2eeModule.class, String.class);
+ resourceFilePath.setAccessible(true);
+
+ final String pathFragment = "myDirectory";
+ final String verifyConfigDirCar = OsUtils.joinPaths(JavaEEModule.META_INF, pathFragment);
+ final String verifyConfigDirEjb = OsUtils.joinPaths(JavaEEModule.META_INF, pathFragment);
+ final String verifyConfigDirEar = OsUtils.joinPaths(JavaEEModule.META_INF, pathFragment);
+ final String verifyConfigDirRar = OsUtils.joinPaths(JavaEEModule.META_INF, pathFragment);
+ final String verifyConfigDirWar = OsUtils.joinPaths(JavaEEModule.WEB_INF, pathFragment);
+ final String configDirCar = (String)resourceFilePath.invoke(null, moduleCar, pathFragment);
+ final String configDirEjb = (String)resourceFilePath.invoke(null, moduleEjb, pathFragment);
+ final String configDirEar = (String)resourceFilePath.invoke(null, moduleEar, pathFragment);
+ final String configDirRar = (String)resourceFilePath.invoke(null, moduleRar, pathFragment);
+ final String configDirWar = (String)resourceFilePath.invoke(null, moduleWar, pathFragment);
+ assertEquals("Expected resource file path for CAR is: " + verifyConfigDirCar,
+ verifyConfigDirCar, configDirCar);
+ assertEquals("Expected resource file path for EJB is: " + verifyConfigDirEjb,
+ verifyConfigDirEjb, configDirEjb);
+ assertEquals("Expected resource file path for EAR is: " + verifyConfigDirEar,
+ verifyConfigDirEar, configDirEar);
+ assertEquals("Expected resource file path for RAR is: " + verifyConfigDirRar,
+ verifyConfigDirRar, configDirRar);
+ assertEquals("Expected resource file path for WAR is: " + verifyConfigDirWar,
+ verifyConfigDirWar, configDirWar);
+ }
+
+ /**
+ * Test new Payara resources file name generation depending on passed {@link PayaraVersion}.
+ * Expected values are:<ul>
+ * <li>PREFIX/src/conf/META_INF/sun-resources.xml for CAR, EAR, EJB and RAR
+ * on Payara older than 3.1</li\>
+ * <li>PREFIX/src/conf/META_INF/sun-resources.xml for CAR, EAR, EJB and RAR
+ * on Payara 3.1 and later</li\>
+ * <li>PREFIX/src/conf/WEB_INF/sun-resources.xml for WAR on Payara older than 3.1</li\>
+ * <li>PREFIX/src/conf/WEB_INF/sun-resources.xml for WAR on Payara 3.1 and later</li\></ul>
+ */
+ @Test
+ public void testGetNewResourceFile() {
+ for (PayaraVersion version : PayaraVersion.values()) {
+ final Pair<File, Boolean> pairCar = PayaraConfiguration.getNewResourceFile(moduleCar, version);
+ final Pair<File, Boolean> pairEar = PayaraConfiguration.getNewResourceFile(moduleEar, version);
+ final Pair<File, Boolean> pairEjb = PayaraConfiguration.getNewResourceFile(moduleEjb, version);
+ final Pair<File, Boolean> pairRar = PayaraConfiguration.getNewResourceFile(moduleRar, version);
+ final Pair<File, Boolean> pairWar = PayaraConfiguration.getNewResourceFile(moduleWar, version);
+ final File resourceFileCar = pairCar.first();
+ final File resourceFileEar = pairEar.first();
+ final File resourceFileEjb = pairEjb.first();
+ final File resourceFileRar = pairRar.first();
+ final File resourceFileWar = pairWar.first();
+File verifyPrefixCar;
+ File verifyPrefixEar;
+ File verifyPrefixEjb;
+ File verifyPrefixRar;
+ File verifyPrefixWar;
+ if (PayaraVersion.lt(version, PayaraVersion.PF_4_1_144)) {
+ verifyPrefixCar = moduleCar.getResourceDirectory();
+ verifyPrefixEar = moduleEar.getResourceDirectory();
+ verifyPrefixEjb = moduleEjb.getResourceDirectory();
+ verifyPrefixRar = moduleRar.getResourceDirectory();
+ verifyPrefixWar = moduleWar.getResourceDirectory();
+ } else {
+ verifyPrefixCar = moduleCar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleCar.getType()));
+ verifyPrefixEar = moduleEar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEar.getType()));
+ verifyPrefixEjb = moduleEjb.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEjb.getType()));
+ verifyPrefixRar = moduleRar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleRar.getType()));
+ verifyPrefixWar = moduleWar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleWar.getType()));
+ }
+ final String fileName = PayaraVersion.lt(version, PayaraVersion.PF_4_1_144)
+ ? "sun-resources.xml"
+ : "glassfish-resources.xml";
+ final File verifyFileCar = new File(verifyPrefixCar, fileName);
+ final File verifyFileEar = new File(verifyPrefixEar, fileName);
+ final File verifyFileEjb = new File(verifyPrefixEjb, fileName);
+ final File verifyFileRar = new File(verifyPrefixRar, fileName);
+ final File verifyFileWar = new File(verifyPrefixWar, fileName);
+ assertTrue("New resource file for " + version.toString() + " CAR: " + verifyFileCar.toString() + " was " + resourceFileCar,
+ verifyFileCar.equals(resourceFileCar));
+ assertTrue("New resource file for " + version.toString() + " EAR: " + verifyFileEar.toString() + " was " + resourceFileEar,
+ verifyFileEar.equals(resourceFileEar));
+ assertTrue("New resource file for " + version.toString() + " EJB: " + verifyFileEjb.toString() + " was " + resourceFileEjb,
+ verifyFileEjb.equals(resourceFileEjb));
+ assertTrue("New resource file for " + version.toString() + " RAR: " + verifyFileRar.toString() + " was " + resourceFileRar,
+ verifyFileRar.equals(resourceFileRar));
+ assertTrue("New resource file for " + version.toString() + " WAR: " + verifyFileWar.toString() + " was " + resourceFileWar,
+ verifyFileWar.equals(resourceFileWar));
+ }
+ }
+
+
+ /**
+ * Verify that proper resource file from Java EE module is returned.
+ * Both {@code sun-resources.xml} and {@code glassfish-resources.xml} are available
+ * in Java EE module configuration directory on the disk.
+ * Expected values are:<ul>
+ * <li>PREFIX/src/conf/META_INF/sun-resources.xml for CAR, EAR, EJB and RAR
+ * on Payara older than 3.1</li\>
+ * <li>PREFIX/src/conf/META_INF/sun-resources.xml for CAR, EAR, EJB and RAR
+ * on Payara 3.1 and later</li\>
+ * <li>PREFIX/src/conf/WEB_INF/sun-resources.xml for WAR on Payara older than 3.1</li\>
+ * <li>PREFIX/src/conf/WEB_INF/sun-resources.xml for WAR on Payara 3.1 and later</li\></ul>
+ */
+ @Test
+ public void testGetExistingResourceFile() throws IOException {
+ final File prefixCar = moduleCar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleCar.getType()));
+ final File prefixEar = moduleEar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEar.getType()));
+ final File prefixEjb = moduleEjb.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEjb.getType()));
+ final File prefixRar = moduleRar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleRar.getType()));
+ final File prefixWar = moduleWar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleWar.getType()));
+ final Set<File> prefixes = new HashSet<File>(5);
+ prefixes.add(prefixCar);
+ prefixes.add(prefixEar);
+ prefixes.add(prefixEjb);
+ prefixes.add(prefixRar);
+ prefixes.add(prefixWar);
+ // Create all resource files (they are empty but it's enough for this test).
+ for (File prefix : prefixes) {
+ final File sunResource = new File(prefix, "sun-resources.xml");
+ final File gfResource = new File(prefix, "glassfish-resources.xml");
+ prefix.mkdirs();
+ sunResource.createNewFile();
+ gfResource.createNewFile();
+ }
+ for (PayaraVersion version : PayaraVersion.values()) {
+ final Pair<File, Boolean> pairCar = PayaraConfiguration.getNewResourceFile(moduleCar, version);
+ final Pair<File, Boolean> pairEar = PayaraConfiguration.getNewResourceFile(moduleEar, version);
+ final Pair<File, Boolean> pairEjb = PayaraConfiguration.getNewResourceFile(moduleEjb, version);
+ final Pair<File, Boolean> pairRar = PayaraConfiguration.getNewResourceFile(moduleRar, version);
+ final Pair<File, Boolean> pairWar = PayaraConfiguration.getNewResourceFile(moduleWar, version);
+ final File resourcesCar = pairCar.first();
+ final File resourcesEar = pairEar.first();
+ final File resourcesEjb = pairEjb.first();
+ final File resourcesRar = pairRar.first();
+ final File resourcesWar = pairWar.first();
+ File verifyPrefixCar;
+ File verifyPrefixEar;
+ File verifyPrefixEjb;
+ File verifyPrefixRar;
+ File verifyPrefixWar;
+ if (PayaraVersion.lt(version, PayaraVersion.PF_4_1_144)) {
+ verifyPrefixCar = moduleCar.getResourceDirectory();
+ verifyPrefixEar = moduleEar.getResourceDirectory();
+ verifyPrefixEjb = moduleEjb.getResourceDirectory();
+ verifyPrefixRar = moduleRar.getResourceDirectory();
+ verifyPrefixWar = moduleWar.getResourceDirectory();
+ } else {
+ verifyPrefixCar = moduleCar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleCar.getType()));
+ verifyPrefixEar = moduleEar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEar.getType()));
+ verifyPrefixEjb = moduleEjb.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleEjb.getType()));
+ verifyPrefixRar = moduleRar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleRar.getType()));
+ verifyPrefixWar = moduleWar.getDeploymentConfigurationFile(
+ JavaEEModule.getConfigDir(moduleWar.getType()));
+ }
+ final String fileName = PayaraVersion.lt(version, PayaraVersion.PF_4_1_144)
+ ? "sun-resources.xml"
+ : "glassfish-resources.xml";
+ final File verifyFileCar = new File(verifyPrefixCar, fileName);
+ final File verifyFileEar = new File(verifyPrefixEar, fileName);
+ final File verifyFileEjb = new File(verifyPrefixEjb, fileName);
+ final File verifyFileRar = new File(verifyPrefixRar, fileName);
+ final File verifyFileWar = new File(verifyPrefixWar, fileName);
+ assertTrue("Existing resource file for " + version.toString() + " CAR: "
+ + verifyFileCar.toString() + " was " + resourcesCar,
+ verifyFileCar.equals(resourcesCar));
+ assertTrue("Existing resource file for " + version.toString() + " EAR: "
+ + verifyFileEar.toString() + " was " + resourcesEar,
+ verifyFileEar.equals(resourcesEar));
+ assertTrue("Existing resource file for " + version.toString() + " EJB: "
+ + verifyFileEjb.toString() + " was " + resourcesEjb,
+ verifyFileEjb.equals(resourcesEjb));
+ assertTrue("Existing resource file for " + version.toString() + " RAR: "
+ + verifyFileRar.toString() + " was " + resourcesRar,
+ verifyFileRar.equals(resourcesRar));
+ assertTrue("Existing resource file for " + version.toString() + " WAR: "
+ + verifyFileWar.toString() + " was " + resourcesWar,
+ verifyFileWar.equals(resourcesWar));
+ }
+ // Delete all resource files.
+ for (File prefix : prefixes) {
+ final File sunResource = new File(prefix, "sun-resources.xml");
+ final File gfResource = new File(prefix, "glassfish-resources.xml");
+ sunResource.delete();
+ gfResource.delete();
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/build.xml b/enterprise/payara.jakartaee/build.xml
new file mode 100644
index 0000000..8618630
--- /dev/null
+++ b/enterprise/payara.jakartaee/build.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<project basedir="." default="build" name="enterprise/payara.jakartaee">
+ <description>Builds, tests, and runs the project org.netbeans.modules.payara.jakartaee</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
\ No newline at end of file
diff --git a/enterprise/payara.jakartaee/licenseinfo.xml b/enterprise/payara.jakartaee/licenseinfo.xml
new file mode 100644
index 0000000..d760a1c
--- /dev/null
+++ b/enterprise/payara.jakartaee/licenseinfo.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<licenseinfo>
+ <fileset>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/appclient.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/ConfigFile.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/connector.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/javamail.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/jdbc.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/jms.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/jndi.gif</file>
+ <file>src/org/netbeans/modules/payara/jakartaee/resources/server.png</file>
+ <license ref="Apache-2.0-ASF" />
+ <comment type="COMMENT_UNSUPPORTED" />
+ </fileset>
+</licenseinfo>
diff --git a/enterprise/payara.jakartaee/manifest.mf b/enterprise/payara.jakartaee/manifest.mf
new file mode 100644
index 0000000..413c39b
--- /dev/null
+++ b/enterprise/payara.jakartaee/manifest.mf
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.payara.jakartaee/0
+OpenIDE-Module-Layer: org/netbeans/modules/payara/jakartaee/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/payara/jakartaee/Bundle.properties
+OpenIDE-Module-Provides: org.netbeans.modules.serverplugins.javaee
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/enterprise/payara.jakartaee/nbproject/project.properties b/enterprise/payara.jakartaee/nbproject/project.properties
new file mode 100644
index 0000000..635a09a
--- /dev/null
+++ b/enterprise/payara.jakartaee/nbproject/project.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+javac.compilerargs=-Xlint -Xlint:-serial
+javac.source=1.8
+
+test.config.stableBTD.includes=**/*Test.class
+test.config.stableBTD.excludes=\
+ org/netbeans/modules/payara/jakartaee/test/*
diff --git a/enterprise/payara.jakartaee/nbproject/project.xml b/enterprise/payara.jakartaee/nbproject/project.xml
new file mode 100644
index 0000000..a4135ba
--- /dev/null
+++ b/enterprise/payara.jakartaee/nbproject/project.xml
@@ -0,0 +1,415 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.payara.jakartaee</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.debugger</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.33</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.debugger.jpda</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>2.33</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.41</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.30</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.progress</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.40</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.xml</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.41</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.db</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.25</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.eecommon</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.payara.tooling</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.core</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.dd</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.11</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.sun.dd</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.15</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.sun.ddui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeapis</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.9</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>4</release-version>
+ <specification-version>1.86</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.platform</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.10</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.project</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.62</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.javaee.specs.support</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.26</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.49</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.24</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.78</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi.base</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.78</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.server</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.2</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.websvc.wsstackapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0-1</release-version>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.catalog</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>2.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.core</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.14</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.6</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.io</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.12</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.61</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.4</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.2</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>qa-functional</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.jellytools.ide</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.jellytools.platform</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.jemmy</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ </test-dependency>
+ </test-type>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AbstractHk2ConfigurationFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AbstractHk2ConfigurationFactory.java
new file mode 100644
index 0000000..007aadf
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AbstractHk2ConfigurationFactory.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory2;
+
+/**
+ * Abstract factory to construct Java EE server configuration API support object.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus
+ */
+abstract class AbstractHk2ConfigurationFactory implements ModuleConfigurationFactory2 {
+ /** Deployment manager. */
+ private final Hk2DeploymentManager hk2dm;
+
+ /**
+ * Creates a new instance of {@link PayaraConfigurationFactory
+ */
+ AbstractHk2ConfigurationFactory(final Hk2DeploymentManager hk2dm) {
+ this.hk2dm = hk2dm;
+ }
+
+ /**
+ * Constructs proper module configuration object without having
+ * Payara server.
+ * <p/>
+ * Proper configuration object is selected depending on Payara specific web
+ * application meta data file (<code>WEB-INF/payara-web.xml</code>,
+ * <code>WEB-INF/glassfish-web.xml</code> or
+ * <code>WEB-INF/sun-web.xml</code>) existence.
+ * <p/>
+ * @param module Java EE module.
+ * @return Module configuration object.
+ * @throws ConfigurationException if there is a problem with the server-specific
+ * configuration.
+ */
+ @Override
+ public ModuleConfiguration create(final J2eeModule module)
+ throws ConfigurationException {
+ ModuleConfiguration retVal = null;
+ try {
+ if (J2eeModuleHelper.isPayaraWeb(module) || J2eeModuleHelper.isGlassFishWeb(module)) {
+ retVal = new ModuleConfigurationImpl(
+ module, new Three1Configuration(module, PayaraVersion.PF_4_1_144), hk2dm);
+ } else {
+ retVal = new ModuleConfigurationImpl(
+ module, new Hk2Configuration(module, PayaraVersion.PF_4_1_144), hk2dm);
+ }
+ } catch (ConfigurationException ce) {
+ throw ce;
+ } catch (Exception ex) {
+ throw new ConfigurationException(module.toString(), ex);
+ }
+ return retVal;
+ }
+
+ /**
+ * Constructs proper module configuration object depending on
+ * Payara server.
+ * <p/>
+ * @param module Java EE module.
+ * @param instanceUrl Payara server internal URL.
+ * @return Module configuration object.
+ * @throws ConfigurationException if there is a problem with the server-specific
+ * configuration.
+ */
+ @Override
+ @SuppressWarnings("UseSpecificCatch")
+ public ModuleConfiguration create(final @NonNull J2eeModule module,
+ final @NonNull String instanceUrl) throws ConfigurationException {
+ ModuleConfiguration retVal = null;
+ final PayaraInstance instance
+ = PayaraInstanceProvider.getProvider()
+ .getPayaraInstance(instanceUrl);
+ final PayaraVersion version = instance != null
+ ? instance.getVersion() : null;
+ try {
+ final Hk2DeploymentManager dm = hk2dm != null
+ ? hk2dm
+ : (Hk2DeploymentManager) Hk2DeploymentFactory.createEe(version)
+ .getDisconnectedDeploymentManager(instanceUrl);
+ if (version != null
+ && PayaraVersion.ge(version, PayaraVersion.PF_4_1_144)) {
+ retVal = new ModuleConfigurationImpl(
+ module, new Three1Configuration(module, version), dm);
+ } else {
+ retVal = new ModuleConfigurationImpl(
+ module, new Hk2Configuration(module, version), dm);
+ }
+ } catch (ConfigurationException ce) {
+ throw ce;
+ } catch (Exception ex) {
+ throw new ConfigurationException(module.toString(), ex);
+ }
+ return retVal;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AntDeploymentProviderImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AntDeploymentProviderImpl.java
new file mode 100644
index 0000000..f3ca8e1
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/AntDeploymentProviderImpl.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.AntDeploymentProvider;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+class AntDeploymentProviderImpl implements AntDeploymentProvider {
+
+ /** Property files location in Payara configuration directory. */
+ private static String PROPERTIES_PATH = "/PayaraEE6/Properties";
+
+ /**
+ * Returns property files location in Payara configuration directory.
+ * <p/>
+ * New property configuration directory is created when not exists under
+ * NetBeans configuration directory.
+ * <p/>
+ * @return Property files location in Payara configuration directory.
+ */
+ private static File getPropertiesDir() {
+ FileObject dir = FileUtil.getConfigFile(PROPERTIES_PATH);
+ if (dir == null) {
+ try {
+ dir = FileUtil.createFolder(
+ FileUtil.getConfigRoot(), PROPERTIES_PATH);
+ } catch(IOException ex) {
+ Logger.getLogger("payara").log(Level.INFO, null, ex);
+ }
+ }
+ return FileUtil.toFile(dir);
+ }
+
+ private final File propFile;
+ private final Properties props;
+
+ AntDeploymentProviderImpl(Hk2DeploymentManager dm, Hk2OptionalFactory aThis) {
+ PayaraModule commonSupport = dm.getCommonServerSupport();
+ // compute the properties file path
+ propFile = computeFile(commonSupport);
+ // compute the property values.
+ props = computeProps(commonSupport);
+ }
+
+ @Override
+ public void writeDeploymentScript(OutputStream os, Object moduleType) throws IOException {
+ InputStream is = AntDeploymentProviderImpl.class.getResourceAsStream("ant-deploy.xml"); // NOI18N
+ try {
+ FileUtil.copy(is, os);
+ } finally {
+ is.close();
+ }
+ }
+
+ @Override
+ public File getDeploymentPropertiesFile() {
+ if (!propFile.exists()) {
+ // generate the deployment properties file only if it does not exist
+ try {
+ FileObject fo = FileUtil.createData(propFile);
+ FileLock lock = null;
+ try {
+ lock = fo.lock();
+ OutputStream os = fo.getOutputStream(lock);
+ try {
+ props.store(os, ""); // NOI18N
+ } finally {
+ if (null != os) {
+ os.close();
+ }
+ }
+ } finally {
+ if (null != lock) {
+ lock.releaseLock();
+ }
+ }
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, null, ioe); //NOI18N
+ }
+ }
+ return propFile;
+ }
+
+ private File computeFile(PayaraModule commonSupport) {
+ String url = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ String domainDir = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ String domain = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ String user = commonSupport.getInstanceProperties().get(PayaraModule.USERNAME_ATTR);
+ String name = "pfv3" + (url+domainDir+domain+user).hashCode() + ""; // NOI18N
+ return new File(getPropertiesDir(), name + ".properties"); // NOI18N
+ }
+
+ private Properties computeProps(PayaraModule commonSupport) {
+ //PayaraModule commonSupport = dm.getCommonServerSupport();
+ Properties retVal = new Properties();
+ retVal.setProperty("pfv3.root", commonSupport.getInstanceProperties().get(PayaraModule.PAYARA_FOLDER_ATTR)); //getPlatformRoot().getAbsolutePath()); // NOI18N
+ String webUrl = "http://" + commonSupport.getInstanceProperties().get(PayaraModule.HOSTNAME_ATTR) +
+ ":" + commonSupport.getInstanceProperties().get(PayaraModule.HTTPPORT_ATTR);
+ retVal.setProperty("pfv3.url", webUrl); // NOI18N
+ webUrl = "http://" + commonSupport.getInstanceProperties().get(PayaraModule.HOSTNAME_ATTR) +
+ ":" + commonSupport.getInstanceProperties().get(PayaraModule.ADMINPORT_ATTR);
+ retVal.setProperty("pfv3.admin.url", webUrl); // NOI18N
+ retVal.setProperty("pfv3.username", commonSupport.getInstanceProperties().get(PayaraModule.USERNAME_ATTR));
+ retVal.setProperty("pfv3.host",commonSupport.getInstanceProperties().get(PayaraModule.HOSTNAME_ATTR));
+ retVal.setProperty("pfv3.port",commonSupport.getInstanceProperties().get(PayaraModule.ADMINPORT_ATTR));
+ return retVal;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ApplicationScopedResourcesUtils.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ApplicationScopedResourcesUtils.java
new file mode 100644
index 0000000..ba1b25b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ApplicationScopedResourcesUtils.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Set;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ui.OpenProjects;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeApplicationProvider;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.javaee.specs.support.api.util.JndiNamespacesDefinition;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ * @author Petr Hejl
+ */
+public final class ApplicationScopedResourcesUtils {
+
+ private ApplicationScopedResourcesUtils() {
+ super();
+ }
+
+ public static ResourceFileDescription checkNamespaces(J2eeModule module, ResourceFileDescription fileDesc, String namespace) {
+ // we need to check and possibly ask for jndi namespace
+ if (fileDesc.isIsApplicationScoped() && namespace == null) {
+ Set<String> ns = fileDesc.getNamespaces();
+ if (!ns.contains(JndiNamespacesDefinition.APPLICATION_NAMESPACE)
+ && !ns.contains(JndiNamespacesDefinition.MODULE_NAMESPACE)) {
+
+ String customNamespace = null;
+ if (ApplicationScopedResourcesUtils.isEarChild(fileDesc.getFile())) {
+ customNamespace = JndiNamespacesDefinition.MODULE_NAMESPACE;
+ } else {
+ customNamespace = JndiNamespacesDefinition.APPLICATION_NAMESPACE;
+ }
+ return new ResourceFileDescription(fileDesc.getFile(),
+ fileDesc.isIsApplicationScoped(), Collections.singleton(customNamespace));
+ }
+ }
+ return fileDesc;
+ }
+
+ public static String getJndiName(String jndiName, ResourceFileDescription fileDesc) {
+ if (!fileDesc.isIsApplicationScoped()) {
+ return jndiName;
+ }
+
+ String realJndiName = jndiName;
+ Set<String> ns = fileDesc.getNamespaces();
+ if (ns.isEmpty()) {
+ // should not happen
+ realJndiName = JndiNamespacesDefinition.normalize(
+ realJndiName, JndiNamespacesDefinition.APPLICATION_NAMESPACE);
+ } else {
+ if (ns.contains(JndiNamespacesDefinition.MODULE_NAMESPACE)) {
+ realJndiName = JndiNamespacesDefinition.normalize(
+ realJndiName, JndiNamespacesDefinition.MODULE_NAMESPACE);
+ } else {
+ realJndiName = JndiNamespacesDefinition.normalize(
+ realJndiName, JndiNamespacesDefinition.APPLICATION_NAMESPACE);
+ }
+ }
+ return realJndiName;
+ }
+
+ public static boolean isEarChild(File file) {
+ FileObject fo = FileUtil.toFileObject(file);
+ assert fo != null;
+ if (fo == null) {
+ return false;
+ }
+ Project p = FileOwnerQuery.getOwner(fo);
+ if (p == null) {
+ return false;
+ }
+ return isEarChild(p);
+ }
+
+ public static boolean isEarChild(Project project) {
+ J2eeModuleProvider childProvider = project.getLookup().lookup(J2eeModuleProvider.class);
+ if (childProvider == null || childProvider instanceof J2eeApplicationProvider) {
+ return false;
+ }
+ // FIXME if the ear is closed it wont find it; is it a problem?
+ Project[] allProjects = OpenProjects.getDefault().getOpenProjects();
+ for (Project candidate : allProjects) {
+ J2eeApplicationProvider app = candidate.getLookup().lookup(J2eeApplicationProvider.class);
+ if (app != null) {
+ for (J2eeModuleProvider p : app.getChildModuleProviders()) {
+ if (p.equals(childProvider)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public static interface JndiNameResolver {
+
+ String resolveJndiName(String jndiName);
+ }
+
+ public static class ResourceFileDescription {
+
+ private final File file;
+
+ private final boolean isApplicationScoped;
+
+ private final Set<String> namespaces;
+
+ public ResourceFileDescription(File file, boolean isApplicationScoped, Set<String> namespaces) {
+ this.file = file;
+ this.isApplicationScoped = isApplicationScoped;
+ this.namespaces = namespaces;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public boolean isIsApplicationScoped() {
+ return isApplicationScoped;
+ }
+
+ public Set<String> getNamespaces() {
+ return namespaces;
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Bundle.properties b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Bundle.properties
new file mode 100644
index 0000000..5db876b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Bundle.properties
@@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+OpenIDE-Module-Display-Category=Java Web and EE
+OpenIDE-Module-Long-Description=\
+ Plugin for servers based on the Payara Server codebase for the development of Java Web applications using Java Servlet-based technologies. \
+ <p>For more information:<li> Payara Community: <a href="http://www.payara.fish/">http://www.payara.fish/</a></li> \
+<li>Payara Server and production support: <a href="http://www.payara.fish/support">http://www.payara.fish/support</a> </li></p>
+OpenIDE-Module-Name=Payara Jakarta EE
+
+OpenIDE-Module-Short-Description=Payara Server support for Java EE / Jakarta EE projects.
+TXT_FactoryDisplayName=Payara Server
+
+MSG_START_SERVER_FAILED_FNF={0} Server can't start. The start jar was not found.
+MSG_START_SERVER_FAILED_PD={0} Server start failed. Can't create start process.
+MSG_START_SERVER_NOT_INITIALIZED= {0} Server is not initialized.
+MSG_START_SERVER_IN_PROGRESS=Starting {0}
+MSG_SERVER_STARTED={0} Server started
+MSG_START_SERVER_FAILED={0} Start Failed
+
+MSG_STOP_SERVER_FAILED_FNF={0} Server can not stop.
+MSG_STOP_SERVER_FAILED_PD={0} Server stop failed. Can't create stop process.
+MSG_STOP_SERVER_IN_PROGRESS=Server {0} is stopping
+MSG_SERVER_STOPPED={0} Server stopped
+MSG_STOP_SERVER_FAILED={0} Stop Failed
+
+MSG_SERVER_PROFILING_IN_PROGRESS=Server profiling in progress. Please restart the server to deploy an application in regular mode.
+
+LBL_V1ServerLibraries=Unsupported Payara Server Libraries
+LBL_V4ServerLibraries=Payara Server 4 Libraries
+LBL_V5ServerLibraries=Payara Server 5 Libraries
+
+MSG_V1ServerPlatform=Unsupported Payara Server Platform
+MSG_V4ServerPlatform=Payara Server 4 Platform
+MSG_V5ServerPlatform=Payara Server 5 Platform
+
+LBL_RunTimeDDCatalog=Payara Server Catalog
+DESC_RunTimeDDCatalog=List of all the runtime descriptors DTDs for Payara Server
+
+ERR_NoResourceFolderForProject=Resource folder for {0} was not specified.
+ERR_NoResourceFolderUnknown=Resource folder for unknown project was not specified.
+ERR_NoJMSResource=JMS resource for {0} was not created.
+
+ERR_WrongTarget=Target {0} is not an instance of Hk2Target.
+
+TITLE_QueryDebugPort=Debug Port for {0}
+
+MSG_SERVER_PROFILING_CLUSTER_NOT_SUPPORTED=Profiling a cluster or stand-alone instance is not supported.
+
+DNAME_PF_ECLIPSELINK=EclipseLink from Payara
+DESC_PF_ECLIPSELINK=EclipseLink jars that are bundled with the most recently registered Payara installation
+
+DNAME_PF_COMET=Comet from Payara
+DESC_PF_COMET=Comet jars that are bundled with the most recently registered Payara installation
+
+DNAME_PF_JAVA_EE_IMPL=Java EE from Payara
+DESC_PF_JAVA_EE_IMPL=Java EE jars that are bundled with the most recently registered Payara installation
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/FindJSPServletImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/FindJSPServletImpl.java
new file mode 100644
index 0000000..b0ca9e3
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/FindJSPServletImpl.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.eecommon.api.FindJSPServletHelper;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet;
+
+class FindJSPServletImpl implements FindJSPServlet {
+
+ final private String domainDir;
+ final private String domain;
+ final private PayaraModule commonSupport;
+
+ public FindJSPServletImpl(Hk2DeploymentManager dm, Hk2OptionalFactory aThis) {
+ commonSupport = dm.getCommonServerSupport();
+ domainDir = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ domain = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ }
+
+ @Override
+ public File getServletTempDirectory(final String moduleContextPath) {
+ // todo -- map the moduleContextPath to the name of the conext root or vice versa...
+ File retVal = new File(domainDir, "/" + domain + "/generated/jsp/" + moduleContextPath); // NOI18N
+ // the straight up war file case
+ if (retVal.exists()) {
+ return retVal;
+ }
+
+ // the war in ear case
+ // Note: this is not a 100% fix, since a user can put a war file into
+ // multiple ear files... this algorithm will not detect the right one
+ File t = new File(domainDir, "/" + domain + "/generated/jsp/");
+ File[] subdirs = t.listFiles(new FileFilter() {
+
+ @Override
+ public boolean accept(File f) {
+ return f.isDirectory();
+ }
+
+ });
+ if (null != subdirs) {
+ final List<File> candidates = new ArrayList<File>();
+ for (File z : subdirs) {
+ z.listFiles(new FileFilter() {
+
+ @Override
+ public boolean accept(File f) {
+ if (f.isDirectory() && f.getAbsolutePath().endsWith(moduleContextPath+"_war")) {
+ candidates.add(f);
+ return true;
+ }
+ return false;
+ }
+
+ });
+ }
+ if (candidates.size() == 1) {
+ return candidates.get(0);
+ } else if (candidates.size() > 1) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "multiple candidates ({0}) for {1}",
+ new Object[]{candidates.size(), moduleContextPath});
+ }
+ }
+
+ // the web app with customized context root case
+ String remappedMCP = moduleContextPath;
+ try {
+ ResultMap<String, String> resultMap = CommandGetProperty
+ .getProperties(commonSupport.getInstance(),
+ "applications.application.*.context-root", 60000);
+ if (resultMap.getState() == TaskState.COMPLETED) {
+ for (Entry<String, String> e : resultMap.getValue().entrySet()) {
+ if (moduleContextPath.equals(e.getValue())) {
+ remappedMCP = e.getKey().replace(
+ "applications.application.", "")
+ .replace(".context-root", "");
+ break;
+ }
+ }
+ }
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ return new File(domainDir, "/" + domain + "/generated/jsp/" + remappedMCP); // NOI18N
+ }
+
+ @Override
+ public String getServletResourcePath(String moduleContextPath, String jspResourcePath) {
+ return FindJSPServletHelper.getServletResourcePath(moduleContextPath, jspResourcePath);
+ }
+
+ @Override
+ public String getServletEncoding(String moduleContextPath, String jspResourcePath) {
+ return FindJSPServletHelper.getServletEncoding(moduleContextPath, jspResourcePath);
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2Configuration.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2Configuration.java
new file mode 100644
index 0000000..4a74e4c
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2Configuration.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.spi.DConfigBeanRoot;
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
+import org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration;
+import org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper;
+import org.netbeans.modules.payara.jakartaee.db.Hk2DatasourceManager;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+
+/**
+ * Java EE server configuration API support for Payara servers before 3.1.
+ * Covers Payara servers before 3.1. Old {@code sun-resources.xml} files are used.
+ * <p/>
+ * @author Ludovic Champenois, Peter Williams, Tomas Kraus
+ */
+public class Hk2Configuration extends PayaraConfiguration implements DeploymentConfiguration {
+
+ /**
+ * Creates an instance of Java EE server configuration API support
+ * for Payara servers before 3.1.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param version Payara server version.
+ * @throws ConfigurationException when there is a problem with Java EE server
+ * configuration initialization.
+ */
+ public Hk2Configuration(
+ final J2eeModule module, final PayaraVersion version
+ ) throws ConfigurationException {
+ super(module, J2eeModuleHelper.getPayaraDDModuleHelper(module.getType()), version);
+ }
+
+ /**
+ * Creates an instance of Java EE server configuration API support
+ * for Payara servers before 3.1 with existing {@link J2eeModuleHelper} instance.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param moduleHelper Already existing {@link J2eeModuleHelper} instance.
+ * @param version Payara server version.
+ * @throws ConfigurationException when there is a problem with Java EE server
+ * configuration initialization.
+ */
+ public Hk2Configuration(
+ final J2eeModule module, final J2eeModuleHelper jmh,
+ final PayaraVersion version
+ ) throws ConfigurationException {
+ super(module, jmh, version);
+ }
+
+ @Deprecated
+ public Hk2Configuration(DeployableObject dObj) {
+ throw new IllegalArgumentException("deprecated constructor called");
+ }
+
+ // ------------------------------------------------------------------------
+ // DatasourceConfiguration support
+ // ------------------------------------------------------------------------
+ @Override
+ public Set<Datasource> getDatasources() throws ConfigurationException {
+ return Hk2DatasourceManager.getDatasources(module, version);
+ }
+
+ @Override
+ public boolean supportsCreateDatasource() {
+ return true;
+ }
+
+ @Override
+ public Datasource createDatasource(
+ final String jndiName, final String url, final String username,
+ final String password, final String driver
+ ) throws UnsupportedOperationException, ConfigurationException, DatasourceAlreadyExistsException {
+ return Hk2DatasourceManager.createDataSource(
+ jndiName, url, username, password, driver, module, version);
+ }
+
+ // ------------------------------------------------------------------------
+ // MessageDestinationConfiguration support
+ // ------------------------------------------------------------------------
+ @Override
+ public Set<MessageDestination> getMessageDestinations()
+ throws ConfigurationException {
+ return Hk2MessageDestinationManager.getMessageDestinations(module.getResourceDirectory(), getResourceFileName());
+ }
+
+ @Override
+ public boolean supportsCreateMessageDestination() {
+ return true;
+ }
+
+ @Override
+ public MessageDestination createMessageDestination(String name, MessageDestination.Type type) throws UnsupportedOperationException, org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException {
+ File resourceDir = module.getResourceDirectory();
+ if (resourceDir == null) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "Null Resource Folder."); // NOI18N
+ throw new ConfigurationException(NbBundle.getMessage(
+ ModuleConfigurationImpl.class, "ERR_NoJMSResource", name, type)); // NOI18N
+ }
+ return Hk2MessageDestinationManager.createMessageDestination(name, type, resourceDir, getResourceFileName());
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation (or lack thereof) of JSR-88 DeploymentConfiguration interface
+ // Here to make the deployment manager class happy.
+ // ------------------------------------------------------------------------
+ @Override
+ public DeployableObject getDeployableObject() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot ddbeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removeDConfigBean(DConfigBeanRoot dconfigBeanRoot) throws BeanNotFoundException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public DConfigBeanRoot restoreDConfigBean(InputStream is, DDBeanRoot ddbeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void saveDConfigBean(OutputStream os, DConfigBeanRoot dconfigBeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void restore(InputStream is) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void save(OutputStream os) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ private static final String GLASSFISH_DASH = "glassfish-"; // NOI18N
+
+ private String getResourceFileName() {
+ return "glassfish-resources";
+ }
+
+ @Override
+ protected FileObject getPayaraDD(File sunDDFile, boolean create) throws IOException {
+ if (!sunDDFile.exists()) {
+ if (create) {
+ createDefaultSunDD(sunDDFile);
+ }
+ }
+ FileObject retVal = FileUtil.toFileObject(FileUtil.normalizeFile(sunDDFile));
+ if (null == retVal) {
+ String fn = sunDDFile.getName();
+ if (fn.contains(GLASSFISH_DASH) && null != sunDDFile.getParentFile()) {
+ File alternate = new File(sunDDFile.getParentFile(), fn.replace(GLASSFISH_DASH, "sun-")); // NOI18N
+ retVal = FileUtil.toFileObject(FileUtil.normalizeFile(alternate));
+ }
+ }
+ return retVal;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentFactory.java
new file mode 100644
index 0000000..eab4e98
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentFactory.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.openide.util.NbBundle;
+
+
+/**
+ *
+ * @author Ludo
+ * @author vince
+ */
+public class Hk2DeploymentFactory implements DeploymentFactory {
+
+ private static Hk2DeploymentFactory preludeInstance;
+ private static Hk2DeploymentFactory ee6Instance;
+ private static Hk2DeploymentFactory ee7Instance;
+ private static Hk2DeploymentFactory ee8Instance;
+ private String[] uriFragments;
+ private String version;
+ private String displayName;
+ private ServerUtilities su;
+
+ private Hk2DeploymentFactory(String[] uriFragments, String version, String displayName) {
+ this.uriFragments = uriFragments;
+ this.version = version;
+ this.displayName = displayName;
+ }
+
+ private void setServerUtilities(ServerUtilities su) {
+ this.su = su;
+ }
+
+ public static synchronized DeploymentFactory createEe(PayaraVersion version) {
+ if (version != null
+ && PayaraVersion.ge(version, PayaraVersion.PF_5_181)) {
+ return createEe8();
+ } else if (version != null
+ && PayaraVersion.ge(version, PayaraVersion.PF_4_1_144)) {
+ return createEe7();
+ }
+ return createEe6();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static synchronized DeploymentFactory createEe6() {
+ // FIXME -- these strings should come from some constant place
+ if (ee6Instance == null) {
+ ServerUtilities tmp = ServerUtilities.getEe6Utilities();
+ ee6Instance = new Hk2DeploymentFactory(new String[]{"deployer:pfv3ee6:", "deployer:pfv3"}, "0.2", // NOI18N
+ NbBundle.getMessage(Hk2DeploymentFactory.class, "TXT_FactoryDisplayName")); // NOI18N
+ DeploymentFactoryManager.getInstance().registerDeploymentFactory(ee6Instance);
+ ee6Instance.setServerUtilities(tmp);
+ }
+ return ee6Instance;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static synchronized DeploymentFactory createEe7() {
+ // FIXME -- these strings should come from some constant place
+ if (ee7Instance == null) {
+ ServerUtilities tmp = ServerUtilities.getEe7Utilities();
+ ee7Instance = new Hk2DeploymentFactory(new String[]{"deployer:pfv4ee7:", "deployer:pfv4"}, "0.2", // NOI18N
+ NbBundle.getMessage(Hk2DeploymentFactory.class, "TXT_FactoryDisplayName")); // NOI18N
+ DeploymentFactoryManager.getInstance().registerDeploymentFactory(ee7Instance);
+ ee7Instance.setServerUtilities(tmp);
+ }
+ return ee7Instance;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static synchronized DeploymentFactory createEe8() {
+ // FIXME -- these strings should come from some constant place
+ if (ee8Instance == null) {
+ ServerUtilities tmp = ServerUtilities.getEe8Utilities();
+ ee8Instance = new Hk2DeploymentFactory(new String[]{"deployer:pfv5ee8:", "deployer:pfv5"}, "0.2", // NOI18N
+ NbBundle.getMessage(Hk2DeploymentFactory.class, "TXT_FactoryDisplayName")); // NOI18N
+ DeploymentFactoryManager.getInstance().registerDeploymentFactory(ee8Instance);
+ ee8Instance.setServerUtilities(tmp);
+ }
+ return ee8Instance;
+ }
+
+ /**
+ *
+ * @param uri
+ * @return
+ */
+ // also check the urlPattern in layer.xml when changing this
+ @Override
+ public boolean handlesURI(String uri) {
+ if (uri == null) {
+ return false;
+ }
+
+ if(uri.startsWith("[")) {//NOI18N
+ for (String uriFragment : uriFragments) {
+ if (uri.indexOf(uriFragment)!=-1) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ * @param uri
+ * @param uname
+ * @param passwd
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException
+ */
+ @Override
+ public DeploymentManager getDeploymentManager(String uri, String uname, String passwd) throws DeploymentManagerCreationException {
+ if (!handlesURI(uri)) {
+ throw new DeploymentManagerCreationException("Invalid URI:" + uri); // NOI18N
+ }
+ // prevent registry mismatches
+ if (!su.isRegisteredUri(uri)) {
+ throw new DeploymentManagerCreationException("Registry mismatch for "+uri);
+ }
+ return new Hk2DeploymentManager(uri, uname, passwd, su);
+ }
+
+ /**
+ *
+ * @param uri
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException
+ */
+ @Override
+ public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException {
+ if (!handlesURI(uri)) {
+ throw new DeploymentManagerCreationException("Invalid URI:" + uri); // NOI18N
+ }
+ // prevent registry mismatches
+ if (!su.isRegisteredUri(uri)) {
+ throw new DeploymentManagerCreationException("Registry mismatch for "+uri);
+ }
+ return new Hk2DeploymentManager(uri, null, null, su);
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public String getProductVersion() {
+ return version;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentManager.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentManager.java
new file mode 100644
index 0000000..489cb8d
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2DeploymentManager.java
@@ -0,0 +1,622 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.DConfigBeanVersionType;
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException;
+import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
+import javax.enterprise.deploy.spi.exceptions.TargetException;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+import org.netbeans.modules.payara.eecommon.api.HttpMonitorHelper;
+import org.netbeans.modules.payara.spi.*;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.DeploymentContext;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.DeploymentManager2;
+import org.netbeans.modules.payara.jakartaee.ide.DummyProgressObject;
+import org.netbeans.modules.payara.jakartaee.ide.Hk2PluginProperties;
+import org.netbeans.modules.payara.jakartaee.ide.Hk2Target;
+import org.netbeans.modules.payara.jakartaee.ide.Hk2TargetModuleID;
+import org.netbeans.modules.payara.jakartaee.ide.MonitorProgressObject;
+import org.netbeans.modules.payara.jakartaee.ide.UpdateContextRoot;
+import org.openide.util.NbBundle;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class Hk2DeploymentManager implements DeploymentManager2 {
+
+ private volatile ServerInstance serverInstance;
+ private final InstanceProperties instanceProperties;
+ private final Hk2PluginProperties pluginProperties;
+ private final String uri;
+ private final ServerUtilities su;
+
+ /**
+ *
+ * @param uri
+ * @param uname
+ * @param passwd
+ */
+ public Hk2DeploymentManager(String uri, String uname, String passwd, ServerUtilities su) {
+ this.uri = uri;
+ this.su = su;
+ pluginProperties = new Hk2PluginProperties(this,su);
+ instanceProperties = InstanceProperties.getInstanceProperties(getUri());
+ }
+
+
+ /**
+ *
+ * @param targetList
+ * @param moduleArchive
+ * @param deploymentPlan
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject distribute(Target[] targetList, final File moduleArchive, File deploymentPlan)
+ throws IllegalStateException {
+ return distribute(targetList, moduleArchive, deploymentPlan, new File[0], null);
+ }
+
+ @Override
+ public ProgressObject distribute(Target[] targets, DeploymentContext context) {
+ String cr = null;
+ String moduleFilePath = context.getModuleFile().getAbsolutePath();
+ if (moduleFilePath.endsWith(".war")) {
+ // compute cr
+ ModuleConfigurationImpl mci = ModuleConfigurationImpl.get(context.getModule());
+ if (null != mci) {
+ try {
+ cr = mci.getContextRoot();
+ } catch (ConfigurationException ex) {
+ Logger.getLogger("payara").log(Level.WARNING, "could not getContextRoot() for {0}",moduleFilePath);
+ }
+ }
+ }
+ return distribute(targets, context.getModuleFile(), context.getDeploymentPlan(), context.getRequiredLibraries(), cr);
+ }
+
+ private ProgressObject distribute(Target[] targetList, final File moduleArchive, File deploymentPlan, File[] requiredLibraries, String cr)
+ throws IllegalStateException {
+ String t = moduleArchive.getName();
+ final PayaraModule commonSupport = getCommonServerSupport();
+ String url = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ String targ = getTargetFromUri(url);
+ String nameSuffix = ""; // NOI18N
+ if (null != targ)
+ nameSuffix = "_"+targ; // NOI18N
+ final String moduleName = org.netbeans.modules.payara.spi.Utils.sanitizeName(t.substring(0, t.length() - 4)) +
+ nameSuffix;
+ //
+ Hk2TargetModuleID moduleId = Hk2TargetModuleID.get((Hk2Target) targetList[0], moduleName,
+ null, moduleArchive.getAbsolutePath());
+ final MonitorProgressObject deployProgress = new MonitorProgressObject(this, moduleId);
+ final MonitorProgressObject updateCRProgress = new MonitorProgressObject(this, moduleId);
+ deployProgress.addProgressListener(new UpdateContextRoot(updateCRProgress, moduleId, getServerInstance(), true));
+ MonitorProgressObject restartProgress = new MonitorProgressObject(this, moduleId);
+
+ final PayaraModule2 commonSupport2 = (commonSupport instanceof PayaraModule2 ?
+ (PayaraModule2)commonSupport : null);
+ boolean restart = false;
+ try {
+ restart = HttpMonitorHelper.synchronizeMonitor(commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR),
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR),
+ Boolean.parseBoolean(commonSupport.getInstanceProperties().get(PayaraModule.HTTP_MONITOR_FLAG)),
+ "modules/org-netbeans-modules-schema2beans.jar");
+ } catch (IOException | SAXException ex) {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.WARNING, "http monitor state", ex);
+ }
+ ResourceRegistrationHelper.deployResources(moduleArchive,this);
+ if (restart) {
+ restartProgress.addProgressListener(new ProgressListener() {
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ if (event.getDeploymentStatus().isCompleted()) {
+ commonSupport.deploy(deployProgress, moduleArchive, moduleName);
+ } else {
+ deployProgress.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ }
+ });
+ commonSupport.restartServer(restartProgress);
+ return updateCRProgress;
+ } else {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.deploy(deployProgress, moduleArchive, moduleName, cr, Collections.<String, String>emptyMap(), requiredLibraries);
+ } else {
+ commonSupport.deploy(deployProgress, moduleArchive, moduleName, cr);
+ }
+ return updateCRProgress;
+ }
+ }
+
+ /**
+ *
+ * @param moduleIDList
+ * @param moduleArchive
+ * @param deploymentPlan
+ * @return
+ * @throws java.lang.UnsupportedOperationException
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject redeploy(TargetModuleID [] moduleIDList, final File moduleArchive, File deploymentPlan)
+ throws UnsupportedOperationException, IllegalStateException {
+ return redeploy(moduleIDList, moduleArchive, deploymentPlan, new File[0]);
+ }
+
+ @Override
+ public ProgressObject redeploy(TargetModuleID[] moduleIDList, DeploymentContext context) {
+ return redeploy(moduleIDList, context.getModuleFile(), context.getDeploymentPlan(), context.getRequiredLibraries());
+ }
+
+ private ProgressObject redeploy(TargetModuleID [] moduleIDList, final File moduleArchive, File deploymentPlan, File[] requiredLibraries)
+ throws UnsupportedOperationException, IllegalStateException {
+ final Hk2TargetModuleID moduleId = (Hk2TargetModuleID) moduleIDList[0];
+ final String moduleName = moduleId.getModuleID();
+ final MonitorProgressObject progressObject = new MonitorProgressObject(this,
+ moduleId, CommandType.REDEPLOY);
+ MonitorProgressObject restartObject = new MonitorProgressObject(this,moduleId,
+ CommandType.REDEPLOY);
+ final MonitorProgressObject updateCRObject = new MonitorProgressObject(this,
+ moduleId, CommandType.REDEPLOY);
+ final PayaraModule commonSupport = this.getCommonServerSupport();
+ final PayaraModule2 commonSupport2 = (commonSupport instanceof PayaraModule2 ?
+ (PayaraModule2)commonSupport : null);
+ // FIXME -- broken for remote deploy of web apps
+ progressObject.addProgressListener(new UpdateContextRoot(updateCRObject,moduleId,getServerInstance(), true));
+ boolean restart = false;
+ try {
+ restart = HttpMonitorHelper.synchronizeMonitor(
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR),
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR),
+ Boolean.parseBoolean(commonSupport.getInstanceProperties().get(PayaraModule.HTTP_MONITOR_FLAG)),
+ "modules/org-netbeans-modules-schema2beans.jar");
+ } catch (IOException | SAXException ex) {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.WARNING, "http monitor state", ex);
+ }
+ ResourceRegistrationHelper.deployResources(moduleArchive,this);
+ if (restart) {
+ restartObject.addProgressListener(new ProgressListener() {
+
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ if (event.getDeploymentStatus().isCompleted()) {
+ commonSupport.deploy(progressObject, moduleArchive, moduleName);
+ } else {
+ progressObject.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ }
+ });
+ commonSupport.restartServer(restartObject);
+ return updateCRObject;
+ } else {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.deploy(progressObject, moduleArchive, moduleName, null, Collections.<String, String>emptyMap(), requiredLibraries);
+ } else {
+ commonSupport.deploy(progressObject, moduleArchive, moduleName);
+ }
+ return updateCRObject;
+ }
+ }
+
+ /**
+ *
+ * @param deployableObject
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.InvalidModuleException
+ */
+ @Override
+ public DeploymentConfiguration createConfiguration(DeployableObject deployableObject)
+ throws InvalidModuleException {
+ return new Hk2Configuration(deployableObject);
+ }
+
+
+ /**
+ *
+ * @param targetList
+ * @param moduleArchive
+ * @param deploymentPlan
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject distribute(Target [] targetList, InputStream moduleArchive, InputStream deploymentPlan)
+ throws IllegalStateException {
+ throw new UnsupportedOperationException(
+ "Hk2DeploymentManager.distribute(target [], stream, stream) not supported yet.");
+ }
+
+ /**
+ *
+ * @param targetList
+ * @param type
+ * @param moduleArchive
+ * @param deploymentPlan
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject distribute(Target [] targetList, ModuleType type, InputStream moduleArchive, InputStream deploymentPlan)
+ throws IllegalStateException {
+ throw new UnsupportedOperationException(
+ "Hk2DeploymentManager.distribute(target [], module_type, stream, stream) not supported yet.");
+ }
+
+ /**
+ *
+ * @param moduleIDList
+ * @param moduleArchive
+ * @param deploymentPlan
+ * @return
+ * @throws java.lang.UnsupportedOperationException
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject redeploy(TargetModuleID [] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan)
+ throws UnsupportedOperationException, IllegalStateException {
+ throw new UnsupportedOperationException(
+ "Hk2DeploymentManager.redeploy(target_module [], stream, stream) not supported yet.");
+ }
+
+ /**
+ *
+ * @param targetModuleID
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject undeploy(TargetModuleID [] targetModuleIDs)
+ throws IllegalStateException {
+ // !PW FIXME handle arrays with length > 1 (EARs?)
+ if(targetModuleIDs != null && targetModuleIDs.length > 0) {
+ PayaraModule commonSupport = getCommonServerSupport();
+ MonitorProgressObject progressObject = new MonitorProgressObject(
+ this, (Hk2TargetModuleID) targetModuleIDs[0], CommandType.UNDEPLOY);
+ commonSupport.undeploy(progressObject, targetModuleIDs[0].getModuleID());
+ return progressObject;
+ } else {
+ throw new IllegalArgumentException("No TargetModuleID's specified.");
+ }
+ }
+
+ /**
+ *
+ * @param targetModuleID
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException {
+ return new DummyProgressObject(moduleIDList[0]);
+ }
+
+ /**
+ *
+ * @param targetModuleID
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public ProgressObject start(TargetModuleID [] moduleIDList) throws IllegalStateException {
+ return new DummyProgressObject(moduleIDList[0]);
+ }
+
+ /**
+ *
+ * @param locale
+ * @throws java.lang.UnsupportedOperationException
+ */
+ @Override
+ public void setLocale(java.util.Locale locale) throws UnsupportedOperationException {
+ }
+
+ /**
+ *
+ * @param locale
+ * @return
+ */
+ @Override
+ public boolean isLocaleSupported(java.util.Locale locale) {
+ return false;
+ }
+
+ /**
+ *
+ * @param moduleType
+ * @param target
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.TargetException
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public TargetModuleID [] getAvailableModules(ModuleType moduleType, Target [] targetList)
+ throws TargetException, IllegalStateException {
+ return getDeployedModules(moduleType, targetList);
+ }
+
+
+ /**
+ *
+ * @param moduleType
+ * @param target
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.TargetException
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public TargetModuleID [] getNonRunningModules(ModuleType moduleType, Target [] targetList)
+ throws TargetException, IllegalStateException {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Hk2DeploymentManager.getNonRunningModules() not supported yet.");
+ return new TargetModuleID[0];
+ }
+
+ /**
+ *
+ * @param moduleType
+ * @param target
+ * @return
+ * @throws javax.enterprise.deploy.spi.exceptions.TargetException
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public TargetModuleID [] getRunningModules(ModuleType moduleType, Target [] targetList)
+ throws TargetException, IllegalStateException {
+ return getDeployedModules(moduleType, targetList);
+ }
+
+ private TargetModuleID [] getDeployedModules(ModuleType moduleType, Target [] targetList)
+ throws TargetException, IllegalStateException {
+ List<TargetModuleID> moduleList = new ArrayList<>();
+ PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null) {
+ AppDesc [] appList = commonSupport.getModuleList(PayaraModule.WEB_CONTAINER);
+ if(appList != null && appList.length > 0) {
+ if(targetList[0] instanceof Hk2Target) {
+ Hk2Target target = (Hk2Target) targetList[0];
+ for(AppDesc app: appList) {
+ moduleList.add(Hk2TargetModuleID.get(target, app.getName(),
+ "".equals(app.getContextRoot()) ? null : app.getContextRoot(),
+ app.getPath()));
+ }
+ } else {
+ String targetDesc = targetList[0] != null ? targetList[0].toString() : "(null)";
+ throw new TargetException(NbBundle.getMessage(
+ Hk2DeploymentManager.class, "ERR_WrongTarget", targetDesc));
+ }
+ }
+ }
+ return moduleList.size() > 0 ? moduleList.toArray(new TargetModuleID[moduleList.size()]) :
+ new TargetModuleID[0];
+ }
+
+ /**
+ *
+ * @param dConfigBeanVersionType
+ * @throws javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException
+ */
+ @Override
+ public void setDConfigBeanVersion(DConfigBeanVersionType version) throws DConfigBeanVersionUnsupportedException {
+ }
+
+ /**
+ *
+ * @param dConfigBeanVersionType
+ * @return
+ */
+ @Override
+ public boolean isDConfigBeanVersionSupported(DConfigBeanVersionType version) {
+ return false;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void release() {
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public boolean isRedeploySupported() {
+ return isLocal();
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public java.util.Locale getCurrentLocale() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public DConfigBeanVersionType getDConfigBeanVersion() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public java.util.Locale getDefaultLocale() {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public java.util.Locale[] getSupportedLocales() {
+ return new java.util.Locale[] { java.util.Locale.getDefault() };
+ }
+
+ /**
+ *
+ * @return
+ * @throws java.lang.IllegalStateException
+ */
+ @Override
+ public Target[] getTargets() throws IllegalStateException {
+ InstanceProperties ip = getInstanceProperties();
+ if (null == ip) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "instance props are null for URI: "+getUri(), new Exception());
+ return new Hk2Target[] {};
+ }
+ String url = ip.getProperty(PayaraModule.URL_ATTR);
+ String protocol = "http";
+ String host = ip.getProperty(PayaraModule.HOSTNAME_ATTR);
+ String httpPort = getCommonServerSupport().getInstanceProperties().get(PayaraModule.HTTPPORT_ATTR);
+ if (url == null || !url.contains("ee6wc")) {
+ protocol = Utils.getHttpListenerProtocol(host, httpPort);
+ }
+
+ String serverUri = constructServerUri(protocol, host, httpPort, null);
+ String name = ip.getProperty(PayaraModule.DISPLAY_NAME_ATTR);
+ Hk2Target target = new Hk2Target(name, serverUri);
+ Hk2Target targets[] = {target};
+ return targets;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public final String getUri() {
+ return uri;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Hk2PluginProperties getProperties() {
+ return pluginProperties;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public InstanceProperties getInstanceProperties() {
+ return instanceProperties;
+ }
+
+ /**
+ * Get the PayaraInstance associated with this deployment manager.
+ * <p/>
+ * @return PayaraInstance associated with this deployment manager.
+ */
+ public ServerInstance getServerInstance() {
+ if (serverInstance != null) {
+ return serverInstance;
+ }
+ if ((serverInstance = su.getServerInstance(uri)) == null) {
+ String warning = "Common server instance not found for " + uri;
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, warning);
+ throw new IllegalStateException(warning);
+ }
+ return serverInstance;
+ }
+
+ /**
+ * Get a reference to the Payara server support API for the
+ * server instance associated with this deployment manager URI.
+ *
+ * @return Reference to the Payara server support API.
+ */
+ public PayaraModule getCommonServerSupport() {
+ PayaraInstance instance
+ = PayaraInstanceProvider.getPayaraInstanceByUri(uri);
+ return instance != null ? instance.getCommonSupport() : null;
+ }
+
+ private String constructServerUri(String protocol, String host, String port, String path) {
+ StringBuilder builder = new StringBuilder(128);
+ builder.append(protocol);
+ builder.append("://"); // NOI18N
+ builder.append(host);
+ builder.append(":"); // NOI18N
+ builder.append(port);
+ if(path != null && path.length() > 0) {
+ builder.append(path);
+ }
+ return builder.toString();
+ }
+
+ public boolean isLocal() {
+ boolean result = true;
+ PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null && commonSupport.isRemote()) {
+ result = false;
+ }
+ return result;
+ }
+
+ public static String getTargetFromUri(String uri) {
+ String target = null;
+ int lastColon = uri.lastIndexOf(':');
+ if (lastColon != -1) {
+ String candidate = uri.substring(lastColon+1);
+ if (!Character.isDigit(candidate.charAt(0))) {
+ target = candidate;
+ }
+ }
+ return target;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformFactory.java
new file mode 100644
index 0000000..684f232
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformFactory.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.modules.payara.tooling.data.PayaraJavaEEConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraJavaSEConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilder;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl;
+import org.openide.util.NbBundle;
+
+
+/**
+ * Payara JavaEE platform factory.
+ * <p/>
+ * Creates Payara JavaEE platform instances for individual Payara server
+ * instances from deployment manager.
+ * <p/>
+ * Works as a singleton instance in regular use-cases. Unfortunately
+ * <code>layer.xml</code> does not allow to work with singletons so we allow
+ * it to create more instances.
+ * <p/>
+ * @author Tomas Kraus, Vince Kraemer
+ */
+public class Hk2JavaEEPlatformFactory extends J2eePlatformFactory {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Payara JavaEE platform lookup key.
+ */
+ private static final String V3_LOOKUP_KEY = "J2EE/DeploymentPlugins/pfv3ee6/Lookup";
+
+ /**
+ * Payara V4 JavaEE platform lookup key.
+ * <p/>
+ * We will keep V3 value now because no one knows what will get broken when
+ * changing it.
+ */
+ private static final String V4_LOOKUP_KEY = "J2EE/DeploymentPlugins/pfv4ee7/Lookup";
+
+ /**
+ * Payara V5 JavaEE platform lookup key.
+ * <p/>
+ * We will keep V3 value now because no one knows what will get broken when
+ * changing it.
+ */
+ private static final String V5_LOOKUP_KEY = "J2EE/DeploymentPlugins/pfv5ee8/Lookup";
+
+ /** Payara JavaEE platform factory singleton object. */
+ private static volatile Hk2JavaEEPlatformFactory instance;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Return existing singleton instance of this class or create a new one
+ * when no instance exists.
+ * <p>
+ * @return {@see Hk2JavaEEPlatformFactory} singleton instance.
+ */
+ public static Hk2JavaEEPlatformFactory getFactory() {
+ if (instance != null) {
+ return instance;
+ }
+ synchronized(Hk2JavaEEPlatformFactory.class) {
+ if (instance == null) {
+ instance = new Hk2JavaEEPlatformFactory();
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Get Payara JavaEE platform name from bundle properties for given
+ * Payara server version.
+ * <p/>
+ * @param version Payara server version used to pick up display name.
+ * @return Payara JavaEE platform name related to given server version.
+ */
+ private static String getDisplayName(final PayaraVersion version) {
+ final int ord = version.ordinal();
+ if (ord >= PayaraVersion.PF_5_181.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "MSG_V5ServerPlatform");
+ } else if (ord >= PayaraVersion.PF_4_1_144.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "MSG_V4ServerPlatform");
+ } else {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "MSG_V1ServerPlatform");
+ }
+ }
+
+ /**
+ * Get Payara JavaEE library name from bundle properties for given
+ * Payara server version.
+ * <p/>
+ * @param version Payara server version used to pick up display name.
+ * @return Payara JavaEE library name related to given server version.
+ */
+ private static String getLibraryName(final PayaraVersion version) {
+ final int ord = version.ordinal();
+ if (ord >= PayaraVersion.PF_5_181.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "LBL_V5ServerLibraries");
+ } else if (ord >= PayaraVersion.PF_4_1_144.ordinal()) {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "LBL_V4ServerLibraries");
+ } else {
+ return NbBundle.getMessage(
+ Hk2JavaEEPlatformFactory.class, "LBL_V1ServerLibraries");
+ }
+ }
+
+ /**
+ * Get Payara JavaEE platform lookup key for given Payara
+ * server version.
+ * <p/>
+ * @param version Payara server version used to pick up lookup key.
+ * @return Lookup key for given Payara server version.
+ */
+ private static String getLookupKey(final PayaraVersion version) {
+ final int ord = version.ordinal();
+ if (ord >= PayaraVersion.PF_5_181.ordinal()) {
+ return V5_LOOKUP_KEY;
+ } else if (ord >= PayaraVersion.PF_4_1_144.ordinal()) {
+ return V4_LOOKUP_KEY;
+ } else {
+ return V3_LOOKUP_KEY;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // J2eePlatformFactory methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Return {@see J2eePlatformImpl} for the given {@see DeploymentManager}.
+ * <p/>
+ * @param dm {@see DeploymentManager} object for which JavaEE platform
+ * environment object is created.
+ */
+ @Override
+ public J2eePlatformImpl getJ2eePlatformImpl(final DeploymentManager dm) {
+ if (dm instanceof Hk2DeploymentManager) {
+ final PayaraServer server = ((Hk2DeploymentManager)dm)
+ .getCommonServerSupport().getInstance();
+ final PayaraVersion version = server.getVersion();
+ final ConfigBuilder cb = ConfigBuilderProvider.getBuilder(server);
+ final PayaraJavaSEConfig javaSEConfig = cb.getJavaSEConfig(version);
+ final PayaraJavaEEConfig javaEEConfig = cb.getJavaEEConfig(version);
+ final String[] platforms = Hk2JavaEEPlatformImpl.nbJavaSEProfiles(
+ javaSEConfig.getPlatforms());
+ final Profile[] profiles = Hk2JavaEEPlatformImpl
+ .nbJavaEEProfiles(javaEEConfig.getProfiles());
+ final J2eeModule.Type[] types = Hk2JavaEEPlatformImpl
+ .nbModuleTypes(javaEEConfig.getModuleTypes());
+ return new Hk2JavaEEPlatformImpl((Hk2DeploymentManager)dm,
+ platforms, profiles, types, getDisplayName(version),
+ getLibraryName(version), getLookupKey(version));
+ }
+ throw new IllegalArgumentException(
+ "Deployment manager instance is not instance of Hk2DeploymentManager");
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformImpl.java
new file mode 100644
index 0000000..d95c2ec
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JavaEEPlatformImpl.java
@@ -0,0 +1,1016 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.server.config.JavaEEProfile;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+import org.netbeans.modules.payara.tooling.server.config.ModuleType;
+import static org.netbeans.modules.payara.tooling.server.config.ModuleType.EJB;
+import static org.netbeans.modules.payara.tooling.server.config.ModuleType.RAR;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.java.classpath.JavaClassPathConstants;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.project.JavaProjectConstants;
+import org.netbeans.api.java.project.classpath.ProjectClassPathModifier;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.api.project.SourceGroup;
+import org.netbeans.api.project.libraries.Library;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule.Type;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl2;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.support.LookupProviderSupport;
+import org.netbeans.modules.javaee.specs.support.api.JaxRpc;
+import org.netbeans.modules.javaee.specs.support.api.JaxWs;
+import org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation;
+import org.netbeans.modules.websvc.wsstack.api.WSStack;
+import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory;
+import org.netbeans.spi.project.libraries.LibraryImplementation;
+import org.openide.filesystems.*;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Lookup;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+import org.openide.util.lookup.Lookups;
+
+/**
+ *
+ * @author Ludo, Tomas Kraus
+ */
+public class Hk2JavaEEPlatformImpl extends J2eePlatformImpl2 {
+
+ /** Deployment manager. */
+ private final Hk2DeploymentManager dm;
+
+ /** Payara library. */
+ private final LibraryImplementation lib = new J2eeLibraryTypeProvider().createLibrary();
+
+ /** Payara library storage. */
+ private final LibraryImplementation[] libraries = { lib };
+
+ /** NetBeans JavaSE platforms. */
+ private final String[] platforms;
+
+ /** NetBeans JavaEE profiles. */
+ private final Profile[] profiles;
+
+ /** NetBeans JavaEE module types. */
+ private final J2eeModule.Type[] types;
+
+ /** NetBeans JavaEE platform display name. */
+ private final String displayName;
+
+ /** NetBeans JavaEE library name. */
+ private final String libraryName;
+
+ /** Payara JavaEE platform lookup key. */
+ private final String lookupKey;
+
+ private FileChangeListener fcl;
+
+ /** Keep local Lookup instance to be returned by getLookup method. */
+ private final Lookup lkp;
+
+ /** Jersey Library support. */
+ private final Hk2LibraryProvider libraryProvider;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor helper to initialize local Lookup instance.
+ * <p/>
+ * @return Local Lookup instance.
+ */
+ private Lookup initLocalLookup() {
+ final String gfRootStr = dm.getProperties().getPayaraRoot();
+ final WSStack<JaxWs> wsStack = WSStackFactory.createWSStack(JaxWs.class,
+ new Hk2JaxWsStack(gfRootStr, this), WSStack.Source.SERVER);
+ final WSStack<JaxRpc> rpcStack = WSStackFactory.createWSStack(JaxRpc.class,
+ new Hk2JaxRpcStack(gfRootStr), WSStack.Source.SERVER);
+ final PayaraServer server = dm.getCommonServerSupport().getInstance();
+ final Lookup baseLookup = Lookups.fixed(
+ gfRootStr, new JaxRsStackSupportImpl(), wsStack, rpcStack,
+ server, new Hk2JpaSupportImpl(server));
+ return LookupProviderSupport.createCompositeLookup(
+ baseLookup, lookupKey);
+ }
+
+ /**
+ * Map Payara tooling SDK JavaSE platforms to NetBeans JavaSE platforms.
+ * <p/>
+ * @param sdkPlatforms Payara tooling SDK JavaSE platforms.
+ * @return Array of NetBeans JavaSE platforms containing known Payara
+ * tooling SDK JavaSE platforms.
+ */
+ @SuppressWarnings("ValueOfIncrementOrDecrementUsed")
+ public static String[] nbJavaSEProfiles(
+ final Set<JavaSEPlatform> sdkPlatforms) {
+ final int size = sdkPlatforms != null ? sdkPlatforms.size() : 0;
+ String[] platforms = new String[size];
+ if (size > 0) {
+ int index = 0;
+ for (JavaSEPlatform platform : sdkPlatforms) {
+ platforms[index++] = platform.toString();
+ }
+ }
+ return platforms;
+ }
+
+
+ /**
+ * Map Payara tooling SDK JavaEE profiles to NetBeans JavaEE profiles.
+ * <p/>
+ * @param sdkProfiles Payara tooling SDK JavaEE profiles.
+ * @return Array of NetBeans JavaEE profiles containing known Payara
+ * tooling SDK JavaEE profiles.
+ */
+ @SuppressWarnings("ValueOfIncrementOrDecrementUsed")
+ public static Profile[] nbJavaEEProfiles(
+ final Set<JavaEEProfile> sdkProfiles) {
+ final int sdkSize = sdkProfiles != null ? sdkProfiles.size() : 0;
+ int size = sdkSize;
+ // Shrink output array size for unsupported JavaEE profiles.
+ for (JavaEEProfile sdkProfile : sdkProfiles) switch(sdkProfile) {
+ case v1_2: size--;
+ }
+ Profile[] profiles;
+ if (sdkSize > 0) {
+ profiles = new Profile[size];
+ int index = 0;
+ // JavaEE 1.2 should be ignored.
+ for (JavaEEProfile sdkProfile : sdkProfiles) switch(sdkProfile) {
+ case v1_3: profiles[index++] = Profile.J2EE_13;
+ break;
+ case v1_4: profiles[index++] = Profile.J2EE_14;
+ break;
+ case v1_5: profiles[index++] = Profile.JAVA_EE_5;
+ break;
+ case v1_6_web: profiles[index++] = Profile.JAVA_EE_6_WEB;
+ break;
+ case v1_6: profiles[index++] = Profile.JAVA_EE_6_FULL;
+ break;
+ case v1_7_web: profiles[index++] = Profile.JAVA_EE_7_WEB;
+ break;
+ case v1_7: profiles[index++] = Profile.JAVA_EE_7_FULL;
+ break;
+ case v1_8_web: profiles[index++] = Profile.JAVA_EE_7_WEB;
+ break;
+ case v1_8: profiles[index++] = Profile.JAVA_EE_7_FULL;
+ break;
+ }
+ } else {
+ profiles = new Profile[0];
+ }
+ return profiles;
+ }
+
+ /**
+ * Map Payara tooling SDK JavaEE module types to NetBeans JavaEE
+ * module types.
+ * <p/>
+ * @param sdkModule Payara tooling SDK JavaEE module types.
+ * @return Array of NetBeans JavaEE module types containing known Payara
+ * tooling SDK JavaEE module types.
+ */
+ @SuppressWarnings("ValueOfIncrementOrDecrementUsed")
+ public static J2eeModule.Type[] nbModuleTypes(
+ final Set<ModuleType> sdkModuleTypes) {
+ final int size = sdkModuleTypes != null ? sdkModuleTypes.size() : 0;
+ J2eeModule.Type[] types = new J2eeModule.Type[size];
+ if (size > 0) {
+ int index = 0;
+ for (ModuleType sdkType : sdkModuleTypes) switch(sdkType) {
+ case EAR: types[index++] = J2eeModule.Type.EAR;
+ break;
+ case EJB: types[index++] = J2eeModule.Type.EJB;
+ break;
+ case CAR: types[index++] = J2eeModule.Type.CAR;
+ break;
+ case RAR: types[index++] = J2eeModule.Type.RAR;
+ break;
+ case WAR: types[index++] = J2eeModule.Type.WAR;
+ break;
+ }
+ }
+ return types;
+ }
+
+ /**
+ * Create {@see Set} of {@see String} objects from array of supported
+ * JavaSE platform objects.
+ * <p>
+ * @param platforms Array of supported JavaSE platforms.
+ * @return Newly created set of supported JavaSE platforms.
+ */
+ Set<String> platformsSetFromArray(final String[] platforms) {
+ final int size = platforms != null ? platforms.length : 0;
+ Set<String> platformSet = new HashSet<>(size);
+ for (int i = 0; i < size; i++) {
+ platformSet.add(platforms[i]);
+ }
+ return platformSet;
+ }
+
+ /**
+ * Create {@see Set} of {@see Profile} objects from array of those objects.
+ * <p>
+ * @param profiles Array of NetBeans JavaEE profiles.
+ * @return Newly created set of NetBeans JavaEE profiles from array.
+ */
+ Set<Profile> profilesSetFromArray(final Profile[] profiles) {
+ final int size = profiles != null ? profiles.length : 0;
+ final Set<Profile> profileSet = new HashSet<>(size);
+ for (int i = 0; i < size; i++) {
+ profileSet.add(profiles[i]);
+ }
+ return profileSet;
+ }
+
+ /**
+ * Create {@see Set} of {@see J2eeModule.Type} objects from array
+ * of those objects.
+ * <p>
+ * @param moduleTypes Array of NetBeans JavaEE module types.
+ * @return Newly created set of NetBeans JavaEE module types from array.
+ */
+ Set<J2eeModule.Type> moduleTypesSetFromArray(
+ final J2eeModule.Type[] moduleTypes) {
+ final int size = moduleTypes != null ? moduleTypes.length : 0;
+ final Set<J2eeModule.Type> moduleTypeSet = new HashSet<>(size);
+ for (int i = 0; i < size; i++) {
+ moduleTypeSet.add(moduleTypes[i]);
+ }
+ return moduleTypeSet;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara JavaEE platform.
+ * <p/>
+ * @param dm {@see Hk2DeploymentManager} instance containing valid reference
+ * to Payara server instance.
+ * @param platforms NetBeans JavaSE platforms supported.
+ * @param profiles NetBeans JavaEE profiles supported.
+ * @param types NetBeans JavaEE module types supported.
+ * @param displayName NetBeans JavaEE platform display name.
+ * @param libraryName NetBeans JavaEE library name.
+ * @param lookupKey Payara JavaEE platform lookup key.
+ */
+ public Hk2JavaEEPlatformImpl(final Hk2DeploymentManager dm,
+ final String[] platforms,
+ final Profile[] profiles, final J2eeModule.Type[] types,
+ final String displayName, final String libraryName,
+ final String lookupKey) {
+ this.dm = dm;
+ this.platforms = platforms;
+ this.profiles = profiles;
+ this.types = types;
+ this.displayName = displayName;
+ this.libraryName = libraryName;
+ this.lookupKey = lookupKey;
+ this.lkp = initLocalLookup();
+ this.libraryProvider = Hk2LibraryProvider.getProvider(
+ dm.getCommonServerSupport().getInstance());
+ addFcl();
+ initLibraries();
+ }
+
+ private void addFcl() {
+ if (null == fcl) {
+ final String path = dm.getCommonServerSupport().getInstanceProperties().get(PayaraModule.PAYARA_FOLDER_ATTR);
+ final File f = new File(path, "modules"); // NOI18N
+ final FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(f));
+ if (null == fo) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "{0} did not exist but should", f.getAbsolutePath());
+ return;
+ }
+ fcl = new FileChangeListener() {
+
+ @Override
+ public void fileFolderCreated(final FileEvent fe) {
+ notifyLibrariesChanged();
+ }
+
+ @Override
+ public void fileDataCreated(final FileEvent fe) {
+ notifyLibrariesChanged();
+ }
+
+ @Override
+ public void fileChanged(final FileEvent fe) {
+ notifyLibrariesChanged();
+ }
+
+ @Override
+ public void fileDeleted(final FileEvent fe) {
+ notifyLibrariesChanged();
+ }
+
+ @Override
+ public void fileRenamed(final FileRenameEvent fe) {
+ notifyLibrariesChanged();
+ }
+
+ @Override
+ public void fileAttributeChanged(final FileAttributeEvent fe) {
+ // we can ignore this type of change
+ }
+ };
+ fo.addFileChangeListener(fcl);
+ }
+ }
+
+ // Persistence provider strings
+ private static final String PERSISTENCE_PROV_ECLIPSELINK = "org.eclipse.persistence.jpa.PersistenceProvider"; //NOI18N
+
+ // WEB SERVICES PROPERTIES
+ // TODO - shall be removed and usages replaced by values from j2eeserver or websvc apis after api redesign
+ private static final String TOOL_WSCOMPILE = "wscompile";
+ private static final String TOOL_JSR109 = "jsr109";
+ private static final String TOOL_WSIMPORT = "wsimport";
+ private static final String TOOL_WSGEN = "wsgen";
+ private static final String TOOL_KEYSTORE = "keystore";
+ private static final String TOOL_KEYSTORECLIENT = "keystoreClient";
+ private static final String TOOL_TRUSTSTORE = "truststore";
+ private static final String TOOL_TRUSTSTORECLIENT = "truststoreClient";
+ private static final String TOOL_WSIT = "wsit";
+ private static final String TOOL_JAXWSTESTER = "jaxws-tester";
+ private static final String TOOL_APPCLIENTRUNTIME = "appClientRuntime";
+ private static final String KEYSTORE_LOCATION = "config/keystore.jks";
+ private static final String TRUSTSTORE_LOCATION = "config/cacerts.jks";
+
+ private static final String EMBEDDED_EJB_CONTAINER_PATH = "lib/embedded/glassfish-embedded-static-shell.jar";
+
+ /** Application client container configuration file for older version (v3). */
+ private static final String SUN_ACC_XML = "sun-acc.xml";
+
+ /** Application client container configuration file for Payara v4. */
+ private static final String GF_ACC_XML = "glassfish-acc.xml";
+
+ /**
+ *
+ * @param toolName
+ * @return
+ */
+ @Override
+ public boolean isToolSupported(String toolName) {
+ // Persistence Providers
+ if(PERSISTENCE_PROV_ECLIPSELINK.equals(toolName)) {
+ return true;
+ }
+
+ if("org.hibernate.ejb.HibernatePersistence".equals(toolName) || //NOI18N
+ "oracle.toplink.essentials.PersistenceProvider".equals(toolName) || // NOI18N
+ "kodo.persistence.PersistenceProviderImpl".equals(toolName) || // NOI18N
+ "org.apache.openjpa.persistence.PersistenceProviderImpl".equals(toolName)) { //NOI18N
+ return true;
+ }
+
+ if("defaultPersistenceProviderJavaEE5".equals(toolName)) { //NOI18N
+ return true;
+ }
+ if("eclipseLinkPersistenceProviderIsDefault2.0".equals(toolName)) {
+ return true;
+ }
+ String gfRootStr = dm.getProperties().getPayaraRoot();
+ if (J2eePlatform.TOOL_EMBEDDABLE_EJB.equals(toolName)) {
+ File jar = new File(gfRootStr, EMBEDDED_EJB_CONTAINER_PATH);
+ return jar.exists() && jar.isFile() && jar.canRead();
+ }
+
+ File wsLib = null;
+
+ if (gfRootStr != null) {
+ wsLib = ServerUtilities.getJarName(gfRootStr, "webservices(|-osgi).jar");
+ }
+
+ // WEB SERVICES SUPPORT
+ if ((wsLib != null) && (wsLib.exists())) { // existence of webservice libraries
+ if (TOOL_WSGEN.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_WSIMPORT.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_WSIT.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_JAXWSTESTER.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_JSR109.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_KEYSTORE.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_KEYSTORECLIENT.equals(toolName)) {//NOI18N
+ return true;
+ }
+ if (TOOL_TRUSTSTORE.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_TRUSTSTORECLIENT.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_WSCOMPILE.equals(toolName)) { //NOI18N
+ return true;
+ }
+ if (TOOL_APPCLIENTRUNTIME.equals(toolName)) { //NOI18N
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ * @param toolName
+ * @return
+ */
+ @Override
+ public File[] getToolClasspathEntries(String toolName) {
+ String gfRootStr = dm.getProperties().getPayaraRoot();
+ if (null != gfRootStr) {
+ if (J2eePlatform.TOOL_EMBEDDABLE_EJB.equals(toolName)) {
+ return new File[]{new File(gfRootStr, EMBEDDED_EJB_CONTAINER_PATH)};
+ }
+ if (TOOL_WSGEN.equals(toolName) || TOOL_WSIMPORT.equals(toolName)) {
+ String[] entries = new String[]{"webservices(|-osgi).jar", //NOI18N
+ "webservices-api(|-osgi).jar", //NOI18N
+ "jaxb(|-osgi).jar", //NOI18N
+ "jaxb-api(|-osgi).jar", //NOI18N
+ "javax.activation.jar"}; //NOI18N
+ List<File> cPath = new ArrayList<>();
+
+ for (String entry : entries) {
+ File f = ServerUtilities.getWsJarName(gfRootStr, entry);
+ if ((f != null) && (f.exists())) {
+ cPath.add(f);
+ }
+ }
+ return cPath.toArray(new File[cPath.size()]);
+ }
+
+ if (TOOL_WSCOMPILE.equals(toolName)) {
+ String[] entries = new String[] {"webservices(|-osgi).jar"}; //NOI18N
+ List<File> cPath = new ArrayList<>();
+
+ for (String entry : entries) {
+ File f = ServerUtilities.getWsJarName(gfRootStr, entry);
+ if ((f != null) && (f.exists())) {
+ cPath.add(f);
+ }
+ }
+ return cPath.toArray(new File[cPath.size()]);
+ }
+
+ File domainDir;
+ File gfRoot = new File(gfRootStr);
+ if (gfRoot.exists()) {
+ String domainDirName = dm.getProperties().getDomainDir();
+ if (domainDirName != null) {
+ domainDir = new File(domainDirName);
+
+ if (TOOL_KEYSTORE.equals(toolName) || TOOL_KEYSTORECLIENT.equals(toolName)) {
+ return new File[]{
+ new File(domainDir, KEYSTORE_LOCATION) //NOI18N
+ };
+ }
+
+ if (TOOL_TRUSTSTORE.equals(toolName) || TOOL_TRUSTSTORECLIENT.equals(toolName)) {
+ return new File[]{
+ new File(domainDir, TRUSTSTORE_LOCATION) //NOI18N
+ };
+ }
+ }
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "dm has no root???", new Exception());
+ }
+
+ return new File[0];
+ }
+
+ /**
+ * Get supported JavaEE profiles.
+ * <p/>
+ * @return Supported JavaEE profiles.
+ */
+ @Override
+ public Set<Profile> getSupportedProfiles() {
+ return profilesSetFromArray(profiles);
+ }
+
+ /**
+ * Get supported JavaEE profiles.
+ * <p/>
+ * @return Supported JavaEE profiles.
+ */
+ @Override
+ public Set<Profile> getSupportedProfiles(final J2eeModule.Type type) {
+ return profilesSetFromArray(profiles);
+ }
+
+ /**
+ * Get supported JavaEE module types.
+ * <p/>
+ * @return Supported JavaEE module types.
+ */
+ @Override
+ public Set<Type> getSupportedTypes() {
+ return moduleTypesSetFromArray(types);
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public java.io.File[] getPlatformRoots() {
+ File server = getServerHome();
+ if (server != null) {
+ return new File[] {server};
+ }
+ return new File[]{};
+ }
+
+ @Override
+ public File getServerHome() {
+ return getExistingFolder(dm.getProperties().getPayaraRoot());
+ }
+
+ @Override
+ public File getDomainHome() {
+ return getExistingFolder(dm.getProperties().getDomainDir());
+ }
+
+ @Override
+ public File getMiddlewareHome() {
+ return getExistingFolder(dm.getProperties().getInstallRoot());
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public LibraryImplementation[] getLibraries() {
+ addFcl();
+ return libraries.clone();
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public java.awt.Image getIcon() {
+ return ImageUtilities.loadImage("org/netbeans/modules/j2ee/hk2/resources/server.gif"); // NOI18N
+ }
+
+ /**
+ * Get Payara JavaEE platform display name.
+ * <p/>
+ * @return Payara JavaEE platform display name.
+ */
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * Get supported JavaSE platforms.
+ * <p/>
+ * @return Supported JavaSE platforms.
+ */
+ @Override
+ public Set getSupportedJavaPlatformVersions() {
+ return platformsSetFromArray(platforms);
+ }
+
+ /**
+ * Get default Payara JavaSE platform.
+ * <p/>
+ * Returns <code>null</code>.
+ * <p/>
+ * @return Default Payara JavaSE platform.
+ */
+ @Override
+ public JavaPlatform getJavaPlatform() {
+ return null;
+ }
+
+ /**
+ *
+ */
+ public void notifyLibrariesChanged() {
+ initLibraries();
+ }
+
+ private static final RequestProcessor libInitThread =
+ new RequestProcessor("init libs -- Hk2JavaEEPlatformImpl");
+
+ private void initLibraries() {
+ libInitThread.post(new Runnable() {
+
+ @Override
+ public void run() {
+ libraryProvider.setJavaEELibraryImplementation(
+ lib, libraryName);
+ firePropertyChange(PROP_LIBRARIES, null, libraries.clone());
+ }
+ });
+ }
+
+ /**
+ * Return Java EE platform lookup instance.
+ * <p/>
+ * @return Java EE platform lookup instance.
+ */
+ @Override
+ public Lookup getLookup() {
+ return lkp;
+ }
+
+ private File getExistingFolder(String path) {
+ if (path != null) {
+ File returnedElement = new File(path);
+ if (returnedElement.exists()) {
+ return returnedElement;
+ }
+ }
+ return null;
+ }
+
+ /* return the string within quotes
+ **/
+ private String quotedString(String s){
+ return "\""+s+"\"";
+ }
+
+ /**
+ * Get Payara version.
+ * Returns {@see PayaraVersion} for current Payara server instance.
+ * <p/>
+ * @return Payara version.
+ */
+ private PayaraVersion getPFVersion() {
+ PayaraVersion version = null;
+ try {
+ version = dm
+ .getCommonServerSupport().getInstance().getVersion();
+ } catch (NullPointerException npe) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Caught NullPointerException in Hk2JavaEEPlatformImpl "
+ + "while checking Payara version", npe);
+ }
+ return version;
+ }
+
+ /**
+ * Get proper application client container configuration file name
+ * for Payara.
+ * <p/>
+ * @return Application client container configuration file name
+ * for Payara.
+ */
+ private String getAccConfigFile() {
+ final PayaraVersion version = getPFVersion();
+ final String accConfigFile;
+ if (version != null
+ && version.ordinal() >= PayaraVersion.PF_4_1_144.ordinal()) {
+ accConfigFile = GF_ACC_XML;
+ } else {
+ accConfigFile = SUN_ACC_XML;
+ }
+ StringBuilder sb = new StringBuilder(
+ ServerUtils.PF_DOMAIN_CONFIG_DIR_NAME.length()
+ + 1 + accConfigFile.length());
+ sb.append(ServerUtils.PF_DOMAIN_CONFIG_DIR_NAME);
+ sb.append(File.separatorChar);
+ sb.append(accConfigFile);
+ return sb.toString();
+ }
+
+ @Override
+ public String getToolProperty(String toolName, String propertyName) {
+ if (J2eePlatform.TOOL_APP_CLIENT_RUNTIME.equals(toolName)) {
+ File root = new File(dm.getProperties().getPayaraRoot());
+ String domainPath = dm.getProperties().getDomainDir();
+ if (J2eePlatform.TOOL_PROP_MAIN_CLASS.equals(propertyName)) {
+ return "org.glassfish.appclient.client.AppClientFacade"; // NOI18N
+ }
+ if (J2eePlatform.TOOL_PROP_MAIN_CLASS_ARGS.equals(propertyName)) {
+ return "${j2ee.appclient.tool.args}"; // NOI18N
+ }
+ if (J2eePlatform.TOOL_PROP_JVM_OPTS.equals(propertyName)) {
+ if(domainPath != null) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("-Djava.endorsed.dirs=");
+ sb.append(quotedString(new File(root,"lib/endorsed").getAbsolutePath()));
+ sb.append(File.pathSeparator);
+ sb.append(quotedString(new File(root,"modules/endorsed").getAbsolutePath()));
+ sb.append(" -javaagent:");
+ String url = dm.getCommonServerSupport().getInstanceProperties().get(PayaraModule.URL_ATTR);
+ File f = new File(root,"lib/gf-client.jar"); // NOI18N
+ if (f.exists()) {
+ sb.append(quotedString(f.getAbsolutePath()));
+ } else {
+ sb.append(quotedString(new File(root,"modules/gf-client.jar").getAbsolutePath()));
+ }
+ sb.append("=mode=acscript,arg=-configxml,arg=");
+ sb.append(quotedString(new File(domainPath, getAccConfigFile()).getAbsolutePath()));
+ sb.append(",client=jar=");
+// sb.append(""); // path to /tmp/test/ApplicationClient1Client.jar
+// sb.append(" -jar ");
+// sb.append(""); // path to /tmp/test/ApplicationClient1Client.jar
+ return sb.toString();
+ } else {
+ return null;
+ }
+ }
+ if (J2eePlatform.TOOL_PROP_CLIENT_JAR_LOCATION.equals(propertyName)) {
+ if(domainPath != null) {
+ FileObject location = FileUtil.toFileObject(FileUtil.normalizeFile(new File(domainPath)));
+ if (location == null) {
+ return null;
+ }
+ return (FileUtil.toFile(location).getAbsolutePath())+File.separator+"generated"+File.separator+"xml"; // NOI18N
+ } else {
+ return null;
+ }
+ }
+ if ("j2ee.appclient.args".equals(propertyName)) { // NOI18N
+ return null; // "-configxml " + quotedString(new File(dmProps.getLocation(), dmProps.getDomainName() +
+ // "/config/sun-acc.xml").getAbsolutePath()); // NOI18N
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get Payara bundled libraries provider.
+ * <p/>
+ * @return Payara bundled libraries provider.
+ */
+ public Hk2LibraryProvider getLibraryProvider() {
+ return libraryProvider;
+ }
+
+ private class JaxRsStackSupportImpl implements JaxRsStackSupportImplementation {
+
+ // Bug# 233840 - Fixing to avoid AssertionError and provide library
+ // for GF4. But JAR names remain hardcoded. This shall be rewritten
+ // to use Hk2LibraryProvider!
+ /* (non-Javadoc)
+ * @see org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation#addJsr311Api(org.netbeans.api.project.Project)
+ */
+ @Override
+ public boolean addJsr311Api(final Project project) {
+ final Library library = libraryProvider.getJaxRsLibrary();
+ final FileObject sourceRoot = getSourceRoot(project);
+ if (library != null && sourceRoot != null) {
+ try {
+ String classPathType = hasJee6Profile()
+ ? JavaClassPathConstants.COMPILE_ONLY
+ : ClassPath.COMPILE;
+ return ProjectClassPathModifier.addLibraries(
+ new Library[] {library}, sourceRoot, classPathType);
+ } catch (UnsupportedOperationException | IOException ex) {
+ return false;
+ }
+ }
+ // TODO: Rewrite to use Hk2LibraryProvider#getJaxRsName()
+ // or getJaxRsClassPathURLs()
+ final PayaraVersion version = getPFVersion();
+ try {
+ if (version == null) {
+ return false;
+ }
+ else if (version.equalsMajorMinor(PayaraVersion.PF_4_1_144)) {
+ final File javaxWsRs = ServerUtilities.getJarName(dm.getProperties().
+ getPayaraRoot(), "javax.ws.rs-api.jar"); // NOI18N
+ if ( javaxWsRs== null || !javaxWsRs.exists()){
+ return false;
+ }
+ return addJars(project, Collections.singletonList(
+ Utilities.toURI(javaxWsRs).toURL()));
+ }
+ } catch (MalformedURLException ex) {
+ return false;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation#extendsJerseyProjectClasspath(org.netbeans.api.project.Project)
+ */
+ @Override
+ public boolean extendsJerseyProjectClasspath( Project project ) {
+ Library library = libraryProvider.getJerseyLibrary();
+ FileObject sourceRoot = getSourceRoot(project);
+ if (sourceRoot == null) {
+ return false;
+ }
+ try {
+ String classPathType;
+ if (hasJee6Profile()) {
+ classPathType = JavaClassPathConstants.COMPILE_ONLY;
+ }
+ else {
+ classPathType = ClassPath.COMPILE;
+ }
+ return ProjectClassPathModifier.addLibraries(
+ new Library[] { library }, sourceRoot, classPathType);
+ }
+ catch (UnsupportedOperationException | IOException ex) {
+ return false;
+ }
+ /*List<URL> urls = getJerseyLibraryURLs();
+ if ( urls.sdkSize() >0 ){
+ return addJars( project , urls );
+ }*/
+ }
+
+ @Override
+ public void removeJaxRsLibraries(final Project project) {
+ final Library library = libraryProvider.getJerseyLibrary();
+ final FileObject sourceRoot = getSourceRoot(project);
+ if ( sourceRoot != null){
+ final String[] classPathTypes = new String[]{ ClassPath.COMPILE ,
+ JavaClassPathConstants.COMPILE_ONLY };
+ for (String type : classPathTypes) {
+ try {
+ ProjectClassPathModifier.removeLibraries( new Library[]{
+ library} ,sourceRoot, type);
+ }
+ catch (UnsupportedOperationException | IOException ex) {
+ Logger.getLogger(JaxRsStackSupportImpl.class.getName()).
+ log (Level.INFO, null , ex );
+ }
+ }
+ }
+ /*List<URL> urls = getJerseyLibraryURLs();
+ if ( urls.sdkSize() >0 ){
+ SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups(
+ JavaProjectConstants.SOURCES_TYPE_JAVA);
+ if (sourceGroups == null || sourceGroups.length < 1) {
+ return;
+ }
+ FileObject sourceRoot = sourceGroups[0].getRootFolder();
+ String[] classPathTypes = new String[]{ ClassPath.COMPILE , ClassPath.EXECUTE };
+ for (String type : classPathTypes) {
+ try {
+ ProjectClassPathModifier.removeRoots(urls.toArray(
+ new URL[ urls.sdkSize()]), sourceRoot, type);
+ }
+ catch(UnsupportedOperationException ex) {
+ Logger.getLogger( JaxRsStackSupportImpl.class.getName() ).
+ log (Level.INFO, null , ex );
+ }
+ catch( IOException e ){
+ Logger.getLogger( JaxRsStackSupportImpl.class.getName() ).
+ log(Level.INFO, null , e );
+ }
+ }
+ }*/
+ }
+
+ @Override
+ public void configureCustomJersey( Project project ){
+ }
+
+ /* (non-Javadoc)
+ * @see org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation#isBundled(java.lang.String)
+ */
+ @Override
+ public boolean isBundled(final String classFqn ) {
+ final List<URL> urls = libraryProvider.getJerseyClassPathURLs();
+ for( URL url : urls ){
+ FileObject root = URLMapper.findFileObject(url);
+ if ( FileUtil.isArchiveFile(root)){
+ root = FileUtil.getArchiveRoot(root);
+ }
+ final String path = classFqn.replace('.', '/')+".class";
+ if ( root.getFileObject(path )!= null ){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private FileObject getSourceRoot(final Project project) {
+ final SourceGroup[] sourceGroups = ProjectUtils.getSources(project)
+ .getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
+ if (sourceGroups == null || sourceGroups.length < 1) {
+ return null;
+ }
+ return sourceGroups[0].getRootFolder();
+ }
+
+ private boolean hasJee6Profile(){
+ final Set<Profile> profiles = getSupportedProfiles();
+ return profiles.contains(Profile.JAVA_EE_6_FULL) ||
+ profiles.contains(Profile.JAVA_EE_6_WEB) ;
+ }
+
+ private void addURL(final Collection<URL> urls, final File file ){
+ if ( file == null || !file.exists()) {
+ return;
+ }
+ try {
+ urls.add(Utilities.toURI(file).toURL());
+ } catch (MalformedURLException ex) {
+ // ignore the file
+ }
+ }
+
+ private boolean addJars(final Project project, Collection<URL> jars ){
+ final List<URL> urls = new ArrayList<>();
+ for (URL url : jars) {
+ if ( FileUtil.isArchiveFile( url)){
+ urls.add(FileUtil.getArchiveRoot(url));
+ }
+ }
+ final SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups(
+ JavaProjectConstants.SOURCES_TYPE_JAVA);
+ if (sourceGroups == null || sourceGroups.length < 1) {
+ return false;
+ }
+ final FileObject sourceRoot = sourceGroups[0].getRootFolder();
+ try {
+ final String classPathType;
+ if ( hasJee6Profile() ){
+ classPathType = JavaClassPathConstants.COMPILE_ONLY;
+ }
+ else {
+ classPathType = ClassPath.COMPILE;
+ }
+ ProjectClassPathModifier.addRoots(urls.toArray( new URL[ urls.size()]),
+ sourceRoot, classPathType );
+ }
+ catch (UnsupportedOperationException | IOException ex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Get Payara version from instance stored in deployment manager.
+ * <p/>
+ * @return Payara version from instance stored in deployment manager.
+ */
+ private PayaraVersion getPFVersion() {
+ PayaraVersion version = null;
+ try {
+ version = dm
+ .getCommonServerSupport().getInstance().getVersion();
+ } catch (NullPointerException npe) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Caught NullPointerException in Hk2JavaEEPlatformImpl "
+ + "while checking Payara version", npe);
+ }
+ return version;
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxRpcStack.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxRpcStack.java
new file mode 100644
index 0000000..f013db6
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxRpcStack.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.netbeans.modules.javaee.specs.support.api.JaxRpc;
+import org.netbeans.modules.websvc.wsstack.api.WSStack.Feature;
+import org.netbeans.modules.websvc.wsstack.api.WSStack.Tool;
+import org.netbeans.modules.websvc.wsstack.api.WSStackVersion;
+import org.netbeans.modules.websvc.wsstack.api.WSTool;
+import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory;
+import org.netbeans.modules.websvc.wsstack.spi.WSStackImplementation;
+import org.netbeans.modules.websvc.wsstack.spi.WSToolImplementation;
+
+/**
+ *
+ * @author mkuchtiak
+ * @author ads
+ */
+public class Hk2JaxRpcStack implements WSStackImplementation<JaxRpc> {
+ private static final String[] METRO_LIBRARIES =
+ new String[] {"webservices(|-osgi).jar"}; //NOI18N
+ private static final String PF_MODULES_DIR_NAME = "modules"; // NOI18N
+
+ private String gfRootStr;
+ private JaxRpc jaxRpc;
+
+ public Hk2JaxRpcStack(String gfRootStr) {
+ this.gfRootStr = gfRootStr;
+ jaxRpc = new JaxRpc();
+ }
+
+ @Override
+ public JaxRpc get() {
+ return jaxRpc;
+ }
+
+ @Override
+ public WSStackVersion getVersion() {
+ return WSStackVersion.valueOf(1, 1, 3, 0);
+ }
+
+ @Override
+ public WSTool getWSTool(Tool toolId) {
+ if (toolId == JaxRpc.Tool.WCOMPILE && isMetroInstalled()) {
+ return WSStackFactory.createWSTool(new JaxRpcTool(JaxRpc.Tool.WCOMPILE));
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isFeatureSupported(Feature feature) {
+ if (feature == JaxRpc.Feature.JSR109 && isMetroInstalled()) {
+ return true;
+ }
+ return false;
+ }
+
+ protected class JaxRpcTool implements WSToolImplementation {
+ JaxRpc.Tool tool;
+ JaxRpcTool(JaxRpc.Tool tool) {
+ this.tool = tool;
+ }
+
+ @Override
+ public String getName() {
+ return tool.getName();
+ }
+
+ @Override
+ public URL[] getLibraries() {
+ List<URL> cPath = new ArrayList<URL>();
+ if (isMetroInstalled()) {
+ for (String entry : METRO_LIBRARIES) {
+ File f = getJarName(gfRootStr, entry);
+ if ((f != null) && (f.exists())) {
+ try {
+ cPath.add(f.toURI().toURL());
+ } catch (MalformedURLException ex) {
+
+ }
+ }
+ }
+ }
+ return cPath.toArray(new URL[cPath.size()]);
+ }
+
+ }
+
+ protected boolean isMetroInstalled() {
+ File f = getJarName(gfRootStr, METRO_LIBRARIES[0]);
+ return f!=null && f.exists();
+ }
+
+ private static class VersionFilter implements FileFilter {
+
+ private final Pattern pattern;
+
+ public VersionFilter(String namePattern) {
+ pattern = Pattern.compile(namePattern);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ }
+
+ protected File getJarName(String glassfishInstallRoot, String jarNamePattern) {
+
+ File modulesDir = new File(glassfishInstallRoot + File.separatorChar +
+ PF_MODULES_DIR_NAME);
+ int subindex = jarNamePattern.lastIndexOf("/");
+ if(subindex != -1) {
+ String subdir = jarNamePattern.substring(0, subindex);
+ jarNamePattern = jarNamePattern.substring(subindex+1);
+ modulesDir = new File(modulesDir, subdir);
+ }
+ File candidates[] = modulesDir.listFiles(new VersionFilter(jarNamePattern));
+
+ if (candidates != null && candidates.length > 0) {
+ return candidates[0]; // the first one
+ }
+ return null;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxWsStack.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxWsStack.java
new file mode 100644
index 0000000..3c6f9bb
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JaxWsStack.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.modules.javaee.specs.support.api.JaxWs;
+import org.netbeans.modules.websvc.wsstack.api.WSStack.Feature;
+import org.netbeans.modules.websvc.wsstack.api.WSStack.Tool;
+import org.netbeans.modules.websvc.wsstack.api.WSStackVersion;
+import org.netbeans.modules.websvc.wsstack.api.WSTool;
+import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory;
+import org.netbeans.modules.websvc.wsstack.spi.WSStackImplementation;
+import org.netbeans.modules.websvc.wsstack.spi.WSToolImplementation;
+
+/**
+ *
+ * @author mkuchtiak
+ * @author ads
+ */
+public class Hk2JaxWsStack implements WSStackImplementation<JaxWs> {
+ private static final String[] METRO_LIBRARIES =
+ new String[] {"webservices(|-osgi).jar", //NOI18N
+ "webservices-api(|-osgi).jar", //NOI18N
+ "jaxb(|-osgi).jar", //NOI18N
+ "jaxb-api(|-osgi).jar", //NOI18N
+ "javax.ejb.jar", //NOI18N
+ "javax.activation.jar"}; //NOI18N
+ private static final String PF_MODULES_DIR_NAME = "modules"; // NOI18N
+
+ private String pfRootStr;
+ private JaxWs jaxWs;
+ private Hk2JavaEEPlatformImpl platform;
+
+ public Hk2JaxWsStack(String pfRootStr, Hk2JavaEEPlatformImpl platform ) {
+ this.pfRootStr = pfRootStr;
+ jaxWs = new JaxWs(getUriDescriptor());
+ this.platform = platform;
+ }
+
+
+ @Override
+ public JaxWs get() {
+ return jaxWs;
+ }
+
+ @Override
+ public WSStackVersion getVersion() {
+ Set<Profile> supportedProfiles = platform.getSupportedProfiles();
+ if (supportedProfiles.contains(Profile.JAVA_EE_7_FULL)
+ || supportedProfiles.contains(Profile.JAVA_EE_7_WEB)
+ || supportedProfiles.contains(Profile.JAVA_EE_6_FULL)
+ || supportedProfiles.contains(Profile.JAVA_EE_6_WEB)) {
+ if (isMetroInstalled()) {
+ return WSStackVersion.valueOf(2, 2, 0, 0);
+ }
+ return WSStackVersion.valueOf(2, 1, 4, 1);
+ } else {
+ if (isMetroInstalled()) {
+ return WSStackVersion.valueOf(2, 1, 4, 1);
+ }
+ return WSStackVersion.valueOf(2, 1, 3, 0);
+ }
+ }
+
+ @Override
+ public WSTool getWSTool(Tool toolId) {
+ if (toolId == JaxWs.Tool.WSIMPORT) {
+ return WSStackFactory.createWSTool(new JaxWsTool(JaxWs.Tool.WSIMPORT));
+ } else if (toolId == JaxWs.Tool.WSGEN) {
+ return WSStackFactory.createWSTool(new JaxWsTool(JaxWs.Tool.WSGEN));
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isFeatureSupported(Feature feature) {
+ if (feature == JaxWs.Feature.WSIT && isMetroInstalled()) {
+ return true;
+ }
+ if (feature == JaxWs.Feature.JSR109 && isMetroInstalled()) {
+ return true;
+ }
+ return feature == JaxWs.Feature.TESTER_PAGE;
+ }
+
+ private JaxWs.UriDescriptor getUriDescriptor() {
+ return new JaxWs.UriDescriptor() {
+
+ @Override
+ public String getServiceUri(String applicationRoot, String serviceName,
+ String portName, boolean isEjb)
+ {
+ if (isEjb) {
+ return serviceName+"/"+portName; //NOI18N
+ } else {
+ if ( applicationRoot == null || applicationRoot.length() ==0 ){
+ return serviceName;
+ }
+ else {
+ StringBuilder builder = new StringBuilder( applicationRoot);
+ builder.append('/');
+ builder.append(serviceName);
+ return builder.toString();
+ }
+ }
+ }
+
+ @Override
+ public String getDescriptorUri(String applicationRoot,
+ String serviceName, String portName, boolean isEjb)
+ {
+ return getServiceUri(applicationRoot, serviceName, portName,
+ isEjb)+"?wsdl"; //NOI18N
+ }
+
+ @Override
+ public String getTesterPageUri(String host, String port,
+ String applicationRoot, String serviceName, String portName,
+ boolean isEjb)
+ {
+ return "http://"+host+":"+port+"/"+getServiceUri(applicationRoot,
+ serviceName, portName, isEjb)+"?Tester"; //NOI18N
+ }
+
+ };
+ }
+
+ protected class JaxWsTool implements WSToolImplementation {
+ JaxWs.Tool tool;
+ JaxWsTool(JaxWs.Tool tool) {
+ this.tool = tool;
+ }
+
+ @Override
+ public String getName() {
+ return tool.getName();
+ }
+
+ @Override
+ public URL[] getLibraries() {
+ List<URL> cPath = new ArrayList<URL>();
+ if (isMetroInstalled()) {
+ for (String entry : METRO_LIBRARIES) {
+ File f = getWsJarName(pfRootStr, entry);
+ if ((f != null) && (f.exists())) {
+ try {
+ cPath.add(f.toURI().toURL());
+ } catch (MalformedURLException ex) {
+
+ }
+ }
+ }
+ }
+ return cPath.toArray(new URL[cPath.size()]);
+ }
+
+ }
+
+ protected boolean isMetroInstalled() {
+ File f = getWsJarName(pfRootStr, METRO_LIBRARIES[0]);
+ return f!=null && f.exists();
+ }
+
+ private static class VersionFilter implements FileFilter {
+
+ private final Pattern pattern;
+
+ public VersionFilter(String namePattern) {
+ pattern = Pattern.compile(namePattern);
+ }
+
+ @Override
+ public boolean accept(File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ }
+
+ public static File getWsJarName(String glassfishInstallRoot,
+ String jarNamePattern)
+ {
+ File modulesDir = new File(glassfishInstallRoot + File.separatorChar +
+ PF_MODULES_DIR_NAME);
+ int subindex = jarNamePattern.lastIndexOf("/");
+ if(subindex != -1) {
+ String subdir = jarNamePattern.substring(0, subindex);
+ jarNamePattern = jarNamePattern.substring(subindex+1);
+ modulesDir = new File(modulesDir, subdir);
+ }
+ File candidates[] = modulesDir.listFiles(
+ new VersionFilter(jarNamePattern));
+
+ if(candidates != null && candidates.length > 0) {
+ return candidates[0]; // the first one
+ } else {
+ File endorsed = new File(modulesDir,"endorsed"); //NOI18N
+ if (endorsed!= null && endorsed.isDirectory()) {
+ File candidates1[] = endorsed.listFiles(
+ new VersionFilter(jarNamePattern));
+ if (candidates1 != null && candidates1.length > 0) {
+ return candidates1[0]; // the first one
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JpaSupportImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JpaSupportImpl.java
new file mode 100644
index 0000000..8b54920
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2JpaSupportImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import static java.util.Collections.unmodifiableSet;
+import java.util.HashSet;
+import java.util.Set;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.javaee.specs.support.api.JpaProvider;
+import org.netbeans.modules.javaee.specs.support.spi.JpaProviderFactory;
+import org.netbeans.modules.javaee.specs.support.spi.JpaSupportImplementation;
+
+/**
+ * Payara server JPA support.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class Hk2JpaSupportImpl implements JpaSupportImplementation {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Individual JPA specifications support.
+ */
+ private static class JpaSupportVector {
+
+ /**
+ * Creates an instance of individual JPA specifications support class.
+ * <p/>
+ * @param jpa_1_0 JPA 1.0 supported.
+ * @param jpa_2_0 JPA 1.0 supported.
+ * @param jpa_2_1 JPA 2.1 supported.
+ */
+ JpaSupportVector(boolean jpa_1_0, boolean jpa_2_0, boolean jpa_2_1) {
+ _1_0 = jpa_1_0;
+ _2_0 = jpa_2_0;
+ _2_1 = jpa_2_1;
+ }
+
+ /** JPA 1.0 supported. */
+ boolean _1_0;
+
+ /** JPA 1.0 supported. */
+ boolean _2_0;
+
+ /** JPA 2.1 supported. */
+ boolean _2_1;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server JPA provider class. */
+ private static final String JPA_PROVIDER
+ = "org.eclipse.persistence.jpa.PersistenceProvider";
+
+ private static final JpaSupportVector jpaSupport[]
+ = new JpaSupportVector[PayaraVersion.length];
+
+ // Initialize Payara JPA support matrix.
+ static {
+ for (PayaraVersion version : PayaraVersion.values()) {
+ jpaSupport[version.ordinal()] = new JpaSupportVector(
+ true, true, version.ordinal() >= PayaraVersion.PF_4_1_144.ordinal()
+ );
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server instance. */
+ private final PayaraServer instance;
+
+ /** Default provider instance. */
+ private volatile JpaProvider defaultProvider;
+
+ /** {@see Set} of available provider instances. */
+ private volatile Set<JpaProvider> providers = null;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server JPA support.
+ * <p/>
+ */
+ Hk2JpaSupportImpl(PayaraServer instance) {
+ this.instance = instance;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // JpaSupportImplementation methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns Payara server JPA providers.
+ * <p/>
+ * @return Payara server JPA providers.
+ */
+ @Override
+ public Set<JpaProvider> getProviders() {
+ if (providers != null) {
+ return unmodifiableSet(providers);
+ }
+ synchronized(this) {
+ if (providers == null) {
+ Set<JpaProvider> newProviders = new HashSet<JpaProvider>();
+ newProviders.add(getDefaultProvider());
+ providers = newProviders;
+ }
+ }
+ return unmodifiableSet(providers);
+ }
+
+ /**
+ * Returns default Payara server JPA provider.
+ * <p/>
+ * @return Default Payara server JPA provider.
+ */
+ @Override
+ public JpaProvider getDefaultProvider() {
+ if (defaultProvider != null) {
+ return defaultProvider;
+ }
+ synchronized(this) {
+ if (defaultProvider == null) {
+ // Unknown version is as the worst known case.
+ JpaSupportVector instanceJpaSupport
+ = jpaSupport[instance.getVersion() != null
+ ? instance.getVersion().ordinal()
+ : PayaraVersion.PF_4_1_144.ordinal()];
+ defaultProvider = JpaProviderFactory.createJpaProvider(
+ JPA_PROVIDER, true, instanceJpaSupport._1_0,
+ instanceJpaSupport._2_0, instanceJpaSupport._2_1);
+ }
+ }
+ return defaultProvider;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2LibraryProvider.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2LibraryProvider.java
new file mode 100644
index 0000000..51ec055
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2LibraryProvider.java
@@ -0,0 +1,462 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.tooling.data.PayaraLibrary;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilder;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.api.project.libraries.Library;
+import org.netbeans.api.project.libraries.LibraryManager;
+import static org.netbeans.modules.payara.jakartaee.ide.Hk2PluginProperties.fileToUrl;
+import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider;
+import org.netbeans.spi.project.libraries.LibraryImplementation;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileUtil;
+import org.openide.modules.InstalledFileLocator;
+
+/**
+ * Payara bundled libraries provider.
+ * <p/>
+ * Builds <code>Library</code> instance containing Jersey library from Payara
+ * modules..
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class Hk2LibraryProvider /*implements JaxRsStackSupportImplementation*/ {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Library provider type. */
+ private static final String PROVIDER_TYPE = "j2se";
+
+ /** Java EE library name suffix to be added after server instance name.
+ * Java EE library name must be unique so combination of instance name
+ * and some common suffix is used. */
+ private static final String JAVAEE_NAME_SUFFIX = " Java EE";
+
+ /** Java EE library name suffix to be added after server instance name.
+ * Jersey library name must be unique so combination of instance name
+ * and some common suffix is used. */
+ private static final String JERSEY_NAME_SUFFIX = " Jersey";
+
+ /** JAX-RS library name suffix to be added after server instance name.
+ * JAX-RS library name must be unique so combination of instance name
+ * and some common suffix is used. */
+ private static final String JAXRS_NAME_SUFFIX = " JAX-RS";
+
+ /** Java EE library name pattern to search for it in
+ * <code>PayaraLibrary</code> list. */
+ private Pattern JAVAEE_PATTERN = Pattern.compile("[jJ]ava {0,1}[eE]{2}");
+
+ /** Jersey library name pattern to search for it in
+ * <code>PayaraLibrary</code> list. */
+ private Pattern JERSEY_PATTERN = Pattern.compile("[jJ]ersey.*");
+
+ /** JAX-RS library name pattern to search for it in
+ * <code>PayaraLibrary</code> list. */
+ private Pattern JAXRS_PATTERN
+ = Pattern.compile("[jJ][aA][xX][ -]{0,1}[rR][sS]");
+
+ /** Code base for file locator. */
+ static final String JAVAEE_DOC_CODE_BASE
+ = "org.netbeans.modules.j2ee.platform";
+
+ /** Internal {@see PayaraServer} to {@see Hk2LibraryProvider}
+ * mapping. */
+ private static final Map <PayaraServer, Hk2LibraryProvider> providers
+ = new HashMap();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns {@see Hk2LibraryProvider} class instance for specific server
+ * instance.
+ * <p/>
+ * Provider instances for individual {@see PayaraServer} instances
+ * are shared.
+ * <p/>
+ * @param server {@see PayaraServer} instance for which provider
+ * is returned.
+ * @return {@see Hk2LibraryProvider} class instance for given server
+ * instance.
+ */
+ public static Hk2LibraryProvider getProvider(PayaraServer server) {
+ Hk2LibraryProvider provider;
+ synchronized(providers) {
+ if ((provider = providers.get(server)) == null)
+ providers.put(
+ server, provider = new Hk2LibraryProvider(server));
+ }
+ return provider;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Library builder associated with current platform.
+ * This attribute should be accessed only using {@see #getBuilder()} even
+ * internally. */
+ private volatile ConfigBuilder builder;
+
+ /** Payara server home directory. */
+ private final String serverHome;
+
+ /** Payara server name. */
+ private final String serverName;
+
+ /** Payara server instance. */
+ private final PayaraServer server;
+
+ /** Java EE library name associated with current Payara server context.
+ * This is lazy initialized internal cache. Do not access this attribute
+ * outside {@see #getJavaEEName()} method! */
+ private volatile String javaEEName = null;
+
+ /** Jersey library name associated with current Payara server context.
+ * This is lazy initialized internal cache. Do not access this attribute
+ * outside {@see #getJerseyName()} method! */
+ private volatile String jerseyName = null;
+
+ /** Jersey JAX-RS name associated with current Payara server context.
+ * This is lazy initialized internal cache. Do not access this attribute
+ * outside {@see #getJaxRsName()} method! */
+ private volatile String jaxRsName = null;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Jersey library provider.
+ * <p/>
+ * @param server Payara server entity.
+ */
+ private Hk2LibraryProvider(PayaraServer server) {
+ if (server == null) {
+ throw new IllegalArgumentException(
+ "Payara server entity shall not be null.");
+ }
+ serverHome = server.getServerHome();
+ serverName = server.getName();
+ this.server = server;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Java EE library name for this server context.
+ * <p/>
+ * This library name shall be registered in default {@see LibraryManager}
+ * and is unique for Jersey modules of given Payara server instance.
+ * Library name is cached after first usage.
+ * <p/>
+ * @return Java EE library name for this server context.
+ */
+ public String getJavaEEName() {
+ if (javaEEName != null) {
+ return javaEEName;
+ }
+ synchronized (this) {
+ StringBuilder sb = new StringBuilder(
+ serverName.length() + JAVAEE_NAME_SUFFIX.length());
+ sb.append(serverName);
+ sb.append(JAVAEE_NAME_SUFFIX);
+ javaEEName = sb.toString();
+ }
+ return javaEEName;
+ }
+
+ /**
+ * Get Jersey library name for this server context.
+ * <p/>
+ * This library name shall be registered in default {@see LibraryManager}
+ * and is unique for Jersey modules of given Payara server instance.
+ * Library name is cached after first usage.
+ * <p/>
+ * @return Jersey library name for this server context.
+ */
+ public String getJerseyName() {
+ if (jerseyName != null) {
+ return jerseyName;
+ }
+ synchronized (this) {
+ StringBuilder sb = new StringBuilder(
+ serverName.length() + JERSEY_NAME_SUFFIX.length());
+ sb.append(serverName);
+ sb.append(JERSEY_NAME_SUFFIX);
+ jerseyName = sb.toString();
+ }
+ return jerseyName;
+ }
+
+ /**
+ * Get JAX-RS library name for this server context.
+ * <p/>
+ * This library name shall be registered in default {@see LibraryManager}
+ * and is unique for Jersey modules of given Payara server instance.
+ * Library name is cached after first usage.
+ * <p/>
+ * @return JAX-RS library name for this server context.
+ */
+ public String getJaxRsName() {
+ if (jaxRsName != null) {
+ return jaxRsName;
+ }
+ synchronized (this) {
+ StringBuilder sb = new StringBuilder(
+ serverName.length() + JAXRS_NAME_SUFFIX.length());
+ sb.append(serverName);
+ sb.append(JAXRS_NAME_SUFFIX);
+ jaxRsName = sb.toString();
+ }
+ return jaxRsName;
+ }
+
+ /**
+ * Return Jersey libraries available in Payara.
+ * <p/>
+ * @return Jersey libraries available in Payara.
+ */
+ public Library getJerseyLibrary() {
+ return getLibrary(JERSEY_PATTERN, getJerseyName());
+ }
+
+ /**
+ * Set {@see LibraryImplementation} content for Jersey libraries
+ * available in Payara.
+ * <p/>
+ * @param lib Target {@see LibraryImplementation}.
+ * @param libraryName Library name in returned Library instance.
+ */
+ public void setJerseyImplementation(
+ LibraryImplementation lib, String libraryName) {
+ setLibraryImplementationContent(lib, JERSEY_PATTERN, libraryName);
+ }
+
+ /**
+ * Get {@see List} of class path {@see URL}s for Jersey libraries.
+ * <p/>
+ * @return {@see List} of class path {@see URL}s for Jersey libraries.
+ */
+ public List<URL> getJerseyClassPathURLs() {
+ return getLibraryClassPathURLs(JERSEY_PATTERN);
+ }
+
+ /**
+ * Return JAX-RS libraries available in Payara.
+ * <p/>
+ * @return JAX-RS libraries available in Payara.
+ */
+ public Library getJaxRsLibrary() {
+ return getLibrary(JAXRS_PATTERN, getJaxRsName());
+ }
+
+ /**
+ * Set {@see LibraryImplementation} content for JAX-RS libraries
+ * available in Payara.
+ * <p/>
+ * @param lib Target {@see LibraryImplementation}.
+ * @param libraryName Library name in returned Library instance.
+ */
+ public void setJaxRsLibraryImplementation(
+ LibraryImplementation lib, String libraryName) {
+ setLibraryImplementationContent(lib, JAXRS_PATTERN, libraryName);
+ }
+
+ /**
+ * Get {@see List} of class path {@see URL}s for JAX-RS libraries.
+ * <p/>
+ * @return {@see List} of class path {@see URL}s for JAX-RS libraries.
+ */
+ public List<URL> getJaxRsClassPathURLs() {
+ return getLibraryClassPathURLs(JAXRS_PATTERN);
+ }
+
+ /**
+ * Return Java EE libraries available in Payara.
+ * <p/>
+ * @return Java EE libraries available in Payara\.
+ */
+ public Library getJavaEELibrary() {
+ return getLibrary(JAVAEE_PATTERN, getJavaEEName());
+ }
+
+ /**
+ * Set {@see LibraryImplementation} content for Java EE libraries
+ * available in Payara.
+ * <p/>
+ * @param lib Target {@see LibraryImplementation}.
+ * @param libraryName Library name in returned Library instance.
+ */
+ public void setJavaEELibraryImplementation(
+ LibraryImplementation lib, String libraryName) {
+ setLibraryImplementationContent(lib, JAVAEE_PATTERN, libraryName);
+ }
+
+ /**
+ * Get {@see List} of class path {@see URL}s for Java EE libraries.
+ * <p/>
+ * @return {@see List} of class path {@see URL}s for Java EE libraries.
+ */
+ public List<URL> getJavaEEClassPathURLs() {
+ return getLibraryClassPathURLs(JAVAEE_PATTERN);
+ }
+
+ /**
+ * Return libraries available in Payara.
+ * <p/>
+ * @param namePattern Library name pattern to search for it in
+ * <code>PayaraLibrary</code> list.
+ * @param libraryName Library name in returned Library instance.
+ * @return Requested Payara library.
+ */
+ private Library getLibrary(Pattern namePattern, String libraryName) {
+ Library lib = LibraryManager.getDefault().getLibrary(libraryName);
+ if (lib != null) {
+ return lib;
+ }
+ ConfigBuilder cb = ConfigBuilderProvider.getBuilder(server);
+ List<PayaraLibrary> gfLibs = cb.getLibraries(server.getVersion());
+ for (PayaraLibrary gfLib : gfLibs) {
+ if (namePattern.matcher(gfLib.getLibraryID()).matches()) {
+ Map<String,List<URL>> contents
+ = new HashMap<String, List<URL>>(1);
+ Map<String, String> properties = new HashMap<String, String>(2);
+ contents.put("classpath", translateArchiveUrls(gfLib.getClasspath()));
+ contents.put("javadoc", translateArchiveUrls(gfLib.getJavadocs()));
+ properties.put("maven-dependencies", gfLib.getMavenDeps());
+ properties.put("maven-repositories", "default");
+ try {
+ return LibraryManager.getDefault().createLibrary(
+ PROVIDER_TYPE,
+ libraryName,
+ null,
+ null,
+ contents,
+ properties);
+ } catch (IOException ioe) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Could not create Jersey library for "
+ + serverName + ": ", ioe);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set {@see LibraryImplementation} content for given library name.
+ * <p/>
+ * @param lib Target {@see LibraryImplementation}.
+ * @param namePattern Library name pattern to search for it in
+ * <code>PayaraLibrary</code> list.
+ * @param libraryName Library name in returned Library instance.
+ */
+ private void setLibraryImplementationContent(LibraryImplementation lib,
+ Pattern namePattern, String libraryName) {
+ ConfigBuilder cb = ConfigBuilderProvider.getBuilder(server);
+ List<PayaraLibrary> gfLibs = cb.getLibraries(server.getVersion());
+ for (PayaraLibrary gfLib : gfLibs) {
+ if (namePattern.matcher(gfLib.getLibraryID()).matches()) {
+ List<String> javadocLookups = gfLib.getJavadocLookups();
+ lib.setName(libraryName);
+ // Build class path
+ List<URL> cp = new ArrayList<URL>();
+ for (URL url : gfLib.getClasspath()) {
+ if (FileUtil.isArchiveFile(url)) {
+ cp.add(FileUtil.getArchiveRoot(url));
+ } else {
+ cp.add(url);
+ }
+ }
+ // Build java docs
+ List<URL> javadoc = new ArrayList<URL>();
+ if (javadocLookups != null) {
+ for (String lookup : javadocLookups) {
+ try {
+ File j2eeDoc = InstalledFileLocator
+ .getDefault().locate(lookup,
+ JAVAEE_DOC_CODE_BASE, false);
+ if (j2eeDoc != null) {
+ javadoc.add(fileToUrl(j2eeDoc));
+ }
+ } catch (MalformedURLException e) {
+ ErrorManager.getDefault()
+ .notify(ErrorManager.INFORMATIONAL, e);
+ }
+ }
+ }
+ lib.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_CLASSPATH,
+ cp);
+ lib.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_JAVADOC,
+ javadoc);
+ }
+ }
+ }
+
+ /**
+ * Get list of class path {@see URL}s for given library name.
+ * <p/>
+ * @param namePattern Library name pattern to search for it in
+ * <code>PayaraLibrary</code> list.
+ * @param libraryName Library name in returned Library instance.
+ */
+ private List<URL> getLibraryClassPathURLs(Pattern namePattern) {
+ ConfigBuilder cb = ConfigBuilderProvider.getBuilder(server);
+ List<PayaraLibrary> gfLibs = cb.getLibraries(server.getVersion());
+ for (PayaraLibrary gfLib : gfLibs) {
+ if (namePattern.matcher(gfLib.getLibraryID()).matches()) {
+ return gfLib.getClasspath();
+ }
+ }
+ return Collections.<URL>emptyList();
+ }
+
+ private List<URL> translateArchiveUrls(List<URL> urls) {
+ List<URL> result = new ArrayList<>(urls.size());
+ for (URL u : urls) {
+ if (FileUtil.isArchiveFile(u)) {
+ result.add(FileUtil.getArchiveRoot(u));
+ } else {
+ result.add(u);
+ }
+ }
+ return result;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2MessageDestinationManager.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2MessageDestinationManager.java
new file mode 100644
index 0000000..024aa04
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2MessageDestinationManager.java
@@ -0,0 +1,438 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.common.parser.TreeParser;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination.Type;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.MessageDestinationDeployment;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author Nitya Doraisamy
+ */
+public class Hk2MessageDestinationManager implements MessageDestinationDeployment {
+
+ private Hk2DeploymentManager dm;
+
+ private static final String DOMAIN_XML_PATH = "config/domain.xml";
+ public static final String JMS_PREFIX = "jms/"; // NOI18N
+ public static final String QUEUE = "javax.jms.Queue"; // NOI18N
+ public static final String TOPIC = "javax.jms.Topic"; // NOI18N
+ public static final String QUEUE_PROP = "PhysicalQueue"; // NOI18N
+ public static final String TOPIC_PROP = "PhysicalTopic"; // NOI18N
+
+ public static final String QUEUE_CNTN_FACTORY = "javax.jms.QueueConnectionFactory"; // NOI18N
+ public static final String TOPIC_CNTN_FACTORY = "javax.jms.TopicConnectionFactory"; // NOI18N
+
+
+ public Hk2MessageDestinationManager(Hk2DeploymentManager dm) {
+ this.dm = dm;
+ }
+
+ @Override
+ public Set<MessageDestination> getMessageDestinations() throws ConfigurationException {
+ PayaraModule commonSupport = dm.getCommonServerSupport();
+ String domainsDir = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ String domainName = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ if (null != domainsDir) {
+ // XXX Fix to work with current server domain, not just default domain.
+ File domainXml = new File(domainsDir, domainName + File.separatorChar + DOMAIN_XML_PATH);
+
+ // TODO : need to account for a remote domain here?
+ return readMessageDestinations(domainXml, "/domain/", null);
+ } else {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ @Override
+ public void deployMessageDestinations(Set<MessageDestination> destinations) throws ConfigurationException {
+ // since a connection pool is not a Datasource, all resource deployment has to
+ // happen in a different part of the deploy processing... so this should remain
+ // empty to prevent redundant processing.
+ }
+
+ // ------------------------------------------------------------------------
+ // Used by ModuleConfigurationImpl since
+ // ------------------------------------------------------------------------
+ public static Set<MessageDestination> getMessageDestinations(File resourceDir, String baseName) {
+ File resourcesXml = new File(resourceDir, baseName+".xml");
+ return readMessageDestinations(resourcesXml, "/", resourceDir);
+ }
+
+ private static Set<MessageDestination> readMessageDestinations(File xmlFile, String xPathPrefix, File resourcesDir) {
+ Set<MessageDestination> msgDestinations = new HashSet<MessageDestination>();
+ if(xmlFile.exists()) {
+ Map<String, AdminObjectResource> aoResourceMap = new HashMap<String, AdminObjectResource>();
+ List<TreeParser.Path> pathList = new ArrayList<TreeParser.Path>();
+ pathList.add(new TreeParser.Path(xPathPrefix + "resources/admin-object-resource", new AdminObjectReader(aoResourceMap)));
+
+ try {
+ TreeParser.readXml(xmlFile, pathList);
+ } catch(IllegalStateException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ for(AdminObjectResource adminObj: aoResourceMap.values()) {
+ String type = adminObj.getResType();
+ if (type.equals(QUEUE)) {
+ msgDestinations.add(new SunMessageDestination(adminObj.getJndiName(), MessageDestination.Type.QUEUE, resourcesDir));
+ } else {
+ msgDestinations.add(new SunMessageDestination(adminObj.getJndiName(), MessageDestination.Type.TOPIC, resourcesDir));
+ }
+ }
+ }
+ return msgDestinations;
+ }
+
+ public static MessageDestination createMessageDestination(String name, MessageDestination.Type type, File resourceDir, String baseName) throws ConfigurationException {
+ SunMessageDestination msgDest;
+ if(! name.startsWith(JMS_PREFIX)){
+ name = JMS_PREFIX + name;
+ }
+
+ DuplicateAOFinder aoFinder = new DuplicateAOFinder(name);
+ DuplicateConnectorFinder connFinder = new DuplicateConnectorFinder(name);
+ ConnectorPoolFinder cpFinder = new ConnectorPoolFinder();
+
+ File xmlFile = new File(resourceDir, baseName+".xml");
+ if(xmlFile.exists()) {
+ List<TreeParser.Path> pathList = new ArrayList<TreeParser.Path>();
+ pathList.add(new TreeParser.Path("/resources/admin-object-resource", aoFinder));
+ pathList.add(new TreeParser.Path("/resources/connector-resource", connFinder));
+ pathList.add(new TreeParser.Path("/resources/connector-connection-pool", cpFinder));
+ TreeParser.readXml(xmlFile, pathList);
+ if(connFinder.isDuplicate()) {
+ throw new ConfigurationException("Resource already exists");
+ }
+ }
+
+ String connectionFactoryJndiName= name + "Factory"; // NOI18N
+ String connectionFactoryPoolName = name + "FactoryPool"; // NOI18N
+ try {
+ createAdminObject(xmlFile, name, type);
+ createConnectorConnectionPool(xmlFile, connectionFactoryPoolName, type);
+ createConnector(xmlFile, connectionFactoryJndiName, connectionFactoryPoolName);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, ex.getLocalizedMessage(), ex); // NOI18N
+ throw new ConfigurationException(ex.getLocalizedMessage(), ex);
+ }
+
+
+ msgDest = new SunMessageDestination(name, type, resourceDir);
+ return msgDest;
+
+ }
+
+ private static final String ATTR_JNDINAME = "jndi-name";
+ private static final String ATTR_POOLNAME = "pool-name";
+ private static final String ATTR_POOL_NAME = "name";
+
+ private static final String AO_TAG_1 =
+ " <admin-object-resource enabled=\"true\" ";
+ private static final String ATTR_RESTYPE =
+ " res-type";
+ private static final String AO_TAG_2 =
+ " res-adapter=\"jmsra\">\n";
+ private static final String PROP_NAME =
+ "Name";
+ private static final String AO_TAG_3 =
+ " </admin-object-resource>\n";
+ public static void createAdminObject(File sunResourcesXml, String jndiName, Type type) throws IOException {
+ // <admin-object-resource res-adapter="jmsra" res-type="javax.jms.Queue" jndi-name="testao"></admin-object-resource>
+ StringBuilder xmlBuilder = new StringBuilder(500);
+ xmlBuilder.append(AO_TAG_1);
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_JNDINAME, jndiName, false);
+ if (MessageDestination.Type.QUEUE.equals(type)) {
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_RESTYPE, QUEUE, true);
+ xmlBuilder.append(AO_TAG_2);
+ ResourceModifier.appendProperty(xmlBuilder, PROP_NAME, QUEUE_PROP, true);
+ } else if (MessageDestination.Type.TOPIC.equals(type)) {
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_RESTYPE, TOPIC, true);
+ xmlBuilder.append(AO_TAG_2);
+ ResourceModifier.appendProperty(xmlBuilder, PROP_NAME, TOPIC_PROP, true);
+ }
+ xmlBuilder.append(AO_TAG_3);
+ String xmlFragment = xmlBuilder.toString();
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "New Connector resource:\n" + xmlFragment);
+ ResourceModifier.appendResource(sunResourcesXml, xmlFragment);
+ }
+
+ private static final String CONNECTOR_POOL_TAG_1 =
+ " <connector-connection-pool ";
+ private static final String ATTR_CONN_DEFINITION =
+ " connection-definition-name";
+ private static final String CONNECTOR_POOL_TAG_2 =
+ " resource-adapter-name=\"jmsra\"/>\n";
+ public static void createConnectorConnectionPool(File sunResourcesXml, String poolName, Type type) throws IOException {
+ //<connector-connection-pool name="testconnectorpool" resource-adapter-name="jmsra" connectiondefinition="javax.jms.ConnectionFactory"/>
+ StringBuilder xmlBuilder = new StringBuilder(500);
+ xmlBuilder.append(CONNECTOR_POOL_TAG_1);
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_POOL_NAME, poolName, true);
+ if(type.equals(MessageDestination.Type.QUEUE)) {
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_CONN_DEFINITION, QUEUE_CNTN_FACTORY, true);
+ } else if (type.equals(MessageDestination.Type.TOPIC)) {
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_CONN_DEFINITION, TOPIC_CNTN_FACTORY, true);
+ }
+ xmlBuilder.append(CONNECTOR_POOL_TAG_2);
+
+ String xmlFragment = xmlBuilder.toString();
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "New Connector Connection Pool resource:\n" + xmlFragment);
+ ResourceModifier.appendResource(sunResourcesXml, xmlFragment);
+ }
+
+ private static final String CONNECTOR_TAG_1 =
+ " <connector-resource enabled=\"true\" ";
+ private static final String CONNECTOR_TAG_2 =
+ " />\n";
+ public static void createConnector(File sunResourcesXml, String jndiName, String poolName) throws IOException {
+ // <connector-resource pool-name="testconnectorpool" jndi-name="testconnector" />
+ StringBuilder xmlBuilder = new StringBuilder(500);
+ xmlBuilder.append(CONNECTOR_TAG_1);
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_JNDINAME, jndiName, true);
+ ResourceModifier.appendAttr(xmlBuilder, ATTR_POOLNAME, poolName, true);
+ xmlBuilder.append(CONNECTOR_TAG_2);
+
+ String xmlFragment = xmlBuilder.toString();
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "New Connector resource:\n" + xmlFragment);
+ ResourceModifier.appendResource(sunResourcesXml, xmlFragment);
+ }
+
+ private static class AdminObjectReader extends TreeParser.NodeReader {
+
+ private final Map<String, AdminObjectResource> resourceMap;
+
+ public AdminObjectReader(Map<String, AdminObjectResource> resourceMap) {
+ this.resourceMap = resourceMap;
+ }
+
+ //<admin-object-resource
+ //enabled="true"
+ //jndi-name="jms/testQ"
+ //res-type="javax.jms.Queue"
+ //res-adapter="jmsra"
+ //</admin-object-resource>
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String type = attributes.getValue("object-type");
+
+ // Ignore system resources
+ if(type != null && type.startsWith("system-")) {
+ return;
+ }
+ String jndiName = attributes.getValue("jndi-name");
+ String resType = attributes.getValue("res-type");
+ String resadapter = attributes.getValue("res-adapter");
+ if(jndiName != null && jndiName.length() > 0 &&
+ resType != null && resType.length() > 0) {
+ // add to admin object resource list
+ resourceMap.put(jndiName,
+ new AdminObjectResource(jndiName, resType, resadapter));
+ }
+ }
+ }
+
+ private static class AdminObjectResource {
+
+ private final String jndiName;
+ private final String resType;
+ private final String resAdapter;
+
+ public AdminObjectResource(String jndiName, String resType, String resAdapter) {
+ this.jndiName = jndiName;
+ this.resType = resType;
+ this.resAdapter = resAdapter;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public String getResType() {
+ return resType;
+ }
+
+ public String getResAdapter() {
+ return resAdapter;
+ }
+ }
+
+ private static class DuplicateAOFinder extends TreeParser.NodeReader {
+
+ private final String targetJndiName;
+ private boolean duplicate;
+ private String resType;
+
+ public DuplicateAOFinder(String jndiName) {
+ targetJndiName = jndiName;
+ duplicate = false;
+ resType = null;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String jndiName = attributes.getValue("jndi-name");
+ if(targetJndiName.equals(jndiName)) {
+ if(duplicate) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Duplicate jndi-names defined for Admin Object resources.");
+ }
+ duplicate = true;
+ resType = attributes.getValue("res-type");
+ }
+ }
+
+ public boolean isDuplicate() {
+ return duplicate;
+ }
+
+ public String getResType() {
+ return resType;
+ }
+ }
+
+ private static class DuplicateConnectorFinder extends TreeParser.NodeReader {
+
+ private final String targetJndiName;
+ private boolean duplicate;
+ private String poolName;
+
+ public DuplicateConnectorFinder(String jndiName) {
+ targetJndiName = jndiName;
+ duplicate = false;
+ poolName = null;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String jndiName = attributes.getValue("jndi-name");
+ if(targetJndiName.equals(jndiName)) {
+ if(duplicate) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Duplicate jndi-names defined for Connector resources.");
+ }
+ duplicate = true;
+ poolName = attributes.getValue("pool-name");
+ }
+ }
+
+ public boolean isDuplicate() {
+ return duplicate;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+ }
+
+ private static class ConnectorPoolFinder extends TreeParser.NodeReader {
+
+ private Map<String, String> properties = null;
+ private Map<String, ConnectorPool> pools = new HashMap<String, ConnectorPool>();
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ properties = new HashMap<String, String>();
+ String poolName = attributes.getValue("name"); // NOI18N
+ if(poolName != null && poolName.length() > 0) {
+ if(!pools.containsKey(poolName)) {
+ properties.put("name", poolName); // NOI18N
+ properties.put("raname", attributes.getValue("resource-adapter-name")); // NOI18N
+ properties.put("conndefname", attributes.getValue("connection-definition-name")); // NOI18N
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, // NOI18N
+ "Duplicate pool-names defined for Resource Adapter Pools: "+poolName); // NOI18N
+ }
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ if (null != attributes && null != properties) {
+ String key = attributes.getValue("name"); // NOI18N
+ if(key != null && key.length() > 0) {
+ properties.put(key.toLowerCase(Locale.ENGLISH), attributes.getValue("value")); // NOI18N
+ }
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ String poolName = properties.get("name");
+ ConnectorPool pool = new ConnectorPool(
+ poolName,
+ properties.get("raname"),
+ properties.get("conndefname")
+ );
+ pools.put(poolName, pool);
+ }
+
+ public List<String> getPoolNames() {
+ return new ArrayList<String>(pools.keySet());
+ }
+
+ public Map<String, ConnectorPool> getPoolData() {
+ return Collections.unmodifiableMap(pools);
+ }
+
+ }
+
+ private static class ConnectorPool {
+
+ private final String poolName;
+ private final String raName;
+ private final String conndefName;
+
+ public ConnectorPool(String poolName, String raname, String conndefname) {
+ this.poolName = poolName;
+ this.raName = raname;
+ this.conndefName = conndefname;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+
+ public String getRaName() {
+ return raName;
+ }
+
+ public String getConndefName() {
+ return conndefName;
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ModuleConfigFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ModuleConfigFactory.java
new file mode 100644
index 0000000..06925d8
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ModuleConfigFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory2;
+
+/**
+ * Factory to construct proper module configuration object.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus
+ */
+public class Hk2ModuleConfigFactory extends AbstractHk2ConfigurationFactory
+implements ModuleConfigurationFactory2 {
+
+ /**
+ * Creates a new instance of {@link Hk2ModuleConfigFactory}
+ */
+ public Hk2ModuleConfigFactory() {
+ super(null);
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2OptionalFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2OptionalFactory.java
new file mode 100644
index 0000000..afea324
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2OptionalFactory.java
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.jakartaee.db.Hk2DatasourceManager;
+import org.netbeans.modules.payara.jakartaee.ide.FastDeploy;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.*;
+import org.openide.WizardDescriptor;
+import org.openide.WizardDescriptor.InstantiatingIterator;
+import org.openide.WizardDescriptor.Panel;
+import org.openide.util.Lookup;
+
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ * @author vince kraemer
+ */
+public class Hk2OptionalFactory extends OptionalDeploymentManagerFactory {
+
+ private final DeploymentFactory df;
+ private final ServerUtilities commonUtilities;
+ private final boolean hasWizard;
+
+ protected Hk2OptionalFactory(DeploymentFactory df, ServerUtilities su, boolean hasWizard) {
+ this.df = df;
+ this.commonUtilities = su;
+ this.hasWizard = hasWizard;
+ }
+
+ public static Hk2OptionalFactory createEe6() {
+ ServerUtilities t = ServerUtilities.getEe6Utilities();
+ return null == t ? null : new Hk2OptionalFactory(Hk2DeploymentFactory.createEe6(),
+ t, true);
+ }
+
+
+ public static Hk2OptionalFactory createEe7() {
+ ServerUtilities t = ServerUtilities.getEe7Utilities();
+ return null == t ? null : new Hk2OptionalFactory(Hk2DeploymentFactory.createEe7(),
+ t, true);
+ }
+
+
+ public static Hk2OptionalFactory createEe8() {
+ ServerUtilities t = ServerUtilities.getEe8Utilities();
+ return null == t ? null : new Hk2OptionalFactory(Hk2DeploymentFactory.createEe8(),
+ t, true);
+ }
+
+ @Override
+ public StartServer getStartServer(DeploymentManager dm) {
+ return new Hk2StartServer(dm);
+ }
+
+ @Override
+ public IncrementalDeployment getIncrementalDeployment(DeploymentManager dm) {
+ IncrementalDeployment result = null;
+ if(dm instanceof Hk2DeploymentManager) {
+ Hk2DeploymentManager hk2dm = (Hk2DeploymentManager) dm;
+ if(hk2dm.isLocal()) {
+ result = new FastDeploy(hk2dm);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public FindJSPServlet getFindJSPServlet(DeploymentManager dm) {
+ // if assertions are on... blame the caller
+ assert dm instanceof Hk2DeploymentManager : "dm isn't an hk2dm"; // NOI18N
+ // this code might actually be in production. log the bogus-ness and degrade gracefully
+ FindJSPServlet retVal = null;
+ try {
+ Hk2DeploymentManager hk2dm = (Hk2DeploymentManager) dm;
+ if(!hk2dm.getCommonServerSupport().isRemote()) {
+ retVal = new FindJSPServletImpl(hk2dm, this);
+ }
+ } catch (ClassCastException cce) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "caller passed invalid param", cce); // NOI18N
+ }
+ return retVal;
+ }
+
+ @Override
+ public boolean isCommonUIRequired() {
+ return false;
+ }
+
+ @Override
+ public InstantiatingIterator getAddInstanceIterator() {
+ return hasWizard ? new J2eeInstantiatingIterator(commonUtilities) : null;
+ }
+
+ @Override
+ public DatasourceManager getDatasourceManager(DeploymentManager dm) {
+ return dm instanceof Hk2DeploymentManager ?
+ new Hk2DatasourceManager((Hk2DeploymentManager) dm) : null;
+ }
+
+ @Override
+ public JDBCDriverDeployer getJDBCDriverDeployer(DeploymentManager dm) {
+ // if assertions are on... blame the caller
+ assert dm instanceof Hk2DeploymentManager : "dm isn't an hk2dm"; // NOI18N
+ // this code might actually be in production. log the bogus-ness and degrade gracefully
+ JDBCDriverDeployer retVal = null;
+ try {
+ retVal = new JDBCDriverDeployerImpl((Hk2DeploymentManager) dm, this);
+ } catch (ClassCastException cce) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "caller passed invalid param", cce); // NOI18N
+ }
+ return retVal;
+ }
+
+ @Override
+ public MessageDestinationDeployment getMessageDestinationDeployment(DeploymentManager dm) {
+ return dm instanceof Hk2DeploymentManager ?
+ new Hk2MessageDestinationManager((Hk2DeploymentManager) dm) : null;
+ }
+
+ @Override
+ public AntDeploymentProvider getAntDeploymentProvider(DeploymentManager dm) {
+ // if assertions are on... blame the caller
+ assert dm instanceof Hk2DeploymentManager : "dm isn't an hk2dm"; // NOI18N
+ // this code might actually be in production. log the bogus-ness and degrade gracefully
+ AntDeploymentProvider retVal = null;
+ try {
+ retVal = new AntDeploymentProviderImpl((Hk2DeploymentManager) dm, this);
+ } catch (ClassCastException cce) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, "caller passed invalid param", cce); // NOI18N
+ }
+ return retVal;
+ }
+
+ @Override
+ public ServerInstanceDescriptor getServerInstanceDescriptor(DeploymentManager dm) {
+ ServerInstanceDescriptor result = null;
+ if(dm instanceof Hk2DeploymentManager) {
+ result = new Hk2ServerInstanceDescriptor((Hk2DeploymentManager) dm);
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "Invalid deployment manager: {0}", dm); // NOI18N
+ }
+ return result;
+ }
+
+ private static class J2eeInstantiatingIterator implements InstantiatingIterator {
+
+ private final InstantiatingIterator delegate;
+ private ServerUtilities su;
+
+ public J2eeInstantiatingIterator(ServerUtilities su) {
+ this.delegate = ServerUtilities.getInstantiatingIterator();
+ this.su = su;
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ delegate.removeChangeListener(l);
+ }
+
+ @Override
+ public void previousPanel() {
+ delegate.previousPanel();
+ }
+
+ @Override
+ public void nextPanel() {
+ delegate.nextPanel();
+ }
+
+ @Override
+ public String name() {
+ return delegate.name();
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return delegate.hasPrevious();
+ }
+
+ @Override
+ public boolean hasNext() {
+ return delegate.hasNext();
+ }
+
+ @Override
+ public Panel current() {
+ return delegate.current();
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ delegate.addChangeListener(l);
+ }
+
+ @Override
+ public void uninitialize(WizardDescriptor wizard) {
+ delegate.uninitialize(wizard);
+ }
+
+ @Override
+ public Set instantiate() throws IOException {
+ Set set = delegate.instantiate();
+ if(!set.isEmpty()) {
+ Object obj = set.iterator().next();
+ if(obj instanceof ServerInstance) {
+ ServerInstance instance = (ServerInstance) obj;
+ Lookup lookup = su.getLookupFor(instance);
+ if (lookup != null) {
+ JavaEEServerModule module = lookup.lookup(JavaEEServerModule.class);
+ if(module != null) {
+ return Collections.singleton(module.getInstanceProperties());
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,"No JavaEE facade found for {0}", instance.getDisplayName()); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "No lookup found for {0}", instance.getDisplayName()); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "AddServerWizard iterator must return a set of ServerInstance objects.");
+ }
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ @Override
+ public void initialize(WizardDescriptor wizard) {
+ delegate.initialize(wizard);
+ }
+
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ServerInstanceDescriptor.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ServerInstanceDescriptor.java
new file mode 100644
index 0000000..64e5f89
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2ServerInstanceDescriptor.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.ServerInstanceDescriptor;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class Hk2ServerInstanceDescriptor implements ServerInstanceDescriptor {
+
+ private final PayaraModule commonSupport;
+
+ public Hk2ServerInstanceDescriptor(Hk2DeploymentManager dm) {
+ commonSupport = dm.getCommonServerSupport();
+ }
+
+ public int getHttpPort() {
+ // By now, should be guaranteed to parse w/o format exception.
+ // XXX Another reason to expose more specific property methods inside
+ // CommonServerSupport impl class.
+ return Integer.parseInt(commonSupport.getInstanceProperties().get(PayaraModule.HTTPPORT_ATTR));
+ }
+
+ public String getHostname() {
+ return commonSupport.getInstanceProperties().get(PayaraModule.HOSTNAME_ATTR);
+ }
+
+ public boolean isLocal() {
+ return !commonSupport.isRemote();
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2StartServer.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2StartServer.java
new file mode 100644
index 0000000..3242139
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Hk2StartServer.java
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
+import javax.enterprise.deploy.spi.status.*;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.eecommon.api.Utils;
+import org.netbeans.modules.payara.jakartaee.ide.Hk2DeploymentStatus;
+import org.netbeans.modules.payara.jakartaee.ui.DebugPortQuery;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule3;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer;
+import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @auther Peter Williams
+ * @author vince kraemer
+ */
+public class Hk2StartServer extends StartServer implements ProgressObject {
+
+ private DeploymentStatus deploymentStatus;
+ private Hk2DeploymentManager dm;
+ private String serverName;
+ private List<ProgressListener> listeners =
+ new CopyOnWriteArrayList<>();
+ private InstanceProperties ip;
+
+ public Hk2StartServer(DeploymentManager jdm) {
+ if (!(jdm instanceof Hk2DeploymentManager)) {
+ throw new IllegalArgumentException("Only Payara v3 is supported"); //NOI18N
+ }
+ this.dm = (Hk2DeploymentManager) jdm;
+ this.ip = dm.getInstanceProperties();
+ if (null != ip) {
+ this.serverName = ip.getProperty(PayaraModule.DISPLAY_NAME_ATTR);
+ }
+ }
+
+ public InstanceProperties getInstanceProperties() {
+ return ip;
+ }
+
+ private PayaraModule getCommonServerSupport() {
+ ServerInstance si = dm.getServerInstance();
+ return si.getBasicNode().getLookup().lookup(PayaraModule.class);
+ }
+
+ @Override
+ public boolean supportsStartDeploymentManager() {
+ // a local instance always supports starting the deployment manager
+ // a remote instance supports start deployment manager via the restart-domain command
+ PayaraModule commonSupport = getCommonServerSupport();
+ assert commonSupport != null : "commonSupport is null??";
+ if (null == commonSupport) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "commonSupport is null??");
+ return false;
+ }
+ boolean local = !commonSupport.isRemote();
+ return local ? local : isRunning() || PayaraModule.ServerState.STARTING.equals(commonSupport.getServerState());
+ }
+
+ // start server
+ @Override
+ public ProgressObject startDeploymentManager() {
+ if(ProfilerSupport.getState() == ProfilerSupport.STATE_BLOCKING) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.FAILED, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_SERVER_PROFILING_IN_PROGRESS", serverName) // NOI18N
+ ));
+ } else {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.RUNNING, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName) // NOI18N
+ ));
+ PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null && !commonSupport.isRemote()) {
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.NORMAL_MODE, true);
+ commonSupport.startServer(new TaskStateListener() {
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+ }
+ }, PayaraModule.ServerState.RUNNING);
+ } else if (commonSupport != null) { // this is the remote case
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.NORMAL_MODE, true);
+ commonSupport.restartServer(new TaskStateListener() {
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+ }
+ });
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ProgressObject stopDeploymentManager() {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.STOP, StateType.RUNNING, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_STOP_SERVER_IN_PROGRESS", serverName) // NOI18N
+ ));
+ PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null && !commonSupport.isRemote()) {
+ commonSupport.stopServer(new TaskStateListener() {
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.STOP, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+ }
+ });
+ } else if (null != commonSupport) { // this is the remote case
+ // we lie, since a start is going to happen right after this
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.STOP, StateType.COMPLETED, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_SERVER_STOPPED", serverName) // NOI18N
+ ));
+ }
+ return this;
+ }
+
+ private static StateType translateState(TaskState commonState) {
+ switch(commonState) {
+ case RUNNING:
+ return StateType.RUNNING;
+ case COMPLETED:
+ return StateType.COMPLETED;
+ case FAILED:
+ return StateType.FAILED;
+ }
+ // Should never happen, but we have to return something. UNKNOWN state
+ // would be convenient, but again, this should never happen.
+ return StateType.FAILED;
+ }
+
+ @Override
+ public boolean supportsStartDebugging(Target target) {
+ PayaraModule commonSupport = getCommonServerSupport();
+ assert null != commonSupport : "commonSupport is null?"; // NOI18N
+ boolean retVal = supportsStartDeploymentManager() && !isClusterOrInstance(commonSupport);
+ return retVal;
+ }
+
+ @Override
+ public ProgressObject startDebugging(Target target) {
+ if (ProfilerSupport.getState() == ProfilerSupport.STATE_BLOCKING) {
+ fireHandleProgressEvent(null,new Hk2DeploymentStatus(
+ CommandType.START, StateType.FAILED, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_SERVER_PROFILING_IN_PROGRESS", serverName) // NOI18N
+ ));
+ } else {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.RUNNING, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName) // NOI18N
+ ));
+ final PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null && !commonSupport.isRemote()) {
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.DEBUG_MODE, true);
+ commonSupport.startServer(new TaskStateListener() {
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+ }
+ }, PayaraModule.ServerState.RUNNING);
+ } else if (null != commonSupport) { // this is the remote case
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.DEBUG_MODE, true);
+ commonSupport.restartServer(new TaskStateListener() {
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ if (TaskState.COMPLETED.equals(newState)) {
+ try {
+ Thread.sleep(1000);
+ while (PayaraModule.ServerState.STARTING.equals(commonSupport.getServerState())) {
+ Thread.sleep(500);
+ }
+ } catch (InterruptedException ie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,"",ie);
+ }
+ }
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+ }
+ });
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public boolean isDebuggable(Target target) {
+ PayaraModule commonSupport = getCommonServerSupport();
+ if (!isRunning()) {
+ return false;
+ }
+ if(commonSupport != null) {
+ return PayaraModule.DEBUG_MODE.equals(
+ commonSupport.getInstanceProperties().get(PayaraModule.JVM_MODE));
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isAlsoTargetServer(Target target) {
+ return true;
+ }
+
+ @Override
+ public ServerDebugInfo getDebugInfo(Target target) {
+ PayaraModule commonSupport = getCommonServerSupport();
+ String debugPort = commonSupport.getInstanceProperties().get(PayaraModule.DEBUG_PORT);
+ ServerDebugInfo retVal = null;
+ if(Utils.strEmpty(debugPort) && commonSupport.isRemote()) {
+ debugPort = queryDebugPort();
+ }
+ if(Utils.notEmpty(debugPort)) {
+ retVal = new ServerDebugInfo(ip.getProperty(PayaraModule.HOSTNAME_ATTR),
+ Integer.parseInt(debugPort));
+ }
+ return retVal;
+ }
+
+ private String queryDebugPort() {
+ String debugPort = null;
+ String name = getCommonServerSupport().getInstanceProperties().get(PayaraModule.DISPLAY_NAME_ATTR);
+ DebugPortQuery debugPortQuery = new DebugPortQuery();
+ DialogDescriptor desc = new DialogDescriptor(debugPortQuery,
+ NbBundle.getMessage(Hk2StartServer.class, "TITLE_QueryDebugPort", name)); // NOI18N
+ if(DialogDisplayer.getDefault().notify(desc) == NotifyDescriptor.OK_OPTION) {
+ debugPort = debugPortQuery.getDebugPort();
+ if(debugPortQuery.shouldPersist()) {
+ getCommonServerSupport().setEnvironmentProperty(
+ PayaraModule.DEBUG_PORT, debugPort, true);
+ }
+ }
+ return debugPort;
+ }
+
+ @Override
+ public boolean needsRestart(Target target) {
+ return false;
+ }
+
+ @Override
+ public boolean needsStartForTargetList() {
+ return false;
+ }
+
+ @Override
+ public boolean needsStartForConfigure() {
+ return false;
+ }
+
+ @Override
+ public boolean needsStartForAdminConfig() {
+ return false;
+ }
+
+ @Override
+ public boolean isRunning() {
+ PayaraModule commonSupport = getCommonServerSupport();
+ if(commonSupport != null) {
+ PayaraServer server = commonSupport.getInstance();
+ return PayaraState.isOnline(server);
+ } else {
+ throw new IllegalStateException("Missing common support object");
+ }
+// } else {
+// return Hk2PluginProperties.isRunning(ip.getProperty(PayaraModule.HOSTNAME_ATTR),
+// ip.getProperty(InstanceProperties.HTTP_PORT_NUMBER));
+// }
+ }
+
+ @Override
+ public DeploymentStatus getDeploymentStatus() {
+ return deploymentStatus;
+ }
+
+ @Override
+ public TargetModuleID[] getResultTargetModuleIDs() {
+ return new TargetModuleID[0];
+ }
+
+ @Override
+ public ClientConfiguration getClientConfiguration(TargetModuleID targetModuleID) {
+ return null;
+ }
+
+ @Override
+ public boolean isCancelSupported() {
+ return false;
+ }
+
+ @Override
+ public void cancel() throws OperationUnsupportedException {
+ assert false : "client called cancel() even though isCancelSupported() returned FALSE.";
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isStopSupported() {
+ return false;
+ }
+
+ @Override
+ public void stop() throws OperationUnsupportedException {
+ assert false : "client called stop() even though isStopSupported() returned FALSE.";
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addProgressListener(ProgressListener progressListener) {
+ // a new listener should hear what the current status is...
+ listeners.add(progressListener);
+ if (null != lastEvent) {
+ progressListener.handleProgressEvent(lastEvent);
+ }
+ }
+
+ @Override
+ public void removeProgressListener(ProgressListener progressListener) {
+ listeners.remove(progressListener);
+ }
+
+ private ProgressEvent lastEvent = null;
+
+ public void fireHandleProgressEvent(TargetModuleID targetModuleID, DeploymentStatus deploymentStatus) {
+ lastEvent = new ProgressEvent(this, targetModuleID, deploymentStatus);
+ this.deploymentStatus = deploymentStatus;
+
+ Iterator<ProgressListener> iter = listeners.iterator();
+ while(iter.hasNext()) {
+ iter.next().handleProgressEvent(lastEvent);
+ }
+ }
+
+ @Override
+ public boolean supportsStartProfiling(Target target) {
+ PayaraModule commonSupport = getCommonServerSupport();
+ assert null != commonSupport : "commonSupport is null?";
+ if (null == commonSupport) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "commonSupport is null??");
+ return false;
+ }
+ boolean retVal = !commonSupport.isRemote() && !isClusterOrInstance(commonSupport);
+ return retVal;
+ }
+
+ public boolean isProfiling(Target target) {
+ return isRunning();
+ }
+
+ @Override
+ public ProgressObject startProfiling(Target target) {
+ if (ProfilerSupport.getState() == ProfilerSupport.STATE_BLOCKING) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.RUNNING, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_SERVER_PROFILING_IN_PROGRESS", serverName))); // NOI18N
+ return this; //we failed to start the server.
+ }
+
+ final PayaraModule commonSupport = getCommonServerSupport();
+ if (commonSupport != null) {
+ if (isClusterOrInstance(commonSupport)) {
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.FAILED, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_SERVER_PROFILING_CLUSTER_NOT_SUPPORTED", serverName))); // NOI18N
+ return this; //we failed to start the server.
+ }
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, StateType.RUNNING, ActionType.EXECUTE,
+ NbBundle.getMessage(Hk2StartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName))); // NOI18N
+// String domainLocation = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+// String domainName = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ commonSupport.setEnvironmentProperty(PayaraModule.JVM_MODE, PayaraModule.PROFILE_MODE, true);
+ commonSupport.startServer(new TaskStateListener() {
+
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public void operationStateChanged(TaskState newState,
+ TaskEvent event, String... args) {
+ if (newState == TaskState.RUNNING) {
+ // wait for the profiler agent to initialize
+ int t = 0;
+ Logger.getLogger("payara-jakartaee").log(Level.FINE,"t == {0}", t); // NOI18N
+
+ // Leave as soon as the profiler reaches state STATE_BLOCKING -
+ // we need the ant execution thread to for the profiler client;
+ // Note: It does not make sense to wait for STATE_RUNNING or STATE_PROFILING
+ // as the profiler won't reach them unless the client is connected
+ try {
+ while (!(ProfilerSupport.getState() == ProfilerSupport.STATE_BLOCKING)
+ && t < 30000) {
+ Thread.sleep(1000);
+ t += 1000;
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "t.1 == {0}", t); // NOI18N
+ }
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ fireHandleProgressEvent(null, new Hk2DeploymentStatus(
+ CommandType.START, translateState(newState), ActionType.EXECUTE,
+ org.netbeans.modules.payara.tooling.utils.Utils.concatenate(args)));
+
+ // FIXME this is pretty ugly workaround and if this is still
+ // needed once GF plugin is rewritten we should introduce
+ // some API to notify about external changes of server state
+ final ScheduledExecutorService statusUpdater = Executors.newSingleThreadScheduledExecutor();
+ statusUpdater.scheduleAtFixedRate(new Runnable() {
+
+ @Override
+ public void run() {
+ if (ProfilerSupport.getState() == ProfilerSupport.STATE_INACTIVE) {
+ statusUpdater.shutdownNow();
+ if (commonSupport instanceof PayaraModule3) {
+ ((PayaraModule3) commonSupport).refresh();
+ }
+ }
+ }
+ }, 50, 100, TimeUnit.MILLISECONDS);
+ }
+ }, PayaraModule.ServerState.STOPPED_JVM_PROFILER);
+ }
+ return this;
+ }
+
+ private boolean isClusterOrInstance(PayaraModule commonSupport) {
+ String uri = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ if (null == uri) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "{0} has a null URI??",
+ commonSupport.getInstanceProperties().get(PayaraModule.DISPLAY_NAME_ATTR)); // NOI18N
+ return true;
+ }
+ String target = Hk2DeploymentManager.getTargetFromUri(uri);
+ return null == target ? false : !"server".equals(target);
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/InstanceProperties.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/InstanceProperties.java
new file mode 100644
index 0000000..f580e31
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/InstanceProperties.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+/**
+ *
+ * @author Peter Williams
+ */
+class InstanceProperties {
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JDBCDriverDeployerImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JDBCDriverDeployerImpl.java
new file mode 100644
index 0000000..bca689a
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JDBCDriverDeployerImpl.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.util.List;
+import java.util.Set;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.eecommon.api.JDBCDriverDeployHelper;
+import org.netbeans.modules.payara.jakartaee.ide.MonitorProgressObject;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.JDBCDriverDeployer;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory;
+import org.openide.util.RequestProcessor;
+
+public class JDBCDriverDeployerImpl implements JDBCDriverDeployer {
+
+ final private File driverLoc;
+ final private PayaraModule commonSupport;
+ final private boolean isLocal;
+ private Hk2DeploymentManager dm;
+
+ public JDBCDriverDeployerImpl(Hk2DeploymentManager dm, OptionalDeploymentManagerFactory odmf) {
+ this.dm = dm;
+ commonSupport = dm.getCommonServerSupport();
+ String domainDir = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ if (null == domainDir || domainDir.trim().length() < 1) {
+ isLocal = false;
+ } else {
+ isLocal = true;
+ }
+ String domain = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ driverLoc = new File(domainDir + File.separator + domain + File.separator + "lib");
+ }
+
+ @Override
+ public boolean supportsDeployJDBCDrivers(Target target) {
+ boolean supported = isLocal;
+ // todo -- allow the user to turn this deployment operation OFF.
+ if (supported) {
+ supported = Boolean.parseBoolean(commonSupport.getInstanceProperties().get(PayaraModule.DRIVER_DEPLOY_FLAG));
+ }
+ return supported;
+ }
+
+ @Override
+ public ProgressObject deployJDBCDrivers(Target target, Set<Datasource> datasources) {
+ List urls = JDBCDriverDeployHelper.getMissingDrivers(getDriverLocations(), datasources);
+ final MonitorProgressObject startProgress = new MonitorProgressObject(dm,null);
+ ProgressObject retVal = JDBCDriverDeployHelper.getProgressObject(driverLoc, urls);
+ if (urls.size() > 0) {
+ retVal.addProgressListener(new ProgressListener() {
+
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ // todo -- enable when this is ready
+ if (event.getDeploymentStatus().isCompleted()) {
+ commonSupport.restartServer(startProgress);
+ } else {
+ startProgress.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ }
+ });
+ } else {
+ startProgress.operationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED, "no deployment necessary");
+ }
+ RequestProcessor.getDefault().post((Runnable) retVal);
+ return startProgress; // new JDBCDriverDeployHelper.getProgressObject(dmp.getDriverLocation(), datasources);
+ }
+
+ private File[] getDriverLocations(){
+ String installLoc = commonSupport.getInstanceProperties().get(PayaraModule.PAYARA_FOLDER_ATTR);
+ File installLib = new File (installLoc + File.separator + "lib"); //NOI18N
+ File[] locs = {driverLoc, installLib};
+ return locs;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEDecoratorFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEDecoratorFactory.java
new file mode 100644
index 0000000..d202f2b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEDecoratorFactory.java
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.awt.Image;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport.ServerIcon;
+import org.netbeans.modules.payara.spi.Decorator;
+import org.netbeans.modules.payara.spi.DecoratorFactory;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.ResourceDecorator;
+import org.openide.util.ImageUtilities;
+
+/**
+ *
+ * @author Peter Williams
+ * @author Gaurav Gupta
+ */
+public class JavaEEDecoratorFactory implements DecoratorFactory {
+
+ private static DecoratorFactory singleton = new JavaEEDecoratorFactory();
+
+ private JavaEEDecoratorFactory() {
+ }
+
+ public static DecoratorFactory getDefault() {
+ return singleton;
+ }
+
+ // ------------------------------------------------------------------------
+ // DecoratorFactor implementation
+ // ------------------------------------------------------------------------
+ @Override
+ public boolean isTypeSupported(String type) {
+ return decoratorMap.containsKey(type);
+ }
+
+ @Override
+ public Decorator getDecorator(String type) {
+ return decoratorMap.get(type);
+ }
+
+ @Override
+ public Map<String, Decorator> getAllDecorators() {
+ return Collections.unmodifiableMap(decoratorMap);
+ }
+
+ // ------------------------------------------------------------------------
+ // Internals...
+ // ------------------------------------------------------------------------
+
+ private static final String JDBC_RESOURCE_ICON =
+ "org/netbeans/modules/payara/jakartaee/resources/jdbc.gif"; // NOI18N
+ private static final String CONNECTOR_ICON =
+ "org/netbeans/modules/payara/jakartaee/resources/connector.gif"; // NOI18N
+ private static final String APPCLIENT_ICON =
+ "org/netbeans/modules/payara/jakartaee/resources/appclient.gif"; // NOI18N
+ private static final String JAVAMAIL_ICON =
+ "org/netbeans/modules/payara/jakartaee/resources/javamail.gif"; // NOI18N
+
+ public static final Decorator J2EE_APPLICATION_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() { return true; }
+ @Override public boolean canDeployTo() { return true; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.EAR_FOLDER); }
+ @Override public Image getOpenedIcon(int type) { return UISupport.getIcon(ServerIcon.EAR_OPENED_FOLDER); }
+ };
+
+ public static final Decorator J2EE_APPLICATION = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.EAR_ARCHIVE); }
+ };
+
+ public static final Decorator WEB_APPLICATION = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return true; }
+ @Override public boolean canCDIProbeEnable() { return true; }
+ @Override public boolean canCDIProbeDisable() { return true; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.WAR_ARCHIVE); }
+ };
+
+ public static final Decorator EJB_JAR = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.EJB_ARCHIVE); }
+ };
+
+ public static final Decorator APPCLIENT = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(APPCLIENT_ICON); }
+ };
+
+ public static final Decorator CONNECTOR = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ };
+
+ public static final Decorator DISABLED_J2EE_APPLICATION = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.EAR_ARCHIVE); }
+ @Override public Image getIconBadge() {return Decorator.DISABLED_BADGE; }
+ };
+
+ public static final Decorator DISABLED_WEB_APPLICATION = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.WAR_ARCHIVE); }
+ @Override public Image getIconBadge() {return Decorator.DISABLED_BADGE; }
+ };
+
+ public static final Decorator DISABLED_EJB_JAR = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return UISupport.getIcon(ServerIcon.EJB_ARCHIVE); }
+ @Override public Image getIconBadge() {return Decorator.DISABLED_BADGE; }
+ };
+
+ public static final Decorator DISABLED_APPCLIENT = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(APPCLIENT_ICON); }
+ @Override public Image getIconBadge() {return Decorator.DISABLED_BADGE; }
+ };
+
+ public static final Decorator DISABLED_CONNECTOR = new Decorator() {
+ @Override public boolean canUndeploy() { return true; }
+ @Override public boolean canEnable() { return true; }
+ @Override public boolean canDisable() { return true; }
+ @Override public boolean canShowBrowser() { return false; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ @Override public Image getIconBadge() {return Decorator.DISABLED_BADGE; }
+ };
+
+ public static final Decorator JDBC_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JDBC_RESOURCE_ICON); }
+ @Override public Image getOpenedIcon(int type) { return ImageUtilities.loadImage(JDBC_RESOURCE_ICON); }
+ };
+
+ public static final Decorator JDBC_MANAGED_DATASOURCES = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JDBC_RESOURCE_ICON); }
+ @Override public String getCmdPropertyName() { return "jdbc_resource_name"; }
+ };
+
+ public static final Decorator JDBC_NATIVE_DATASOURCES = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JDBC_RESOURCE_ICON); }
+ @Override public String getCmdPropertyName() { return "jdbc_resource_name"; }
+ };
+
+ public static final Decorator CONNECTORS_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ @Override public Image getOpenedIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ };
+
+ public static final Decorator CONNECTION_POOLS = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JDBC_RESOURCE_ICON); }
+ @Override public String getCmdPropertyName() { return "jdbc_connection_pool_id"; }
+ @Override public boolean isCascadeDelete() { return true; }
+ };
+
+ public static final Decorator CONN_RESOURCE = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ @Override public String getCmdPropertyName() { return "connector_resource_name"; }
+ };
+
+ public static final Decorator CONN_CONNECTION_POOL = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ @Override public String getCmdPropertyName() { return "poolname"; }
+ @Override public boolean isCascadeDelete() { return true; }
+ };
+
+ public static final Decorator ADMINOBJECT_RESOURCE = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(CONNECTOR_ICON); }
+ @Override public String getCmdPropertyName() { return "jndi_name"; }
+ };
+
+ public static final Decorator JAVAMAIL_FOLDER = new Decorator() {
+ @Override public boolean isRefreshable() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JAVAMAIL_ICON); }
+ @Override public Image getOpenedIcon(int type) { return ImageUtilities.loadImage(JAVAMAIL_ICON); }
+ };
+
+ public static final Decorator JAVAMAIL_RESOURCE = new ResourceDecorator() {
+ @Override public boolean canUnregister() { return true; }
+ @Override public Image getIcon(int type) { return ImageUtilities.loadImage(JAVAMAIL_ICON); }
+ @Override public String getCmdPropertyName() { return "jndi_name"; }
+ };
+
+ private static final Map<String, Decorator> decoratorMap = new HashMap<String, Decorator>();
+
+ static {
+ // !PW XXX need to put in correct strings, then define as static
+ // (export in Decorator API, for lack of better place)
+ decoratorMap.put(PayaraModule.WEB_CONTAINER, WEB_APPLICATION);
+ decoratorMap.put(PayaraModule.EJB_CONTAINER, EJB_JAR);
+ decoratorMap.put(PayaraModule.EAR_CONTAINER, J2EE_APPLICATION);
+ decoratorMap.put(PayaraModule.APPCLIENT_CONTAINER, APPCLIENT);
+ decoratorMap.put(PayaraModule.CONNECTOR_CONTAINER, CONNECTOR);
+ decoratorMap.put(Decorator.DISABLED+PayaraModule.WEB_CONTAINER, DISABLED_WEB_APPLICATION);
+ decoratorMap.put(Decorator.DISABLED+PayaraModule.EJB_CONTAINER, DISABLED_EJB_JAR);
+ decoratorMap.put(Decorator.DISABLED+PayaraModule.EAR_CONTAINER, DISABLED_J2EE_APPLICATION);
+ decoratorMap.put(Decorator.DISABLED+PayaraModule.APPCLIENT_CONTAINER, DISABLED_APPCLIENT);
+ decoratorMap.put(Decorator.DISABLED+PayaraModule.CONNECTOR_CONTAINER, DISABLED_CONNECTOR);
+ decoratorMap.put(PayaraModule.JDBC_RESOURCE, JDBC_MANAGED_DATASOURCES);
+ decoratorMap.put(PayaraModule.JDBC_CONNECTION_POOL, CONNECTION_POOLS);
+ decoratorMap.put(PayaraModule.JDBC, JDBC_FOLDER);
+ decoratorMap.put(PayaraModule.CONNECTORS, CONNECTORS_FOLDER);
+ decoratorMap.put(PayaraModule.CONN_RESOURCE, CONN_RESOURCE);
+ decoratorMap.put(PayaraModule.CONN_CONNECTION_POOL, CONN_CONNECTION_POOL);
+ decoratorMap.put(PayaraModule.ADMINOBJECT_RESOURCE, ADMINOBJECT_RESOURCE);
+ decoratorMap.put(PayaraModule.JAVAMAIL, JAVAMAIL_FOLDER);
+ decoratorMap.put(PayaraModule.JAVAMAIL_RESOURCE, JAVAMAIL_RESOURCE);
+ };
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModule.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModule.java
new file mode 100644
index 0000000..f275592
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModule.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.netbeans.modules.payara.eecommon.api.LogHyperLinkSupport;
+import org.netbeans.modules.payara.spi.Recognizer;
+import org.netbeans.modules.payara.spi.RecognizerCookie;
+import org.netbeans.modules.payara.spi.RemoveCookie;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.ServerInstance;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ProxyLookup;
+import org.openide.windows.OutputListener;
+
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class JavaEEServerModule implements Lookup.Provider, RemoveCookie, RecognizerCookie {
+
+ private final InstanceProperties instanceProperties;
+ private final LogHyperLinkSupport.AppServerLogSupport logSupport;
+
+ private final Lookup lookup;
+
+ JavaEEServerModule(Lookup instanceLookup, InstanceProperties ip) {
+ instanceProperties = ip;
+ logSupport = new LogHyperLinkSupport.AppServerLogSupport("", "/");
+
+ // is this ok, can platform change ?
+ ServerInstance inst = Deployment.getDefault().getServerInstance(
+ instanceProperties.getProperty(InstanceProperties.URL_ATTR));
+ J2eePlatform platform = null;
+ try {
+ platform = inst.getJ2eePlatform();
+ } catch (InstanceRemovedException ex) {
+ }
+ lookup = platform != null
+ ? new ProxyLookup(Lookups.fixed(platform, ip), Lookups.proxy(platform))
+ : Lookup.EMPTY;
+ }
+
+ public InstanceProperties getInstanceProperties() {
+ return instanceProperties;
+ }
+
+ @Override
+ public Lookup getLookup() {
+ return lookup;
+ }
+
+ // ------------------------------------------------------------------------
+ // RemoveCookie support
+ // ------------------------------------------------------------------------
+ public void removeInstance(String serverUri) {
+ InstanceProperties.removeInstance(serverUri);
+ }
+
+ // ------------------------------------------------------------------------
+ // RecognizerCookie support
+ // ------------------------------------------------------------------------
+ public Collection<? extends Recognizer> getRecognizers() {
+ return Collections.singleton(new Recognizer() {
+ public OutputListener processLine(String text) {
+ OutputListener result = null;
+ if(text.length() > 0 && text.length() < 500 && !" ".equals(text)) {
+ LogHyperLinkSupport.AppServerLogSupport.LineInfo lineInfo =
+ logSupport.analyzeLine(text);
+ if(lineInfo != null && lineInfo.isError() && lineInfo.isAccessible()) {
+ result = logSupport.getLink(lineInfo.message(), lineInfo.path(), lineInfo.line());
+ }
+ }
+ return result;
+ }
+ });
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModuleFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModuleFactory.java
new file mode 100644
index 0000000..483f637
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/JavaEEServerModuleFactory.java
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.api.project.libraries.Library;
+import org.netbeans.api.project.libraries.LibraryManager;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModuleFactory;
+import org.netbeans.modules.payara.spi.RegisteredDerbyServer;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException;
+import org.netbeans.spi.project.libraries.LibraryTypeProvider;
+import org.netbeans.spi.project.libraries.support.LibrariesSupport;
+import org.openide.filesystems.FileUtil;
+import org.openide.modules.InstalledFileLocator;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class JavaEEServerModuleFactory implements PayaraModuleFactory {
+
+ private static final JavaEEServerModuleFactory singleton = new JavaEEServerModuleFactory();
+
+ private JavaEEServerModuleFactory() {
+ }
+
+ public static PayaraModuleFactory getDefault() {
+ return singleton;
+ }
+
+ @Override
+ public boolean isModuleSupported(String payaraHome, Properties asenvProps) {
+ // Do some moderate sanity checking to see if this build looks ok.
+ File jar = ServerUtilities.getJarName(payaraHome, ServerUtilities.GF_JAR_MATCHER);
+
+ if (jar==null) {
+ return false;
+ }
+ return jar.exists();
+ }
+
+ private static final RequestProcessor RP = new RequestProcessor("JavaEEServerModuleFactory");
+
+ @Override
+ public Object createModule(Lookup instanceLookup) {
+ // When creating JavaEE support, also ensure this instance is added to j2eeserver
+ InstanceProperties ip = null;
+ final PayaraModule commonModule
+ = instanceLookup.lookup(PayaraModule.class);
+ if(commonModule != null) {
+ Map<String, String> props = commonModule.getInstanceProperties();
+ String url = props.get(InstanceProperties.URL_ATTR);
+ ip = InstanceProperties.getInstanceProperties(url);
+ if (ip == null) {
+ String username = props.get(InstanceProperties.USERNAME_ATTR);
+ // Password shall not be read from keyring during initialization
+ String password = null;
+ String displayName = props.get(InstanceProperties.DISPLAY_NAME_ATTR);
+ try {
+ ip = InstanceProperties.createInstancePropertiesNonPersistent(
+ url, username, password, displayName, props);
+ } catch (InstanceCreationException ex) {
+ // the initialization delay of the ServerRegistry may have triggered a ignorable
+ // exception
+ ip = InstanceProperties.getInstanceProperties(url);
+ if (null == ip) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, null, ex); // NOI18N
+ }
+ }
+
+ if(ip == null) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "Unable to create/locate J2EE InstanceProperties for {0}", url);
+ }
+ }
+
+ final String payaraRoot = commonModule.getInstanceProperties().get(
+ PayaraModule.PAYARA_FOLDER_ATTR);
+ final String installRoot = commonModule.getInstanceProperties().get(
+ PayaraModule.INSTALL_FOLDER_ATTR);
+ RP.post(new Runnable() {
+ @Override
+ public void run() {
+ ensureEclipseLinkSupport(payaraRoot);
+ ensureCometSupport(payaraRoot);
+ ensurePayaraApiSupport(commonModule.getInstance());
+ // lookup the javadb register service here and use it.
+ RegisteredDerbyServer db = Lookup.getDefault().lookup(RegisteredDerbyServer.class);
+ if (null != db && null != installRoot) {
+ File ir = new File(installRoot);
+ File f = new File(ir,"javadb");
+ if (f.exists() && f.isDirectory() && f.canRead()) {
+ db.initialize(f.getAbsolutePath());
+ }
+ }
+ }
+ });
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "commonModule is NULL");
+ }
+
+ return (ip != null) ? new JavaEEServerModule(instanceLookup, ip) : null;
+ }
+
+ private static final String CLASS_LIBRARY_TYPE = "j2se"; // NOI18N
+ private static final String CLASSPATH_VOLUME = "classpath"; // NOI18N
+ private static final String SOURCE_VOLUME = "src"; // NOI18N
+ private static final String JAVADOC_VOLUME = "javadoc"; // NOI18N
+
+ private static final String ECLIPSE_LINK_LIB = "EclipseLink-GlassFish-v3-Prelude"; // NOI18N
+ private static final String ECLIPSE_LINK_LIB_2 = "EclipseLink-GlassFish-v3"; // NOI18N
+ private static final String EL_CORE_JAR_MATCHER = "eclipselink-wrapper" + ServerUtilities.VERSION_MATCHER; // NOI18N
+
+ private static final String PERSISTENCE_API_JAR_MATCHER_1 = "javax.javaee" + ServerUtilities.VERSION_MATCHER; // NOI18N
+ private static final String PERSISTENCE_API_JAR_MATCHER_2 = "javax.persistence" + ServerUtilities.VERSION_MATCHER; // NOI18N
+
+ private static final String PERSISTENCE_JAVADOC = "javaee-doc-api.jar"; // NOI18N
+
+ private static boolean ensureEclipseLinkSupport(String installRoot) {
+ List<URL> libraryList = new ArrayList<URL>();
+ List<URL> docList = new ArrayList<URL>();
+ try {
+ File f = ServerUtilities.getJarName(installRoot, EL_CORE_JAR_MATCHER);
+ if (f != null && f.exists()) {
+ libraryList.add(ServerUtilities.fileToUrl(f));
+ } else {// we are in the final V3 Prelude jar name structure
+ // find the org.eclipse.persistence*.jar files and add them
+ for (File candidate : new File(installRoot, "modules").listFiles()) {// NOI18N
+ if (candidate.getName().indexOf("org.eclipse.persistence") != -1) {// NOI18N
+ libraryList.add(ServerUtilities.fileToUrl(candidate));
+ }
+ }
+ }
+ f = ServerUtilities.getJarName(installRoot, PERSISTENCE_API_JAR_MATCHER_1);
+ if (f != null && f.exists()) {
+ libraryList.add(ServerUtilities.fileToUrl(f));
+ } else {
+ f = ServerUtilities.getJarName(installRoot, PERSISTENCE_API_JAR_MATCHER_2);
+ if (f != null && f.exists()) {
+ libraryList.add(ServerUtilities.fileToUrl(f));
+ }
+ }
+
+ File j2eeDoc = InstalledFileLocator.getDefault().locate(
+ "docs/" + PERSISTENCE_JAVADOC,
+ Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
+ if (j2eeDoc != null) {
+ docList.add(ServerUtilities.fileToUrl(j2eeDoc));
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "Warning: Java EE documentation not found when registering EclipseLink library.");
+ }
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, ex.getLocalizedMessage(), ex);
+ return false;
+ }
+ String name = ECLIPSE_LINK_LIB;
+ File f = ServerUtilities.getJarName(installRoot, "gmbal" + ServerUtilities.VERSION_MATCHER);
+ if (f != null && f.exists()) {
+ name = ECLIPSE_LINK_LIB_2;
+ }
+ return addLibrary(name, libraryList, docList,
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DNAME_PF_ECLIPSELINK"), // NOI18N
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DESC_PF_ECLIPSELINK")); // NOI18N
+ }
+ private static final String COMET_LIB = "Comet-GlassFish-v3-Prelude"; // NOI18N
+ private static final String COMET_LIB_2 = "Comet-GlassFish-v3"; // NOI18N
+ private static final String COMET_JAR_MATCHER = "grizzly-module" + ServerUtilities.VERSION_MATCHER; // NOI18N
+ private static final String COMET_JAR_2_MATCHER = "grizzly-comet" + ServerUtilities.VERSION_MATCHER; // NOI18N
+ private static final String GRIZZLY_OPTIONAL_JAR_MATCHER = "grizzly-optional" + ServerUtilities.VERSION_MATCHER; // NOI18N
+
+ private static boolean ensureCometSupport(String installRoot) {
+ List<URL> libraryList = new ArrayList<>();
+ String name = COMET_LIB;
+ File f = ServerUtilities.getJarName(installRoot, GRIZZLY_OPTIONAL_JAR_MATCHER);
+ if (f == null || !f.exists()) {
+ f = ServerUtilities.getJarName(installRoot, COMET_JAR_MATCHER);
+ }
+ if (f == null || !f.exists()) {
+ name = COMET_LIB_2;
+ f = ServerUtilities.getJarName(installRoot, COMET_JAR_2_MATCHER);
+ }
+ if (f != null && f.exists()) {
+ try {
+ libraryList.add(ServerUtilities.fileToUrl(f));
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, ex.getLocalizedMessage(), ex);
+ return false;
+ }
+ }
+
+ return addLibrary(name, libraryList, null,
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DNAME_PF_COMET"), // NOI18N
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DESC_PF_COMET")); // NOI18N
+ }
+
+ private static final String[] JAXRS_LIBRARIES
+ = {"jackson-asl", "jackson-core-asl", "jersey-bundle", "jersey-gf-bundle", "jersey-multipart", "jettison", "mimepull", "jsr311-api"}; //NOI18N
+ private static final String[] PAYARA_LIBRARIES
+ = {"web-core", "payara-api"}; //NOI18N
+
+ private static final String JAVA_EE_7_LIB = "Java-EE-Payara-v4"; // NOI18N
+
+ private static final String JAVA_EE_JAVADOC = "javaee-doc-api.jar"; // NOI18N
+
+ private static boolean ensurePayaraApiSupport(PayaraServer server) {
+ String installRoot = server.getServerRoot();
+ List<URL> libraryList = Hk2LibraryProvider.getProvider(server).getJavaEEClassPathURLs();
+ List<URL> docList = new ArrayList<>();
+ String name = JAVA_EE_7_LIB;
+
+ File j2eeDoc = InstalledFileLocator.getDefault().locate(
+ "docs/" + JAVA_EE_JAVADOC,
+ Hk2LibraryProvider.JAVAEE_DOC_CODE_BASE, false);
+ if (j2eeDoc != null) {
+ try {
+ docList.add(ServerUtilities.fileToUrl(j2eeDoc));
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "Problem while registering Java EE API library JavaDoc."); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "Java EE documentation not found when registering Java EE API library."); // NOI18N
+ }
+
+ for (String entry : PAYARA_LIBRARIES) {
+ File f = ServerUtilities.getJarName(installRoot, entry + ServerUtilities.VERSION_MATCHER);
+ if (f != null && f.exists()) {
+ try {
+ libraryList.add(ServerUtilities.fileToUrl(f));
+ } catch (MalformedURLException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "Problem while registering web-core into Payara API library."); // NOI18N
+ }
+ }
+ }
+
+ for (String entry : JAXRS_LIBRARIES) {
+ File f = ServerUtilities.getJarName(installRoot, entry + ServerUtilities.VERSION_MATCHER);
+ if ((f != null) && (f.exists())) {
+ try {
+ libraryList.add(
+ FileUtil.getArchiveRoot(Utilities.toURI(f).toURL()));
+ } catch (MalformedURLException ex) {
+ }
+ }
+ }
+ return addLibrary(name, libraryList, docList,
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DNAME_PF_JAVA_EE_IMPL"), // NOI18N
+ NbBundle.getMessage(JavaEEServerModuleFactory.class, "DESC_PF_JAVA_EE_IMPL")); // NOI18N
+ }
+
+ private static boolean addLibrary(String name, List<URL> libraryList, List<URL> docList, String displayName, String description) {
+ return addLibrary(name, CLASS_LIBRARY_TYPE, libraryList, docList, displayName, description);
+ }
+
+ private synchronized static boolean addLibrary(String name, String libType, List<URL> libraryList, List<URL> docList, String displayName,
+ String description) {
+ LibraryManager lmgr = LibraryManager.getDefault();
+
+ int size = 0;
+
+ Library lib = lmgr.getLibrary(name);
+
+ // Verify that existing library is still valid.
+ if (lib != null) {
+ List<URL> libList = lib.getContent(CLASSPATH_VOLUME);
+ size = libList.size();
+ for (URL libUrl : libList) {
+ String libPath = libUrl.getFile();
+ // file seems to want to return a file: protocol string... not the FILE portion of the URL
+ if (libPath.length() > 5) {
+ libPath = libPath.substring(5);
+ }
+ if (!new File(libPath.replace("!/", "")).exists()) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "libPath does not exist. Updating {0}", name);
+ try {
+ lmgr.removeLibrary(lib);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ } catch (IllegalArgumentException ex) {
+ // Already removed somehow, ignore.
+ }
+ lib = null;
+ size = 0;
+ break;
+ }
+ }
+ }
+
+ // verify that there are not new components in the 'new' definition
+ // of the library... If there are new components... rebuild the library.
+ if (lib != null && size < libraryList.size()) {
+ try {
+ lmgr.removeLibrary(lib);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ } catch (IllegalArgumentException ex) {
+ // Already removed somehow, ignore.
+ }
+ lib = null;
+ }
+
+ if (lib != null) {
+ List<URL> libList = lib.getContent(JAVADOC_VOLUME);
+ size = libList.size();
+ for (URL libUrl : libList) {
+ String libPath = libUrl.getFile();
+ // file seems to want to return a file: protocol string... not the FILE portion of the URL
+ if (libPath.length() > 5) {
+ libPath = libPath.substring(5);
+ }
+ if (!new File(libPath.replace("!/", "")).exists()) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "libPath does not exist. Updating {0}", name);
+ try {
+ lmgr.removeLibrary(lib);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ } catch (IllegalArgumentException ex) {
+ // Already removed somehow, ignore.
+ }
+ lib = null;
+ size = 0;
+ break;
+ }
+ }
+ }
+
+ // verify that there are not new components in the 'new' definition
+ // of the library... If there are new components... rebuild the library.
+ if (lib != null && null != docList && size < docList.size()) {
+ try {
+ lmgr.removeLibrary(lib);
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ } catch (IllegalArgumentException ex) {
+ // Already removed somehow, ignore.
+ }
+ lib = null;
+ }
+
+ if (lib == null) {
+ Map<String, List<URL>> contents;
+ try {
+ contents = new HashMap<String, List<URL>>();
+ if (null != libraryList) {
+ contents.put(CLASSPATH_VOLUME, libraryList);
+ }
+ if (null != docList) {
+ contents.put(JAVADOC_VOLUME, docList);
+ }
+
+ LibraryTypeProvider ltp = LibrariesSupport.getLibraryTypeProvider(libType);
+ if (null != ltp) {
+ lib = lmgr.createLibrary(libType, name, displayName, description, contents);
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "Created library {0}", name);
+ } else {
+ lmgr.addPropertyChangeListener(new InitializeLibrary(lmgr, libType, name, contents, displayName, description));
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "schedule to create library {0}", name);
+ }
+ } catch (IOException | IllegalArgumentException ex) {
+ // Someone must have created the library in a parallel thread, try again otherwise fail.
+ lib = lmgr.getLibrary(name);
+ if (lib == null) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+ }
+ // Someone must have created the library in a parallel thread, try again otherwise fail.
+
+ }
+ return lib != null;
+ }
+
+ static class InitializeLibrary implements PropertyChangeListener {
+
+ final private LibraryManager lmgr;
+ private String name;
+ private Map<String, List<URL>> content;
+ private final String libType;
+ private final String displayName;
+ private final String description;
+
+ InitializeLibrary(LibraryManager lmgr, String libType, String name, Map<String, List<URL>> content,
+ String displayName, String description) {
+ this.lmgr = lmgr;
+ this.name = name;
+ this.content = content;
+ this.libType = libType;
+ this.displayName = displayName;
+ this.description = description;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ synchronized (singleton) {
+ if (null != name) {
+ Library l = lmgr.getLibrary(name);
+ final PropertyChangeListener pcl = this;
+ if (null == l) {
+ try {
+ LibraryTypeProvider ltp = LibrariesSupport.getLibraryTypeProvider(libType);
+ if (null != ltp) {
+ lmgr.createLibrary(libType, name, displayName, description, content);
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "Created library {0}", name);
+ removeFromListenerList(pcl);
+ }
+ } catch (IOException | IllegalArgumentException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ ex.getLocalizedMessage(), ex);
+ }
+ } else {
+ // The library is there... and the listener is still active... hmmm.
+ removeFromListenerList(pcl);
+ }
+ }
+ }
+ }
+
+ private void removeFromListenerList(final PropertyChangeListener pcl) {
+ RP.post(new Runnable() {
+
+ @Override
+ public void run() {
+ synchronized (singleton) {
+ if (null != lmgr) {
+ lmgr.removePropertyChangeListener(pcl);
+ content = null;
+ name = null;
+ }
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ModuleConfigurationImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ModuleConfigurationImpl.java
new file mode 100644
index 0000000..ca06792
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ModuleConfigurationImpl.java
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.modules.payara.jakartaee.db.ResourcesHelper;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination.Type;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.DatasourceConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.EjbResourceConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ContextRootConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.DeploymentPlanConfiguration;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.MessageDestinationConfiguration;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+
+/**
+ * Implementation of ModuleConfiguration.
+ * <p/>
+ * Primarily serves to delegate directly to the specified
+ * DeploymentConfiguration instance, as that is in shared code
+ * and has appropriate access and this instance is not.
+ */
+public class ModuleConfigurationImpl implements
+ ModuleConfiguration,
+ ContextRootConfiguration,
+ DeploymentPlanConfiguration,
+ DatasourceConfiguration,
+ MessageDestinationConfiguration,
+ EjbResourceConfiguration
+{
+
+ private Hk2Configuration config;
+ private J2eeModule module;
+ private Lookup lookup;
+
+ private static final Map<J2eeModule,ModuleConfigurationImpl> configs =
+ new HashMap<J2eeModule,ModuleConfigurationImpl>();
+
+ @SuppressWarnings("LeakingThisInConstructor")
+ ModuleConfigurationImpl(J2eeModule module, Hk2Configuration config, Hk2DeploymentManager hk2Dm) throws ConfigurationException {
+ synchronized (configs) {
+ this.module = module;
+ this.config = config;
+ ResourcesHelper.addSampleDatasource(module, hk2Dm);
+ configs.put(module, this);
+ }
+ }
+
+ static public ModuleConfigurationImpl get(J2eeModule j2eemodule) {
+ synchronized (configs) {
+ return configs.get(j2eemodule);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // J2EE Server API implementations
+ // ------------------------------------------------------------------------
+
+ // ------------------------------------------------------------------------
+ // Implementation of ModuleConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public synchronized Lookup getLookup() {
+ if (null == lookup) {
+ lookup = Lookups.fixed(this);
+ }
+ return lookup;
+ }
+
+ @Override
+ public J2eeModule getJ2eeModule() {
+ return module;
+ }
+
+ @Override
+ public void dispose() {
+ config.dispose();
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of ContextRootConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public String getContextRoot() throws ConfigurationException {
+ return config.getContextRoot();
+ }
+
+ @Override
+ public void setContextRoot(String contextRoot) throws ConfigurationException {
+ config.setContextRoot(contextRoot);
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of DeploymentPlanConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public void save(OutputStream outputStream) throws ConfigurationException {
+ config.saveConfiguration(outputStream);
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of DatasourceConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public Set<Datasource> getDatasources() throws ConfigurationException {
+ return config.getDatasources();
+ }
+
+ @Override
+ public boolean supportsCreateDatasource() {
+ return config.supportsCreateDatasource();
+ }
+
+ @Override
+ public Datasource createDatasource(String jndiName, String url, String username, String password, String driver) throws UnsupportedOperationException, ConfigurationException, DatasourceAlreadyExistsException {
+ return config.createDatasource(jndiName, url, username, password, driver);
+ }
+
+ @Override
+ public void bindDatasourceReference(String referenceName, String jndiName) throws ConfigurationException {
+ config.bindDatasourceReference(referenceName, jndiName);
+ }
+
+ @Override
+ public void bindDatasourceReferenceForEjb(String ejbName, String ejbType, String referenceName, String jndiName) throws ConfigurationException {
+ config.bindDatasourceReferenceForEjb(ejbName, ejbType, referenceName, jndiName);
+ }
+
+ @Override
+ public String findDatasourceJndiName(String referenceName) throws ConfigurationException {
+ return config.findDatasourceJndiName(referenceName);
+ }
+
+ @Override
+ public String findDatasourceJndiNameForEjb(String ejbName, String referenceName) throws ConfigurationException {
+ return config.findDatasourceJndiNameForEjb(ejbName, referenceName);
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of EjbResourceConfiguration
+ // ------------------------------------------------------------------------
+ @Override
+ public String findJndiNameForEjb(String ejbName) throws ConfigurationException {
+ return config.findJndiNameForEjb(ejbName);
+ }
+
+ @Override
+ public void bindEjbReference(String referenceName, String jndiName) throws ConfigurationException {
+ config.bindEjbReference(referenceName, jndiName);
+ }
+
+ @Override
+ public void bindEjbReferenceForEjb(String ejbName, String ejbType, String referenceName, String jndiName) throws ConfigurationException {
+ config.bindEjbReferenceForEjb(ejbName, ejbType, referenceName, jndiName);
+ }
+
+ @Override
+ public Set<MessageDestination> getMessageDestinations() throws ConfigurationException {
+ return config.getMessageDestinations();
+ }
+
+ @Override
+ public boolean supportsCreateMessageDestination() {
+ return config.supportsCreateMessageDestination();
+ }
+
+ @Override
+ public MessageDestination createMessageDestination(String name, Type type) throws UnsupportedOperationException, ConfigurationException {
+ return config.createMessageDestination(name, type);
+ }
+
+ @Override
+ public void bindMdbToMessageDestination(String mdbName, String name, Type type) throws ConfigurationException {
+ config.bindMdbToMessageDestination(mdbName, name, type);
+ }
+
+ @Override
+ public String findMessageDestinationName(String mdbName) throws ConfigurationException {
+ return config.findMessageDestinationName(mdbName);
+ }
+
+ @Override
+ public void bindMessageDestinationReference(String referenceName, String connectionFactoryName, String destName, Type type) throws ConfigurationException {
+ config.bindMessageDestinationReference(referenceName, connectionFactoryName, destName, type);
+ }
+
+ @Override
+ public void bindMessageDestinationReferenceForEjb(String ejbName, String ejbType, String referenceName, String connectionFactoryName, String destName, Type type) throws ConfigurationException {
+ config.bindMessageDestinationReferenceForEjb(ejbName, ejbType, referenceName, connectionFactoryName, destName, type);
+ }
+
+ }
+
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceModifier.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceModifier.java
new file mode 100644
index 0000000..f53abe9
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceModifier.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import org.netbeans.modules.xml.api.EncodingUtil;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ * @author Nitya Doraisamy
+ */
+public class ResourceModifier {
+ public static void appendAttr(StringBuilder builder, String name, String value, boolean force) {
+ if(force || (name != null && name.length() > 0)) {
+ builder.append(name);
+ builder.append("=\"");
+ builder.append(value);
+ builder.append("\" ");
+ }
+ }
+
+ public static void appendProperty(StringBuilder builder, String name, String value, boolean force) {
+ if(force || (value != null && value.length() > 0)) {
+ builder.append(" <property name=\"");
+ builder.append(name);
+ builder.append("\" value=\"");
+ builder.append(value);
+ builder.append("\"/>\n");
+ }
+ }
+
+ public static void appendResource(File sunResourcesXml, String fragment) throws IOException {
+ String sunResourcesBuf = readResourceFile(sunResourcesXml);
+ if (sunResourcesXml.getAbsolutePath().contains("sun-resources.xml")) {
+ sunResourcesBuf = insertFragment(SUN_RESOURCES_XML_HEADER,sunResourcesBuf, fragment);
+ } else {
+ sunResourcesBuf = insertFragment(GF_RESOURCES_XML_HEADER,sunResourcesBuf, fragment);
+ }
+ writeResourceFile(sunResourcesXml, sunResourcesBuf);
+ }
+
+ private static final String SUN_RESOURCES_XML_HEADER =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE resources PUBLIC " +
+ "\"-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN\" " +
+ "\"http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd\">\n" +
+ "<resources>\n";
+ private static final String GF_RESOURCES_XML_HEADER =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<!DOCTYPE resources PUBLIC " +"\"-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN\" " +
+ "\"http://glassfish.org/dtds/glassfish-resources_1_5.dtd\">\n" +
+// "\"-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN\" " +
+// "\"http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd\">\n" +
+ "<resources>\n";
+ private static final String SUN_RESOURCES_XML_FOOTER =
+ "</resources>\n";
+
+ private static String insertFragment(String header, String sunResourcesBuf, String fragment) throws IOException {
+ //String header = SUN_RESOURCES_XML_HEADER;
+ String footer = SUN_RESOURCES_XML_FOOTER;
+ boolean insertNewLine = false;
+
+ if(sunResourcesBuf != null) {
+ int closeIndex = sunResourcesBuf.indexOf("</resources>");
+ if(closeIndex == -1) {
+ throw new IOException("Malformed XML");
+ }
+ header = sunResourcesBuf.substring(0, closeIndex);
+ footer = sunResourcesBuf.substring(closeIndex);
+
+ if(closeIndex > 0 && sunResourcesBuf.charAt(closeIndex-1) != '\n') {
+ insertNewLine = true;
+ }
+ }
+
+ int length = header.length() + footer.length() + 2;
+ if(fragment != null) {
+ length += fragment.length();
+ }
+
+ StringBuilder builder = new StringBuilder(length);
+ builder.append(header);
+
+ if(insertNewLine) {
+ String lineSeparator = System.getProperty("line.separator");
+ builder.append(lineSeparator != null ? lineSeparator : "\n");
+ }
+
+ if(fragment != null) {
+ builder.append(fragment);
+ }
+
+ builder.append(footer);
+ return builder.toString();
+ }
+
+ private static String readResourceFile(File sunResourcesXml) throws IOException {
+ String content = null;
+ if(sunResourcesXml.exists()) {
+ sunResourcesXml = FileUtil.normalizeFile(sunResourcesXml);
+ FileObject sunResourcesFO = FileUtil.toFileObject(sunResourcesXml);
+
+ if(sunResourcesFO != null) {
+ InputStream is = null;
+ Reader reader = null;
+ try {
+ long flen = sunResourcesFO.getSize();
+ if(flen > 1000000) {
+ throw new IOException(sunResourcesXml.getAbsolutePath() + " is too long to update.");
+ }
+
+ int length = (int) (2 * flen + 32);
+ char [] buf = new char[length];
+ is = new BufferedInputStream(sunResourcesFO.getInputStream());
+ String encoding = EncodingUtil.detectEncoding(is);
+ reader = new InputStreamReader(is, encoding);
+ int max = reader.read(buf);
+ if(max > 0) {
+ content = new String(buf, 0, max);
+ }
+ } finally {
+ if(is != null) {
+ try { is.close(); } catch(IOException ex) { }
+ }
+ if(reader != null) {
+ try { reader.close(); } catch(IOException ex) { }
+ }
+ }
+ } else {
+ throw new IOException("Unable to get FileObject for " + sunResourcesXml.getAbsolutePath());
+ }
+ }
+ return content;
+ }
+
+ private static void writeResourceFile(final File sunResourcesXml, final String content) throws IOException {
+ FileObject parentFolder = FileUtil.createFolder(sunResourcesXml.getParentFile());
+ FileSystem fs = parentFolder.getFileSystem();
+ writeResourceFile(fs, sunResourcesXml, content);
+ }
+
+ private static void writeResourceFile(FileSystem fs, final File sunResourcesXml, final String content) throws IOException {
+ fs.runAtomicAction(new FileSystem.AtomicAction() {
+ public void run() throws IOException {
+ FileLock lock = null;
+ BufferedWriter writer = null;
+ try {
+ FileObject sunResourcesFO = FileUtil.createData(sunResourcesXml);
+ lock = sunResourcesFO.lock();
+ writer = new BufferedWriter(new OutputStreamWriter(sunResourcesFO.getOutputStream(lock)));
+ writer.write(content);
+ } finally {
+ if(writer != null) {
+ try { writer.close(); } catch(IOException ex) { }
+ }
+ if(lock != null) {
+ lock.releaseLock();
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceRegistrationHelper.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceRegistrationHelper.java
new file mode 100644
index 0000000..8beafe3
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ResourceRegistrationHelper.java
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import org.netbeans.modules.payara.tooling.admin.CommandSetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.CommandAddResources;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import java.io.File;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.common.parser.TreeParser;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class ResourceRegistrationHelper {
+ private static final int TIMEOUT = 2000;
+
+ private ResourceRegistrationHelper() {
+ }
+
+ public static void deployResources(File root, Hk2DeploymentManager dm) {
+ Set<File> resourceDirs = getResourceDirs(root);
+ deployResources(resourceDirs,dm);
+ }
+
+ private static void deployResources(Set<File> resourceDirs, Hk2DeploymentManager dm) {
+ for(File resourceDir: resourceDirs) {
+ try {
+ boolean usedNewName = registerResourceDir(resourceDir,dm,dm.getCommonServerSupport().getResourcesXmlName());
+ if (!usedNewName) {
+ // try to use sun-resources.xml
+ registerResourceDir(resourceDir,dm,"sun-resources"); // NOI18N
+ }
+ } catch (ConfigurationException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, "some data sources may not be deployed", ex);
+ }
+ }
+ }
+
+ private static Set<File> getResourceDirs(File file){
+ Set<File> retVal = new TreeSet<File>();
+ FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(file));
+ SourceFileMap sourceFileMap = SourceFileMap.findSourceMap(fo);
+ if (sourceFileMap != null) {
+ File[] erds = sourceFileMap.getEnterpriseResourceDirs();
+
+ if (null != erds) {
+ for (File f : erds) {
+ if (null != f && f.getPath() != null) {
+ retVal.add(f);
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+ private static boolean registerResourceDir(File resourceDir, Hk2DeploymentManager dm, String baseName) throws ConfigurationException {
+ boolean succeeded = false;
+ File sunResourcesXml = new File(resourceDir, baseName+".xml"); //NOI18N
+ if(sunResourcesXml.exists()) {
+ checkUpdateServerResources(sunResourcesXml, dm);
+ PayaraModule commonSupport = dm.getCommonServerSupport();
+ String uri =
+ commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ String target = Hk2DeploymentManager.getTargetFromUri(uri);
+ try {
+ ResultString result = CommandAddResources.addResource(
+ commonSupport.getInstance(), sunResourcesXml, target);
+ return result.getState() == TaskState.COMPLETED;
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee")
+ .log(Level.INFO, gfie.getLocalizedMessage(), gfie);
+ throw new ConfigurationException(gfie.getLocalizedMessage(), gfie);
+ }
+ }
+ return succeeded;
+ }
+
+ private static void checkUpdateServerResources(File sunResourcesXml, Hk2DeploymentManager dm){
+ Map<String, String> changedData = new HashMap<String, String>();
+ List<TreeParser.Path> pathList = new ArrayList<TreeParser.Path>();
+ ResourceFinder cpFinder = new ResourceFinder("name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/jdbc-connection-pool", cpFinder)); // NOI18N
+ ResourceFinder jdbcFinder = new ResourceFinder("jndi-name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/jdbc-resource", jdbcFinder)); // NOI18N
+ ResourceFinder connectorPoolFinder = new ResourceFinder("name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-connection-pool", connectorPoolFinder)); // NOI18N
+ ResourceFinder connectorFinder = new ResourceFinder("jndi-name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-resource", connectorFinder)); // NOI18N
+ ResourceFinder aoFinder = new ResourceFinder("jndi-name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/admin-object-resource", aoFinder)); // NOI18N
+ ResourceFinder mailFinder = new ResourceFinder("jndi-name"); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/mail-resource", mailFinder)); // NOI18N
+
+ try {
+ TreeParser.readXml(sunResourcesXml, pathList);
+ } catch (IllegalStateException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ Map<String, String> allRemoteData = getResourceData("resources.*", dm); // NOI18N
+ changedData = checkResources(cpFinder, "resources.jdbc-connection-pool.", allRemoteData, changedData, dm); // NOI18N
+ changedData = checkResources(jdbcFinder, "resources.jdbc-resource.", allRemoteData, changedData, dm); // NOI18N
+ changedData = checkResources(connectorPoolFinder, "resources.connector-connection-pool.", allRemoteData, changedData, dm); // NOI18N
+ changedData = checkResources(connectorFinder, "resources.connector-resource.", allRemoteData, changedData, dm); // NOI18N
+ changedData = checkResources(aoFinder, "resources.admin-object-resource.", allRemoteData, changedData, dm); // NOI18N
+ changedData = checkResources(mailFinder, "resources.mail-resource.", allRemoteData, changedData, dm); // NOI18N
+
+ if(changedData.size() > 0) {
+ putResourceData(changedData, dm);
+ }
+ }
+
+ private static Map<String, String> checkResources(ResourceFinder resourceFinder, String prefix, Map<String, String> allRemoteData, Map<String, String> changedData, Hk2DeploymentManager dm) {
+ List<String> resources = resourceFinder.getResourceNames();
+ for (int i = 0; i < resources.size(); i++) {
+ String jndiName = resources.get(i);
+ Map<String, String> localData = resourceFinder.getResourceData().get(jndiName);
+ String remoteKey = prefix + jndiName + "."; // NOI18N
+ Map<String, String> remoteData = new HashMap<String, String>();
+ Iterator itr = allRemoteData.keySet().iterator();
+ while (itr.hasNext()) {
+ String key = (String) itr.next();
+ if(key.startsWith(remoteKey)){
+ remoteData.put(key, allRemoteData.get(key));
+ }
+ }
+ if (remoteData.size() > 0) {
+ changedData = getChangedData(remoteData, localData, changedData, remoteKey);
+ }
+ }
+ return changedData;
+ }
+
+ private static Map<String, String> getChangedData(Map<String, String> remoteData, Map<String, String> localData, Map<String, String> changedData, String resourceKey) {
+ List<String> props = new ArrayList<String>();
+ Iterator<String> keys = remoteData.keySet().iterator();
+ Set<String> localKeySet = localData.keySet();
+ while (keys.hasNext()) {
+ String remoteDataKey = keys.next();
+ String remoteValue = remoteData.get(remoteDataKey);
+ String[] split = remoteDataKey.split(resourceKey);
+ String key = split[1];
+ if (key.indexOf("property.") != -1) { // NOI18N
+ props.add(key);
+ }
+ String localValue = (String) localData.get(key);
+ if (localValue != null) {
+ if (remoteValue == null || !localValue.equals(remoteValue)) {
+ changedData.put(remoteDataKey, localValue);
+ }
+ } else {
+ if (localKeySet.contains(key)) {
+ if (remoteValue != null) {
+ changedData.put(remoteDataKey, localValue);
+ }
+ }
+ }
+ }
+ keys = localData.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ if (key.indexOf("property.") != -1) { // NOI18N
+ if (!props.contains(key)) {
+ String remoteKey = resourceKey + key;
+ changedData.put(remoteKey, localData.get(key));
+ }
+ }
+ }
+ return changedData;
+ }
+
+ public static Map<String, String> getResourceData(String query, Hk2DeploymentManager dm) {
+ try {
+ ResultMap<String, String> result = CommandGetProperty.getProperties(
+ dm.getCommonServerSupport().getInstance(), query);
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String,String> values = result.getValue();
+ if (values.isEmpty())
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, null,
+ new IllegalStateException(query+" has no data"));
+ return values;
+
+ }
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ return new HashMap<String,String>();
+ }
+
+ public static void putResourceData(Map<String, String> data, Hk2DeploymentManager dm) {
+ Set<String> keys = data.keySet();
+ for (String k : keys) {
+ String name = k;
+ String value = data.get(k);
+ try {
+ PayaraModule support = dm.getCommonServerSupport();
+ CommandSetProperty command = support.getCommandFactory()
+ .getSetPropertyCommand(name, value);
+ CommandSetProperty.setProperty(support.getInstance(), command);
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, gfie.getMessage(), gfie); // NOI18N
+ }
+ }
+ }
+
+ public static class ResourceFinder extends TreeParser.NodeReader {
+
+ private Map<String, String> properties = null;
+ private Map<String, Map<String, String>> resourceData = new HashMap<String, Map<String, String>>();
+
+ private final String nameKey;
+
+ public ResourceFinder(String in_nameKey) {
+ nameKey = in_nameKey;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ properties = new HashMap<String, String>();
+
+ String resourceName = attributes.getValue(nameKey);
+ properties.put(nameKey, resourceName); //NOI18N
+
+ int attrLen = attributes.getLength();
+ for (int i = 0; i < attrLen; i++) {
+ String name = attributes.getLocalName(i);
+ String value = attributes.getValue(i);
+ if (name != null && name.length() > 0 && value != null && value.length() > 0) {
+ properties.put(name, value);
+ }
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ if (null != properties && null != attributes) {
+ String propName = qname + "." + attributes.getValue("name"); // NO18N
+ properties.put(propName, attributes.getValue("value")); //NOI18N
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ String poolName = properties.get(nameKey); //NOI18N
+ resourceData.put(poolName, properties);
+ }
+
+ public List<String> getResourceNames() {
+ return new ArrayList<String>(resourceData.keySet());
+ }
+
+ public Map<String, Map<String, String>> getResourceData() {
+ return Collections.unmodifiableMap(resourceData);
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/RunTimeDDCatalog.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/RunTimeDDCatalog.java
new file mode 100644
index 0000000..b7c64a4
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/RunTimeDDCatalog.java
@@ -0,0 +1,820 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import java.beans.FeatureDescriptor;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.xml.api.model.GrammarEnvironment;
+import org.netbeans.modules.xml.api.model.GrammarQuery;
+import org.openide.util.NbBundle;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.netbeans.modules.xml.api.model.DTDUtil;
+import org.netbeans.api.xml.services.UserCatalog;
+import org.netbeans.modules.xml.api.model.GrammarQueryManager;
+import org.netbeans.modules.xml.catalog.spi.CatalogDescriptor2;
+import org.netbeans.modules.xml.catalog.spi.CatalogListener;
+import org.netbeans.modules.xml.catalog.spi.CatalogReader;
+import org.netbeans.spi.server.ServerInstanceProvider;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** Catalog for Payara DTDs that enables completion support in editor.
+ * This is basically a copy of the class in org.netbeans.modules.j2ee.sun.ide.j2ee
+ * with a few changes for maintaining 2 instances and for getting the root in a
+ * slightly different way.
+ *
+ * @author Ludo
+ */
+
+public class RunTimeDDCatalog extends GrammarQueryManager implements CatalogReader, CatalogDescriptor2,org.xml.sax.EntityResolver {
+
+ private static final String XML_XSD="http://www.w3.org/2001/xml.xsd"; // NOI18N
+ private static final String XML_XSD_DEF="<?xml version='1.0'?><xs:schema targetNamespace=\"http://www.w3.org/XML/1998/namespace\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xml:lang=\"en\"><xs:attribute name=\"lang\" type=\"xs:language\"><xs:annotation><xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter codes as the enumerated possible values . . .</xs:documentation></xs:annotation></xs:attribute></xs:schema>"; // NOI18N
+ private static final String TypeToURLMap[] = {
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 J2EE Application 1.3//EN" , "sun-application_1_3-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 J2EE Application 1.4//EN" , "sun-application_1_4-0.dtd" , ///[THIS IS DEPRECATED]
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 J2EE Application 1.4//EN" , "sun-application_1_4-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 J2EE Application 1.4//EN" , "sun-application_1_4-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Java EE Application 5.0//EN" , "sun-application_5_0-0.dtd",
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 EJB 2.0//EN" , "sun-ejb-jar_2_0-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 EJB 2.1//EN" , "sun-ejb-jar_2_1-0.dtd" , ///[THIS IS DEPRECATED]
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 EJB 2.1//EN" , "sun-ejb-jar_2_1-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" , "sun-ejb-jar_2_1-1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" , "sun-ejb-jar_3_0-0.dtd",
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.1.1 EJB 3.0//EN" , "sun-ejb-jar_3_0-1.dtd",
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Application Client 1.3//EN" , "sun-application-client_1_3-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 Application Client 1.4//EN" , "sun-application-client_1_4-0.dtd" , ///[THIS IS DEPRECATED]
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 Application Client 1.4//EN" , "sun-application-client_1_4-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Application Client 1.4//EN" , "sun-application-client_1_4-1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Application Client 5.0//EN" , "sun-application-client_5_0-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Connector 1.0//EN" , "sun-connector_1_0-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Connector 1.5//EN" , "sun-connector_1_5-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Servlet 2.3//EN" , "sun-web-app_2_3-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 Servlet 2.4//EN" , "sun-web-app_2_4-0.dtd" , ///[THIS IS DEPRECATED]
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 Servlet 2.4//EN" , "sun-web-app_2_4-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Web Server 6.1 Servlet 2.3//EN" , "sun-web-app_2_3-1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN" , "sun-web-app_2_4-1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" , "sun-web-app_2_5-0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Application Client Container 1.0//EN" , "sun-application-client-container_1_0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 OR Mapping //EN" , "sun-cmp-mapping_1_0.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 OR Mapping//EN" , "sun-cmp-mapping_1_1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 OR Mapping//EN" , "sun-cmp-mapping_1_2.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.0 Domain//EN" , "sun-domain_1_0.dtd" ,
+ "-//Sun Microsystems Inc.//DTD Application Server 8.0 Application Client Container//EN" , "sun-application-client-container_1_2.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Application Client Container //EN" , "sun-application-client-container_1_1.dtd" ,
+ "-//Sun Microsystems Inc.//DTD Application Server 8.0 Domain//EN" ,"sun-domain_1_1.dtd",
+ "-//Sun Microsystems Inc.//DTD Application Server 8.1 Domain//EN" ,"sun-domain_1_1.dtd",
+ "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" ,"sun-domain_1_2.dtd",
+ "-//Sun Microsystems Inc.//DTD Application Server 9.1 Domain//EN" ,"sun-domain_1_3.dtd",
+ "-//Sun Microsystems Inc.//DTD Payara Communications Server 1.5 Domain//EN" ,"sun-domain_1_4.dtd",
+ "-//Sun Microsystems Inc.//DTD Payara Communications Server 2.0 Domain//EN" ,"sun-domain_1_5.dtd",
+ "-//Sun Microsystems, Inc.//DTD Application Server 9.0 SIP Servlet 1.1//EN" , "sun-sip-app_1_1-0.dtd",
+
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" , "application_1_3.dtd",
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" , "application_1_2.dtd",
+ "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" , "ejb-jar_2_0.dtd",
+ "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" , "ejb-jar_1_1.dtd",
+ "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN" , "application-client_1_3.dtd",
+ "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" , "application-client_1_2.dtd",
+ "-//Sun Microsystems, Inc.//DTD Connector 1.0//EN" , "connector_1_0.dtd",
+ "-//Java Community Process//DTD SIP Application 1.0//EN" , "sip-app_1_0.dtd",
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" , "web-app_2_3.dtd",
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" , "web-app_2_2.dtd",
+ "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" , "web-jsptaglibrary_1_2.dtd",
+ "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" , "web-jsptaglibrary_1_1.dtd",
+ };
+
+ private static final String JavaEE6TypeToURLMap[] = {
+ "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Java EE Application 6.0//EN" , "sun-application_6_0-0.dtd",
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 Java EE Application 6.0//EN" , "glassfish-application_6_0-1.dtd",
+ "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Application Client 6.0//EN" , "sun-application-client_6_0-0.dtd" ,
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 Java EE Application Client 6.0//EN" , "glassfish-application-client_6_0-1.dtd" ,
+ "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 EJB 3.1//EN" , "sun-ejb-jar_3_1-0.dtd",
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" , "glassfish-ejb-jar_3_1-1.dtd",
+ "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" , "sun-web-app_3_0-0.dtd" ,
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" , "glassfish-web-app_3_0-1.dtd" ,
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions //EN", "glassfish-resources_1_5.dtd",
+ "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN", "glassfish-resources_1_5.dtd",
+ "-//Payara.fish//DTD Payara Server 4 Servlet 3.0//EN", "payara-web-app_4.dtd"
+ };
+
+ /*******NetBeans 3.6 is NOT ready yet to support schemas for code completion... What a pity!: */
+ private static final String SchemaToURLMap[] = {
+
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" , "ejb-jar_2_1",
+
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" , "application-client_1_4",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" , "application_1_4",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/jax-rpc-ri-config.xsd" , "jax-rpc-ri-config",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" , "connector_1_5",
+ ///"SCHEMA:http://java.sun.com/xml/ns/j2ee/jsp_2_0.xsd" , "jsp_2_0.xsd",
+ ///"SCHEMA:http://java.sun.com/xml/ns/j2ee/datatypes.dtd" , "datatypes",
+ ///"SCHEMA:http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" , "web-app_2_4",
+ ///"SCHEMA:http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" , "web-jsptaglibrary_2_0",
+ ///"SCHEMA:http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd" , "j2ee_1_4",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/j2ee_jaxrpc_mapping_1_1.xsd" , "j2ee_jaxrpc_mapping_1_1",
+ "SCHEMA:http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd" ,"j2ee_web_services_1_1",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/j2ee_web_services_client_1_1.xsd" ,"j2ee_web_services_client_1_1",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" , "ejb-jar_3_0",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/application-client_5.xsd" , "application-client_5",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/application_5.xsd" , "application_5",
+ "SCHEMA:http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" , "orm_1_0",
+ "SCHEMA:http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" , "persistence_1_0",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/javaee_web_services_1_2.xsd" ,"javaee_web_services_1_2",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/javaee_web_services_client_1_2.xsd" ,"javaee_web_services_client_1_2",
+
+ };
+
+ private static final String JavaEE6SchemaToURLMap[] = {
+
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" , "ejb-jar_3_1",
+ "SCHEMA:http://java.sun.com/xml/ns/j2ee/jsp_2_2.xsd" , "jsp_2_2",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" , "web-app_3_0",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd" , "web-common_3_0",
+ "SCHEMA:http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd" , "web-fragment_3_0",
+ "SCHEMA:http://xmlns.oracle.com/weblogic/jdbc-data-source/1.0/jdbc-data-source.xsd", "jdbc-data-source",
+ };
+
+ private static Map<ServerInstanceProvider, RunTimeDDCatalog> ddCatalogMap = new HashMap<ServerInstanceProvider, RunTimeDDCatalog>();
+// private static RunTimeDDCatalog preludeDDCatalog;
+ private static RunTimeDDCatalog defaultDDCatalog;
+
+ private File platformRootDir=null;
+ private String displayNameKey;
+ private String shortDescriptionKey;
+ private boolean hasAdditionalMap = false;
+
+ /** Creates a new instance of RunTimeDDCatalog */
+ public RunTimeDDCatalog() {
+ }
+
+ public void setInstanceProvider(ServerInstanceProvider ip) {
+ if (ddCatalogMap.get(ip) == null) {
+ ddCatalogMap.put(ip, this);
+ }
+ }
+ /** Factory method providing catalog for XML completion of DD */
+ public static RunTimeDDCatalog getRunTimeDDCatalog(ServerInstanceProvider ip){
+ return ddCatalogMap.get(ip);
+ }
+
+ /** Factory method providing catalog for XML completion of DD */
+ public static synchronized RunTimeDDCatalog getDefaultRunTimeDDCatalog(){
+ if (defaultDDCatalog==null) {
+ defaultDDCatalog = new RunTimeDDCatalog();
+ defaultDDCatalog.displayNameKey = "LBL_RunTimeDDCatalog"; // NOI18N
+ defaultDDCatalog.shortDescriptionKey = "DESC_RunTimeDDCatalog"; // NOI18N
+ defaultDDCatalog.hasAdditionalMap = true;
+ }
+ return defaultDDCatalog;
+ }
+
+ /**
+ * Get String iterator representing all public IDs registered in catalog.
+ * @return null if cannot proceed, try later.
+ */
+ @Override
+ public Iterator getPublicIDs() {
+ if (platformRootDir == null) {
+ return null;
+ }
+ if (!platformRootDir.exists()) {
+ return null;
+ }
+
+ String installRoot = platformRootDir.getAbsolutePath();
+ if (installRoot == null) {
+ return null;
+ }
+
+ List<String> list = new ArrayList<String>();
+ for (int i=0;i<TypeToURLMap.length;i = i+2){
+ list.add(TypeToURLMap[i]);
+ }
+ if (hasAdditionalMap) {
+ for (int i=0;i<JavaEE6TypeToURLMap.length;i = i+2){
+ list.add(JavaEE6TypeToURLMap[i]);
+ }
+ }
+ for (int i=0;i<SchemaToURLMap.length;i = i+2){
+ list.add(SchemaToURLMap[i]);
+ }
+ if (hasAdditionalMap) {
+ for (int i=0;i<JavaEE6SchemaToURLMap.length;i = i+2){
+ list.add(JavaEE6SchemaToURLMap[i]);
+ }
+ }
+
+ return list.listIterator();
+ }
+
+ /**
+ * Get registered systemid for given public Id or null if not registered.
+ * @return null if not registered
+ */
+ @Override
+ public String getSystemID(String publicId) {
+ if (platformRootDir == null) {
+ return null;
+ }
+ if (!platformRootDir.exists()) {
+ return null;
+ }
+
+ String installRoot = platformRootDir.getAbsolutePath(); //System.getProperty("com.sun.aas.installRoot");
+ if (installRoot == null) {
+ return null;
+ }
+ String loc="dtds";
+ for (int i=0;i<TypeToURLMap.length;i = i+2){
+ if (TypeToURLMap[i].equals(publicId)){
+ File file = new File(installRoot+"/lib/"+loc+"/"+TypeToURLMap[i+1]);
+ try{
+ return file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ return "";
+ }
+ }
+ }
+ if (hasAdditionalMap) {
+ for (int i=0;i<JavaEE6TypeToURLMap.length;i = i+2){
+ if (JavaEE6TypeToURLMap[i].equals(publicId)){
+ File file = new File(installRoot+"/lib/"+loc+"/"+JavaEE6TypeToURLMap[i+1]);
+ try{
+ return file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ return "";
+ }
+ }
+ }
+ }
+ loc="schemas";
+ for (int i=0;i<SchemaToURLMap.length;i = i+2){
+ if (SchemaToURLMap[i].equals(publicId)){
+ File file = new File(installRoot+"/lib/"+loc+"/"+SchemaToURLMap[i+1]);
+ try{
+ return file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ return "";
+ }
+ }
+ }
+ if (hasAdditionalMap) {
+ for (int i=0;i<JavaEE6SchemaToURLMap.length;i = i+2){
+ if (JavaEE6SchemaToURLMap[i].equals(publicId)){
+
+ // xsds are in the server and NB can now use them for code completion
+ // old code required dtds and would have done something like this:
+ // return "nbres:/org/netbeans/modules/j2ee/sun/ide/resources/"+JavaEE6SchemaToURLMap[i+1]+".dtd";
+ // because before NB could use xsd for code completion, the module had a
+ // hacked copy of the dtd to deal with that
+ File file = new File(installRoot+"/lib/"+loc+"/"+JavaEE6SchemaToURLMap[i+1]+".xsd");
+ try{
+ return file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ return "";
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Refresh content according to content of mounted catalog.
+ */
+ @Override
+ public void refresh() {
+ fireCatalogListeners();
+ }
+
+ /**
+ * Refresh content according to content of mounted catalog.
+ */
+ public void refresh(File newLoc) {
+ if (platformRootDir!=newLoc){
+ platformRootDir = newLoc;
+ refresh();
+ }
+
+ }
+
+ private List<CatalogListener> catalogListeners = new ArrayList<CatalogListener>(1);
+
+ /**
+ * Optional operation allowing to listen at catalog for changes.
+ * @throws UnsupportedOpertaionException if not supported by the implementation.
+ */
+ @Override
+ public void addCatalogListener(CatalogListener l) {
+ if (null == l)
+ return;
+ if (catalogListeners.contains(l))
+ return;
+ catalogListeners.add(l);
+ }
+
+ /**
+ * Optional operation couled with addCatalogListener.
+ * @throws UnsupportedOpertaionException if not supported by the implementation.
+ */
+ @Override
+ public void removeCatalogListener(CatalogListener l) {
+ if (null == l)
+ return;
+ if (catalogListeners.contains(l))
+ catalogListeners.remove(l);
+ }
+
+ public void fireCatalogListeners() {
+ Iterator iter = catalogListeners.iterator();
+ while (iter.hasNext()) {
+ CatalogListener l = (CatalogListener) iter.next();
+ l.notifyInvalidate();
+ }
+ }
+
+ /** Registers new listener. */
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener l) {
+ }
+
+ /**
+ * @return I18N display name
+ */
+ @Override
+ public String getDisplayName() {
+ return NbBundle.getMessage(RunTimeDDCatalog.class, displayNameKey);
+ }
+
+ /**
+ * Return visuaized state of given catalog.
+ * @param type of icon defined by JavaBeans specs
+ * @return icon representing current state or null
+ */
+ @Override
+ public String getIconResource(int type) {
+ return "org/netbeans/modules/payara/javaee/resources/server.png"; // NOI18N
+ }
+
+ /**
+ * @return I18N short description
+ */
+ @Override
+ public String getShortDescription() {
+ return NbBundle.getMessage(RunTimeDDCatalog.class, shortDescriptionKey);
+ }
+
+ /** Unregister the listener. */
+ @Override
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
+ }
+
+ public static final String J2EE_NS = "http://java.sun.com/xml/ns/j2ee"; // NOI18N
+ public static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee"; // NOI18N
+ public static final String RI_CONFIG_NS = "http://java.sun.com/xml/ns/jax-rpc/ri/config"; // NOI18N
+
+ public static final String IBM_J2EE_NS = "http://www.ibm.com/webservices/xsd"; // NOI18N
+ private static final String XMLNS_ATTR="xmlns"; //NOI18N
+ // public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException, java.io.IOException {
+ // return null;
+ // }
+ private static final String EJB_JAR_TAG="ejb-jar"; //NOI18N
+ private static final String EJBJAR_2_1_XSD="ejb-jar_2_1.xsd"; // NOI18N
+ private static final String EJBJAR_2_1 = J2EE_NS+"/"+EJBJAR_2_1_XSD; // NOI18N
+ public static final String EJBJAR_2_1_ID = "SCHEMA:"+EJBJAR_2_1; // NOI18N
+
+ private static final String EJBJAR_3_0_XSD="ejb-jar_3_0.xsd"; // NOI18N
+ private static final String EJBJAR_3_0 = JAVAEE_NS+"/"+EJBJAR_3_0_XSD; // NOI18N
+ public static final String EJBJAR_3_0_ID = "SCHEMA:"+EJBJAR_3_0; // NOI18N
+
+ private static final String APP_TAG="application"; //NOI18N
+ private static final String APP_1_4_XSD="application_1_4.xsd"; // NOI18N
+ private static final String APP_1_4= J2EE_NS+"/"+APP_1_4_XSD; // NOI18N
+ public static final String APP_1_4_ID = "SCHEMA:"+APP_1_4; // NOI18N
+
+ private static final String APP_5_XSD="application_5.xsd"; // NOI18N
+ private static final String APP_5= JAVAEE_NS+"/"+APP_5_XSD; // NOI18N
+ public static final String APP_5_ID = "SCHEMA:"+APP_5; // NOI18N
+
+
+ private static final String APPCLIENT_TAG="application-client"; //NOI18N
+ private static final String APPCLIENT_1_4_XSD="application-client_1_4.xsd"; // NOI18N
+ private static final String APPCLIENT_1_4= J2EE_NS+"/"+APPCLIENT_1_4_XSD; // NOI18N
+ public static final String APPCLIENT_1_4_ID = "SCHEMA:"+APPCLIENT_1_4; // NOI18N
+
+ private static final String APPCLIENT_5_XSD="application-client_5.xsd"; // NOI18N
+ private static final String APPCLIENT_5= JAVAEE_NS+"/"+APPCLIENT_5_XSD; // NOI18N
+ public static final String APPCLIENT_5_ID = "SCHEMA:"+APPCLIENT_5; // NOI18N
+
+
+ private static final String WEBSERVICES_TAG="webservices"; //NOI18N
+ private static final String WEBSERVICES_1_1_XSD="j2ee_web_services_1_1.xsd"; // NOI18N
+ private static final String WEBSERVICES_1_1= IBM_J2EE_NS+"/"+WEBSERVICES_1_1_XSD; // NOI18N
+ public static final String WEBSERVICES_1_1_ID = "SCHEMA:"+WEBSERVICES_1_1; // NOI18N
+
+ private static final String WEBSERVICES_CLIENT_1_1_XSD="j2ee_web_services_client_1_1.xsd"; // NOI18N
+ private static final String WEBSERVICES_CLIENT_1_1= J2EE_NS+"/"+WEBSERVICES_CLIENT_1_1_XSD; // NOI18N
+ public static final String WEBSERVICES_CLIENT_1_1_ID = "SCHEMA:"+WEBSERVICES_CLIENT_1_1; // NOI18N
+
+ private static final String WEBSERVICES_1_2_XSD="javaee_web_services_1_2.xsd"; // NOI18N
+ private static final String WEBSERVICES_1_2= JAVAEE_NS+"/"+WEBSERVICES_1_2_XSD; // NOI18N
+ public static final String WEBSERVICES_1_2_ID = "SCHEMA:"+WEBSERVICES_1_2; // NOI18N
+
+ private static final String WEBSERVICES_CLIENT_1_2_XSD="javaee_web_services_client_1_2.xsd"; // NOI18N
+ private static final String WEBSERVICES_CLIENT_1_2= JAVAEE_NS+"/"+WEBSERVICES_CLIENT_1_2_XSD; // NOI18N
+ public static final String WEBSERVICES_CLIENT_1_2_ID = "SCHEMA:"+WEBSERVICES_CLIENT_1_2; // NOI18N
+
+ private static final String WEBAPP_TAG="web-app"; //NOI18N
+ private static final String WEBAPP_2_5_XSD="web-app_2_5.xsd"; // NOI18N
+ private static final String WEBAPP_2_5 = JAVAEE_NS+"/"+WEBAPP_2_5_XSD; // NOI18N
+ public static final String WEBAPP_2_5_ID = "SCHEMA:"+WEBAPP_2_5; // NOI18N
+
+ private static final String WEBAPP_3_0_XSD="web-app_3_0.xsd"; // NOI18N
+
+ private static final String WEBFRAGMENT_3_0_XSD="web-fragment_3_0.xsd"; // NOI18N
+
+ private static final String WEBCOMMON_3_0_XSD="web-common_3_0.xsd"; // NOI18N
+
+ public static final String PERSISTENCE_NS = "http://java.sun.com/xml/ns/persistence"; // NOI18N
+ private static final String PERSISTENCE_TAG="persistence"; //NOI18N
+ private static final String PERSISTENCE_XSD="persistence_1_0.xsd"; // NOI18N
+ private static final String PERSISTENCE = PERSISTENCE_NS+"/"+PERSISTENCE_XSD; // NOI18N
+ public static final String PERSISTENCE_ID = "SCHEMA:"+PERSISTENCE; // NOI18N
+
+ public static final String PERSISTENCEORM_NS = "http://java.sun.com/xml/ns/persistence/orm"; // NOI18N
+ private static final String PERSISTENCEORM_TAG="entity-mappings"; //NOI18N
+ private static final String PERSISTENCEORM_XSD="orm_1_0.xsd"; // NOI18N
+ private static final String PERSISTENCEORM = PERSISTENCE_NS+"/"+PERSISTENCEORM_XSD; // NOI18N yes not ORM NS!!!
+ public static final String PERSISTENCEORM_ID = "SCHEMA:"+PERSISTENCEORM; // NOI18N
+
+
+
+
+ public String getFullURLFromSystemId(String systemId){
+ return null;
+
+ }
+
+ private static String SCHEMASLOCATION=null;
+ /**
+ * Resolves schema definition file for deployment descriptor (spec.2_4)
+ * @param publicId publicId for resolved entity (null in our case)
+ * @param systemId systemId for resolved entity
+ * @return InputSource for
+ */
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+
+ if (SCHEMASLOCATION == null) {
+ if (platformRootDir == null) {
+ return null;
+ }
+ if (!platformRootDir.exists()) {
+ return null;
+ }
+
+ String installRoot = platformRootDir.getAbsolutePath(); //System.getProperty("com.sun.aas.installRoot");
+ if (installRoot==null)
+ return null;
+ File f = new File(installRoot);
+ if (f.exists()==false)
+ return null;
+ File file = new File(installRoot+"/lib/schemas/");
+ SCHEMASLOCATION = "";
+ try{
+ SCHEMASLOCATION= file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ }
+
+
+ }
+ if (systemId!=null && systemId.endsWith(EJBJAR_2_1_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+EJBJAR_2_1_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(EJBJAR_3_0_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+EJBJAR_3_0_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(APP_1_4_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+APP_1_4_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(APPCLIENT_1_4_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+APPCLIENT_1_4_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBAPP_2_5_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBAPP_2_5_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBAPP_3_0_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBAPP_3_0_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBFRAGMENT_3_0_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBFRAGMENT_3_0_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBCOMMON_3_0_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBCOMMON_3_0_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(APP_5_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+APP_5_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(APPCLIENT_5_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+APPCLIENT_5_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(PERSISTENCEORM_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+PERSISTENCEORM_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(PERSISTENCE_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+PERSISTENCE_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBSERVICES_1_1_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBSERVICES_1_1_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBSERVICES_1_2_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBSERVICES_1_2_XSD);
+ } else if (XML_XSD.equals(systemId)) {
+ return new org.xml.sax.InputSource(new java.io.StringReader(XML_XSD_DEF));
+ }
+ else if (systemId!=null && systemId.endsWith(WEBSERVICES_CLIENT_1_1_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBSERVICES_CLIENT_1_1_XSD);
+ }
+ else if (systemId!=null && systemId.endsWith(WEBSERVICES_CLIENT_1_2_XSD)) {
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+WEBSERVICES_CLIENT_1_2_XSD);
+ } else if (XML_XSD.equals(systemId)) {
+ return new org.xml.sax.InputSource(new java.io.StringReader(XML_XSD_DEF));
+ } else if (systemId != null && systemId.endsWith("jdbc-data-source.xsd")) { //NOI18N
+ return new org.xml.sax.InputSource(SCHEMASLOCATION+"jdbc-data-source.xsd"); //NOI18N
+ } else {
+ return null;
+ }
+ }
+
+
+
+ @Override
+ public Enumeration enabled(GrammarEnvironment ctx) {
+ if (ctx.getFileObject() == null) return null;
+ Enumeration en = ctx.getDocumentChildren();
+ while (en.hasMoreElements()) {
+ Node next = (Node) en.nextElement();
+ if (next.getNodeType() == next.DOCUMENT_TYPE_NODE) {
+ return null; // null for web.xml specified by DTD
+ } else if (next.getNodeType() == next.ELEMENT_NODE) {
+ Element element = (Element) next;
+ String tag = element.getTagName();
+ if (EJB_JAR_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && J2EE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ else if (xmlns!=null && JAVAEE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ }
+
+ if (APP_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && J2EE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ else if (xmlns!=null && JAVAEE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ }
+ if (WEBAPP_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && JAVAEE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+
+ }
+ if (APPCLIENT_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && J2EE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ else if (xmlns!=null && JAVAEE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ }
+ if (PERSISTENCEORM_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && PERSISTENCEORM_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+
+ }
+
+ if (PERSISTENCE_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && PERSISTENCE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+
+ }
+
+ if (WEBSERVICES_TAG.equals(tag)) { // NOI18N
+ String xmlns = element.getAttribute(XMLNS_ATTR);
+ if (xmlns!=null && J2EE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ } else if (xmlns!=null && JAVAEE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ else if (xmlns!=null && IBM_J2EE_NS.equals(xmlns)) {
+ Vector<Node> v = new Vector<Node>();
+ v.add(next);
+ return v.elements();
+ // return org.openide.util.Enumerations.singleton(next);
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public FeatureDescriptor getDescriptor() {
+ return new FeatureDescriptor();
+ }
+
+ /** Returns pseudo DTD for code completion
+ */
+ @Override
+ public GrammarQuery getGrammar(GrammarEnvironment ctx) {
+ UserCatalog catalog = UserCatalog.getDefault();
+ ///System.out.println("bbb");
+ InputSource is= ctx.getInputSource();
+ //System.out.println(is.getPublicId());
+ //System.out.println(is.getSystemId());
+ //System.out.println(is);
+ if (catalog != null) {
+
+ EntityResolver resolver = catalog.getEntityResolver();
+ if (resolver != null) {
+ try {
+
+
+ if (ctx.getFileObject() == null) {
+ return null;
+ }
+ InputSource inputSource = null;
+
+ String mimeType = ctx.getFileObject().getMIMEType();
+ if (mimeType==null){
+ return null;
+ }
+ if (mimeType.equals("text/x-dd-ejbjar3.0")){// NOI18N
+ inputSource = resolver.resolveEntity(EJBJAR_3_0_ID, "");
+ } else if (mimeType.equals("text/x-dd-ejbjar2.1")) {// NOI18N
+ inputSource = resolver.resolveEntity(EJBJAR_2_1_ID, "");
+ } else if (mimeType.equals("text/x-dd-application5.0")) {// NOI18N
+ inputSource = resolver.resolveEntity(APP_5_ID, "");
+ }else if (mimeType.equals("text/x-dd-application1.4")) {// NOI18N
+ inputSource = resolver.resolveEntity(APP_1_4_ID, "");
+ }else if (mimeType.equals("text/x-dd-client5.0")) {// NOI18N
+ inputSource = resolver.resolveEntity(APPCLIENT_5_ID, "");
+ }else if (mimeType.equals("text/x-dd-client1.4")) {// NOI18N
+ inputSource = resolver.resolveEntity(APPCLIENT_1_4_ID, "");
+ }else if (mimeType.equals("text/x-persistence1.0")) {// NOI18N
+ inputSource = resolver.resolveEntity(PERSISTENCE_ID, "");
+ }else if (mimeType.equals("text/x-orm1.0")) {// NOI18N
+ inputSource = resolver.resolveEntity(PERSISTENCEORM_ID, "");
+ }
+
+ if (inputSource!=null) {
+ return DTDUtil.parseDTD(true, inputSource);
+ }
+
+
+ if (is.getSystemId().endsWith("webservices.xml") ) { // NOI18N
+ // System.out.println("webservices tag");
+ inputSource = resolver.resolveEntity(WEBSERVICES_1_1_ID, "");
+ if (inputSource!=null) {
+ return DTDUtil.parseDTD(true, inputSource);
+ }
+
+
+ }
+
+ } catch(SAXException e) {
+ } catch(java.io.IOException e) {
+ //System.out.println("eeee");
+ e.printStackTrace();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get registered URI for the given name or null if not registered.
+ * @return null if not registered
+ */
+ @Override
+ public String resolveURI(String name) {
+ // System.out.println("resolveURI(String name)="+name);
+ if (platformRootDir == null) {
+ return null;
+ }
+ if (!platformRootDir.exists()) {
+ return null;
+ }
+ String installRoot = platformRootDir.getAbsolutePath();
+ String prefix ="";
+ File file = new File(installRoot+"/lib/schemas/");
+ try{
+ prefix= file.toURI().toURL().toExternalForm();
+ }catch(Exception e){
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, file.getAbsolutePath(), e); // NOI18N
+ }
+ if (name.equals("http://java.sun.com/xml/ns/jax-rpc/ri/config")){
+ return prefix +"jax-rpc-ri-config.xsd";
+ }
+// if (name.equals("http://java.sun.com/xml/ns/persistence")){
+// System.out.println("prefix +persistence.xsd="+ prefix +"persistence.xsd");
+// return prefix +"persistence.xsd";
+// }
+ // ludo: this is meant to be this way.
+ if (name.equals("http://java.sun.com/xml/ns/j2eeppppppp")){
+ return prefix +"j2ee_web_services_1_1.xsd";
+ }
+
+ return null;
+ }
+ /**
+ * Get registered URI for the given publicId or null if not registered.
+ * @return null if not registered
+ */
+ @Override
+ public String resolvePublic(String publicId) {
+ return null;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/SunMessageDestination.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/SunMessageDestination.java
new file mode 100644
index 0000000..253e063
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/SunMessageDestination.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+
+/**
+ *
+ * @author Nitya Doraisamy
+ */
+public class SunMessageDestination implements MessageDestination {
+ private String name;
+ private Type type;
+ private File resourceDir;
+
+ public SunMessageDestination(String name, Type type) {
+ this(name, type, null);
+ }
+
+ public SunMessageDestination(String name, Type type, File resourceDir) {
+ this.name = name;
+ this.type = type;
+ this.resourceDir = resourceDir;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ File getResourceDir() {
+ return resourceDir;
+ }
+
+ void setResourceDir(File resourceDir) {
+ this.resourceDir = resourceDir;
+ }
+
+ @Override
+ public String toString() {
+ return "[ " + name + " : " + type.toString() + " ]";
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final SunMessageDestination other = (SunMessageDestination) obj;
+ if (this.name == null || !this.name.equals(other.name)) {
+ return false;
+ }
+ if (this.type == null || !this.type.equals(other.type)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
+ hash = 41 * hash + (this.type != null ? this.type.hashCode() : 0);
+ return hash;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1Configuration.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1Configuration.java
new file mode 100644
index 0000000..78de2be
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1Configuration.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.spi.DConfigBeanRoot;
+import javax.enterprise.deploy.spi.DeploymentConfiguration;
+import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
+import org.netbeans.modules.payara.eecommon.api.config.J2eeModuleHelper;
+import org.netbeans.modules.payara.jakartaee.db.Hk2DatasourceManager;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
+import org.netbeans.modules.j2ee.deployment.common.api.MessageDestination;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+
+/**
+ * Java EE server configuration API support for Payara servers 3.1 and later.
+ * <p/>
+ * @author Ludovic Champenois, Peter Williams, Tomas Kraus
+ */
+public class Three1Configuration extends Hk2Configuration implements DeploymentConfiguration {
+
+ /**
+ * Creates an instance of Java EE server configuration API support
+ * for Payara servers 3.1 and later.
+ * <p/>
+ * @param module Java EE module (project).
+ * @param version Payara server version.
+ * @throws ConfigurationException when there is a problem with Java EE server
+ * configuration initialization.
+ */
+ public Three1Configuration(
+ final J2eeModule module, final PayaraVersion version
+ ) throws ConfigurationException {
+ super(module, J2eeModuleHelper.getPayaraDDModuleHelper(module.getType()), version);
+ }
+
+ @Deprecated
+ public Three1Configuration(DeployableObject dObj) {
+ super(dObj);
+ }
+
+ // ------------------------------------------------------------------------
+ // DatasourceConfiguration support
+ // ------------------------------------------------------------------------
+ @Override
+ public Set<Datasource> getDatasources() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException {
+ return Hk2DatasourceManager.getDatasources(module, version);
+ }
+
+ @Override
+ public boolean supportsCreateDatasource() {
+ return true;
+ }
+
+ @Override
+ public Datasource createDatasource(String jndiName, String url, String username, String password, String driver) throws UnsupportedOperationException, org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException, DatasourceAlreadyExistsException {
+ return Hk2DatasourceManager.createDataSource(
+ jndiName, url, username, password, driver, module, version);
+ }
+
+ // ------------------------------------------------------------------------
+ // MessageDestinationConfiguration support
+ // ------------------------------------------------------------------------
+ @Override
+ public Set<MessageDestination> getMessageDestinations() throws org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException {
+ return Hk2MessageDestinationManager.getMessageDestinations(module.getResourceDirectory(),"glassfish-resources");
+ }
+
+ @Override
+ public boolean supportsCreateMessageDestination() {
+ return true;
+ }
+
+ @Override
+ public MessageDestination createMessageDestination(String name, MessageDestination.Type type) throws UnsupportedOperationException, org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException {
+ File resourceDir = module.getResourceDirectory();
+ if (resourceDir == null) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Resource Folder " + resourceDir + " does not exist.");
+ throw new ConfigurationException(NbBundle.getMessage(
+ ModuleConfigurationImpl.class, "ERR_NoJMSResource", name, type)); // NOI18N
+ }
+
+ return Hk2MessageDestinationManager.createMessageDestination(name, type, resourceDir,"glassfish-resources");
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation (or lack thereof) of JSR-88 DeploymentConfiguration interface
+ // Here to make the deployment manager class happy.
+ // ------------------------------------------------------------------------
+ @Override
+ public DeployableObject getDeployableObject() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot ddbeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removeDConfigBean(DConfigBeanRoot dconfigBeanRoot) throws BeanNotFoundException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public DConfigBeanRoot restoreDConfigBean(InputStream is, DDBeanRoot ddbeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void saveDConfigBean(OutputStream os, DConfigBeanRoot dconfigBeanRoot) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void restore(InputStream is) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void save(OutputStream os) throws javax.enterprise.deploy.spi.exceptions.ConfigurationException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ private static final String GLASSFISH_DASH = "glassfish-"; // NOI18N
+
+ @Override
+ protected FileObject getPayaraDD(File payaraDDFile, boolean create) throws IOException {
+ if (!payaraDDFile.exists()) {
+ if (create) {
+ createDefaultSunDD(payaraDDFile);
+ }
+ }
+ FileObject retVal = FileUtil.toFileObject(FileUtil.normalizeFile(payaraDDFile));
+ if (null == retVal) {
+ String fn = payaraDDFile.getName();
+ if (fn.contains(GLASSFISH_DASH) && null != payaraDDFile.getParentFile()) {
+ File alternate = new File(payaraDDFile.getParentFile(), fn.replace(GLASSFISH_DASH, "sun-")); // NOI18N
+ retVal = FileUtil.toFileObject(FileUtil.normalizeFile(alternate));
+ }
+ }
+ return retVal;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1ModuleConfigFactory.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1ModuleConfigFactory.java
new file mode 100644
index 0000000..787c4f6
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/Three1ModuleConfigFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee;
+
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory2;
+
+/**
+ * Factory to construct proper module configuration object.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus
+ */
+public class Three1ModuleConfigFactory extends AbstractHk2ConfigurationFactory
+implements ModuleConfigurationFactory2 {
+
+ /**
+ * Creates a new instance of {@link Three1ModuleConfigFactory}.
+ * <p/>
+ * @param hk2dm Deployment manager.
+ */
+ public Three1ModuleConfigFactory(final Hk2DeploymentManager hk2dm) {
+ super(hk2dm);
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ant-deploy.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ant-deploy.xml
new file mode 100644
index 0000000..353491d
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ant-deploy.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project default="-deploy-ant" basedir=".">
+ <target name="-init-cl-deployment-env" if="deploy.ant.enabled">
+ <property file="${deploy.ant.properties.file}" />
+ <available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
+ <available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
+ <available file="${deploy.ant.resource.dir}" property="has.setup"/>
+ <tempfile prefix="pfv3" property="pfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
+ <echo message="AS_ADMIN_PASSWORD=${pfv3.password}" file="${pfv3.password.file}"/>
+ </target>
+
+ <target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
+ <tempfile prefix="pfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
+ <copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
+ <!-- The doctype triggers resolution which can fail -->
+ <replace file="${temp.sun.web}">
+ <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
+ <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
+ </replace>
+ <replace file="${temp.sun.web}">
+ <replacetoken><![CDATA[<sun-web-app]]></replacetoken>
+ <replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
+ </replace>
+ <xmlproperty file="${temp.sun.web}" validate="false">
+ </xmlproperty>
+ <delete file="${temp.sun.web}"/>
+ <condition property="deploy.ant.client.url" value="${pfv3.url}${sun-web-app.context-root}" else="${pfv3.url}/${ant.project.name}">
+ <isset property="sun-web-app.context-root"/>
+ </condition>
+ <condition property="deploy.context.root.argument" value="&contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
+ <isset property="sun-web-app.context-root"/>
+ </condition>
+ </target>
+ <target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
+ <tempfile prefix="pfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
+ <copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
+ <!-- The doctype triggers resolution which can fail -->
+ <replace file="${temp.gf.web}">
+ <replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
+ <replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
+ </replace>
+ <replace file="${temp.gf.web}">
+ <replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
+ <replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
+ </replace>
+ <xmlproperty file="${temp.gf.web}" validate="false">
+ </xmlproperty>
+ <delete file="${temp.gf.web}"/>
+ <condition property="deploy.ant.client.url" value="${pfv3.url}${glassfish-web-app.context-root}" else="${pfv3.url}/${ant.project.name}">
+ <isset property="glassfish-web-app.context-root"/>
+ </condition>
+ <condition property="deploy.context.root.argument" value="&contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
+ <isset property="glassfish-web-app.context-root"/>
+ </condition>
+ </target>
+ <target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
+ <property name="deploy.context.root.argument" value=""/>
+ </target>
+ <target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
+ <tempfile prefix="pfv3" property="pfv3.resources.dir" destdir="${java.io.tmpdir}"/>
+ <mkdir dir="${pfv3.resources.dir}"/>
+ <mkdir dir="${pfv3.resources.dir}/META-INF"/>
+ <copy todir="${pfv3.resources.dir}/META-INF">
+ <fileset dir="${deploy.ant.resource.dir}"/>
+ </copy>
+ <jar destfile="${deploy.ant.archive}" update="true">
+ <fileset dir="${pfv3.resources.dir}"/>
+ </jar>
+ <delete dir="${pfv3.resources.dir}"/>
+ </target>
+ <target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
+ <antcall target="-deploy-without-pw"/>
+ <antcall target="-deploy-with-pw"/>
+ </target>
+
+ <target name="-deploy-without-pw" unless="pfv3.password">
+ <echo message="Deploying ${deploy.ant.archive}"/>
+ <tempfile prefix="pfv3" property="pfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
+ <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
+ <get src="${pfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}"
+ dest="${pfv3.results.file}"/>
+ <delete file="${pfv3.results.file}"/>
+ </target>
+ <target name="-deploy-with-pw" if="pfv3.password">
+ <echo message="Deploying ${deploy.ant.archive}"/>
+ <tempfile prefix="pfv3" property="pfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
+ <property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
+ <get username="${pfv3.username}" password="${pfv3.password}" src="${pfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&force=true&name=${ant.project.name}"
+ dest="${pfv3.results.file}"/>
+ <delete file="${pfv3.results.file}"/>
+ </target>
+ <target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
+ <antcall target="-undeploy-without-pw"/>
+ <antcall target="-undeploy-with-pw"/>
+ </target>
+
+ <target name="-undeploy-without-pw" unless="pfv3.password">
+ <echo message="Undeploying ${deploy.ant.archive}"/>
+ <tempfile prefix="pfv3" property="pfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
+ <get src="${pfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
+ dest="${pfv3.results.file}"/>
+ <delete file="${pfv3.results.file}"/>
+ </target>
+ <target name="-undeploy-with-pw" if="pfv3.password">
+ <echo message="Undeploying ${deploy.ant.archive}"/>
+ <tempfile prefix="pfv3" property="pfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
+ <get username="${pfv3.username}" password="${pfv3.password}" src="${pfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
+ dest="${pfv3.results.file}"/>
+ <delete file="${pfv3.results.file}"/>
+ </target>
+</project>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DataSourcesReader.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DataSourcesReader.java
new file mode 100644
index 0000000..aa6ce2b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DataSourcesReader.java
@@ -0,0 +1,374 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.StringPrefixTree;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+
+/**
+ * Reads data sources from Payara server.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class DataSourcesReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara server <code>resource</code> property type.
+ */
+ private static enum ResourceType {
+ /** Unknown resource type. */
+ UNKNOWN,
+
+ /** JDBC connection pool. */
+ CONNECTION_POOL,
+
+ /** JDBC data source. */
+ DATA_SOURCE;
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String UNKNOWN_STR = "UNKNOWN";
+
+ /** A <code>String</code> representation of CONNECTION_POOL value. */
+ private static final String CONNECTION_POOL_STR
+ = "jdbc-connection-pool";
+
+ /** A <code>String</code> representation of DATA_SOURCE value. */
+ private static final String DATA_SOURCE_STR = "jdbc-resource";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final StringPrefixTree<ResourceType> stringValues
+ = new StringPrefixTree<>(false);
+
+ static {
+ stringValues.add(CONNECTION_POOL.toString(), CONNECTION_POOL);
+ stringValues.add(DATA_SOURCE.toString(), DATA_SOURCE);
+ }
+
+ /**
+ * Returns a <code>ResourceType</code> with a value represented
+ * by the specified <code>String</code>.
+ * <p/>
+ * The <code>ResourceType</code> returned represents existing value
+ * only if specified <code>String</code> matches any <code>String</code>
+ * returned by <code>toString</code> method. Otherwise <code>null</code>
+ * value is returned.
+ * <p>
+ * @param name Value containing <code>ResourceType</code>
+ * <code>toString</code> representation.
+ * @return <code>ResourceType</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static ResourceType toValue(final String name) {
+ if (name != null) {
+ ResourceType type = stringValues.match(name.toLowerCase());
+ return type != null ? type : UNKNOWN;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Convert <code>ResourceType</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case UNKNOWN: return UNKNOWN_STR;
+ case CONNECTION_POOL: return CONNECTION_POOL_STR;
+ case DATA_SOURCE: return DATA_SOURCE_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default:
+ throw new IllegalStateException("Invalid ResourceType value");
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server JDBC data sources properties search pattern. */
+ public static final String DATA_SOURCES_PATTERN = "resources.*";
+
+ /** Payara server property key split pattern. */
+ public static final String PROPERTY_SPLIT_PATTERN = "\\.";
+
+ /** Payara server resource property identifier. */
+ public static final String PROPERTY_IDENT = "property";
+
+ /** Default JDBC data source registered in GF. */
+ static final String DEFAULT_DATA_SOURCE = "jdbc/__default";
+
+ /** JavaEE 7 new default data source linked to old default data source. */
+ static final String DEFAULT_DATA_SOURCE_EE7
+ = "java:comp/DefaultDataSource";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server to read data sources from. */
+ private final PayaraServer server;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server data sources reader.
+ * <p/>
+ * @param server Payara server to read data sources from.
+ */
+ public DataSourcesReader(final PayaraServer server) {
+ this.server = server;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve data sources from Payara server.
+ * <p/>
+ * @return Data sources from Payara server or <code>null</code>
+ * when retrieving of data sources failed.
+ */
+ public Set<Datasource> getDataSourcesFromServer() {
+ Map<String, String> properties = getPropertiesFromServer();
+ if (properties != null) {
+ Map<String, JDBCConnectionPool> pools = new HashMap<>();
+ Map<String, JDBCResource> resources = new HashMap<>();
+ buildJDBCContentObjects(properties, pools, resources);
+ assignConnectionPoolsToResources(pools, resources);
+ // Add Java EE 7 comp/DefaultDataSource data source (since PF 4).
+ if (server.getVersion().ordinal()
+ >= PayaraVersion.PF_4_1_144.ordinal()) {
+ addNewJavaEE7dataSource(resources);
+ }
+ return new HashSet<Datasource>(resources.values());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Build JDBC connection pools and resources content objects
+ * from server properties.
+ * <p/>
+ * @param properties Server <code>resources.*</code> properties map.
+ * @param pools Existing JDBC connection pools map.
+ * @param resources Existing JDBC resources map.
+ */
+ private void buildJDBCContentObjects(final Map<String, String> properties,
+ final Map<String, JDBCConnectionPool> pools,
+ final Map<String, JDBCResource> resources) {
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ String key = entry.getKey();
+ if (key != null && key.length() > 0) {
+ String[] elements = key.split(PROPERTY_SPLIT_PATTERN);
+ if (elements.length >= 4) {
+ JDBCConnectionPool.PropertyType propertyType;
+ ResourceType type = ResourceType.toValue(elements[1]);
+ switch (type) {
+ case CONNECTION_POOL:
+ buildJDBCConnectionPool(
+ pools, elements, entry.getValue());
+ break;
+ case DATA_SOURCE:
+ buildJDBCResource(
+ resources, elements, entry.getValue());
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Assign JDBC connection pools to resources (data sources).
+ * <p/>
+ * @param pools Existing JDBC connection pools map.
+ * @param resources Existing JDBC resources map.
+ */
+ private void assignConnectionPoolsToResources(
+ final Map<String, JDBCConnectionPool> pools,
+ final Map<String, JDBCResource> resources) {
+ for (Map.Entry<String, JDBCResource> entry : resources.entrySet()) {
+ JDBCResource resource = entry.getValue();
+ if (resource != null && resource.getPoolName() != null) {
+ resource.setPool(pools.get(resource.getPoolName()));
+ }
+ }
+ }
+
+ /**
+ * Add new Java EE 7 <code>comp/DefaultDataSource</code> data source as old
+ * default <code>jdbc/__default</code> data source clone.
+ * <p/>
+ * Data source will be added only if <code>jdbc/__default</code> data source
+ * exists and Java EE 7 new data source is not registered yet. Old data
+ * source must be already fully initialized and linked with connection pool.
+ * <p/>
+ * @param resources Existing JDBC resources map.
+ */
+ private void addNewJavaEE7dataSource(
+ final Map<String, JDBCResource> resources) {
+ JDBCResource defaultResource = resources.get(DEFAULT_DATA_SOURCE);
+ if (defaultResource != null
+ && !resources.containsKey(DEFAULT_DATA_SOURCE_EE7)) {
+ resources.put(DEFAULT_DATA_SOURCE_EE7,
+ defaultResource.copy(DEFAULT_DATA_SOURCE_EE7));
+ }
+ }
+
+ /**
+ * Process one step of building <code>Map</code> of JDBC connection pool
+ * content objects.
+ * <p/>
+ * @param pools Existing JDBC connection pools map.
+ * @param elements Payara server JDBC connection pool property key
+ * elements.
+ * @param attributeValue Payara server JDBC connection pool property
+ * value.
+ */
+ private void buildJDBCConnectionPool(
+ final Map<String, JDBCConnectionPool> pools,
+ final String[] elements, final String attributeValue) {
+ JDBCConnectionPool.PropertyType propertyType = null;
+ final String name = elements[2];
+ switch(elements.length) {
+ case 4:
+ propertyType = null;
+ break;
+ case 5:
+ if (PROPERTY_IDENT.equalsIgnoreCase(elements[3])) {
+ propertyType = JDBCConnectionPool
+ .PropertyType.toValue(elements[4]);
+ } else {
+ propertyType = null;
+ }
+ break;
+ }
+ if (propertyType != null
+ && propertyType != JDBCConnectionPool.PropertyType.UNKNOWN) {
+ JDBCConnectionPool pool = getJDBCConnectionPool(pools, name);
+ pool.setProperty(propertyType, attributeValue);
+ }
+
+ }
+
+ /**
+ * Process one step of building <code>Map</code> of JDBC resource
+ * content objects.
+ * <p/>
+ * @param resources Existing JDBC resources map.
+ * @param elements Payara server JDBC resource property key
+ * elements.
+ * @param attributeValue Payara server JDBC resource property value.
+ */
+ private void buildJDBCResource(final Map<String, JDBCResource> resources,
+ final String[] elements, final String attributeValue) {
+ JDBCResource.AttrType attrType = null;
+ final String name = elements[2];
+ if (elements.length == 4) {
+ attrType = JDBCResource.AttrType.toValue(elements[3]);
+ }
+ if (attrType != null && attrType != JDBCResource.AttrType.UNKNOWN) {
+ JDBCResource resource = getJDBCResource(resources, name);
+ resource.setProperty(attrType, attributeValue);
+ }
+ }
+
+ /**
+ * Get existing JDBC connection pool content object from pools
+ * <code>Map</code> or create new one and put it into pools <code>Map</code>
+ * when no such object exists.
+ * <p/>
+ * @param pools Existing JDBC connection pools map.
+ * @param name JDBC connection pool name (<code>Map</code> key).
+ * @return JDBC connection pool content object. Never returns
+ * <code>null</code>.
+ */
+ private JDBCConnectionPool getJDBCConnectionPool(
+ final Map<String, JDBCConnectionPool> pools, final String name) {
+ JDBCConnectionPool pool = pools.get(name);
+ if (pool == null) {
+ pool = new JDBCConnectionPool();
+ pools.put(name, pool);
+ }
+ return pool;
+ }
+
+ /**
+ * Get existing JDBC resources content object from resources
+ * <code>Map</code> or create new one and put it into resources
+ * <code>Map</code> when no such object exists.
+ * <p/>
+ * @param pools Existing JDBC resources map.
+ * @param name JDBC resource name (<code>Map</code> key).
+ * @return JDBC resource content object. Never returns <code>null</code>.
+ */
+ private JDBCResource getJDBCResource(
+ final Map<String, JDBCResource> resources, final String name) {
+ JDBCResource resource = resources.get(name);
+ if (resource == null) {
+ resource = new JDBCResource();
+ resources.put(name, resource);
+ }
+ return resource;
+ }
+
+ /**
+ * Retrieve data sources properties from Payara server.
+ * <p/>
+ * @return Data sources properties from Payara server
+ * or <code>null</code> when retrieving using server
+ * <code>get</code> administration command failed.
+ */
+ private Map<String, String> getPropertiesFromServer() {
+ ResultMap<String, String> result = CommandGetProperty
+ .getProperties(server, DATA_SOURCES_PATTERN);
+ if (result != null && result.getState() == TaskState.COMPLETED) {
+ return result.getValue();
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DbUtil.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DbUtil.java
new file mode 100644
index 0000000..b5ed5e0
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DbUtil.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+
+/**
+ *
+ * @author Peter Williams
+ */
+public class DbUtil {
+
+ private static final String __DatabaseVendor = "database-vendor";
+ private static final String __DatabaseName = "databaseName";
+ private static final String __Url = "URL";
+ private static final String __User = "User";
+ private static final String __Password = "Password";
+ private static final String __NotApplicable = "NA";
+ private static final String __IsXA = "isXA";
+ private static final String __IsCPExisting = "is-cp-existing";
+
+ private static final String __DerbyDatabaseName = "DatabaseName";
+ private static final String __DerbyPortNumber = "PortNumber";
+ private static final String __ServerName = "serverName";
+ private static final String __InformixHostName = "IfxIFXHOST";
+ private static final String __InformixServer = "InformixServer";
+ private static final String __DerbyConnAttr = "connectionAttributes";
+
+ private static final String __PortNumber = "portNumber";
+ private static final String __SID = "SID";
+ private static final String __DriverClass = "driverClass";
+
+
+ static final String[] VendorsDBNameProp = {
+ "sun_db2", "sun_oracle", "sun_msftsql", "db2", "microsoft_sql",
+ "post-gre-sql", "mysql", "datadirect_sql", "datadirect_db2",
+ "datadirect_informix", "datadirect_sybase", "datadirect_oracle",
+ "jtds_sql", "jtds_sybase", "informix"
+ };
+
+ static final String[] Reqd_DBName = {
+ "sun_db2", "sun_msftsql", "datadirect_sql", "microsoft_sql",
+ "datadirect_db2", "datadirect_informix", "datadirect_sybase"
+ };
+
+ static Map<String, String> normalizePoolMap(Map<String, String> poolValues) {
+ String driverClassName = poolValues.get("dsClassName"); //NOI18N
+ String resType = poolValues.get("resType"); //NOI18N
+ String url = ""; //NOI18N
+ String serverName = poolValues.get(__ServerName);
+ String portNo = poolValues.get(__DerbyPortNumber);
+ String dbName = poolValues.get(__DerbyDatabaseName);
+ String dbVal = poolValues.get(__DatabaseName);
+ String portVal = poolValues.get(__PortNumber);
+ String sid = poolValues.get(__SID);
+ String urlValue = poolValues.get(__Url);
+ String driverClass = poolValues.get(__DriverClass);
+ String derbyConnAttr = poolValues.get(__DerbyConnAttr);
+ String password = poolValues.get(__Password);
+ String user = poolValues.get(__User);
+
+ if (driverClassName.indexOf("pointbase") != -1) {
+ url = poolValues.get(__DatabaseName);
+ }
+ // Search for server name key should be case insensitive.
+ if (serverName == null) {
+ for (String key : poolValues.keySet()) {
+ if (__ServerName.equalsIgnoreCase(key)) {
+ serverName = poolValues.get(key);
+ break;
+ }
+ }
+ poolValues.put(__ServerName, serverName);
+ }
+ if (urlValue == null || urlValue.equals("")) { //NOI18N
+ if (driverClassName.indexOf("derby") != -1) {
+ if (serverName != null) {
+ url = "jdbc:derby://" + serverName;
+ if (portNo != null && portNo.length() > 0) {
+ url = url + ":" + portNo; //NOI18N
+ }
+ url = url + "/" + dbName; //NOI18N
+ if(derbyConnAttr != null && (! derbyConnAttr.equals(""))) { //NOI18N
+ url = url + derbyConnAttr;
+ }
+ }
+ } else {
+ if (url == null || url.equals("")) { //NOI18N
+ String urlPrefix = DriverMaps.getUrlPrefix(driverClassName, resType);
+ // !PW FIXME no access to vendor name yet.
+// String vName = ResourceConfigurator.getDatabaseVendorName(urlPrefix, null);
+ //
+ String vName = "Unknown";//NOI18N
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Unable to compute database vendor name for datasource url.");
+ if (serverName != null) {
+ if (vName.equals("sun_oracle")) { //NOI18N
+ url = urlPrefix + serverName;
+ } else {
+ url = urlPrefix + "//" + serverName; //NOI18N
+ }
+ if (portVal != null && portVal.length() > 0) {
+ url = url + ":" + portVal; //NOI18N
+ }
+ }
+ if (vName.equals("sun_oracle") || vName.equals("datadirect_oracle")) { //NOI18N
+ url = url + ";SID=" + sid; //NOI18N
+ } else if (Arrays.asList(Reqd_DBName).contains(vName)) {
+ url = url + ";databaseName=" + dbVal; //NOI18N
+ } else if (Arrays.asList(VendorsDBNameProp).contains(vName) || "Unknown".equals(vName)) {//NOI18N
+ url = url + "/" + dbVal; //NOI18N
+ }
+ }
+ }
+ } else {
+ url = urlValue;
+ }
+
+ if (url != null && (!url.equals(""))) { //NOI18N
+ if (driverClass == null || driverClass.equals("")) { //NOI18N
+ DatabaseConnection databaseConnection = getDatabaseConnection(url);
+ if (databaseConnection != null) {
+ driverClass = databaseConnection.getDriverClass();
+ } else {
+ //Fix Issue 78212 - NB required driver classname
+ String drivername = DriverMaps.getDriverName(url);
+ if (drivername != null) {
+ driverClass = drivername;
+ } else {
+ driverClass = driverClassName;
+ }
+ }
+ }
+ }
+
+ if (user == null) {
+ for(String key : poolValues.keySet()){
+ if(__User.equalsIgnoreCase(key)){
+ user = poolValues.get(key);
+ break;
+ }
+ }
+ poolValues.put(__User, user);
+ }
+
+ if (password == null) {
+ for(String key : poolValues.keySet()){
+ if(__Password.equalsIgnoreCase(key)){
+ password = poolValues.get(key);
+ break;
+ }
+ }
+ poolValues.put(__Password, password);
+ }
+
+ poolValues.put(__Url, url);
+ poolValues.put(__DriverClass, driverClass);
+
+ return poolValues;
+ }
+
+ private static DatabaseConnection getDatabaseConnection(String url) {
+ DatabaseConnection [] dbConns = ConnectionManager.getDefault().getConnections();
+ for(int i = 0; i < dbConns.length; i++) {
+ String dbConnUrl = dbConns[i].getDatabaseURL();
+ if(dbConnUrl.startsWith(url)) {
+ return dbConns[i];
+ }
+ }
+ return null;
+ }
+
+ public static final boolean notEmpty(String testedString) {
+ return (testedString != null) && (testedString.length() > 0);
+ }
+
+ public static final boolean strEmpty(String testedString) {
+ return testedString == null || testedString.length() == 0;
+ }
+
+ public static final boolean strEquals(String one, String two) {
+ boolean result = false;
+
+ if(one == null) {
+ result = (two == null);
+ } else {
+ if(two == null) {
+ result = false;
+ } else {
+ result = one.equals(two);
+ }
+ }
+ return result;
+ }
+
+ public static final boolean strEquivalent(String one, String two) {
+ boolean result = false;
+
+ if(strEmpty(one) && strEmpty(two)) {
+ result = true;
+ } else if(one != null && two != null) {
+ result = one.equals(two);
+ }
+
+ return result;
+ }
+
+ public static final int strCompareTo(String one, String two) {
+ int result;
+
+ if(one == null) {
+ if(two == null) {
+ result = 0;
+ } else {
+ result = -1;
+ }
+ } else {
+ if(two == null) {
+ result = 1;
+ } else {
+ result = one.compareTo(two);
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DriverMaps.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DriverMaps.java
new file mode 100644
index 0000000..c3c4606
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/DriverMaps.java
@@ -0,0 +1,366 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * DatabaseUtils.java
+ *
+ * Created on June 26, 2006, 1:55 PM
+ *
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * From DatabaseUtils in the V2 plugin
+ *
+ * XXX This primarily code does linear searchs through map keys because of extra
+ * logic on key comparisons. Find a way to use the maps properly.
+ *
+ * @author Nitya Doraisamy
+ * @author Peter Williams
+ */
+public class DriverMaps {
+
+ private static final int INITIAL_MAP_SIZE = 107;
+
+ private static Map<String, String> driverMap;
+ private static Map<String, String> dsClassMap;
+ private static Map<String, String> cpClassMap;
+
+ private DriverMaps() {
+ }
+
+ /**
+ * Returns the driver name for the given url
+ *
+ * @param url url of this connection
+ * @return driver name required
+ */
+ public static final String getDriverName(String url) {
+ return getValueForUrl(driverMap, url);
+ }
+
+ /**
+ * Returns driver class name for the given url
+ *
+ * @param url url of this connection
+ * @return driver class name required
+ */
+ public static final String getDSClassName(String url) {
+ return getValueForUrl(dsClassMap, url);
+ }
+
+ private static final String getValueForUrl(Map<String, String> mapping, String url) {
+ for(String urlPrefix: mapping.keySet()) {
+ if(url.startsWith(urlPrefix)){
+ return mapping.get(urlPrefix);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the URL prefix fiven a Datasource Classname
+ * @param inClass Datasource Classname
+ * @return URL prefix for given Datasource Classname
+ */
+ public static final String getUrlPrefix(String inClass, String resType) {
+ return "javax.sql.ConnectionPoolDataSource".equals(resType) ? // NOI18N
+ getPrefix(cpClassMap, inClass) : getPrefix(dsClassMap, inClass);
+ }
+
+ private static final String getPrefix(Map<String, String> classMap, String inClass) {
+ for(String urlPrefix: classMap.keySet()) {
+ String dsClass = classMap.get(urlPrefix);
+ if(dsClass.equalsIgnoreCase(inClass)) {
+ return urlPrefix;
+ }
+ }
+ return null;
+ }
+
+ static {
+ driverMap = new HashMap<String, String>(INITIAL_MAP_SIZE);
+
+ //IBM DB2
+ driverMap.put("jdbc:db2:", "COM.ibm.db2.jdbc.net.DB2Driver");
+ //JDBC-ODBC Bridge
+ driverMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver");
+ //Microsoft SQL Server (Weblogic driver)
+ driverMap.put("jdbc:weblogic:mssqlserver4:", "weblogic.jdbc.mssqlserver4.Driver");
+
+ //Oracle-thin
+ driverMap.put("jdbc:oracle:thin:", "oracle.jdbc.driver.OracleDriver");
+ //Oracle //OCI 8i
+ driverMap.put("jdbc:oracle:oci8:", "oracle.jdbc.driver.OracleDriver");
+ //Oracle //OCI 9i
+ driverMap.put("jdbc:oracle:oci:", "oracle.jdbc.driver.OracleDriver");
+
+ //PointBase
+ driverMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcUniversalDriver");
+ //Cloudscape
+ driverMap.put("jdbc:cloudscape:", "COM.cloudscape.core.JDBCDriver");
+ //Java DB (Net)
+ driverMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientDriver");
+ //Firebird (JCA/JDBC driver)
+ driverMap.put("jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver");
+ //FirstSQL/J //Enterprise Server Edition
+ driverMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver");
+ //FirstSQL/J //Professional Edition
+ driverMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver");
+
+ //IBM DB2 (DataDirect Connect for JDBC)
+ driverMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbc.db2.DB2Driver");
+ //Informix Dynamic Server (DataDirect Connect for JDBC)
+ driverMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbc.informix.InformixDriver");
+ //Oracle (DataDirect Connect for JDBC)
+ driverMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbc.oracle.OracleDriver");
+ //Microsoft SQL Server (DataDirect Connect for JDBC)
+ driverMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbc.sqlserver.SQLServerDriver");
+ //Sybase (DataDirect Connect for JDBC)
+ driverMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbc.sybase.SybaseDriver");
+
+ //IDS Server
+ driverMap.put("jdbc:ids:", "ids.sql.IDSDriver");
+ //Informix Dynamic Server
+ driverMap.put("jdbc:informix-sqli:", "com.informix.jdbc.IfxDriver");
+ //InstantDB (v3.13 and earlier)
+ driverMap.put("jdbc:idb:", "jdbc.idbDriver");
+ //InstantDB (v3.14 and later)
+ driverMap.put("jdbc:idb:", "org.enhydra.instantdb.jdbc.idbDriver");
+ //Interbase (InterClient driver)
+ driverMap.put("jdbc:interbase:", "interbase.interclient.Driver");
+ //HSQLDB //(server)
+ driverMap.put("jdbc:hsqldb:hsql:", "org.hsqldb.jdbcDriver");
+ //HSQLDB //(webserver)
+ driverMap.put("jdbc:hsqldb:http:", "org.hsqldb.jdbcDriver");
+ //Hypersonic SQL (v1.2 and earlier)
+ driverMap.put("jdbc:HypersonicSQL:", "hSql.hDriver");
+ //Hypersonic SQL (v1.3 and later)
+ driverMap.put("jdbc:HypersonicSQL:", "org.hsql.jdbcDriver");
+ //jTDS
+ driverMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbc.Driver");
+ //jTDS
+ driverMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbc.Driver");
+ //Mckoi SQL Database //(server)
+ driverMap.put("jdbc:mckoi:", "com.mckoi.JDBCDriver");
+ //Mckoi SQL Database //(standalone)
+ driverMap.put("jdbc:mckoi:local:", "com.mckoi.JDBCDriver");
+ //Microsoft SQL Server (JTurbo driver)
+ driverMap.put("jdbc:JTurbo:", "com.ashna.jturbo.driver.Driver");
+ //Microsoft SQL Server (JTurbo driver 3.0)
+ //driverMap.put("jdbc:JTurbo:", "com.newatlanta.jturbo.driver.Driver");
+ //Microsoft SQL Server (Sprinta driver)
+ driverMap.put("jdbc:inetdae:", "com.inet.tds.TdsDriver");
+ //Microsoft SQL Server 2005 (Microsoft driver)
+ //driverMap.put("jdbc:microsoft:sqlserver:", "com.microsoft.jdbc.sqlserver.SQLServerDriver");
+ driverMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDriver"); //NOI18N
+ //MySQL (Connector/J driver)
+ driverMap.put("jdbc:mysql:", "com.mysql.jdbc.Driver");
+ //MySQL (MM.MySQL driver)
+ //driverMap.put("jdbc:mysql:", "org.gjt.mm.mysql.Driver");
+
+ //PostgreSQL (v6.5 and earlier)
+ //driverMap.put("jdbc:postgresql:", "postgresql.Driver");
+ //PostgreSQL (v7.0 and later)
+ driverMap.put("jdbc:postgresql:", "org.postgresql.Driver");
+ //Quadcap Embeddable Database
+ driverMap.put("jdbc:qed:", "com.quadcap.jdbc.JdbcDriver");
+ //Sybase (jConnect 4.2 and earlier)
+ //driverMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc.SybDriver");
+ //Sybase (jConnect 5.2)
+ driverMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybDriver");
+
+ // Following four entries for drivers to be included in Java Studio Enterprise 7 (Bow)
+ //Microsoft SQL Server Driver
+ driverMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbc.sqlserver.SQLServerDriver");
+ //DB2 Driver
+ driverMap.put("jdbc:sun:db2:", "com.sun.sql.jdbc.db2.DB2Driver");
+ //Oracle Driver
+ driverMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbc.oracle.OracleDriver");
+ //Sybase Driver
+ driverMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbc.sybase.SybaseDriver");
+
+ //AS400 Driver
+ driverMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCDriver");
+ }
+
+ static {
+ dsClassMap = new HashMap<String, String>(INITIAL_MAP_SIZE);
+
+ //IBM DB2
+ dsClassMap.put("jdbc:db2:", "com.ibm.db2.jcc.DB2DataSource");
+ //JDBC-ODBC Bridge
+ dsClassMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver");
+ //Microsoft SQL Server (Weblogic driver)
+ //dsClassMap.put("jdbc:weblogic:mssqlserver4:", "weblogic.jdbc.mssqlserver4.Driver");
+
+ //Oracle-thin
+ dsClassMap.put("jdbc:oracle:thin:", "oracle.jdbc.pool.OracleDataSource");
+ //Oracle //OCI 8i
+ dsClassMap.put("jdbc:oracle:oci8:", "oracle.jdbc.pool.OracleDataSource");
+ //Oracle //OCI 9i
+ dsClassMap.put("jdbc:oracle:oci:", "oracle.jdbc.pool.OracleDataSource");
+
+ //PointBase
+ dsClassMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcDataSource");
+ //Cloudscape
+ dsClassMap.put("jdbc:cloudscape:", "com.cloudscape.core.BasicDataSource");
+ //Java DB (Net)
+ dsClassMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientDataSource");
+ //Firebird (JCA/JDBC driver)
+ //dsClassMap.put("jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver");
+ //FirstSQL/J //Enterprise Server Edition
+ //dsClassMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver");
+ //FirstSQL/J //Professional Edition
+ //dsClassMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver");
+
+ //IBM DB2 (DataDirect Connect for JDBC)
+ dsClassMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbcx.db2.DB2DataSource");
+ //Informix Dynamic Server (DataDirect Connect for JDBC)
+ dsClassMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbcx.informix.InformixDataSource");
+ //Oracle (DataDirect Connect for JDBC)
+ dsClassMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbcx.oracle.OracleDataSource");
+ //Microsoft SQL Server (DataDirect Connect for JDBC)
+ dsClassMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbcx.sqlserver.SQLServerDataSource");
+ //Sybase (DataDirect Connect for JDBC)
+ dsClassMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbcx.sybase.SybaseDataSource");
+
+ //IDS Server
+ dsClassMap.put("jdbc:ids:", "ids.sql.IDSDriver");
+ //Informix Dynamic Server
+ dsClassMap.put("jdbc:informix-sqli:", "com.informix.jdbcx.IfxDataSource");
+ //InstantDB (v3.13 and earlier)
+ //dsClassMap.put("jdbc:idb:", "jdbc.idbDriver");
+ //InstantDB (v3.14 and later)
+ //dsClassMap.put("jdbc:idb:", "org.enhydra.instantdb.jdbc.idbDriver");
+ //Interbase (InterClient driver)
+ //dsClassMap.put("jdbc:interbase:", "interbase.interclient.Driver");
+ //HSQLDB //(server)
+ //dsClassMap.put("jdbc:hsqldb:hsql:", "org.hsqldb.jdbcDriver");
+ //HSQLDB //(webserver)
+ //dsClassMap.put("jdbc:hsqldb:http:", "org.hsqldb.jdbcDriver");
+ //Hypersonic SQL (v1.2 and earlier)
+ //dsClassMap.put("jdbc:HypersonicSQL:", "hSql.hDriver");
+ //Hypersonic SQL (v1.3 and later)
+ //dsClassMap.put("jdbc:HypersonicSQL:", "org.hsql.jdbcDriver");
+ //jTDS
+ dsClassMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ //jTDS
+ dsClassMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ //Mckoi SQL Database //(server)
+ //dsClassMap.put("jdbc:mckoi:", "com.mckoi.JDBCDriver");
+ //Mckoi SQL Database //(standalone)
+ //dsClassMap.put("jdbc:mckoi:local:", "com.mckoi.JDBCDriver");
+ //Microsoft SQL Server (JTurbo driver old version)
+ //dsClassMap.put("jdbc:JTurbo:", "com.ashna.jturbo.driver.DataSource");
+ //Microsoft SQL Server (JTurbo driver 3.0)
+ dsClassMap.put("jdbc:JTurbo:", "com.newatlanta.jturbo.driver.DataSource");
+ //Microsoft SQL Server (Sprinta driver)
+ dsClassMap.put("jdbc:inetdae:", "com.inet.tds.TdsDataSource");
+ //Microsoft SQL Server 2005 (Microsoft driver)
+ //dsClassMap.put("jdbc:microsoft:sqlserver:", "com.microsoft.jdbc.sqlserver.SQLServerDataSource");
+ dsClassMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDataSource"); //NOI18N
+ //MySQL (Connector/J driver)
+ //dsClassMap.put("jdbc:mysql:", "com.mysql.jdbc.Driver");
+ //MySQL (MM.MySQL driver)
+ dsClassMap.put("jdbc:mysql:", "com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
+
+ //PostgreSQL (v6.5 and earlier)
+ //dsClassMap.put("jdbc:postgresql:", "postgresql.Driver");
+ //PostgreSQL (v7.0 and later)
+ dsClassMap.put("jdbc:postgresql:", "org.postgresql.ds.PGSimpleDataSource");//1st implementation without pooling
+ dsClassMap.put("jdbc:postgresql:", "org.postgresql.ds.PGPoolingDataSource");//another one with pooling support
+ //Quadcap Embeddable Database
+ //dsClassMap.put("jdbc:qed:", "com.quadcap.jdbc.JdbcDriver");
+ //Sybase (jConnect 4.2 and earlier)
+ //dsClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc.SybDriver");
+ //Sybase (jConnect 5.2)
+ dsClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybDataSource");
+
+ // Following four entries for drivers to be included in Java Studio Enterprise 7 (Bow)
+ //Microsoft SQL Server Driver
+ dsClassMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource");
+ //DB2 Driver
+ dsClassMap.put("jdbc:sun:db2:", "com.sun.sql.jdbcx.db2.DB2DataSource");
+ //Oracle Driver
+ dsClassMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbcx.oracle.OracleDataSource");
+ //Sybase
+ dsClassMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbcx.sybase.SybaseDataSource");
+
+ //AS400
+ dsClassMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCDataSource");
+ }
+
+ static {
+ cpClassMap = new HashMap<String, String>(INITIAL_MAP_SIZE);
+ //Java DB (Net)
+ cpClassMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientConnectionPoolDataSource");
+ //DB2 Driver
+ cpClassMap.put("jdbc:sun:db2:", "com.sun.sql.jdbcx.db2.DB2DataSource");
+ //Microsoft SQL Server Driver
+ cpClassMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource");
+ //Oracle Driver
+ cpClassMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbcx.oracle.OracleDataSource");
+ //Sybase Driver
+ cpClassMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbcx.sybase.SybaseDataSource");
+ //PostgreSQL (v7.0 and later)
+ cpClassMap.put("jdbc:postgresql:", "org.postgresql.ds.PGConnectionPoolDataSource");
+ //Microsoft SQL Server 2000 (Microsoft driver)
+ cpClassMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource");
+ //jTDS
+ cpClassMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ //jTDS
+ cpClassMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ //Oracle //OCI 8i
+ cpClassMap.put("jdbc:oracle:oci8:", "oracle.jdbc.pool.OracleConnectionPoolDataSource");
+ //Oracle-thin
+ cpClassMap.put("jdbc:oracle:thin:", "oracle.jdbc.pool.OracleConnectionPoolDataSource");
+ //IBM DB2
+ cpClassMap.put("jdbc:db2:", "com.ibm.db2.jcc.DB2ConnectionPoolDataSource");
+ //Microsoft SQL Server (DataDirect Connect for JDBC)
+ cpClassMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbcx.sqlserver.SQLServerDataSource");
+ //Oracle (DataDirect Connect for JDBC)
+ cpClassMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbcx.oracle.OracleDataSource");
+ //IBM DB2 (DataDirect Connect for JDBC)
+ cpClassMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbcx.db2.DB2DataSource");
+ //Informix Dynamic Server (DataDirect Connect for JDBC)
+ cpClassMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbcx.informix.InformixDataSource");
+ //Sybase (DataDirect Connect for JDBC)
+ cpClassMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbcx.sybase.SybaseDataSource");
+ //Sybase (jConnect 5.2)
+ cpClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource");
+ //PointBase
+ cpClassMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcDataSource");
+ //Cloudscape
+ cpClassMap.put("jdbc:cloudscape:", "COM.cloudscape.core.LocalConnectionPoolDataSource");
+ //Informix Dynamic Server
+ cpClassMap.put("jdbc:informix-sqli:", "com.informix.jdbcx.IfxConnectionPoolDataSource");
+ //MySQL (MM.MySQL driver)
+ cpClassMap.put("jdbc:mysql:", "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource");
+ //JDBC-ODBC Bridge
+ cpClassMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver");
+
+ //AS400
+ cpClassMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCConnectionPoolDataSource");
+
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManager.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManager.java
new file mode 100644
index 0000000..0dc76bb
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManager.java
@@ -0,0 +1,1136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.netbeans.modules.payara.common.PayaraState;
+import org.netbeans.modules.payara.common.parser.TreeParser;
+import org.netbeans.modules.payara.eecommon.api.UrlData;
+import org.netbeans.modules.payara.eecommon.api.config.PayaraConfiguration;
+import org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils;
+import org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils.JndiNameResolver;
+import org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils.ResourceFileDescription;
+import static org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils.checkNamespaces;
+import static org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils.getJndiName;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.DatasourceManager;
+import org.netbeans.modules.j2ee.sun.dd.api.RootInterface;
+import org.netbeans.modules.javaee.specs.support.api.util.JndiNamespacesDefinition;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
+import org.openide.util.Pair;
+import org.openide.xml.XMLUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Payara server data source manager.
+ * <p/>
+ * @author Peter Williams, Tomas Kraus
+ */
+public class Hk2DatasourceManager implements DatasourceManager {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server domain configuration file. */
+ private static final String DOMAIN_XML_PATH = OsUtils.joinPaths(
+ ServerUtils.PF_DOMAIN_CONFIG_DIR_NAME,
+ ServerUtils.PF_DOMAIN_CONFIG_FILE_NAME);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server deployment manager. */
+ private Hk2DeploymentManager dm;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server data source manager.
+ * <p/>
+ * @param dm Payara server deployment manager.
+ */
+ public Hk2DatasourceManager(Hk2DeploymentManager dm) {
+ this.dm = dm;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieves the data sources deployed on the server.
+ * <p/>
+ * @return The set of data sources deployed on the server.
+ * @throws ConfigurationException reports problems in retrieving data source
+ * definitions.
+ */
+ @Override
+ public Set<Datasource> getDatasources() throws ConfigurationException {
+ PayaraServer server = dm.getCommonServerSupport().getInstance();
+ String domainsDir = server.getDomainsFolder();
+ String domainName = server.getDomainName();
+ // Try to retrieve data sources from asadmin interface if possible
+ if (PayaraState.isOnline(server) || server.isRemote()) {
+ DataSourcesReader dataSourcesReader
+ = new DataSourcesReader(server);
+ Set<Datasource> dataSources = dataSourcesReader.getDataSourcesFromServer();
+ // Return when data sources were retrieved successfully.
+ if (dataSources != null) {
+ // #250444 we have to convert JDBCResource back to SunDatasource
+ // to have it all the same type in collections
+ return translate(dataSources);
+ }
+ }
+ // Fallback option to retrieve data sources from domain.xml
+ // for local server
+ if (!server.isRemote() && null != domainsDir) {
+ // XXX This won't read app scoped DS. This does not seem to be a problem.
+ File domainXml = new File(domainsDir, domainName + File.separatorChar + DOMAIN_XML_PATH);
+ return readDatasources(
+ domainXml, "/domain/", null, server.getVersion(), false);
+ } else {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ /**
+ * Deploys the given set of data sources.
+ * <p/>
+ * @param Set of datasources to deploy.
+ * @throws ConfigurationException if there is some problem with data source
+ * configuration.
+ * @throws DatasourceAlreadyExistsException if module data source(s) are
+ * conflicting with data source(s) already deployed on the server.
+ */
+ @Override
+ public void deployDatasources(Set<Datasource> datasources)
+ throws ConfigurationException, DatasourceAlreadyExistsException {
+ // Since a connection pool is not a Datasource, the deploy has to
+ // happen in a different part of the deploy processing...
+ }
+
+ /**
+ * Get {@link Datasource} objects from first available resources file.
+ * <p/>
+ * @param version Resources file names depend on Payara server version.
+ * @param module Java EE module (project).
+ * @return {@link Datasource} objects found in first available file.
+ */
+ public static Set<Datasource> getDatasources(
+ final J2eeModule module, final PayaraVersion version) {
+ Pair<File, Boolean> result = PayaraConfiguration.getExistingResourceFile(module, version);
+ if (result != null) {
+ return readDatasources(result.first(), "/", module, version, result.second());
+ } else {
+ return new HashSet<>();
+ }
+ }
+
+ private static Set<Datasource> translate(Collection<Datasource> sources) {
+ Set<Datasource> ret = new HashSet<>();
+ for (Datasource ds : sources) {
+ ret.add(new SunDatasource(ds.getJndiName(), ds.getUrl(), ds.getUsername(), ds.getPassword(), ds.getDriverClassName()));
+ }
+ return ret;
+ }
+
+ // ------------------------------------------------------------------------
+ // Internal logic
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get resource file for new data source creation and verify it.
+ * Verifies existing resource file syntax and data sources or provides
+ * a new file when no resource file exists.
+ * <br/>
+ * <i>Internal {@link #createDataSource(String, String, String,
+ * String, String, J2eeModule, PayaraVersion)} helper method.</i>
+ * <p/>
+ * @param jndiName Data source JNDI name.
+ * @param url Database URL.
+ * @param username Database user name.
+ * @param password Database user password.
+ * @param driver Database JDBC driver.
+ * @param module Java EE module (project).
+ * @param version Payara server version.
+ * @param cpFinder Connection pool finder.
+ * @return Resource file for new data source creation.
+ * @throws ConfigurationException if there is a problem with resource
+ * file parsing.
+ * @throws DatasourceAlreadyExistsException if the required data source
+ * already exists in resource file.
+ */
+ private static ApplicationScopedResourcesUtils.ResourceFileDescription resourceFileForDSCreation(
+ final String jndiName, final String url, final String username,
+ final String password, final String driver, final J2eeModule module,
+ final PayaraVersion version,final ConnectionPoolFinder cpFinder
+ ) throws ConfigurationException, DatasourceAlreadyExistsException {
+ Pair<File, Boolean> pair = PayaraConfiguration.getExistingResourceFile(module, version);
+ File file = pair == null ? null : pair.first();
+ if (file != null && file.exists()) {
+ final DuplicateJdbcResourceFinder jdbcFinder
+ = new DuplicateJdbcResourceFinder(jndiName);
+ final JndiNamespaceFinder namespaceFinder = new JndiNamespaceFinder();
+ List<TreeParser.Path> pathList = new ArrayList<>();
+ pathList.add(new TreeParser.Path("/resources/jdbc-resource",
+ new ProxyNodeReader(jdbcFinder, namespaceFinder))); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/jdbc-connection-pool",
+ new ProxyNodeReader(cpFinder, namespaceFinder))); // NOI18N
+
+ pathList.add(new TreeParser.Path("/resources/custom-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/mail-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/admin-object-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-connection-pool", namespaceFinder)); // NOI18N
+ try {
+ TreeParser.readXml(file, pathList);
+ if(jdbcFinder.isDuplicate()) {
+ throw new DatasourceAlreadyExistsException(new SunDatasource(
+ jndiName, url, username, password, driver));
+ }
+ } catch(IllegalStateException ex) {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.INFO, ex.getLocalizedMessage(), ex);
+ throw new ConfigurationException(ex.getLocalizedMessage(), ex);
+ }
+ return new ResourceFileDescription(file, pair.second(), namespaceFinder.getNamespaces());
+ }
+ pair = PayaraConfiguration.getNewResourceFile(module, version);
+ return new ResourceFileDescription(pair.first(), pair.second(), Collections.<String>emptySet());
+ }
+
+ /**
+ * Create a data source (jdbc-resource and jdbc-connection-pool) and add it
+ * to sun-resources.xml in the specified resource folder.
+ *
+ * @param jndiName Data source JNDI name.
+ * @param url Database URL.
+ * @param username Database user name.
+ * @param password Database user password.
+ * @param driver Database JDBC driver.
+ * @param module Java EE module (project).
+ * @param version Payara server version.
+ * @return New {@link Datasource} object.
+ * @throws ConfigurationException if there is a problem with resource
+ * file parsing.
+ * @throws DatasourceAlreadyExistsException if the required data source
+ * already exists in resource file.
+ */
+ public static Datasource createDataSource(
+ final String jndiName, final String url, final String username,
+ final String password, final String driver,
+ final J2eeModule module, final PayaraVersion version
+ ) throws ConfigurationException, DatasourceAlreadyExistsException {
+ SunDatasource ds;
+ ConnectionPoolFinder cpFinder = new ConnectionPoolFinder();
+
+ ResourceFileDescription fileDesc = resourceFileForDSCreation(
+ jndiName, url, username, password, driver, module, version, cpFinder);
+
+ File xmlFile = fileDesc.getFile();
+ try {
+ String vendorName = VendorNameMgr.vendorNameFromDbUrl(url);
+ if(vendorName == null) {
+ vendorName = jndiName;
+ } else {
+ if("derby_embedded".equals(vendorName)) {
+ // !PW FIXME display as dialog warning?
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Embedded derby not supported as a datasource");
+ return null;
+ }
+ }
+
+ // Is there a connection pool we can reuse, or do we need to create one?
+ String defaultPoolName = computePoolName(url, vendorName, username);
+ Map<String, CPool> pools = cpFinder.getPoolData();
+ CPool defaultPool = pools.get(defaultPoolName);
+
+ String poolName = null;
+ if(defaultPool != null && isSameDatabaseConnection(defaultPool, url, username, password)) {
+ poolName = defaultPoolName;
+ } else {
+ for(CPool pool: pools.values()) {
+ if(isSameDatabaseConnection(pool, url, username, password)) {
+ poolName = pool.getPoolName();
+ break;
+ }
+ }
+ }
+
+ if (poolName == null) {
+ poolName = defaultPool == null ? defaultPoolName : generateUniqueName(defaultPoolName, pools.keySet());
+ createConnectionPool(xmlFile, poolName, url, username, password, driver);
+ }
+
+ fileDesc = checkNamespaces(module, fileDesc, JndiNamespacesDefinition.getNamespace(jndiName));
+ String realJndiName = getJndiName(jndiName, fileDesc);
+
+ // create jdbc resource
+ createJdbcResource(xmlFile, realJndiName, poolName);
+
+ ds = new SunDatasource(realJndiName, url, username, password, driver, fileDesc.isIsApplicationScoped(), null);
+ } catch(IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ throw new ConfigurationException(ex.getLocalizedMessage(), ex);
+ }
+
+ return ds;
+ }
+
+ /**
+ * Parse resource file and build <code>Datasource</code> objects from it.
+ * <p/>
+ * For Payara server version 4 and higher new Java EE 7
+ * <<code>comp/DefaultDataSource</code> data source is added if default
+ * <code>jdbc/__default</code> data source exists. This does not apply
+ * to calls with <code>null</code> value of <code>version</code> attribute.
+ * <p/>
+ * @param xmlFile Resource file to be read. This file must exists, and must
+ * be readable regular file containing XML.
+ * @param xPathPrefix XML path prefix,
+ * @param resourcesDir Directory containing resource files.
+ * @param version Payara server version to determine if Java EE 7
+ * new data source shall be added.
+ * @return Data sources found in resource file.
+ */
+ private static Set<Datasource> readDatasources(
+ final File xmlFile, final String xPathPrefix,
+ final J2eeModule module, final PayaraVersion version, boolean applicationScoped) {
+ final Set<Datasource> dataSources = new HashSet<>();
+
+ if (xmlFile.canRead()) {
+ final List<JdbcResource> jdbcResources = new LinkedList<>();
+ final Map<String, ConnectionPool> connectionPoolMap = new HashMap<>();
+
+ final JndiNamespaceFinder namespaceFinder = new JndiNamespaceFinder();
+ final List<TreeParser.Path> pathList = new ArrayList<>();
+ pathList.add(new TreeParser.Path(xPathPrefix + "resources/jdbc-resource",
+ new ProxyNodeReader(new JdbcReader(jdbcResources), namespaceFinder)));
+ pathList.add(new TreeParser.Path(xPathPrefix + "resources/jdbc-connection-pool",
+ new ProxyNodeReader(new ConnectionPoolReader(connectionPoolMap), namespaceFinder)));
+
+ pathList.add(new TreeParser.Path("/resources/custom-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/mail-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/admin-object-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-resource", namespaceFinder)); // NOI18N
+ pathList.add(new TreeParser.Path("/resources/connector-connection-pool", namespaceFinder)); // NOI18N
+ try {
+ TreeParser.readXml(xmlFile, pathList);
+ } catch(IllegalStateException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, ex.getLocalizedMessage(), ex);
+ }
+
+ ApplicationScopedResourcesUtils.ResourceFileDescription fileDesc = new ApplicationScopedResourcesUtils.ResourceFileDescription(
+ xmlFile, applicationScoped, namespaceFinder.getNamespaces());
+ JndiNameResolver resolver = applicationScoped && module != null ? new UserResolver(module, fileDesc) : null;
+ for (JdbcResource jdbc : jdbcResources) {
+ final ConnectionPool pool = connectionPoolMap.get(jdbc.getPoolName());
+ if (pool != null) {
+ try {
+ pool.normalize();
+
+ // add to sun datasource list
+ final String url = pool.getProperty("URL"); //NOI18N
+ final String username = pool.getProperty("User"); //NOI18N
+ final String password = pool.getProperty("Password"); //NOI18N
+ final String driverClassName = pool.getProperty("driverClass"); //NOI18N
+
+ final SunDatasource dataSource = new SunDatasource(
+ jdbc.getJndiName(), url, username, password, driverClassName, applicationScoped, resolver);
+ dataSources.add(dataSource);
+ // Add Java EE 7 comp/DefaultDataSource data source
+ // as jdbc/__default clone (since PF 4).
+ if (version != null && version.ordinal()
+ >= PayaraVersion.PF_4_1_144.ordinal()
+ && DataSourcesReader.DEFAULT_DATA_SOURCE
+ .equals(jdbc.getJndiName()) ) {
+ dataSources.add(dataSource.copy(
+ DataSourcesReader.DEFAULT_DATA_SOURCE_EE7));
+ }
+ } catch (NullPointerException npe) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, pool.toString(), npe);
+ }
+ }
+ }
+ }
+ return dataSources;
+ }
+
+ private static class JdbcResource {
+
+ private final String jndiName;
+ private final String poolName;
+
+ public JdbcResource(String jndiName) {
+ this(jndiName, "");
+ }
+
+ public JdbcResource(String jndiName, String poolName) {
+ this.jndiName = jndiName;
+ this.poolName = poolName;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+ }
+
+ private static class JdbcReader extends TreeParser.NodeReader {
+
+ private final List<JdbcResource> resources;
+
+ public JdbcReader(List<JdbcResource> resources) {
+ this.resources = resources;
+ }
+
+ // <jdbc-resource
+ // enabled="true"
+ // pool-name="DerbyPool"
+ // jndi-name="jdbc/__default"
+ // object-type="user" />
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String type = attributes.getValue("object-type");
+
+ String jndiName = attributes.getValue("jndi-name");
+ String poolName = attributes.getValue("pool-name");
+ if(jndiName != null && jndiName.length() > 0 &&
+ poolName != null && poolName.length() > 0) {
+ // add to jdbc resource list
+ resources.add(
+ new JdbcResource(jndiName, poolName));
+ }
+ }
+ }
+
+ private static class ConnectionPool {
+
+ private final Map<String, String> properties;
+
+ public ConnectionPool(String poolName) {
+ this.properties = new HashMap<>();
+ }
+
+ public void setProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ public void normalize() {
+ DbUtil.normalizePoolMap(properties);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Hk2DatasourceManager$ConnectionPool[");
+ for (Entry<String,String> e : properties.entrySet()) {
+ sb.append(e.getKey());
+ sb.append("=");
+ sb.append(e.getValue());
+ sb.append("--%%--");
+ }
+ return sb.append("]").toString();
+ }
+
+ }
+
+ private static class ConnectionPoolReader extends TreeParser.NodeReader {
+
+ private Map<String, ConnectionPool> resourceMap;
+ private ConnectionPool currentPool;
+
+ public ConnectionPoolReader(Map<String, ConnectionPool> resourceMap) {
+ this.resourceMap = resourceMap;
+ }
+
+ //<jdbc-connection-pool
+ // datasource-classname="org.apache.derby.jdbc.ClientDataSource"
+ // name="DerbyPool"
+ // res-type="javax.sql.DataSource"
+ // <property name="PortNumber" value="1527" />
+ // <property name="Password" value="APP" />
+ // <property name="User" value="APP" />
+ // <property name="serverName" value="localhost" />
+ // <property name="DatabaseName" value="sun-appserv-samples" />
+ // <property name="connectionAttributes" value=";create=true" />
+ //</jdbc-connection-pool>
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String poolName = attributes.getValue("name");
+ if(poolName != null && poolName.length() > 0) {
+ currentPool = new ConnectionPool(poolName);
+ currentPool.setProperty("dsClassName", attributes.getValue("datasource-classname"));
+ currentPool.setProperty("resType", attributes.getValue("res-type"));
+ resourceMap.put(poolName, currentPool);
+ } else {
+ currentPool = null;
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ if(currentPool != null) {
+ String key = attributes.getValue("name");
+ if(key != null && key.length() > 0) {
+ currentPool.setProperty(key, attributes.getValue("value"));
+ }
+ }
+ }
+ }
+
+ private static String generateUniqueName(String prefix, Set<String> keys) {
+ for(int i = 1; ; i++) {
+ String candidate = prefix + "_" + i; // NOI18N
+ if(!keys.contains(candidate)) {
+ return candidate;
+ }
+ }
+ }
+
+ private static boolean isSameDatabaseConnection(final CPool pool, final String url,
+ final String username, final String password) {
+ boolean result = false;
+ boolean matchedSettings;
+
+ UrlData urlData = new UrlData(url);
+ if(DbUtil.strEmpty(pool.getUrl())) {
+ matchedSettings = DbUtil.strEquivalent(urlData.getHostName(), pool.getHostname()) &&
+ DbUtil.strEquivalent(urlData.getPort(), pool.getPort()) &&
+ DbUtil.strEquivalent(urlData.getDatabaseName(), pool.getDatabaseName()) &&
+ DbUtil.strEquivalent(urlData.getSid(), pool.getSid());
+ } else {
+ matchedSettings = DbUtil.strEquivalent(url, pool.getUrl());
+ }
+
+ if(matchedSettings) {
+ if(DbUtil.strEquivalent(username, pool.getUsername()) &&
+ DbUtil.strEquivalent(password, pool.getPassword())) {
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ private static final String CP_TAG_1 =
+ " <jdbc-connection-pool " +
+ "allow-non-component-callers=\"false\" " +
+ "associate-with-thread=\"false\" " +
+ "connection-creation-retry-attempts=\"0\" " +
+ "connection-creation-retry-interval-in-seconds=\"10\" " +
+ "connection-leak-reclaim=\"false\" " +
+ "connection-leak-timeout-in-seconds=\"0\" " +
+ "connection-validation-method=\"auto-commit\" ";
+
+// "datasource-classname=\"org.postgresql.ds.PGSimpleDataSource\" " +
+ private static final String ATTR_DATASOURCE_CLASSNAME = "datasource-classname";
+ private static final String CP_TAG_2 =
+ "fail-all-connections=\"false\" " +
+ "idle-timeout-in-seconds=\"300\" " +
+ "is-connection-validation-required=\"false\" " +
+ "is-isolation-level-guaranteed=\"true\" " +
+ "lazy-connection-association=\"false\" " +
+ "lazy-connection-enlistment=\"false\" " +
+ "match-connections=\"false\" " +
+ "max-connection-usage-count=\"0\" " +
+ "max-pool-size=\"32\" " +
+ "max-wait-time-in-millis=\"60000\" ";
+// "name=\"sawhorse-pool\" " +
+ private static final String ATTR_POOL_NAME = "name";
+ private static final String CP_TAG_3 =
+ "non-transactional-connections=\"false\" " +
+ "pool-resize-quantity=\"2\" ";
+// "res-type=\"javax.sql.DataSource\" " +
+ private static final String ATTR_RES_TYPE = "res-type";
+ private static final String CP_TAG_4 =
+ "statement-timeout-in-seconds=\"-1\" " +
+ "steady-pool-size=\"8\" " +
+ "validate-atmost-once-period-in-seconds=\"0\" " +
+ "wrap-jdbc-objects=\"false\">\n";
+ private static final String PROP_SERVER_NAME = "serverName";
+ private static final String PROP_PORT_NUMBER = "portNumber";
+ private static final String PROP_DATABASE_NAME = "databaseName";
+ private static final String PROP_USER = "User";
+ private static final String PROP_PASSWORD = "Password";
+ private static final String PROP_URL = "URL";
+ private static final String PROP_DRIVER_CLASS = "driverClass";
+ private static final String CP_TAG_5 = " </jdbc-connection-pool>\n";
+
+ private static final String RESTYPE_DATASOURCE = "javax.sql.DataSource";
+
+ public static void createConnectionPool(File sunResourcesXml, String poolName,
+ String url, String username, String password, String driver) throws IOException {
+
+// <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGSimpleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="sawhorse-pool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
+// <property name="serverName" value="localhost"/>
+// <property name="portNumber" value="5432"/>
+// <property name="databaseName" value="cookbook2_development"/>
+// <property name="User" value="cookbook2"/>
+// <property name="Password" value="cookbook2"/>
+// <property name="URL" value="jdbc:postgresql://localhost:5432/cookbook2_development"/>
+// <property name="driverClass" value="org.postgresql.Driver"/>
+// </jdbc-connection-pool>
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = null;
+ Document doc = null;
+ try {
+ docBuilder = docFactory.newDocumentBuilder();
+ docBuilder.setEntityResolver(DDResolver.getInstance());
+ doc = readResourceFile(docBuilder, sunResourcesXml);
+ } catch (ParserConfigurationException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+
+ if (doc == null || docBuilder == null) return;
+ NodeList resourcesNodes = doc.getElementsByTagName("resources");//NOI18N
+ Node resourcesNode;
+ if(resourcesNodes.getLength()<1){
+ resourcesNode = doc.createElement("resources");//NOI18N
+ doc.getDocumentElement().appendChild(resourcesNode);
+ } else {
+ resourcesNode = resourcesNodes.item(0);
+ }
+ Node newPool;
+ try {
+ newPool = resourcesNode.appendChild(doc.importNode(docBuilder.parse(new InputSource(new StringReader(CP_TAG_1+CP_TAG_2+CP_TAG_3+CP_TAG_4+CP_TAG_5))).getDocumentElement(), true));
+ UrlData urlData = new UrlData(url);
+
+ // Maybe move this logic into UrlData?
+ String dsClassName = computeDataSourceClassName(url, driver);
+
+ appendAttr(doc, newPool, ATTR_DATASOURCE_CLASSNAME, dsClassName, false);
+ appendAttr(doc, newPool, ATTR_POOL_NAME, poolName, true);
+ appendAttr(doc, newPool, ATTR_RES_TYPE, RESTYPE_DATASOURCE, true);
+ appendProperty(doc, newPool, PROP_SERVER_NAME, urlData.getHostName(), true);
+ appendProperty(doc, newPool, PROP_PORT_NUMBER, urlData.getPort(), false);
+ appendProperty(doc, newPool, PROP_DATABASE_NAME, urlData.getDatabaseName(), false);
+ appendProperty(doc, newPool, PROP_USER, username, true);
+ // blank password is ok so check just null here and pass force=true.
+ if(password != null) {
+ appendProperty(doc, newPool, PROP_PASSWORD, password, true);
+ }
+ appendProperty(doc, newPool, PROP_URL, url, true);
+ appendProperty(doc, newPool, PROP_DRIVER_CLASS, driver, true);
+
+ Logger.getLogger("payara-jakartaee").log(Level.FINER,
+ "New connection pool resource:\n{0}", newPool.getTextContent());
+ } catch (SAXException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+
+ writeXmlResourceToFile(sunResourcesXml, doc);
+ }
+
+ private static String computeDataSourceClassName(String url, String driver) {
+ String vendorName = VendorNameMgr.vendorNameFromDbUrl(url);
+ String dsClassName = VendorNameMgr.dsClassNameFromVendorName(vendorName);
+
+ if(dsClassName == null || dsClassName.length() == 0) {
+ dsClassName = DriverMaps.getDSClassName(url);
+ if(dsClassName == null || dsClassName.length() == 0) {
+ dsClassName = driver;
+ }
+ }
+
+ return dsClassName;
+ }
+
+ private static String computePoolName(String url, String vendorName, String username){
+ UrlData urlData = new UrlData(url);
+ StringBuilder poolName = new StringBuilder(vendorName);
+ String dbName = getDatabaseName(urlData);
+ if (dbName != null) {
+ poolName.append("_").append(dbName); //NOI18N
+ }
+ if (username != null) {
+ poolName.append("_").append(username); //NOI18N
+ }
+ poolName.append("Pool"); //NOI18N
+ return poolName.toString();
+ }
+
+ private static String getDatabaseName(UrlData urlData) {
+ String databaseName = urlData.getDatabaseName();
+ if (databaseName == null) {
+ databaseName = urlData.getAlternateDBName();
+ }
+
+ return databaseName;
+ }
+
+ private static final String JDBC_TAG_1 =
+ " <jdbc-resource " +
+ "enabled=\"true\" ";
+ // pool-name="DerbyPool"
+ private static final String ATTR_POOLNAME = "pool-name";
+ // jndi-name="jdbc/__default"
+ private static final String ATTR_JNDINAME = "jndi-name";
+ private static final String JDBC_TAG_2 =
+ " object-type=\"user\"/>\n";
+
+ public static void createJdbcResource(File sunResourcesXml, String jndiName, String poolName) throws IOException {
+
+ // <jdbc-resource
+ // enabled="true"
+ // pool-name="DerbyPool"
+ // jndi-name="jdbc/__default"
+ // object-type="user" />
+
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = null;
+ Document doc = null;
+ try {
+ docBuilder = docFactory.newDocumentBuilder();
+ docBuilder.setEntityResolver(DDResolver.getInstance());
+ doc = readResourceFile(docBuilder, sunResourcesXml);
+ } catch (ParserConfigurationException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ if (doc == null || docBuilder == null) {
+ return;
+ }
+ NodeList resourcesNodes = doc.getElementsByTagName("resources");//NOI18N
+ Node resourcesNode = null;
+ if(resourcesNodes.getLength()<1){
+ throw new IOException("Malformed XML");
+ } else {
+ resourcesNode = resourcesNodes.item(0);
+ }
+ Node newJdbcRes;
+ try {
+ newJdbcRes = resourcesNode.appendChild(doc.importNode(
+ docBuilder.parse(new InputSource(new StringReader(JDBC_TAG_1+JDBC_TAG_2))).getDocumentElement(), true));
+ appendAttr(doc, newJdbcRes, ATTR_POOLNAME, poolName, true);
+ appendAttr(doc, newJdbcRes, ATTR_JNDINAME, jndiName, true);
+
+ Logger.getLogger("payara-jakartaee").log(Level.FINER,
+ "New JDBC resource:\n{0}", newJdbcRes.getTextContent());
+ } catch (SAXException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ writeXmlResourceToFile(sunResourcesXml, doc);
+ }
+
+ private static void appendAttr(Document doc, Node node, String name, String value, boolean force) {
+ if(force || (name != null && name.length() > 0)) {
+ Attr attr = doc.createAttribute(name);
+ attr.setValue(value);
+ NamedNodeMap attrs = node.getAttributes();
+ attrs.setNamedItem(attr);
+ }
+ }
+
+ private static void appendProperty(Document doc, Node node, String name, String value, boolean force) {
+ if(force || (value != null && value.length() > 0)) {
+ Node newProperty = doc.createElement("property");//NOI18N
+ Attr nameAttr = doc.createAttribute("name");//NOI18N
+ nameAttr.setValue(name);
+ Attr valueAttr = doc.createAttribute("value");//NOI18N
+ valueAttr.setValue(value);
+ NamedNodeMap attrs = newProperty.getAttributes();
+ attrs.setNamedItem(nameAttr);
+ attrs.setNamedItem(valueAttr);
+ node.appendChild(newProperty);
+ }
+ }
+
+ private static final String SUN_RESOURCES_XML_HEADER =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<!DOCTYPE resources PUBLIC " +
+ "\"-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN\" " +
+ "\"http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd\">\n" +
+ "<resources/>";
+
+ private static final String GF_RESOURCES_XML_HEADER =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<!DOCTYPE resources PUBLIC " +"\"-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN\" " +
+ "\"http://glassfish.org/dtds/glassfish-resources_1_5.dtd\">\n" +
+// "\"-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN\" " +
+// "\"http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd\">\n" +
+ "<resources/>";
+
+ private static Document readResourceFile(DocumentBuilder docBuilder, File sunResourcesXml) throws IOException{
+ boolean newOne = false;
+ if(!sunResourcesXml.exists()){
+ FileUtil.createData(sunResourcesXml);//ensure file exist
+ newOne = true;
+ }
+ Document doc = null;
+ try {
+ if(newOne) {
+ if (sunResourcesXml.getAbsolutePath().contains("sun-resources.xml"))
+ doc = docBuilder.parse(new InputSource(new StringReader(SUN_RESOURCES_XML_HEADER)));
+ else
+ doc = docBuilder.parse(new InputSource(new StringReader(GF_RESOURCES_XML_HEADER)));
+ }
+ else {
+ doc = docBuilder.parse(sunResourcesXml);
+ }
+ } catch (SAXException ex) {
+ throw new IOException("Malformed XML: " +ex.getMessage());
+ }
+
+ return doc;
+ }
+
+
+ private static void writeXmlResourceToFile(final File sunResourcesXml, final Document doc) throws IOException {
+
+ FileObject parentFolder = FileUtil.createFolder(sunResourcesXml.getParentFile());
+ FileSystem fs = parentFolder.getFileSystem();
+
+ fs.runAtomicAction(new FileSystem.AtomicAction() {
+ @Override
+ public void run() throws IOException {
+ FileLock lock = null;
+ OutputStream os = null;
+ try {
+ FileObject sunResourcesFO = FileUtil.createData(sunResourcesXml);
+ lock = sunResourcesFO.lock();
+ os = sunResourcesFO.getOutputStream(lock);
+
+ XMLUtil.write(doc, os, doc.getXmlEncoding());
+ } finally {
+ if(os !=null ){
+ os.close();
+ }
+ if(lock != null) {
+ lock.releaseLock();
+ }
+ }
+ }
+ });
+ }
+
+ private static class UserResolver implements JndiNameResolver {
+
+ private final J2eeModule module;
+
+ private ApplicationScopedResourcesUtils.ResourceFileDescription fileDesc;
+
+ public UserResolver(J2eeModule module, ApplicationScopedResourcesUtils.ResourceFileDescription fileDesc) {
+ this.module = module;
+ this.fileDesc = fileDesc;
+ }
+
+ @Override
+ public synchronized String resolveJndiName(String jndiName) {
+ fileDesc = ApplicationScopedResourcesUtils.checkNamespaces(module, fileDesc,
+ JndiNamespacesDefinition.getNamespace(jndiName));
+ String jndi = ApplicationScopedResourcesUtils.getJndiName(jndiName, fileDesc);
+ return jndi;
+ }
+ }
+
+ private static class DuplicateJdbcResourceFinder extends TreeParser.NodeReader {
+
+ private final String targetJndiName;
+ private boolean duplicate;
+ private String poolName;
+
+ public DuplicateJdbcResourceFinder(String jndiName) {
+ targetJndiName = jndiName;
+ duplicate = false;
+ poolName = null;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String jndiName = attributes.getValue("jndi-name");
+ if(targetJndiName.equals(jndiName)) {
+ if(duplicate) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Duplicate jndi-names defined for JDBC resources.");
+ }
+ duplicate = true;
+ poolName = attributes.getValue("pool-name");
+ }
+ }
+
+ public boolean isDuplicate() {
+ return duplicate;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+
+ }
+
+ private static class ConnectionPoolFinder extends TreeParser.NodeReader {
+
+ private Map<String, String> properties = null;
+ private Map<String, CPool> pools = new HashMap<>();
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ properties = new HashMap<>();
+
+ String poolName = attributes.getValue("name");
+ if(poolName != null && poolName.length() > 0) {
+ if(!pools.containsKey(poolName)) {
+ properties.put("name", poolName);
+ } else {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,
+ "Duplicate pool-names defined for JDBC Connection Pools.");
+ }
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ if (null != attributes && null != properties) {
+ String key = attributes.getValue("name"); // NOI18N
+ if(key != null && key.length() > 0) {
+ properties.put(key.toLowerCase(Locale.ENGLISH), attributes.getValue("value")); // NOI18N
+ }
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ String poolName = properties.get("name");
+ CPool pool = new CPool(
+ poolName,
+ properties.get("url"),
+ properties.get("servername"),
+ properties.get("portnumber"),
+ properties.get("databasename"),
+ properties.get("user"),
+ properties.get("password"),
+ properties.get("connectionattributes")
+ );
+ pools.put(poolName, pool);
+ }
+
+ public List<String> getPoolNames() {
+ return new ArrayList<>(pools.keySet());
+ }
+
+ public Map<String, CPool> getPoolData() {
+ return Collections.unmodifiableMap(pools);
+ }
+
+ }
+
+ private static class CPool {
+
+ private final String poolName;
+ private final String url;
+ private final String hostname;
+ private final String port;
+ private final String databaseName;
+ private final String username;
+ private final String password;
+ private final String sid;
+
+ public CPool(String poolName, String url, String hostName, String port,
+ String databaseName, String username, String password, String sid) {
+ this.poolName = poolName;
+ this.url = url;
+ this.hostname = hostName;
+ this.port = port;
+ this.databaseName = databaseName;
+ this.username = username;
+ this.password = password;
+ this.sid = sid;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getDatabaseName() {
+ return databaseName;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public String getSid() {
+ return sid;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ }
+
+ private static class JndiNamespaceFinder extends TreeParser.NodeReader {
+
+ private final Set<String> namespaces = new HashSet<>();
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ String jndiName = attributes.getValue("jndi-name");
+ if (jndiName == null) {
+ jndiName = attributes.getValue("name");
+ }
+ if (jndiName != null) {
+ String ns = JndiNamespacesDefinition.getNamespace(jndiName);
+ if (ns != null) {
+ namespaces.add(ns);
+ }
+ }
+ }
+
+ public Set<String> getNamespaces() {
+ return namespaces;
+ }
+ }
+
+ private static class ProxyNodeReader extends TreeParser.NodeReader {
+
+ private final TreeParser.NodeReader[] readers;
+
+ public ProxyNodeReader(TreeParser.NodeReader... readers) {
+ this.readers = readers;
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ for (TreeParser.NodeReader r : readers) {
+ r.endNode(qname);
+ }
+ }
+
+ @Override
+ public void readCData(String qname, char[] ch, int start, int length) throws SAXException {
+ for (TreeParser.NodeReader r : readers) {
+ r.readCData(qname, ch, start, length);
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws SAXException {
+ for (TreeParser.NodeReader r : readers) {
+ r.readChildren(qname, attributes);
+ }
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ for (TreeParser.NodeReader r : readers) {
+ r.readAttributes(qname, attributes);
+ }
+ }
+ }
+
+ private static class DDResolver implements EntityResolver {
+ static DDResolver resolver;
+ static synchronized DDResolver getInstance() {
+ if (resolver==null) {
+ resolver=new DDResolver();
+ }
+ return resolver;
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) {
+
+ String resource=null;
+ // return a proper input source
+ if (systemId!=null && systemId.endsWith("sun-resources_1_3.dtd")) {
+ resource="/org/netbeans/modules/j2ee/sun/dd/impl/resources/sun-resources_1_3.dtd"; //NOI18N
+ }
+ if (systemId!=null && systemId.endsWith("glassfish-resources_1_5.dtd")) {
+ resource="/org/netbeans/modules/j2ee/sun/dd/impl/resources/glassfish-resources_1_5.dtd"; //NOI18N
+ }
+
+ if (resource==null) {
+ return null;
+ }
+ java.net.URL url = RootInterface.class.getResource(resource);
+ return new InputSource(url.toString());
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCConnectionPool.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCConnectionPool.java
new file mode 100644
index 0000000..1a9291a
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCConnectionPool.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.db;
+
+import org.netbeans.modules.payara.tooling.utils.StringPrefixTree;
+
+/**
+ * Payara JDBC connection pool server property content.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JDBCConnectionPool {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Recognized properties in JDBC connection pool.
+ */
+ public enum PropertyType {
+
+ /** Unknown JDBC connection pool property. */
+ UNKNOWN,
+
+ /** JDBC resource user name. */
+ USER,
+
+ /** JDBC resource password. */
+ PASSWORD,
+
+ /** JDBC resource driver class. */
+ DRIVER_CLASS,
+
+ /** JDBC resource URL. */
+ URL,
+
+ /** JDBC resource database name. */
+ DATABASE_NAME,
+
+ /** JDBC resource server host name. */
+ SERVER_NAME,
+
+ /** JDBC resource server port name. */
+ PORT_NUMBER;
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String UNKNOWN_STR = "UNKNOWN";
+
+ /** A <code>String</code> representation of USER value. */
+ private static final String USER_STR = "User";
+
+ /** A <code>String</code> representation of PASSWORD value. */
+ private static final String PASSWORD_STR = "Password";
+
+ /** A <code>String</code> representation of DRIVER_CLASS value. */
+ private static final String DRIVER_CLASS_STR = "DriverClass";
+
+ /** A <code>String</code> representation of URL value. */
+ private static final String URL_STR = "URL";
+
+ /** A <code>String</code> representation of DATABASE_NAME value. */
+ private static final String DATABASE_NAME_STR = "DatabaseName";
+
+ /** A <code>String</code> representation of SERVER_NAME value. */
+ private static final String SERVER_NAME_STR = "ServerName";
+
+ /** A <code>String</code> representation of PORT_NUMBER value. */
+ private static final String PORT_NUMBER_STR = "PortNumber";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final StringPrefixTree<PropertyType> stringValues
+ = new StringPrefixTree<>(false);
+
+ static {
+ stringValues.add(USER.toString(), USER);
+ stringValues.add(PASSWORD.toString(), PASSWORD);
+ stringValues.add(DRIVER_CLASS.toString(), DRIVER_CLASS);
+ stringValues.add(URL.toString(), URL);
+ stringValues.add(DATABASE_NAME.toString(), DATABASE_NAME);
+ stringValues.add(SERVER_NAME.toString(), SERVER_NAME);
+ stringValues.add(PORT_NUMBER.toString(), PORT_NUMBER);
+ }
+
+ /**
+ * Returns a <code>Properties</code> with a value represented
+ * by the specified <code>String</code>.
+ * <p/>
+ * The <code>Properties</code> returned represents existing value
+ * only if specified <code>String</code> matches any <code>String</code>
+ * returned by <code>toString</code> method. Otherwise <code>null</code>
+ * value is returned.
+ * <p>
+ * @param name Value containing <code>Properties</code>
+ * <code>toString</code> representation.
+ * @return <code>Properties</code> value represented
+ * by <code>String</code> or <code>UNKNOWN</code> if value
+ * was not recognized.
+ */
+ public static PropertyType toValue(final String name) {
+ if (name != null) {
+ PropertyType type = stringValues.match(name.toLowerCase());
+ return type != null ? type : UNKNOWN;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Convert <code>Properties</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case UNKNOWN: return UNKNOWN_STR;
+ case USER: return USER_STR;
+ case PASSWORD: return PASSWORD_STR;
+ case DRIVER_CLASS: return DRIVER_CLASS_STR;
+ case URL: return URL_STR;
+ case DATABASE_NAME: return DATABASE_NAME_STR;
+ case SERVER_NAME: return SERVER_NAME_STR;
+ case PORT_NUMBER: return PORT_NUMBER_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default:
+ throw new IllegalStateException(
+ "Invalid ResourceType value");
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** User property value. */
+ private String user;
+
+ /** Password value. */
+ private String password;
+
+ /** Driver class value. */
+ private String driverClass;
+
+ /** Resource URL. */
+ private String url;
+
+ /** Database name. */
+ private String databaseName;
+
+ /** Server host name. */
+ private String serverName;
+
+ /** Server host port. Negative value (usually <code>-1</code>)
+ * represents <code>null</code>. */
+ private int port;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of JDBC connection pool content with no values set.
+ */
+ public JDBCConnectionPool() {
+ this.user = null;
+ this.password = null;
+ this.driverClass = null;
+ this.url = null;
+ this.databaseName = null;
+ this.serverName = null;
+ this.port = -1;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get user property value.
+ * <p/>
+ * @return User property value.
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * Get password property value.
+ * <p/>
+ * @return Password value.
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Get driver class property value.
+ * <p/>
+ * @return Driver class value.
+ */
+ public String getDriverClass() {
+ return driverClass;
+ }
+
+ /**
+ * Get resource URL property value.
+ * <p/>
+ * @return Resource URL.
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * Get database name property value.
+ * <p/>
+ * @return Database name.
+ */
+ public String getDatabaseName() {
+ return databaseName;
+ }
+
+ /**
+ * Get server host name property value.
+ * <p/>
+ * @return Server host name.
+ */
+ public String getServerName() {
+ return serverName;
+ }
+
+ /**
+ * Get server host port property value.
+ * <p/>
+ * Negative value (usually <code>-1</code>) represents <code>null</code>.
+ * <p/>
+ * @return Server host port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set property value depending on {@link Properties} type
+ * <code>enum</code> value.
+ * <p/>
+ * @return Value of <code>true</code> if property was set
+ * or <code>false</code> otherwise (what means that
+ * {@link Properties} type value vas <code>UNKNOWN</code>.
+ */
+ public boolean setProperty(PropertyType type, String value) {
+ switch (type) {
+ case USER:
+ this.user = value;
+ return true;
+ case PASSWORD:
+ this.password = value;
+ return true;
+ case DRIVER_CLASS:
+ this.driverClass = value;
+ return true;
+ case URL:
+ this.url = value;
+ return true;
+ case DATABASE_NAME:
+ this.databaseName = value;
+ return true;
+ case SERVER_NAME:
+ this.serverName = value;
+ return true;
+ case PORT_NUMBER:
+ try {
+ this.port = Integer.parseInt(value);
+ return true;
+ } catch (NumberFormatException nfe) {
+ this.port = -1;
+ return false;
+ }
+ default:
+ return false;
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCResource.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCResource.java
new file mode 100644
index 0000000..ca466bc
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JDBCResource.java
@@ -0,0 +1,375 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.db;
+
+import org.netbeans.modules.payara.tooling.utils.StringPrefixTree;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+
+/**
+ * Payara JDBC resource (data source) server property content.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JDBCResource implements Datasource {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Recognized attributes in JDBC resource.
+ */
+ public enum AttrType {
+
+ /** Unknown JDBC resource attribute. */
+ UNKNOWN,
+
+ /** Resource JNDI name. */
+ JNDI_NAME,
+
+ /** Resource object type. */
+ OBJECT_TYPE,
+
+ /** JDBC connection pool name. */
+ POOL_NAME,
+
+ /** Is this JDBC resource enabled? */
+ ENABLED,
+
+ /** Deployment order. */
+ DEPLOYMENT_ORDER;
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String UNKNOWN_STR = "UNKNOWN";
+
+ /** A <code>String</code> representation of JNDI_NAME value. */
+ private static final String JNDI_NAME_STR = "jndi-name";
+
+ /** A <code>String</code> representation of OBJECT_TYPE value. */
+ private static final String OBJECT_TYPE_STR = "object-type";
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String POOL_NAME_STR = "pool-name";
+
+ /** A <code>String</code> representation of ENABLED value. */
+ private static final String ENABLED_STR = "enabled";
+
+ /** A <code>String</code> representation of DEPLOYMENT_ORDER value. */
+ private static final String DEPLOYMENT_ORDER_STR = "deployment-order";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final StringPrefixTree<AttrType> stringValues
+ = new StringPrefixTree<>(false);
+
+ static {
+ stringValues.add(JNDI_NAME.toString(), JNDI_NAME);
+ stringValues.add(OBJECT_TYPE.toString(), OBJECT_TYPE);
+ stringValues.add(POOL_NAME.toString(), POOL_NAME);
+ stringValues.add(ENABLED.toString(), ENABLED);
+ stringValues.add(DEPLOYMENT_ORDER.toString(), DEPLOYMENT_ORDER);
+ }
+
+ /**
+ * Returns a <code>AttrType</code> with a value represented
+ * by the specified <code>String</code>.
+ * <p/>
+ * The <code>AttrType</code> returned represents existing value
+ * only if specified <code>String</code> matches any <code>String</code>
+ * returned by <code>toString</code> method. Otherwise <code>null</code>
+ * value is returned.
+ * <p>
+ * @param name Value containing <code>AttrType</code>
+ * <code>toString</code> representation.
+ * @return <code>AttrType</code> value represented
+ * by <code>String</code> or <code>UNKNOWN</code> if value
+ * was not recognized.
+ */
+ public static AttrType toValue(final String name) {
+ if (name != null) {
+ AttrType type = stringValues.match(name.toLowerCase());
+ return type != null ? type : UNKNOWN;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Convert <code>AttrType</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case UNKNOWN: return UNKNOWN_STR;
+ case JNDI_NAME: return JNDI_NAME_STR;
+ case OBJECT_TYPE: return OBJECT_TYPE_STR;
+ case POOL_NAME: return POOL_NAME_STR;
+ case ENABLED: return ENABLED_STR;
+ case DEPLOYMENT_ORDER: return DEPLOYMENT_ORDER_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default:
+ throw new IllegalStateException(
+ "Invalid ResourceType value");
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Resource JNDI name. */
+ private String jndiName;
+
+ /** Resource object type. */
+ private String objectType;
+
+ /** JDBC connection pool name. */
+ private String poolName;
+
+ /** Is this JDBC resource enabled? Default value is false. */
+ private boolean enabled;
+
+ /** Deployment order. Negative value (usually <code>-1</code>)
+ * represents <code>null</code>. */
+ private int deploymentOrder;
+
+ /** JDBC connection pool reference. */
+ private JDBCConnectionPool pool;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of JDBC resource (data source) content with
+ * no values set.
+ */
+ public JDBCResource() {
+ this.jndiName = null;
+ this.objectType = null;
+ this.poolName = null;
+ this.enabled = false;
+ this.deploymentOrder = -1;
+ this.pool = null;
+ }
+
+ /**
+ * Creates an instance of JDBC resource (data source) content with
+ * all values set.
+ * <p/>
+ * @param jndiName Resource JNDI name.
+ * @param objectType Resource object type.
+ * @param poolName JDBC connection pool name.
+ * @param enabled Is this JDBC resource enabled?
+ * @param deploymentOrder Deployment order.
+ * @param pool JDBC connection pool reference.
+ */
+ public JDBCResource(final String jndiName, final String objectType,
+ final String poolName, final boolean enabled,
+ final int deploymentOrder, final JDBCConnectionPool pool) {
+ this.jndiName = jndiName;
+ this.objectType = objectType;
+ this.poolName = poolName;
+ this.enabled = enabled;
+ this.deploymentOrder = deploymentOrder;
+ this.pool = pool;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Datasource interface getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get resource JNDI name.
+ * <p/>
+ * @return Resource JNDI name.
+ */
+ @Override
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ /**
+ * Get data source JNDI name.
+ * <p/>
+ * @return Data source JNDI name.
+ */
+ @Override
+ public String getDisplayName() {
+ return jndiName;
+ }
+
+ /**
+ * Get data source URL.
+ * <p/>
+ * @return Data source URL.
+ */
+ @Override
+ public String getUrl() {
+ return pool != null ? pool.getUrl() : null;
+ }
+
+ /**
+ * Get data source user name.
+ * <p/>
+ * @return Data source user name.
+ */
+ @Override
+ public String getUsername() {
+ return pool != null ? pool.getUser() : null;
+ }
+
+ /**
+ * Get data source user password.
+ * <p/>
+ * @return Data source user password.
+ */
+ @Override
+ public String getPassword() {
+ return pool != null ? pool.getPassword() : null;
+ }
+
+ /**
+ * Get data source driver class name.
+ * <p/>
+ * @return Data source driver class name.
+ */
+ @Override
+ public String getDriverClassName() {
+ return pool != null ? pool.getDriverClass() : null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get resource object type.
+ * <p/>
+ * @return Resource object type.
+ */
+ public String getObjectType() {
+ return objectType;
+ }
+
+ /**
+ * Get JDBC connection pool name.
+ * <p/>
+ * @return JDBC connection pool name.
+ */
+ public String getPoolName() {
+ return poolName;
+ }
+
+ /**
+ * Is this JDBC resource enabled? Default value is false.
+ * <p/>
+ * @return Is this JDBC resource enabled?
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Get deployment order.
+ * <p/>
+ * Negative value (usually <code>-1</code>) represents <code>null</code>.
+ * <p/>
+ * @return Deployment order.
+ */
+ public int getDeploymentOrder() {
+ return deploymentOrder;
+ }
+
+ /**
+ * Get JDBC connection pool reference.
+ * <p/>
+ * @return JDBC connection pool reference.
+ */
+ public JDBCConnectionPool getPool() {
+ return pool;
+ }
+
+ /**
+ * Set JDBC connection pool reference.
+ * <p/>
+ * @param pool JDBC connection pool reference.
+ */
+ public void setPool(JDBCConnectionPool pool) {
+ this.pool = pool;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set property value depending on {@link AttrType} type
+ * <code>enum</code> value.
+ * <p/>
+ * @return Value of <code>true</code> if property was set
+ * or <code>false</code> otherwise (what means that
+ * {@link Properties} type value vas <code>UNKNOWN</code>.
+ */
+ public boolean setProperty(AttrType type, String value) {
+ switch (type) {
+ case JNDI_NAME:
+ this.jndiName = value;
+ return true;
+ case OBJECT_TYPE:
+ this.objectType = value;
+ return true;
+ case POOL_NAME:
+ this.poolName = value;
+ return true;
+ case ENABLED:
+ this.enabled = Boolean.parseBoolean(value);
+ return true;
+ case DEPLOYMENT_ORDER:
+ try {
+ this.deploymentOrder = Integer.parseInt(value);
+ return true;
+ } catch (NumberFormatException nfe) {
+ this.deploymentOrder = -1;
+ return false;
+ }
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Create a copy of existing JDBC data source object with new JNDI name.
+ * <p/>
+ * @param jndiName JNDI name to be assigned to new JDBC data source
+ * copy.
+ */
+ public JDBCResource copy(final String jndiName) {
+ return new JDBCResource(
+ jndiName, this.objectType, this.poolName,
+ this.enabled, this.deploymentOrder, this.pool);
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JndiNameResolver.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JndiNameResolver.java
new file mode 100644
index 0000000..308bc11
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/JndiNameResolver.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.db;
+
+/**
+ *
+ * @author Petr Hejl
+ */
+public interface JndiNameResolver {
+
+ String resolveJndiName(String jndiName);
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/ResourcesHelper.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/ResourcesHelper.java
new file mode 100644
index 0000000..16bea8c
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/ResourcesHelper.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.admin.CommandCreateJDBCConnectionPool;
+import org.netbeans.modules.payara.tooling.admin.CommandCreateJDBCResource;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.payara.eecommon.api.DomainEditor;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule.ServerState;
+import org.netbeans.modules.payara.spi.ResourceDesc;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Nitya Doraisamy
+ */
+public class ResourcesHelper {
+
+ private static RequestProcessor RP = new RequestProcessor("Sample Datasource work");
+
+ public static void addSampleDatasource(final J2eeModule module , final DeploymentManager dmParam) {
+ RP.post(new Runnable() {
+
+ @Override
+ public void run() {
+ File f = module.getResourceDirectory();
+ if(null != f && f.exists()){
+ f = f.getParentFile();
+ }
+ if (null != f) {
+ Project p = FileOwnerQuery.getOwner(Utilities.toURI(f));
+ if (null != p) {
+ J2eeModuleProvider jmp = getProvider(p);
+ if (null != jmp) {
+ DeploymentManager dm = dmParam;
+ if (dm instanceof Hk2DeploymentManager) {
+ PayaraModule commonSupport = ((Hk2DeploymentManager) dm).getCommonServerSupport();
+ String gfdir = commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR);
+ if (null != gfdir) {
+ String domain = commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR);
+ if (commonSupport.getServerState() != ServerState.RUNNING) {
+ // TODO : need to account for remote domain here?
+ DomainEditor de = new DomainEditor(gfdir, domain);
+ de.createSampleDatasource();
+ } else {
+ registerSampleResource(commonSupport);
+ }
+ }
+ }
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").finer("Could not find project for J2eeModule"); // NOI18N
+ }
+ } else {
+ Logger.getLogger("payara-jakartaee").finer("Could not find project root directory for J2eeModule"); // NOI18N
+ }
+ }
+ });
+ }
+
+ static private J2eeModuleProvider getProvider(Project project) {
+ J2eeModuleProvider provider = null;
+ if (project != null) {
+ org.openide.util.Lookup lookup = project.getLookup();
+ provider = lookup.lookup(J2eeModuleProvider.class);
+ }
+ return provider;
+ }
+
+ static private void registerSampleResource(PayaraModule commonSupport) {
+ String sample_poolname = "SamplePool"; //NOI18N
+ String sample_jdbc = "jdbc/sample"; //NOI18N
+ String sample_classname = "org.apache.derby.jdbc.ClientDataSource"; //NOI18N
+ String sample_restype = "javax.sql.DataSource"; //NOI18N
+ Map<String, String> sample_props = new HashMap<String, String>();
+ sample_props.put("DatabaseName", "sample");
+ sample_props.put("User", "app");
+ sample_props.put("Password", "app");
+ sample_props.put("PortNumber", "1527");
+ sample_props.put("serverName", "localhost");
+ sample_props.put("URL", "jdbc\\:derby\\://localhost\\:1527/sample");
+ Map<String, ResourceDesc> jdbcsMap = commonSupport.getResourcesMap(PayaraModule.JDBC_RESOURCE);
+ if (!jdbcsMap.containsKey(sample_jdbc)) {
+ try {
+ CommandCreateJDBCConnectionPool.createJDBCConnectionPool(commonSupport.getInstance(),
+ sample_poolname, sample_classname, sample_restype,
+ sample_props, 60000);
+ CommandCreateJDBCResource.createJDBCResource(
+ commonSupport.getInstance(), sample_poolname,
+ sample_jdbc, null, null, 60000);
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.SEVERE, gfie.getLocalizedMessage(), gfie);
+ }
+ }
+ }
+
+}
+
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/SunDatasource.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/SunDatasource.java
new file mode 100644
index 0000000..ebb591d
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/SunDatasource.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.util.Objects;
+import org.netbeans.modules.payara.jakartaee.ApplicationScopedResourcesUtils.JndiNameResolver;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+
+/**
+ * Data model for a sun datasource (combined jdbc resource and connection pool).
+ *
+ * @author Nitya Doraisamy
+ */
+public class SunDatasource implements Datasource {
+
+ private final String jndiName;
+ private final String url;
+ private final String username;
+ private final String password;
+ private final String driverClassName;
+
+ private final JndiNameResolver resolver;
+
+ public SunDatasource(String jndiName, String url, String username,
+ String password, String driverClassName) {
+ this(jndiName, url, username, password, driverClassName, false, null);
+ }
+
+ public SunDatasource(String jndiName, String url, String username,
+ String password, String driverClassName, boolean scoped, JndiNameResolver resolver) {
+ this.jndiName = jndiName;
+ this.url = url;
+ this.username = username;
+ this.password = password;
+ this.driverClassName = driverClassName;
+ this.resolver = resolver;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return getJndiName();
+ }
+
+ @Override
+ public String getJndiName() {
+ if (resolver != null) {
+ return resolver.resolveJndiName(jndiName);
+ }
+ return jndiName;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public String getDriverClassName() {
+ return driverClassName;
+ }
+
+ @Override
+ public String toString() {
+ return "[ " + jndiName + " : " + url
+ + " : " + username + " : " + password
+ + " : " + driverClassName + " ]";
+ }
+
+ @Override
+ @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject")
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final SunDatasource other = (SunDatasource) obj;
+ if (! Objects.equals(this.jndiName, other.jndiName)) {
+ return false;
+ }
+ if (! Objects.equals(this.url, other.url)) {
+ return false;
+ }
+ if (! Objects.equals(this.username, other.username)) {
+ return false;
+ }
+ if (! Objects.equals(this.password, other.password)) {
+ return false;
+ }
+ if (! Objects.equals(this.driverClassName, other.driverClassName)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 41 * hash + (this.jndiName != null ? this.jndiName.hashCode() : 0);
+ hash = 41 * hash + (this.url != null ? this.url.hashCode() : 0);
+ hash = 41 * hash + (this.username != null ? this.username.hashCode() : 0);
+ hash = 41 * hash + (this.password != null ? this.password.hashCode() : 0);
+ hash = 41 * hash + (this.driverClassName != null ? this.driverClassName.hashCode() : 0);
+ return hash;
+ }
+
+ public SunDatasource copy(String jndiName) {
+ return new SunDatasource(jndiName, this.url, this.username,
+ this.password, this.driverClassName/*, this.resourceDir*/);
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/VendorNameMgr.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/VendorNameMgr.java
new file mode 100644
index 0000000..3ddf985
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/db/VendorNameMgr.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Collect all the vendor name manipulation in one place. Refactor it ASAP.
+ *
+ * @author Peter Williams
+ */
+public class VendorNameMgr {
+
+ private final static char BLANK = ' ';
+ private final static char DOT = '.';
+ private final static char [] ILLEGAL_FILENAME_CHARS = {'/', '\\', ':', '*', '?', '"', '<', '>', '|', ',', '=', ';' };
+
+ private final static String ILLEGAL_CHARS_PATTERN = "[/\\:*\"<>|,=; \\.]"; // NOI18N
+ private final static String REPLACEMENT_PATTERN = "_"; // NOI18N
+
+
+ /**
+ * Determine the proper vendor name for the database url passed in. If
+ * no vendor name can be determined, generate something valid from the url.
+ *
+ * @param url database url for a datasource
+ * @return vendor name (or filename legal string) for the database vendor
+ * associated with that url.
+ */
+ public static String vendorNameFromDbUrl(String url) {
+ url = stripExtraDBInfo(url);
+ String vendorName = getDatabaseVendorName(url);
+ if(vendorName != null) {
+ if(vendorName.length() > 0) { // NOI18N
+ if(!isFriendlyFilename(vendorName)) {
+ vendorName = makeLegalFilename(vendorName);
+ }
+ } else {
+ vendorName = makeShorterLegalFilename(url);
+ }
+ }
+ return vendorName;
+ }
+
+ /**
+ * Determine the standard datasource classname for this vendor
+ *
+ * @param vendorName vendor name to lookup
+ * @return standard datasource classname for this vendor, or null if unknown.
+ */
+ public static String dsClassNameFromVendorName(String vendorName) {
+ return vendorName != null ? vendorNameToDscnMap.get(vendorName) : null;
+ }
+
+
+ private static boolean isLegalFilename(String filename) {
+ for(int i = 0; i < ILLEGAL_FILENAME_CHARS.length; i++) {
+ if(filename.indexOf(ILLEGAL_FILENAME_CHARS[i]) >= 0) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static boolean isFriendlyFilename(String filename) {
+ if(filename.indexOf(BLANK) >= 0 || filename.indexOf(DOT) >= 0) {
+ return false;
+ }
+
+ return isLegalFilename(filename);
+ }
+
+ private static String makeLegalFilename(String filename) {
+ return filename.replaceAll(ILLEGAL_CHARS_PATTERN, REPLACEMENT_PATTERN);
+ }
+
+ private static String makeShorterLegalFilename(String filename) {
+ //To clean up the default generation a little
+ int separatorIndex = filename.indexOf("://"); // NOI18N
+ if(separatorIndex != -1) { // NOI18N
+ filename = filename.substring(0, separatorIndex) +
+ "_" + // NOI18N
+ filename.substring(separatorIndex + 3);
+ }
+ separatorIndex = filename.indexOf("//"); // NOI18N
+ if(separatorIndex != -1) { // NOI18N
+ filename = filename.substring(0, separatorIndex) +
+ "_" + // NOI18N
+ filename.substring(separatorIndex + 2);
+ }
+ filename = makeLegalFilename(filename);
+
+ return filename;
+ }
+
+
+ static String stripExtraDBInfo(String dbConnectionString) {
+ int bracketIndex = dbConnectionString.indexOf("["); // NOI18N
+ if(bracketIndex != -1) {
+ dbConnectionString = dbConnectionString.substring(0, bracketIndex).trim();
+ }
+ return dbConnectionString;
+ }
+
+ private static String getDatabaseVendorName(String url) {
+ String vendorName = "";
+ for(Entry<String, String> entry : vendorNameToUrlMap.entrySet()) {
+ if(url.indexOf(entry.getValue()) != -1){
+ vendorName = entry.getKey();
+ break;
+ }
+ }
+ return vendorName;
+ }
+
+ // vendor name -> datasource classname mapping.
+ // XXX From CPWizard.xml until that can be refactored
+ // XXX Using linked hashmap due to order dependency between derby urls & reverse lookup.
+ //
+ private static Map<String, String> vendorNameToDscnMap = new LinkedHashMap<String, String>();
+
+ static {
+ vendorNameToDscnMap.put("oracle-thin", "oracle.jdbc.pool.OracleDataSource");
+ vendorNameToDscnMap.put("derby_net", "org.apache.derby.jdbc.ClientDataSource");
+ vendorNameToDscnMap.put("sun_db2", "com.sun.sql.jdbcx.db2.DB2DataSource");
+ vendorNameToDscnMap.put("sun_msftsql", "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource");
+ vendorNameToDscnMap.put("sun_oracle", "com.sun.sql.jdbcx.oracle.OracleDataSource");
+ vendorNameToDscnMap.put("sun_sybase", "com.sun.sql.jdbcx.sybase.SybaseDataSource");
+ vendorNameToDscnMap.put("post-gre-sql", "org.postgresql.ds.PGSimpleDataSource");
+ vendorNameToDscnMap.put("microsoft_sql", "com.microsoft.sqlserver.jdbc.SQLServerDataSource");
+ vendorNameToDscnMap.put("jtds_sql", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ vendorNameToDscnMap.put("jtds_sybase", "net.sourceforge.jtds.jdbcx.JtdsDataSource");
+ vendorNameToDscnMap.put("oracle", "oracle.jdbc.pool.OracleDataSource");
+ vendorNameToDscnMap.put("db2", "com.ibm.db2.jcc.DB2DataSource");
+ vendorNameToDscnMap.put("datadirect_sql", "com.ddtek.jdbcx.sqlserver.SQLServerDataSource");
+ vendorNameToDscnMap.put("datadirect_oracle", "com.ddtek.jdbcx.oracle.OracleDataSource");
+ vendorNameToDscnMap.put("datadirect_db2", "com.ddtek.jdbcx.db2.DB2DataSource");
+ vendorNameToDscnMap.put("datadirect_informix", "com.ddtek.jdbcx.informix.InformixDataSource");
+ vendorNameToDscnMap.put("datadirect_sybase", "com.ddtek.jdbcx.sybase.SybaseDataSource");
+ vendorNameToDscnMap.put("sybase2", "com.sybase.jdbc2.jdbc.SybDataSource");
+ vendorNameToDscnMap.put("pointbase", "com.pointbase.jdbc.jdbcDataSource");
+ vendorNameToDscnMap.put("cloudscape", "com.cloudscape.core.BasicDataSource");
+ vendorNameToDscnMap.put("informix", "com.informix.jdbcx.IfxDataSource");
+ vendorNameToDscnMap.put("mysql", "com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
+ vendorNameToDscnMap.put("jdbc-odbc-bridge", "sun.jdbc.odbc.JdbcOdbcDriver");
+ vendorNameToDscnMap.put("sql-server", "weblogic.jdbc.mssqlserver4.Driver");
+ }
+
+ // Url fragment -> vendor name mapping.
+ // XXX From CPWizard.xml until that can be refactored
+ // XXX Using linked hashmap due to order dependency between derby urls & reverse lookup.
+ //
+ private static Map<String, String> vendorNameToUrlMap = new LinkedHashMap<String, String>();
+
+ static {
+ vendorNameToUrlMap.put("oracle-thin", "jdbc:oracle:thin");
+ vendorNameToUrlMap.put("derby_net", "jdbc:derby://");
+ vendorNameToUrlMap.put("derby_embedded", "jdbc:derby:");
+ vendorNameToUrlMap.put("sun_db2", "jdbc:sun:db2:");
+ vendorNameToUrlMap.put("sun_msftsql", "jdbc:sun:sqlserver:");
+ vendorNameToUrlMap.put("sun_oracle", "jdbc:sun:oracle:");
+ vendorNameToUrlMap.put("sun_sybase", "jdbc:sun:sybase:");
+ vendorNameToUrlMap.put("post-gre-sql", "jdbc:postgresql:");
+ vendorNameToUrlMap.put("microsoft_sql", "jdbc:sqlserver:");
+ vendorNameToUrlMap.put("jtds_sql", "jdbc:jtds:sqlserver:");
+ vendorNameToUrlMap.put("jtds_sybase", "jdbc:jtds:sybase:");
+ vendorNameToUrlMap.put("oracle", "jdbc:oracle:oci8:");
+ vendorNameToUrlMap.put("db2", "jdbc:db2:");
+ vendorNameToUrlMap.put("jdbc-odbc-bridge", "jdbc:odbc:");
+ vendorNameToUrlMap.put("sql-server", "jdbc:weblogic:mssqlserver4:");
+ vendorNameToUrlMap.put("sybase2", "jdbc:sybase:Tds:");
+ vendorNameToUrlMap.put("cloudscape", "jdbc:cloudscape:");
+ vendorNameToUrlMap.put("informix", "jdbc:informix-sqli:");
+ vendorNameToUrlMap.put("mysql", "jdbc:mysql:");
+ vendorNameToUrlMap.put("pointbase", "jdbc:pointbase:");
+ vendorNameToUrlMap.put("datadirect_sql", "jdbc:datadirect:sqlserver:");
+ vendorNameToUrlMap.put("datadirect_oracle", "jdbc:datadirect:oracle:");
+ vendorNameToUrlMap.put("datadirect_db2", "jdbc:datadirect:db2:");
+ vendorNameToUrlMap.put("datadirect_informix", "jdbc:datadirect:informix:");
+ vendorNameToUrlMap.put("datadirect_sybase", "jdbc:datadirect:sybase:");
+ vendorNameToUrlMap.put("as400", "jdbc:as400:");
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Bundle.properties b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Bundle.properties
new file mode 100644
index 0000000..72d09ff
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Bundle.properties
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+MSG_START_SERVER_FAILED_FNF={0} Server can't start. The start jar was not found.
+MSG_START_SERVER_FAILED_PD={0} Server start failed. Can't create start process.
+MSG_START_SERVER_NOT_INITIALIZED= {0} Server is not initialized.
+MSG_START_SERVER_IN_PROGRESS=Starting {0}
+MSG_SERVER_STARTED={0} Server started
+MSG_START_SERVER_FAILED={0} Start Failed
+
+MSG_STOP_SERVER_FAILED_FNF={0} Server can not stop.
+MSG_STOP_SERVER_FAILED_PD={0} Server stop failed. Can't create stop process.
+MSG_STOP_SERVER_IN_PROGRESS=Server {0} is stopping
+MSG_SERVER_STOPPED={0} Server stopped
+MSG_STOP_SERVER_FAILED={0} Stop Failed
+
+MSG_DeployBrokenContextXml=Cannot deploy the module. xxx
+
+MSG_CannotUndeployManager=It is not allowed to undeploy the Hk2 Manager application.\n\
+If your are trying to deploy your application to the reserved /manager context path, \
+please, use another one.
+MSG_DeploymentInProgress=Deployment is in progress...
+MSG_UndeploymentInProgress=Undeployment is in progress...
+MSG_StartInProgress=Start is in progress...
+MSG_StopInProgress=Stop is in progress...
+MSG_ReloadInProgress=Reload is in progress...
+MSG_DeployInProgress=Deploy is in progress...
+MSG_RedeployUnneeded=Skipping unnecessary redeploy operation
+
+ERR_SPACE_IN_JAR_NAMES=Payara cannot directory deploy applications with an exploded submodule directory name that contains spaces like "{0}"
+ERR_UndeployAndRedeploy=Project is currently archive deployed. Undeploy this project and redeploy it to take advantage of directory deployment.
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/DummyProgressObject.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/DummyProgressObject.java
new file mode 100644
index 0000000..dec827c
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/DummyProgressObject.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
+import javax.enterprise.deploy.spi.status.ClientConfiguration;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+/**
+ * ProgressObject implementation that is in a permanent completed state.
+ * For returning from methods that must return a ProgressObject, but do not
+ * need to implement any asynchronous functionality.
+ *
+ * @author Peter Williams
+ */
+public class DummyProgressObject implements ProgressObject {
+
+ private final TargetModuleID [] moduleIDs;
+ private final DeploymentStatus status = new Hk2DeploymentStatus(
+ CommandType.DISTRIBUTE, StateType.COMPLETED, ActionType.EXECUTE, "");
+
+ public DummyProgressObject(final TargetModuleID moduleID) {
+ moduleIDs = new TargetModuleID [] { moduleID };
+ }
+
+ public DeploymentStatus getDeploymentStatus() {
+ return status;
+ }
+
+ public TargetModuleID [] getResultTargetModuleIDs() {
+ return moduleIDs.clone();
+ }
+
+ public ClientConfiguration getClientConfiguration(TargetModuleID tmid) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean isCancelSupported() {
+ return true;
+ }
+
+ public void cancel() throws OperationUnsupportedException {
+ }
+
+ public boolean isStopSupported() {
+ return true;
+ }
+
+ public void stop() throws OperationUnsupportedException {
+ }
+
+ public void addProgressListener(ProgressListener listener) {
+ }
+
+ public void removeProgressListener(ProgressListener listener) {
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/FastDeploy.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/FastDeploy.java
new file mode 100644
index 0000000..e67bfe4
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/FastDeploy.java
@@ -0,0 +1,562 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.payara.eecommon.api.HttpMonitorHelper;
+import org.netbeans.modules.payara.eecommon.api.Utils;
+import org.netbeans.modules.payara.eecommon.api.XmlFileCreator;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.payara.jakartaee.ModuleConfigurationImpl;
+import org.netbeans.modules.payara.jakartaee.ResourceRegistrationHelper;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.PayaraModule2;
+import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeApplication;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.plugins.api.AppChangeDescriptor;
+import org.netbeans.modules.j2ee.deployment.plugins.api.DeploymentChangeDescriptor;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.DeploymentContext;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.IncrementalDeployment;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.IncrementalDeployment2;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfiguration;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class FastDeploy extends IncrementalDeployment implements IncrementalDeployment2 {
+
+ private static volatile long lastDeployHack = System.currentTimeMillis();
+
+ private static final String GFDEPLOY = "gfdeploy"; // NOI18N
+
+ private Hk2DeploymentManager dm;
+
+ /**
+ * Creates a new instance of FastDeploy
+ *
+ * @param dm The deployment manager for the server instance this object
+ * deploys to.
+ */
+ public FastDeploy(Hk2DeploymentManager dm) {
+ this.dm = dm;
+ }
+
+ /**
+ *
+ * @param target
+ * @param app
+ * @param configuration
+ * @param file
+ * @return
+ */
+ @Override
+ public ProgressObject initialDeploy(Target target, final J2eeModule module, ModuleConfiguration configuration, final File dir) {
+ return initialDeploy(target, module, dir, new File[0]);
+ }
+
+ @Override
+ public ProgressObject initialDeploy(Target target, DeploymentContext context) {
+ return initialDeploy(target, context.getModule(), context.getModuleFile(), context.getRequiredLibraries());
+ }
+
+
+ /**
+ * Get web application context root from module configuration.
+ * @param module Java EE module containing context root (WAR archive).
+ * @param dir Web application root.
+ * @return
+ */
+ private String getContextRoot(final J2eeModule module, final File dir) {
+ ModuleConfigurationImpl mci = ModuleConfigurationImpl.get(module);
+ if (null != mci) {
+ try {
+ return mci.getContextRoot();
+ } catch (ConfigurationException ex) {
+ Logger.getLogger("payara").log(Level.WARNING,
+ "could not getContextRoot() for {0}", dir);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private ProgressObject initialDeploy(Target target, J2eeModule module, final File dir, final File[] requiredLibraries) {
+ final PayaraModule commonSupport = dm.getCommonServerSupport();
+ String url = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+ String targ = Hk2DeploymentManager.getTargetFromUri(url);
+ String nameSuffix = ""; // NOI18N
+ if (null != targ)
+ nameSuffix = "_"+targ; // NOI18N
+ final String moduleName = org.netbeans.modules.payara.spi.Utils.sanitizeName(Utils.computeModuleID(module, dir, Integer.toString(hashCode()))) +
+ nameSuffix;
+ String contextRoot = null;
+ J2eeModule.Type type = module.getType();
+ if (type == J2eeModule.Type.WAR) {
+ contextRoot = getContextRoot(module, dir);
+ // drop a glassfish-web.xml file in here.. if necessary
+ FileObject rootOfWebApp = FileUtil.toFileObject(FileUtil.normalizeFile(dir));
+ if (null != rootOfWebApp) {
+ String fileName = null;
+ String SUNWEB = "WEB-INF/sun-web.xml"; // NOI18N
+ if (url.contains("pfv3")
+ || url.contains("pfv4")
+ || url.contains("pfv5")) { // NOI18N
+ String GFWEB = "WEB-INF/glassfish-web.xml"; // NOI18N
+ String PYWEB = "WEB-INF/payara-web.xml"; // NOI18N
+ if (null != rootOfWebApp.getFileObject(GFWEB)) {
+ fileName = PYWEB;
+ } else if (null == rootOfWebApp.getFileObject(GFWEB)
+ && null == rootOfWebApp.getFileObject(SUNWEB)) {
+ fileName = GFWEB;
+ }
+ } else {
+ if (null == rootOfWebApp.getFileObject(SUNWEB)) {
+ // add sun-web to deployed app
+ fileName = SUNWEB;
+ }
+ }
+ if (null != fileName) {
+ File ddFile = new File(dir, fileName);
+ addDescriptorToDeployedDirectory(module, ddFile);
+ }
+ }
+ // Context root is in encapsulated WAR
+ } else if (type == J2eeModule.Type.EAR) {
+ if (module instanceof J2eeApplication) {
+ for (J2eeModule child : ((J2eeApplication)module).getModules()) {
+ if (child.getType() == J2eeModule.Type.WAR) {
+ contextRoot = getContextRoot(child, dir);
+ break;
+ }
+ }
+ }
+ }
+ // XXX fix cast -- need error instance for ProgressObject to return errors
+ Hk2TargetModuleID moduleId = Hk2TargetModuleID.get((Hk2Target) target,
+ moduleName, contextRoot, dir.getAbsolutePath());
+
+ // prevent issues by protecting against triggering
+ ProgressObject po = checkAgainstGF15690(dir,moduleId);
+ if (null != po) {
+ return po;
+ }
+ final MonitorProgressObject deployProgress = new MonitorProgressObject(dm, moduleId);
+ final MonitorProgressObject updateCRProgress = new MonitorProgressObject(dm, moduleId);
+ deployProgress.addProgressListener(new UpdateContextRoot(updateCRProgress,moduleId, dm.getServerInstance(), J2eeModule.Type.WAR.equals(module.getType())));
+ MonitorProgressObject restartProgress = new MonitorProgressObject(dm, moduleId);
+
+ final PayaraModule2 commonSupport2 = (commonSupport instanceof PayaraModule2 ?
+ (PayaraModule2)commonSupport : null);
+ boolean restart = false;
+ try {
+ restart = HttpMonitorHelper.synchronizeMonitor(commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR),
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR),
+ Boolean.parseBoolean(commonSupport.getInstanceProperties().get(PayaraModule.HTTP_MONITOR_FLAG)),
+ "modules/org-netbeans-modules-schema2beans.jar");
+ } catch (IOException | SAXException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING, "http monitor state", ex);
+ }
+ ResourceRegistrationHelper.deployResources(dir,dm);
+ if (restart) {
+ final String cr = contextRoot;
+ restartProgress.addProgressListener(new ProgressListener() {
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ if (event.getDeploymentStatus().isCompleted()) {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.deploy(deployProgress, dir, moduleName, cr, Collections.<String, String>emptyMap(), requiredLibraries);
+ } else {
+ commonSupport.deploy(deployProgress, dir, moduleName, cr);
+ }
+ } else {
+ deployProgress.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ }
+ });
+ commonSupport.restartServer(restartProgress);
+ return updateCRProgress;
+ } else {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.deploy(deployProgress, dir, moduleName, contextRoot, Collections.<String, String>emptyMap(), requiredLibraries);
+ } else {
+ commonSupport.deploy(deployProgress, dir, moduleName, contextRoot);
+ }
+ return updateCRProgress;
+ }
+ }
+
+ private void addDescriptorToDeployedDirectory(J2eeModule module, File sunDDFile) {
+ FileObject sunDDTemplate = Utils.getSunDDFromProjectsModuleVersion(module, sunDDFile.getName()); //FileUtil.getConfigFile(resource);
+ if (sunDDTemplate != null) {
+ try {
+ FileObject configFolder = FileUtil.createFolder(sunDDFile.getParentFile());
+ FileSystem fs = configFolder.getFileSystem();
+ XmlFileCreator creator = new XmlFileCreator(sunDDTemplate, configFolder, sunDDTemplate.getName(), sunDDTemplate.getExt());
+ fs.runAtomicAction(creator);
+ } catch (IOException ioe) {
+ Logger.getLogger("payara").log(Level.WARNING, "could not create {0}", sunDDTemplate.getPath());
+ }
+ }
+ }
+
+ private static Pattern badName = Pattern.compile(".*\\s.*_[jwrc]ar"); // NOI18N
+ private static Pattern badPath = Pattern.compile(".*[\\\\/].*\\s.*_[jwrc]ar[\\\\/].*"); // NOI18N
+
+ private ProgressObject checkAgainstGF15690(final File dir, Hk2TargetModuleID moduleId) {
+ File parent = dir.getParentFile();
+ if (null != parent) {
+ if (GFDEPLOY.equals(parent.getName())) {
+ File modules[] = dir.listFiles();
+ for (File f : modules) {
+ if (f.isDirectory()) {
+ String fname = f.getName();
+ if (badName.matcher(fname).matches()) {
+ MonitorProgressObject po = new MonitorProgressObject(dm, moduleId);
+ po.operationStateChanged(TaskState.FAILED, TaskEvent.CMD_FAILED,
+ NbBundle.getMessage(FastDeploy.class, "ERR_SPACE_IN_JAR_NAMES", fname)); // NOI18N
+ return po;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param targetModuleID
+ * @param appChangeDescriptor
+ * @return
+ */
+ @Override
+ public ProgressObject incrementalDeploy(final TargetModuleID targetModuleID, AppChangeDescriptor appChangeDescriptor) {
+ return incrementalDeploy(targetModuleID, appChangeDescriptor, new File[0]);
+ }
+
+ @Override
+ public ProgressObject incrementalDeploy(final TargetModuleID targetModuleID, DeploymentContext context) {
+ return incrementalDeploy(targetModuleID, context.getChanges(), context.getRequiredLibraries());
+ }
+
+ private ProgressObject incrementalDeploy(final TargetModuleID targetModuleID, AppChangeDescriptor appChangeDescriptor, final File[] requiredLibraries) {
+ final MonitorProgressObject progressObject = new MonitorProgressObject(dm,
+ (Hk2TargetModuleID) targetModuleID, CommandType.REDEPLOY);
+ // prevent issues by protecting against triggering
+ // http://java.net/jira/browse/GLASSFISH-15690
+ for (File f : appChangeDescriptor.getChangedFiles()) {
+ String fname = f.getAbsolutePath();
+ if (badPath.matcher(fname).matches()) { // NOI18N
+ progressObject.operationStateChanged(TaskState.FAILED, TaskEvent.CMD_FAILED,
+ NbBundle.getMessage(FastDeploy.class, "ERR_SPACE_IN_JAR_NAMES", fname)); // NOI18N
+ return progressObject;
+ }
+ }
+ MonitorProgressObject restartObject = new MonitorProgressObject(dm, (Hk2TargetModuleID) targetModuleID,
+ CommandType.REDEPLOY);
+ final MonitorProgressObject updateCRObject = new MonitorProgressObject(dm,
+ (Hk2TargetModuleID) targetModuleID, CommandType.REDEPLOY);
+ progressObject.addProgressListener(new UpdateContextRoot(updateCRObject,(Hk2TargetModuleID) targetModuleID, dm.getServerInstance(), ! (null == targetModuleID.getWebURL())));
+ final PayaraModule commonSupport = dm.getCommonServerSupport();
+ final PayaraModule2 commonSupport2 = (commonSupport instanceof PayaraModule2 ?
+ (PayaraModule2)commonSupport : null);
+ boolean restart = false;
+ try {
+ restart = HttpMonitorHelper.synchronizeMonitor(
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAINS_FOLDER_ATTR),
+ commonSupport.getInstanceProperties().get(PayaraModule.DOMAIN_NAME_ATTR),
+ Boolean.parseBoolean(commonSupport.getInstanceProperties().get(PayaraModule.HTTP_MONITOR_FLAG)),
+ "modules/org-netbeans-modules-schema2beans.jar");
+ } catch (IOException | SAXException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.WARNING,"http monitor state",
+ ex);
+ }
+ long currentTime = System.currentTimeMillis();
+ long sinceLast = currentTime - lastDeployHack;
+ final boolean resourcesChanged = containsFileWithName("glassfish-resources.xml",appChangeDescriptor.getChangedFiles()); // NOI18N
+ final boolean hasChanges = appChangeDescriptor.classesChanged() ||
+ appChangeDescriptor.descriptorChanged() ||
+ appChangeDescriptor.ejbsChanged() ||
+ appChangeDescriptor.manifestChanged() ||
+ appChangeDescriptor.serverDescriptorChanged() ||
+ resourcesChanged ||
+ //
+ // this accounts for a feature/bug of Payara.
+ // if a static resource is modified there is a window where later
+ // modifications might be missed... so old content gets served...
+ // even when new content is available to be served.
+ // That window is about 5 seconds.
+ //
+ // If the user is doing pathological things like adding a character
+ // and hitting save, the auto-refresh will show the right thing.
+ //
+ sinceLast < 5000;
+
+ lastDeployHack = currentTime;
+
+ if(appChangeDescriptor instanceof DeploymentChangeDescriptor) {
+ DeploymentChangeDescriptor dcd = (DeploymentChangeDescriptor)appChangeDescriptor;
+ if (dcd.serverResourcesChanged()) {
+ File dir = getDirectoryForModule(targetModuleID);
+ if (null != dir) {
+ ResourceRegistrationHelper.deployResources(dir, dm);
+ }
+ }
+ }
+
+ if (restart) {
+ restartObject.addProgressListener(new ProgressListener() {
+
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ if (event.getDeploymentStatus().isCompleted()) {
+ if (hasChanges) {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.redeploy(progressObject, targetModuleID.getModuleID(), null, requiredLibraries,resourcesChanged);
+ } else {
+ commonSupport.redeploy(progressObject, targetModuleID.getModuleID(),resourcesChanged);
+ }
+ } else {
+ progressObject.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ } else {
+ progressObject.fireHandleProgressEvent(event.getDeploymentStatus());
+ }
+ }
+ });
+ commonSupport.restartServer(restartObject);
+ return updateCRObject;
+ } else {
+ if (hasChanges) {
+ if (commonSupport2 != null && requiredLibraries.length > 0) {
+ commonSupport2.redeploy(progressObject, targetModuleID.getModuleID(), null, requiredLibraries, resourcesChanged);
+ } else {
+ commonSupport.redeploy(progressObject, targetModuleID.getModuleID(), resourcesChanged);
+ }
+ } else {
+ progressObject.operationStateChanged(TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ NbBundle.getMessage(FastDeploy.class, "MSG_RedeployUnneeded"));
+ }
+ return updateCRObject;
+ }
+ }
+
+ /**
+ *
+ * @param target
+ * @param deployable
+ * @return
+ */
+ @Override
+ public boolean canFileDeploy(Target target, J2eeModule deployable) {
+ if (null == deployable){
+ return false;
+ }
+
+ if (deployable.getType() == J2eeModule.Type.CAR) {
+ return false;
+ }
+
+ final PayaraModule commonSupport = dm.getCommonServerSupport();
+ String url = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+
+ if (!url.trim().matches(".*:[0-9]+$")) // NOI18N
+ return url.trim().endsWith("server");
+
+ return true;
+ }
+
+ /**
+ * @return Absolute path root directory for the specified app or null if
+ * server can accept the deployment from an arbitrary directory.
+ */
+ @Override
+ public File getDirectoryForNewApplication(Target target, J2eeModule app, ModuleConfiguration configuration) {
+ File dest = null;
+ if (app.getType() == J2eeModule.Type.EAR) {
+ File tmp = getProjectDir(app);
+ if (null == tmp) {
+ return dest;
+ }
+ dest = new File(tmp, "target"); // NOI18N
+ if (!dest.exists()) {
+ // the app wasn't a maven project
+ dest = new File(tmp, "dist"); // NOI18N
+ }
+ if (dest.isFile() || (dest.isDirectory() && !dest.canWrite())) {
+ throw new IllegalStateException();
+ }
+ String moduleName = org.netbeans.modules.payara.spi.Utils.sanitizeName(Utils.computeModuleID(app, null, null));
+ String dirName = GFDEPLOY;
+ if (null != moduleName) {
+ dirName += "/"+moduleName; // NOI18N
+ }
+ dest = new File(dest, dirName);
+ boolean retval = true;
+ if (!dest.exists()) {
+ retval = dest.mkdirs();
+ }
+ if (!retval || !dest.isDirectory()) {
+ dest = null;
+ }
+ }
+ return dest;
+ }
+
+ /**
+ *
+ * @param file
+ * @param string
+ * @param app
+ * @param configuration
+ * @return
+ */
+ @Override
+ public File getDirectoryForNewModule(File file, String string, J2eeModule app, ModuleConfiguration configuration) {
+ return new File(file, transform(removeLeadSlash(string)));
+ }
+
+ private String removeLeadSlash(String s) {
+ if (null == s) {
+ return s;
+ }
+ if (s.length() < 1) {
+ return s;
+ }
+ if (!s.startsWith("/")) {
+ return s;
+ }
+ return s.substring(1);
+ }
+
+ static String transform(String s) {
+ int len = s.length();
+ if (len > 4) {
+ StringBuilder sb = new StringBuilder(s);
+ char tmp = sb.charAt(len - 4);
+ if (tmp == '.') {
+ sb.setCharAt(len-4, '_');
+ return sb.toString();
+ }
+ }
+ return s;
+ }
+
+ /**
+ *
+ * @param targetModuleID
+ * @return
+ */
+ @Override
+ public File getDirectoryForModule(TargetModuleID targetModuleID) {
+ File retVal
+ = new File(((Hk2TargetModuleID) targetModuleID).getLocation());
+ if (retVal.getPath().contains("${")) {
+ throw new IllegalStateException(NbBundle.getMessage(FastDeploy.class,
+ "ERR_UndeployAndRedeploy"));
+ }
+ return retVal;
+ }
+
+ @Override
+ public ProgressObject deployOnSave(TargetModuleID module, DeploymentChangeDescriptor desc) {
+ return incrementalDeploy(module, desc);
+ }
+
+ @Override
+ public boolean isDeployOnSaveSupported() {
+ final PayaraModule commonSupport = dm.getCommonServerSupport();
+ String url = commonSupport.getInstanceProperties().get(PayaraModule.URL_ATTR);
+
+ if (!url.trim().matches(".*:[0-9]+$")) // NOI18N
+ return url.trim().endsWith("server");
+ return !"false".equals(System.getProperty("glassfish.javaee.deployonsave"));
+ }
+
+ // try to get the Project Directory as a File
+ // use a couple different stratgies, since the resource.dir is in a user-
+ // editable file -- but it is quicker to access, if it is there....
+ //
+ private File getProjectDir(J2eeModule app) {
+ try {
+ FileObject fo = app.getContentDirectory();
+ Project p = FileOwnerQuery.getOwner(fo);
+ if (null != p) {
+ fo = p.getProjectDirectory();
+ return FileUtil.toFile(fo);
+ }
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINER, // NOI18N
+ null,ex);
+ }
+ java.io.File tmp = app.getResourceDirectory();
+
+ if (tmp != null) {
+ return tmp.getParentFile();
+ }
+ return null;
+ }
+
+ @Override
+ public String getModuleUrl(TargetModuleID module) {
+ assert null != module;
+// if (null == module) {
+// return "/bogusModule";
+// }
+ Hk2TargetModuleID self = (Hk2TargetModuleID) module;
+ String retVal = self.getModuleID();
+ return retVal.startsWith("/") ? retVal : "/"+retVal;
+ }
+
+ private boolean containsFileWithName(String name, File[] changedFiles) {
+ if (null == changedFiles || null == name)
+ return false;
+ for (File f : changedFiles) {
+ String fp = null != f ? f.getAbsolutePath() : null;
+ if (null != fp && fp.contains(name))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2DeploymentStatus.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2DeploymentStatus.java
new file mode 100644
index 0000000..ad0b2cc
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2DeploymentStatus.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+
+/**
+ * This should have been included in JSR-88 as a helper class.
+ *
+ * @author Peter Williams
+ */
+public class Hk2DeploymentStatus implements DeploymentStatus {
+
+ private final CommandType command;
+ private final StateType state;
+ private final ActionType action;
+ private final String message;
+
+ /**
+ * Create DeploymentStatus object
+ *
+ * @param state State of command being performed (running, completed, failed)
+ * @param command Command being performed (start, stop, deploy, etc.)
+ * @param action Action represented by this status event (command is executing,
+ * cancelled, or stopped.)
+ * @param message Informational message for the user describing this status object.
+ */
+ public Hk2DeploymentStatus(final CommandType command, final StateType state,
+ final ActionType action, final String message) {
+ this.command = command;
+ this.state = state;
+ this.action = action;
+ this.message = message;
+ }
+
+ public CommandType getCommand() {
+ return command;
+ }
+
+ public StateType getState() {
+ return state;
+ }
+
+ public ActionType getAction() {
+ return action;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public boolean isCompleted() {
+ return StateType.COMPLETED.equals(state);
+ }
+
+ public boolean isFailed() {
+ return StateType.FAILED.equals(state);
+ }
+
+ public boolean isRunning() {
+ return StateType.RUNNING.equals(state);
+ }
+
+ @Override
+ public String toString() {
+ return message;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Logger.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Logger.java
new file mode 100644
index 0000000..946931d
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Logger.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
+import org.openide.ErrorManager;
+import org.openide.util.RequestProcessor;
+import org.openide.windows.InputOutput;
+
+
+/**
+ * This class is capable of tailing the specified file or input stream. It
+ * checks for changes at the specified intervals and outputs the changes to
+ * the given I/O panel in NetBeans
+ *
+ * @author Michal Mocnak
+ */
+public class Hk2Logger {
+
+ /**
+ * Amount of time in milliseconds to wait between checks of the input
+ * stream
+ */
+ private static final int delay = 1000;
+
+ /**
+ * Singleton model pattern
+ */
+ private static Map<String, Hk2Logger> instances = new HashMap<String, Hk2Logger>();
+
+ /**
+ * The I/O window where to output the changes
+ */
+ private InputOutput io;
+
+ /**
+ * Creates and starts a new instance of Hk2Logger
+ *
+ * @param uri the uri of the server
+ */
+ private Hk2Logger(String uri) {
+ io = UISupport.getServerIO(uri);
+
+ if (io == null) {
+ return; // finish, it looks like this server instance has been unregistered
+ }
+
+ // clear the old output
+ try {
+ io.getOut().reset();
+ } catch (IOException ioe) {
+ // no op
+ }
+
+ io.select();
+ }
+
+ /**
+ * Returns uri specific instance of Hk2Logger
+ *
+ * @param uri the uri of the server
+ * @return uri specific instamce of OCHk2Logger
+ */
+ public static Hk2Logger getInstance(String uri) {
+ if (!instances.containsKey(uri))
+ instances.put(uri, new Hk2Logger(uri));
+
+ return instances.get(uri);
+ }
+
+ /**
+ * Reads a newly included InputSreams
+ *
+ * @param inputStreams InputStreams to read
+ */
+ public void readInputStreams(InputStream[] inputStreams) {
+ for(InputStream inputStream : inputStreams)
+ RequestProcessor.getDefault().post(new LoggerRunnable(inputStream));
+ }
+
+ /**
+ * Reads a newly included Files
+ *
+ * @param files Files to read
+ */
+ public void readFiles(File[] files) {
+ for(InputStream inputStream : getInputStreamsFromFiles(files))
+ RequestProcessor.getDefault().post(new LoggerRunnable(inputStream));
+ }
+
+ /**
+ * Writes a message into output
+ *
+ * @param s message to write
+ */
+ public synchronized void write(String s) {
+ io.getOut().print(s);
+ }
+
+ /**
+ * Selects output panel
+ */
+ public synchronized void selectIO() {
+ io.select();
+ }
+
+ private static InputStream[] getInputStreamsFromFiles(File[] files) {
+ InputStream[] inputStreams = new InputStream[files.length];
+ int i = 0;
+ try {
+ for(i=0 ; i<files.length ; i++)
+ inputStreams[i] = new FileInputStream(files[i]);
+ } catch(FileNotFoundException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, files[i].getAbsolutePath(), ex); // NOI18N
+ return new InputStream[] {};
+ }
+
+ return inputStreams;
+ }
+
+ private class LoggerRunnable implements Runnable {
+
+ private InputStream inputStream;
+
+ public LoggerRunnable(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Implementation of the Runnable interface. Here all tailing is
+ * performed
+ */
+ public void run() {
+ try {
+ // create a reader from the input stream
+ InputStreamReader reader = new InputStreamReader(inputStream);
+
+ // read from the input stream and put all the changes to the
+ // I/O window
+ char[] chars = new char[1024];
+ while (true) {
+ // while there is something in the stream to be read - read that
+ while (reader.ready()) {
+ write(new String(chars, 0, reader.read(chars)));
+ selectIO();
+ }
+
+ // when the stream is empty - sleep for a while
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ }
+ } catch (IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, e);
+ } finally {
+ // close the opened stream
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, e);
+ }
+ }
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginProperties.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginProperties.java
new file mode 100644
index 0000000..76bf445
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginProperties.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.Specification;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.payara.spi.ServerUtilities;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Hk2PluginProperties
+ */
+public class Hk2PluginProperties {
+
+ /**
+ *
+ */
+ public static final String PROP_JAVA_PLATFORM = "java_platform"; //NOI18N
+
+ /**
+ *
+ */
+ public static final String PROP_JAVADOCS = "javadocs"; // NOI18N
+
+ /**
+ *
+ */
+ public static final String PLAT_PROP_ANT_NAME = "platform.ant.name"; //NOI18N
+
+ private InstanceProperties ip;
+ private static final int DEBUGPORT = 9009;
+ private ServerUtilities su;
+
+ /**
+ *
+ * @param dm
+ */
+ public Hk2PluginProperties(Hk2DeploymentManager dm,ServerUtilities su) {
+ ip = InstanceProperties.getInstanceProperties(dm.getUri());
+ this.su = su;
+ }
+
+ public String getDomainDir() {
+ String path = ip.getProperty(PayaraModule.DOMAINS_FOLDER_ATTR);
+ return null == path ? path : path+File.separator+
+ ip.getProperty(PayaraModule.DOMAIN_NAME_ATTR);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getInstallRoot() {
+ return ip.getProperty(PayaraModule.INSTALL_FOLDER_ATTR);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPayaraRoot() {
+ return ip.getProperty(PayaraModule.PAYARA_FOLDER_ATTR);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public JavaPlatform getJavaPlatform() {
+ String currentJvm = ip.getProperty(PROP_JAVA_PLATFORM);
+ JavaPlatformManager jpm = JavaPlatformManager.getDefault();
+ JavaPlatform[] installedPlatforms = jpm.getPlatforms(null, new Specification("J2SE", null)); // NOI18N
+
+ for (int i = 0; i < installedPlatforms.length; i++) {
+ String platformName = installedPlatforms[i].getProperties().get(PLAT_PROP_ANT_NAME);
+ if (platformName != null && platformName.equals(currentJvm)) {
+ return installedPlatforms[i];
+ }
+ }
+ // return default platform if none was set
+ return jpm.getDefaultPlatform();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public InstanceProperties getInstanceProperties() {
+ return ip;
+ }
+
+ /**
+ * Splits an Ant-style path specification into the list of URLs. Tokenizes on
+ * <code>:</code> and <code>;</code>, paying attention to DOS-style components
+ * such as <samp>C:\FOO</samp>. Also removes any empty components.
+ *
+ * @param path An Ant-style path (elements arbitrary) using DOS or Unix separators
+ *
+ * @return A tokenization of the specified path into the list of URLs.
+ */
+ public static List<URL> tokenizePath(String path) {
+ try {
+ List<URL> l = new ArrayList<URL>();
+ StringTokenizer tok = new StringTokenizer(path, ":;", true); // NOI18N
+
+ char dosHack = '\0';
+ char lastDelim = '\0';
+ int delimCount = 0;
+ while (tok.hasMoreTokens()) {
+ String s = tok.nextToken();
+ if (s.length() == 0) {
+ // Strip empty components.
+ continue;
+ }
+ if (s.length() == 1) {
+ char c = s.charAt(0);
+ if (c == ':' || c == ';') {
+ // Just a delimiter.
+ lastDelim = c;
+ delimCount++;
+ continue;
+ }
+ }
+ if (dosHack != '\0') {
+ // #50679 - "C:/something" is also accepted as DOS path
+ if (lastDelim == ':' && delimCount == 1 && (s.charAt(0) == '\\' || s.charAt(0) == '/')) {
+ // We had a single letter followed by ':' now followed by \something or /something
+ s = "" + dosHack + ':' + s;
+ // and use the new token with the drive prefix...
+ } else {
+ // Something else, leave alone.
+ l.add(fileToUrl(new File(Character.toString(dosHack))));
+ // and continue with this token too...
+ }
+ dosHack = '\0';
+ }
+ // Reset count of # of delimiters in a row.
+ delimCount = 0;
+ if (s.length() == 1) {
+ char c = s.charAt(0);
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
+ // Probably a DOS drive letter. Leave it with the next component.
+ dosHack = c;
+ continue;
+ }
+ }
+ l.add(fileToUrl(new File(s)));
+ }
+ if (dosHack != '\0') {
+ //the dosHack was the last letter in the input string (not followed by the ':')
+ //so obviously not a drive letter.
+ //Fix for issue #57304
+ l.add(fileToUrl(new File(Character.toString(dosHack))));
+ }
+ return l;
+ } catch (MalformedURLException e) {
+ ErrorManager.getDefault().notify(e);
+ return new ArrayList<URL>();
+ }
+ }
+
+ /**
+ *
+ * @param file
+ * @return
+ * @throws java.net.MalformedURLException
+ */
+ public static URL fileToUrl(File file) throws MalformedURLException {
+ File nfile = FileUtil.normalizeFile(file);
+ URL url = nfile.toURI().toURL();
+ if (FileUtil.isArchiveFile(url)) {
+ url = FileUtil.getArchiveRoot(url);
+ }
+ return url;
+ }
+
+ /**
+ * Creates an Ant-style path specification from the specified list of URLs.
+ *
+ * @param The list of URLs.
+ *
+ * @return An Ant-style path specification.
+ */
+ public static String buildPath(List<URL> path) {
+ String PATH_SEPARATOR = System.getProperty("path.separator"); // NOI18N
+
+ StringBuilder sb = new StringBuilder(path.size() * 16);
+ for (Iterator<URL> i = path.iterator(); i.hasNext();) {
+ sb.append(urlToString(i.next()));
+ if (i.hasNext()) {
+ sb.append(PATH_SEPARATOR);
+ }
+ }
+ return sb.toString();
+ }
+
+ /** Return string representation of the specified URL. */
+ private static String urlToString(URL url) {
+ if ("jar".equals(url.getProtocol())) { // NOI18N
+
+ URL fileURL = FileUtil.getArchiveFile(url);
+ if (FileUtil.getArchiveRoot(fileURL).equals(url)) {
+ // really the root
+ url = fileURL;
+ } else {
+ // some subdir, just show it as is
+ return url.toExternalForm();
+ }
+ }
+ if ("file".equals(url.getProtocol())) { // NOI18N
+
+ File f = new File(URI.create(url.toExternalForm()));
+ return f.getAbsolutePath();
+ } else {
+ return url.toExternalForm();
+ }
+ }
+
+ /**
+ *
+ * @param path
+ */
+ public void setJavadocs(List<URL> path) {
+ ip.setProperty(PROP_JAVADOCS, buildPath(path));
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getDebugPort() {
+ return DEBUGPORT;
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Target.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Target.java
new file mode 100644
index 0000000..6a56294
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2Target.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import javax.enterprise.deploy.spi.Target;
+
+/**
+ *
+ * @author Ludo
+ */
+public class Hk2Target implements Target {
+
+ private final String displayName;
+ private final String uri;
+
+ public Hk2Target(String displayName, String uri) {
+ this.displayName = displayName;
+ this.uri = uri;
+ }
+
+ public String getName() {
+ return displayName;
+ }
+
+ public String getDescription() {
+ return displayName;
+ }
+
+ public String getServerUri () {
+ return uri;
+ }
+
+ @Override
+ public String toString() {
+ return getDescription();
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2TargetModuleID.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2TargetModuleID.java
new file mode 100644
index 0000000..df6eb92
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/Hk2TargetModuleID.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+
+/**
+ *
+ * @author Ludovic Champenois
+ * @author Peter Williams
+ */
+public class Hk2TargetModuleID implements TargetModuleID {
+
+ private final Hk2Target target;
+ private final String docBaseURI;
+ private String contextPath;
+ private final String location;
+ private TargetModuleID parent;
+ private final Vector<TargetModuleID> children;
+ final static private Map<String,Hk2TargetModuleID> knownModules =
+ new HashMap<String,Hk2TargetModuleID>();
+
+ private Hk2TargetModuleID(Hk2Target target, String docBaseURI, String contextPath, String location) {
+ this.target = target;
+ this.docBaseURI = docBaseURI;
+ this.contextPath = contextPath;
+ this.location = location;
+ this.parent = null;
+ this.children = new Vector<TargetModuleID>();
+ }
+
+ public static Hk2TargetModuleID get(Hk2Target target, String docBaseURI, String contextPath, String location) {
+ return get(target, docBaseURI, contextPath, location, false);
+ }
+
+ public static Hk2TargetModuleID get(Hk2Target target, String docBaseURI, String contextPath, String location, boolean clearChildren) {
+ synchronized(knownModules) {
+ // Normalize the location data
+ if (!location.endsWith(File.separator)) {
+ location += File.separator;
+ }
+ String key = target.getServerUri()+docBaseURI+location;
+ Hk2TargetModuleID retVal = knownModules.get(key);
+ if (null == retVal) {
+ retVal = new Hk2TargetModuleID(target, docBaseURI, contextPath, location);
+ knownModules.put(key,retVal);
+ } else {
+ if (null != contextPath)
+ retVal.setPath(contextPath);
+ }
+ if (clearChildren) {
+ retVal.children.clear();
+ }
+ return retVal;
+
+ }
+ }
+
+ // Retrieve the identifier of the parent object of this deployed module.
+ public Target getTarget() {
+ return target;
+ }
+
+ // Retrieve a list of identifiers of the children of this deployed module.
+ public String getModuleID() {
+ return docBaseURI;
+ }
+
+ public String getWebURL() {
+ // !PW FIXME path ought to be URL encoded by the time we get here.
+ if (null != contextPath) {
+ if(!contextPath.startsWith("/")) {
+ return target.getServerUri() + "/" + contextPath.replaceAll(" ", "%20");
+ } else {
+ return target.getServerUri() + contextPath.replaceAll(" ", "%20");
+ }
+ }
+ return null;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ // Retrieve the id assigned to represent the deployed module.
+ public TargetModuleID getParentTargetModuleID() {
+ return parent;
+ }
+
+ public TargetModuleID [] getChildTargetModuleID() {
+ return children.toArray(new TargetModuleID[children.size()]);
+ }
+
+ public void setParent(Hk2TargetModuleID parent) {
+ this.parent = parent;
+ }
+
+ public void setPath(String p) {
+ this.contextPath = p;
+ }
+
+ public void addChild(Hk2TargetModuleID child) {
+ children.add(child);
+ child.setParent(this);
+ }
+
+ @Override
+ public String toString() {
+ return getModuleID();
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/MonitorProgressObject.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/MonitorProgressObject.java
new file mode 100644
index 0000000..179a02c
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/MonitorProgressObject.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.StringTokenizer;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.shared.ActionType;
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.shared.StateType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
+import javax.enterprise.deploy.spi.status.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.j2ee.dd.api.application.Application;
+import org.netbeans.modules.j2ee.dd.api.application.DDProvider;
+import org.netbeans.modules.j2ee.dd.api.application.Module;
+import org.netbeans.modules.j2ee.dd.api.application.Web;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Progress object that monitors events from Payara Common and translates
+ * them into JSR-88 equivalents.
+ *
+ * @author Peter Williams
+ */
+public class MonitorProgressObject
+ implements ProgressObject, TaskStateListener {
+
+ /** Server property pattern prefix to search in applications. */
+ private static final String PROPERTY_PATTERN_PREFIX
+ = "applications.application.";
+
+ private final Hk2DeploymentManager dm;
+ private final Hk2TargetModuleID moduleId;
+ private final CommandType commandType;
+
+ public MonitorProgressObject(Hk2DeploymentManager dm, Hk2TargetModuleID moduleId) {
+ this(dm, moduleId, CommandType.DISTRIBUTE);
+ }
+
+ public MonitorProgressObject(Hk2DeploymentManager dm, Hk2TargetModuleID moduleId, CommandType commandType) {
+ this.dm = dm;
+ this.moduleId = moduleId;
+ this.commandType = commandType;
+ this.operationStatus = new Hk2DeploymentStatus(commandType,
+ StateType.RUNNING, ActionType.EXECUTE, "Initializing...");
+ }
+
+ @Override
+ public DeploymentStatus getDeploymentStatus() {
+ return operationStatus;
+ }
+
+ @Override
+ public TargetModuleID[] getResultTargetModuleIDs() {
+ if (null == moduleId) {
+ return computeResultTMID();
+ } else {
+ synchronized (moduleId) {
+ return computeResultTMID();
+ }
+ }
+ }
+
+ @Override
+ public ClientConfiguration getClientConfiguration(TargetModuleID moduleId) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean isCancelSupported() {
+ return false;
+ }
+
+ @Override
+ public void cancel() throws OperationUnsupportedException {
+ throw new OperationUnsupportedException("Cancel not supported yet.");
+ }
+
+ @Override
+ public boolean isStopSupported() {
+ return false;
+ }
+
+ @Override
+ public void stop() throws OperationUnsupportedException {
+ throw new OperationUnsupportedException("Stop not supported yet.");
+ }
+
+ /**
+ * OperationState listener - translates state events from common instance
+ * manager to JSR-88 compatible type.
+ *
+ * @param newState Current state of operation
+ * @param message Informational message about latest state change
+ */
+ @Override
+ public void operationStateChanged(
+ TaskState newState, TaskEvent event, String... args) {
+ String message = args != null ? Utils.concatenate(args) : "";
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, message);
+ // Suppress message except in cases of failure. Returning an empty
+ // string prevents status from being displayed in build output window.
+ String relayedMessage = newState == TaskState.FAILED ? message : "";
+ fireHandleProgressEvent(new Hk2DeploymentStatus(commandType,
+ translateState(newState), ActionType.EXECUTE, relayedMessage));
+ }
+
+ private TargetModuleID[] computeResultTMID() {
+ TargetModuleID[] retVal = new TargetModuleID[]{moduleId};
+ try {
+ retVal = createModuleIdTree(moduleId);
+ } catch (InterruptedException | ExecutionException | TimeoutException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, null, ex);
+ }
+ return retVal;
+ }
+
+ private void loopThroughListeners(DeploymentStatus status) {
+ operationStatus = status;
+ ProgressEvent event = new ProgressEvent(dm, moduleId, status);
+ for (ProgressListener target : listeners) {
+ target.handleProgressEvent(event);
+ }
+ }
+
+ private StateType translateState(TaskState commonState) {
+ switch(commonState) {
+ case READY: case RUNNING:
+ return StateType.RUNNING;
+ case COMPLETED:
+ return StateType.COMPLETED;
+ case FAILED:
+ return StateType.FAILED;
+ default:
+ return StateType.FAILED;
+ }
+ }
+
+ // ProgressEvent/Listener support
+
+ private volatile DeploymentStatus operationStatus;
+ private CopyOnWriteArrayList<ProgressListener> listeners =
+ new CopyOnWriteArrayList<ProgressListener>();
+
+ @Override
+ public void addProgressListener(ProgressListener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeProgressListener(ProgressListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void fireHandleProgressEvent(DeploymentStatus status) {
+ if (null == moduleId) {
+ loopThroughListeners(status);
+ } else {
+ synchronized(moduleId) {
+ loopThroughListeners(status);
+ }
+ }
+ }
+
+ static final private String[] TYPES = {"web", "ejb"};
+
+ private TargetModuleID[] createModuleIdTree(Hk2TargetModuleID moduleId)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ synchronized (moduleId) {
+ // this should only get called in the ear deploy case...
+ Hk2TargetModuleID root
+ = Hk2TargetModuleID.get((Hk2Target) moduleId.getTarget(),
+ moduleId.getModuleID(), null, moduleId.getLocation(), true);
+ // build the tree of submodule
+ String query = getNameToQuery(moduleId.getModuleID());
+ int queryLen = query != null ? query.length() : 0;
+ StringBuilder propertyPattern = new StringBuilder(
+ PROPERTY_PATTERN_PREFIX.length() + queryLen);
+ propertyPattern.append(PROPERTY_PATTERN_PREFIX);
+ if (queryLen > 0) {
+ propertyPattern.append(query);
+ }
+ try {
+ ResultMap<String, String> result = CommandGetProperty
+ .getProperties(dm.getCommonServerSupport()
+ .getInstance(), propertyPattern.toString(), 60000);
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> values = result.getValue();
+ for (Entry<String, String> e : values.entrySet()) {
+ String k = e.getKey();
+ int dex1 = k.lastIndexOf(".module."); // NOI18N
+ int dex2 = k.lastIndexOf(".name"); // NOI18N
+ String moduleName = e.getValue();
+ if (dex2 > dex1 && dex1 > 0
+ && !moduleId.getModuleID().equals(moduleName)) {
+ for (String guess : TYPES) {
+ String type
+ = values.get("applications.application."
+ + moduleId.getModuleID() + ".module."
+ + moduleName + ".engine." + guess
+ + ".sniffer");
+ if (null != type) {
+ Hk2TargetModuleID kid = Hk2TargetModuleID
+ .get(
+ (Hk2Target) moduleId.getTarget(),
+ moduleName, "web".equals(guess)
+ ? determineContextRoot(root, moduleName)
+ : null,
+ moduleId.getLocation()
+ + File.separator
+ + FastDeploy.transform(moduleName));
+ root.addChild(kid);
+ }
+ }
+ }
+ }
+
+ }
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Could not retrieve property from server.", gfie);
+ }
+ return new TargetModuleID[]{root};
+ }
+ }
+
+ // hotfix for #176096 - maven moduleID can contains dots and result is that
+ // GetPropertyCommand above does not match right module. this fix
+ // is extracting the longest name which does not have dots and will use it
+ // as query, for example for "org.foo.bar.mywebapp_1.0-dev the query
+ // will be "mywebapp_1"
+
+ private String getNameToQuery(String name) {
+ if (name.indexOf('.') == -1) {
+ return name+".*";
+ }
+ StringTokenizer st = new StringTokenizer(name, ".");
+ String newName = "";
+ int segment = 0;
+ int nameSegment = 0;
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ segment++;
+ if (token.length() > newName.length()) {
+ newName = token;
+ nameSegment = segment;
+ }
+ }
+ return (nameSegment > 1 ? "*."+newName : newName)+".*";
+ }
+
+ private String determineContextRoot(Hk2TargetModuleID root, String moduleName) {
+ String retVal = "/" + moduleName; // incorrect falback
+ int dex = moduleName.lastIndexOf('.');
+ if (dex > -1) {
+ retVal = "/" + moduleName.substring(0, dex);
+ }
+ // look for the application.xml
+ File appxml = new File(root.getLocation(), "META-INF"+File.separator+"application.xml");
+ if (appxml.exists()) {
+ try {
+ // TODO read the entries
+ DDProvider ddp = DDProvider.getDefault();
+ Application app = ddp.getDDRoot(FileUtil.createData(FileUtil.normalizeFile(appxml)));
+ // TODO build a map
+ Module[] mods = app.getModule();
+ for (Module m : mods) {
+ Web w = m.getWeb();
+ if (null != w && moduleName.equals(w.getWebUri())) {
+ retVal = w.getContextRoot();
+ break;
+ }
+ }
+ } catch (IOException ex) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO, null, ex);
+ }
+ }
+ return retVal;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/RegisteredDDCatalogImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/RegisteredDDCatalogImpl.java
new file mode 100644
index 0000000..ecaf547
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/RegisteredDDCatalogImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.File;
+import org.netbeans.spi.server.ServerInstanceProvider;
+import org.netbeans.modules.payara.jakartaee.RunTimeDDCatalog;
+import org.netbeans.modules.payara.spi.RegisteredDDCatalog;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author raccah
+ */
+@ServiceProvider(service=RegisteredDDCatalog.class,path="Servers/Payara")
+public class RegisteredDDCatalogImpl implements RegisteredDDCatalog {
+ private void registerRunTimeDDCatalog(RunTimeDDCatalog catalog, ServerInstanceProvider pip) {
+ if (catalog != null) {
+ catalog.setInstanceProvider(pip);
+ }
+ }
+
+ @Override
+ public void registerRunTimeDDCatalog(ServerInstanceProvider pip) {
+ registerRunTimeDDCatalog(RunTimeDDCatalog.getDefaultRunTimeDDCatalog(), pip);
+ }
+
+ @Override
+ public void refreshRunTimeDDCatalog(ServerInstanceProvider pip, String installRoot) {
+ RunTimeDDCatalog catalog = RunTimeDDCatalog.getRunTimeDDCatalog(pip);
+ if (catalog != null) {
+ catalog.refresh((installRoot != null) ? new File(installRoot) : null);
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/UpdateContextRoot.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/UpdateContextRoot.java
new file mode 100644
index 0000000..238ba57
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/UpdateContextRoot.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.admin.CommandGetProperty;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class UpdateContextRoot implements ProgressListener {
+
+ private MonitorProgressObject returnProgress;
+ private Hk2TargetModuleID moduleId;
+ private ServerInstance si;
+ private boolean needToDo;
+
+ private static final RequestProcessor RP = new RequestProcessor("UpdateContextRoot",5); // NOI18N
+
+ public UpdateContextRoot(MonitorProgressObject returnProgress, Hk2TargetModuleID moduleId,
+ ServerInstance si, boolean needToDo) {
+ this.returnProgress = returnProgress;
+ this.moduleId = moduleId;
+ this.si = si;
+ this.needToDo = needToDo;
+ }
+
+ @Override
+ public void handleProgressEvent(ProgressEvent event) {
+ if (event.getDeploymentStatus().isCompleted()) {
+ if (needToDo) {
+ returnProgress.operationStateChanged(TaskState.RUNNING,
+ TaskEvent.CMD_RUNNING,
+ event.getDeploymentStatus().getMessage());
+ // let's update the context-root
+ //
+ RP.post(new Runnable() {
+
+ @Override
+ public void run() {
+ // Maven projects like to embed a '.' into the ModuleID
+ // that played havoc with the get command, so we started
+ // to use a different get pattern,
+ try {
+ PayaraServer server
+ = si.getBasicNode().getLookup()
+ .lookup(PayaraModule.class).getInstance();
+ ResultMap<String, String> result
+ = CommandGetProperty.getProperties( server,
+ "applications.application.*.context-root");
+ if (result.getState() == TaskState.COMPLETED) {
+ Map<String, String> retVal = result.getValue();
+ String newCR = retVal.get(
+ "applications.application."
+ + moduleId.getModuleID()
+ + ".context-root");
+ if (null != newCR) {
+ moduleId.setPath(newCR); //e.getValue());
+ returnProgress.operationStateChanged(
+ TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "updated the moduleid");
+ } else {
+ returnProgress.operationStateChanged(
+ TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "no moduleid update necessary");
+ }
+ } else {
+ // there are no context-root values to be had...
+ // the query failed... but the update has been successful
+ returnProgress.operationStateChanged(
+ TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED,
+ "no moduleid update necessary");
+ }
+ } catch (PayaraIdeException gfie) {
+ Logger.getLogger("payara-jakartaee").log(Level.INFO,
+ "Could not retrieve property from server"
+ + " when updating module id.", gfie);
+ }
+
+ }
+ });
+ } else {
+ returnProgress.operationStateChanged(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED, event.getDeploymentStatus().getMessage());
+ }
+ }else if (event.getDeploymentStatus().isFailed()) {
+ returnProgress.operationStateChanged(TaskState.FAILED,
+ TaskEvent.CMD_FAILED, event.getDeploymentStatus().getMessage());
+ } else {
+ returnProgress.operationStateChanged(TaskState.RUNNING,
+ TaskEvent.CMD_RUNNING, event.getDeploymentStatus().getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/VMIntrospectorImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/VMIntrospectorImpl.java
new file mode 100644
index 0000000..e1978fa
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ide/VMIntrospectorImpl.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.api.debugger.Session;
+import org.netbeans.api.debugger.jpda.AttachingDICookie;
+import org.netbeans.api.debugger.jpda.JPDADebugger;
+import org.netbeans.modules.payara.spi.VMIntrospector;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author vkraemer
+ */
+@ServiceProvider(service=VMIntrospector.class,path="Servers/Payara") // NOI18N
+public class VMIntrospectorImpl implements VMIntrospector {
+
+ public VMIntrospectorImpl() {
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "VMIntrospector created"); // NOI18N
+ }
+
+
+ /**
+ * Returns true if this server is started in debug mode AND debugger is attached to it
+ * AND threads are suspended (e.g. debugger stopped on breakpoint)
+ */
+ @Override
+ public boolean isSuspended(String host, String port) {
+ Logger.getLogger("payara-jakartaee").log(Level.FINE, "VMIntrospector called {0}, {1}", new Object[] { host, port }); // NOI18N
+ boolean retVal = false;
+ Session[] sessions = DebuggerManager.getDebuggerManager().getSessions();
+
+ for (int i=0; ! retVal && i < sessions.length; i++) {
+ Session s = sessions[i];
+ if (s != null) {
+ Object o = s.lookupFirst(null,AttachingDICookie.class);
+ if (o != null) {
+ Object d = s.lookupFirst(null,JPDADebugger.class);
+ if (d != null) {
+ JPDADebugger jpda = (JPDADebugger)d;
+ if (jpda.getState() == JPDADebugger.STATE_STOPPED) { // the session is suspended.
+ AttachingDICookie attCookie = (AttachingDICookie)o;
+ String shmName = attCookie.getSharedMemoryName();
+ if (shmName!=null) {
+ if (shmName.startsWith(port)) {
+ retVal = true;
+ }
+ } else {//test the machine name and port number
+ int attachedPort = attCookie.getPortNumber();
+ if (sameMachine(attCookie.getHostName(), host) &&
+ Integer.parseInt(port) == attachedPort) {
+ retVal = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+ private static final String LOCALHOST="localhost";//NOI18N
+ private static final String LOCALADDRESS="127.0.0.1";//NOI18N
+
+
+
+ boolean sameMachine(String host1, String host2){
+ try {
+ if (host1.equals(host2)){
+ return true;
+ }
+ if (host1.equals(LOCALHOST)){
+ if (host2.equals(LOCALADDRESS)){
+ return true;
+ }
+ String localCanonicalHostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
+ String h2 = java.net.InetAddress.getByName(host2).getCanonicalHostName();
+ if (localCanonicalHostName.equals(h2)){
+ return true;
+ }
+ }
+ if (host1.equals(LOCALADDRESS)){
+ if (host2.equals(LOCALHOST)){
+ return true;
+ }
+ return true;
+ }
+ if (host2.equals(LOCALHOST)){
+ if (host1.equals(LOCALADDRESS)){
+ return true;
+ }
+ String localCanonicalHostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
+ String h1 = java.net.InetAddress.getByName(host1).getCanonicalHostName();
+ if (localCanonicalHostName.equals(h1)){
+ return true;
+ }
+ }
+ if (host2.equals(LOCALADDRESS)){
+ if (host1.equals(LOCALHOST)){
+ return true;
+ }
+ String localCanonicalHostName = java.net.InetAddress.getLocalHost().getCanonicalHostName();
+ String h1 = java.net.InetAddress.getByName(host1).getCanonicalHostName();
+ if (localCanonicalHostName.equals(h1)){
+ return true;
+ }
+ }
+ String h1 = java.net.InetAddress.getByName(host1).getCanonicalHostName();
+ String h2 = java.net.InetAddress.getByName(host2).getCanonicalHostName();
+ if (h1.equals(h2)){
+ return true;
+ }
+ } catch (java.net.UnknownHostException ex) {
+ //ex.printStackTrace();
+ }
+ return false;
+ }
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/layer.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/layer.xml
new file mode 100644
index 0000000..13b932b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/layer.xml
@@ -0,0 +1,253 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<filesystem>
+
+ <!-- Payara common server module support -->
+ <folder name="Servers">
+ <folder name="Payara">
+ <file name="JavaEEServerModuleFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.JavaEEServerModuleFactory.getDefault"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.JavaEEServerModuleFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.payara.spi.PayaraModuleFactory"/>
+ </file>
+ <file name="JavaEEDecoratorFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.JavaEEDecoratorFactory.getDefault"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.JavaEEDecoratorFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.payara.spi.DecoratorFactory"/>
+ </file>
+ </folder>
+ </folder>
+
+ <!-- j2eeserver api support -->
+ <folder name="J2EE">
+ <folder name="DeploymentPlugins">
+ <folder name="pfv3ee6">
+ <file name="Descriptor" url="nbdepee6.xml"/>
+ <!-- -->
+ <file name="Factory.instance">
+ <attr name="urlPattern" stringvalue="^\[.*deployer:pfv3ee6[w]?[c]?:.*$"/>
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2DeploymentFactory.createEe6"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory"/>
+ <attr name="instanceOf" stringvalue="javax.enterprise.deploy.spi.factories.DeploymentFactory"/>
+ </file>
+ <file name="J2eePlatformFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory.getFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory"/>
+ </file>
+ <file name="OptionalFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyOptionalFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2OptionalFactory.createEe6"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory"/>
+ </file>
+ <file name="ModuleConfigFactory.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory"/>
+ </file>
+ <file name="J2eeVerifierSupport.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport"/>
+ </file>
+ <!-- -->
+ <folder name="DeploymentFileNames">
+ <folder name="WAR">
+ <file name="WEB-INF\payara-web.xml"/>
+ <file name="WEB-INF\sun-web.xml"/>
+ <file name="WEB-INF\glassfish-web.xml"/>
+ <file name="WEB-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EJB">
+ <file name="META-INF\sun-ejb-jar.xml"/>
+ <file name="META-INF\sun-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-ejb-jar.xml"/>
+ <file name="META-INF\glassfish-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EAR">
+ <file name="META-INF\sun-application.xml"/>
+ <file name="META-INF\glassfish-application.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="RAR">
+ <file name="META-INF\sun-ra.xml"/>
+ <file name="META-INF\glassfish-ra.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="CAR">
+ <file name="META-INF\sun-application-client.xml"/>
+ <file name="META-INF\glassfish-application-client.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ </folder>
+ </folder>
+
+ <folder name="pfv4ee7">
+ <file name="Descriptor" url="nbdepee7.xml"/>
+ <!-- -->
+ <file name="Factory.instance">
+ <attr name="urlPattern" stringvalue="^\[.*deployer:pfv4ee7[w]?[c]?:.*$"/>
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2DeploymentFactory.createEe7"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory"/>
+ <attr name="instanceOf" stringvalue="javax.enterprise.deploy.spi.factories.DeploymentFactory"/>
+ </file>
+ <file name="J2eePlatformFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory.getFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory"/>
+ </file>
+ <file name="OptionalFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyOptionalFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2OptionalFactory.createEe7"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory"/>
+ </file>
+ <file name="ModuleConfigFactory.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory"/>
+ </file>
+ <file name="J2eeVerifierSupport.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport"/>
+ </file>
+ <!-- -->
+ <folder name="DeploymentFileNames">
+ <folder name="WAR">
+ <file name="WEB-INF\payara-web.xml"/>
+ <file name="WEB-INF\sun-web.xml"/>
+ <file name="WEB-INF\glassfish-web.xml"/>
+ <file name="WEB-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EJB">
+ <file name="META-INF\sun-ejb-jar.xml"/>
+ <file name="META-INF\sun-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-ejb-jar.xml"/>
+ <file name="META-INF\glassfish-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EAR">
+ <file name="META-INF\sun-application.xml"/>
+ <file name="META-INF\glassfish-application.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="RAR">
+ <file name="META-INF\sun-ra.xml"/>
+ <file name="META-INF\glassfish-ra.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="CAR">
+ <file name="META-INF\sun-application-client.xml"/>
+ <file name="META-INF\glassfish-application-client.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ </folder>
+ </folder>
+
+ <folder name="pfv5ee8">
+ <file name="Descriptor" url="nbdepee8.xml"/>
+ <!-- -->
+ <file name="Factory.instance">
+ <attr name="urlPattern" stringvalue="^\[.*deployer:pfv5ee8[w]?[c]?:.*$"/>
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2DeploymentFactory.createEe8"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyDeploymentFactory"/>
+ <attr name="instanceOf" stringvalue="javax.enterprise.deploy.spi.factories.DeploymentFactory"/>
+ </file>
+ <file name="J2eePlatformFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory.getFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2JavaEEPlatformFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformFactory"/>
+ </file>
+ <file name="OptionalFactory.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.support.ProxyOptionalFactory.create"/>
+ <attr name="delegate" methodvalue="org.netbeans.modules.payara.jakartaee.Hk2OptionalFactory.createEe8"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory"/>
+ </file>
+ <file name="ModuleConfigFactory.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.Hk2ModuleConfigFactory"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfigurationFactory"/>
+ </file>
+ <file name="J2eeVerifierSupport.instance">
+ <attr name="instanceCreate" newvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceClass" stringvalue="org.netbeans.modules.payara.jakartaee.verifier.VerifierImpl"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport"/>
+ </file>
+ <!-- -->
+ <folder name="DeploymentFileNames">
+ <folder name="WAR">
+ <file name="WEB-INF\payara-web.xml"/>
+ <file name="WEB-INF\sun-web.xml"/>
+ <file name="WEB-INF\glassfish-web.xml"/>
+ <file name="WEB-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EJB">
+ <file name="META-INF\sun-ejb-jar.xml"/>
+ <file name="META-INF\sun-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-ejb-jar.xml"/>
+ <file name="META-INF\glassfish-cmp-mappings.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="EAR">
+ <file name="META-INF\sun-application.xml"/>
+ <file name="META-INF\glassfish-application.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="RAR">
+ <file name="META-INF\sun-ra.xml"/>
+ <file name="META-INF\glassfish-ra.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ <folder name="CAR">
+ <file name="META-INF\sun-application-client.xml"/>
+ <file name="META-INF\glassfish-application-client.xml"/>
+ <file name="META-INF\glassfish-resources.xml"/>
+ </folder>
+ </folder>
+ </folder>
+ </folder>
+ </folder>
+
+ <folder name="Plugins">
+ <!-- Register XML module catalog plugin -->
+ <folder name="XML">
+ <folder name="UserCatalogs">
+ <file name="org-netbeans-modules-payara-jakartaee-RunTimeDDCatalog.instance">
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.RunTimeDDCatalog.getRunTimeDDCatalog"/>
+ <attr name="instanceOf" stringvalue="org.netbeans.modules.xml.catalog.spi.CatalogReader"/>
+ </file>
+ </folder>
+ <folder name="GrammarQueryManagers">
+ <file name="org-netbeans-modules-payara-jakartaee-RunTimeDDCatalog.instance">
+ <attr name="position" intvalue="350"/>
+ <attr name="instanceCreate" methodvalue="org.netbeans.modules.payara.jakartaee.RunTimeDDCatalog.getRunTimeDDCatalog"/>
+ </file>
+ </folder> <!-- GrammarQueryManagers -->
+ </folder>
+ </folder>
+
+</filesystem>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdep.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdep.xml
new file mode 100644
index 0000000..f925468
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdep.xml
@@ -0,0 +1,51 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/payara/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:pfv3</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <container-limitation>
+ <war-deploy/>
+ </container-limitation>
+
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6.xml
new file mode 100644
index 0000000..d09acab
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6.xml
@@ -0,0 +1,54 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/payara/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:pfv3ee6</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <!-- v3 ee6 has no limitations...
+ <container-limitation>
+ <ear-deploy/>
+ <war-deploy/>
+ <ejbjar-deploy/>
+ </container-limitation>
+ -->
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6wc.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6wc.xml
new file mode 100644
index 0000000..a8f762e
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee6wc.xml
@@ -0,0 +1,54 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/payara/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:pfv3ee6wc</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <!-- v3 ee6 has no limitations...
+ <container-limitation>
+ <ear-deploy/>
+ <war-deploy/>
+ <ejbjar-deploy/>
+ </container-limitation>
+ -->
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee7.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee7.xml
new file mode 100644
index 0000000..0288ece
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee7.xml
@@ -0,0 +1,54 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/payara/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:pfv4ee7</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <!-- v3 ee6 has no limitations...
+ <container-limitation>
+ <ear-deploy/>
+ <war-deploy/>
+ <ejbjar-deploy/>
+ </container-limitation>
+ -->
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee8.xml b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee8.xml
new file mode 100644
index 0000000..81a67ff
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/nbdepee8.xml
@@ -0,0 +1,54 @@
+<netbeans-deployment>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+ <!--
+ The icon element contains a path to the icon to be used to present the server
+ in the server registry.
+ -->
+ <icon>org/netbeans/modules/payara/common/resources/server</icon>
+
+ <!--
+ The disconnected-string element contains the String parameter to DeploymentFactory.getDisconnectedDeploymentManager()
+ -->
+ <disconnected-string>deployer:pfv5ee8</disconnected-string>
+
+ <!--
+ The container-limitation element modifies a plugin to say that not all j2ee deployments are valid.
+ For example, a web-only server would include
+ <container-limitation> <war-deploy/> </container-limitation>
+ to indicate that only war deployments are accepted.
+ If a container-limitation element is not present, all j2ee deployments are assumed valid.
+ If a container-limitation element is present, then only j2ee deployment types explicitly
+ mentioned are allowed.
+ -->
+ <!-- v3 ee6 has no limitations...
+ <container-limitation>
+ <ear-deploy/>
+ <war-deploy/>
+ <ejbjar-deploy/>
+ </container-limitation>
+ -->
+ <web-context-root>
+ <xpath>/</xpath>
+ <prop-name>contextRoot</prop-name>
+ </web-context-root>
+
+</netbeans-deployment>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/ConfigFile.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/ConfigFile.gif
new file mode 100644
index 0000000..fd79bcd
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/ConfigFile.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/appclient.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/appclient.gif
new file mode 100644
index 0000000..6781498
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/appclient.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/connector.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/connector.gif
new file mode 100644
index 0000000..30801db
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/connector.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/javamail.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/javamail.gif
new file mode 100644
index 0000000..19ae844
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/javamail.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jdbc.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jdbc.gif
new file mode 100644
index 0000000..237bc65
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jdbc.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jms.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jms.gif
new file mode 100644
index 0000000..ca9c191
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jms.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jndi.gif b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jndi.gif
new file mode 100644
index 0000000..5282220
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/jndi.gif
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/server.png b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/server.png
new file mode 100644
index 0000000..e7b14f2
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/resources/server.png
Binary files differ
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/Bundle.properties b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/Bundle.properties
new file mode 100644
index 0000000..c2afa49
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/Bundle.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+DebugPortQuery.debugPortLable.text=<html><body>Debug port is undefined for remote server. Which port should the debugger attach to?</body></html>
+DebugPortQuery.noAskCheck.text=<html><body>Don't ask me again. <i><small>(Change in Server Properties.)</small></i></body></html>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.form b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.form
new file mode 100644
index 0000000..cbb9722
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.form
@@ -0,0 +1,94 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="debugPortLable" alignment="1" pref="393" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="6" pref="6" max="6" attributes="0"/>
+ <Component id="debugPortSpinner" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="204" max="-2" attributes="0"/>
+ </Group>
+ <Component id="noAskCheck" alignment="0" pref="393" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="debugPortLable" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="debugPortSpinner" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="noAskCheck" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="debugPortLable">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/javaee/ui/Bundle.properties" key="DebugPortQuery.debugPortLable.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="verticalTextPosition" type="int" value="1"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JSpinner" name="debugPortSpinner">
+ <Properties>
+ <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="9009" maximum="65535" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="noAskCheck">
+ <Properties>
+ <Property name="selected" type="boolean" value="true"/>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/glassfish/javaee/ui/Bundle.properties" key="DebugPortQuery.noAskCheck.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.java
new file mode 100644
index 0000000..89a3c6b
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/ui/DebugPortQuery.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ui;
+
+import java.awt.Dimension;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author peterw99
+ */
+public class DebugPortQuery extends javax.swing.JPanel {
+
+ /** Creates new form DebugPortQuery */
+ public DebugPortQuery() {
+ initComponents();
+ }
+
+ public void setDebugPort(String debugPort) {
+ try {
+ int port = Integer.valueOf(debugPort);
+ if(port > 0 && port < 65536) {
+ debugPortSpinner.getModel().setValue(Integer.valueOf(port));
+ } else {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.INFO, "Debug port out of range in DebugPortQuery");
+ }
+ } catch(NumberFormatException ex) {
+ Logger.getLogger("payara-jakartaee").log(
+ Level.INFO, "Invalid debug port, using default = 9009.", ex);
+ }
+ }
+
+ public String getDebugPort() {
+ Object value = debugPortSpinner.getModel().getValue();
+ return value != null ? value.toString() : "";
+ }
+
+ public boolean shouldPersist() {
+ return noAskCheck.getModel().isSelected();
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ // Bump height by 16% because GroupLayout doesn't resize properly when
+ // label text uses HTML to wrap lines.
+ Dimension preferredSize = super.getPreferredSize();
+ preferredSize.height = preferredSize.height * 29 / 25;
+ return preferredSize;
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ debugPortLable = new javax.swing.JLabel();
+ debugPortSpinner = new javax.swing.JSpinner();
+ noAskCheck = new javax.swing.JCheckBox();
+
+ debugPortLable.setText(org.openide.util.NbBundle.getMessage(DebugPortQuery.class, "DebugPortQuery.debugPortLable.text")); // NOI18N
+ debugPortLable.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
+
+ debugPortSpinner.setModel(new javax.swing.SpinnerNumberModel(9009, 1, 65535, 1));
+
+ noAskCheck.setSelected(true);
+ noAskCheck.setText(org.openide.util.NbBundle.getMessage(DebugPortQuery.class, "DebugPortQuery.noAskCheck.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(debugPortLable, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(debugPortSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(204, 204, 204))
+ .addComponent(noAskCheck, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(debugPortLable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(debugPortSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(noAskCheck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel debugPortLable;
+ private javax.swing.JSpinner debugPortSpinner;
+ private javax.swing.JCheckBox noAskCheck;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/verifier/VerifierImpl.java b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/verifier/VerifierImpl.java
new file mode 100644
index 0000000..1897aa8
--- /dev/null
+++ b/enterprise/payara.jakartaee/src/org/netbeans/modules/payara/jakartaee/verifier/VerifierImpl.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.verifier;
+
+import java.io.File;
+import java.io.OutputStream;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.payara.common.PayaraInstance;
+import org.netbeans.modules.payara.common.ui.JavaSEPlatformPanel;
+import org.netbeans.modules.payara.common.utils.JavaUtils;
+import org.netbeans.modules.payara.eecommon.api.VerifierSupport;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentFactory;
+import org.netbeans.modules.payara.jakartaee.Hk2DeploymentManager;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.common.api.ValidationException;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+
+public class VerifierImpl extends org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport {
+
+ /** Creates a new instance of VerifierImpl */
+ public VerifierImpl() {
+ }
+
+ /**
+ * Verify the provided target J2EE module or application, including both
+ * standard J2EE and platform specific deployment info. The provided
+ * service could include invoking its own specific UI displaying of verification
+ * result. In this case, the service could have limited or no output to logger stream.
+ *
+ * @param target The an archive, directory or file to verify.
+ * @param logger Log stream to write verification output to.
+ * @exception ValidationException if the target fails the validation.
+ */
+ @Override
+ public void verify(FileObject target, OutputStream logger) throws ValidationException {
+ final String jname = FileUtil.toFile(target).getAbsolutePath();
+ DeploymentManager dm;
+ try {
+ dm = getAssociatedSunDM(target);
+ if (dm instanceof Hk2DeploymentManager) {
+ Hk2DeploymentManager hk2dm = (Hk2DeploymentManager) dm;
+ PayaraModule gm = hk2dm.getCommonServerSupport();
+ PayaraServer server = gm.getInstance();
+ String javaHome = gm.getInstanceProperties()
+ .get(PayaraModule.JAVA_PLATFORM_ATTR);
+ if (javaHome == null || javaHome.length() < 1) {
+ javaHome = JavaUtils.getDefaultJavaHome();
+ }
+ File javaHomeFile = new File(javaHome);
+ if (!JavaUtils.isJavaPlatformSupported(
+ (PayaraInstance)server, javaHomeFile)) {
+ FileObject javaFO
+ = JavaSEPlatformPanel.selectServerSEPlatform(
+ (PayaraInstance)server, javaHomeFile);
+ javaHome = FileUtil.toFile(javaFO).getAbsolutePath();
+ }
+ VerifierSupport.launchVerifier(jname, logger, server, javaHome);
+ }
+ } catch (DeploymentManagerCreationException ex) {
+ ValidationException ve = new ValidationException("Bad DM");
+ ve.initCause(ex);
+ throw ve;
+ }
+ }
+
+ private DeploymentManager getAssociatedSunDM(FileObject target) throws DeploymentManagerCreationException{
+ DeploymentManager dm = null;
+ J2eeModuleProvider modProvider = getModuleProvider(target);
+ if (modProvider != null){
+ InstanceProperties serverName = modProvider.getInstanceProperties();
+ dm = Hk2DeploymentFactory.createEe6().getDisconnectedDeploymentManager(serverName.getProperty(InstanceProperties.URL_ATTR));
+ }
+ return dm;
+ }
+
+ private J2eeModuleProvider getModuleProvider(FileObject target){
+ J2eeModuleProvider modProvider = null;
+ Project holdingProj = FileOwnerQuery.getOwner(target);
+ if (holdingProj != null){
+ modProvider = (J2eeModuleProvider) holdingProj.getLookup().lookup(J2eeModuleProvider.class);
+ }
+ return modProvider;
+ }
+
+}
+
diff --git a/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerResourceProperties.java b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerResourceProperties.java
new file mode 100644
index 0000000..80582fa
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerResourceProperties.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ /**
+ * @author davisn
+ */
+
+package org.netbeans.modules.payara.jakartaee.test;
+
+import org.netbeans.jellytools.RuntimeTabOperator;
+import org.netbeans.jellytools.nodes.Node;
+import org.netbeans.junit.NbTestCase;
+
+public class ServerResourceProperties extends NbTestCase {
+ private final int SLEEP = 10000;
+
+ public ServerResourceProperties (String testName) {
+ super(testName);
+ }
+
+ public void preludeServerProperties() {
+ RuntimeTabOperator rto;
+ String[] serverList;
+ rto = RuntimeTabOperator.invoke();
+ Node snode = new Node(rto.tree(), "Servers");
+ snode.expand();
+ serverList = snode.getChildren();
+ for (String server : serverList) {
+ if (server.compareTo("Prelude V3") == 0)
+ System.out.printf("Found the %s:", server);
+ else
+ System.err.printf("Problem %s does not exist", server);
+ }
+ Util.sleep(SLEEP);
+ }
+
+ public void VerifyPreludeDerbyPool() {
+ RuntimeTabOperator rto;
+ rto = RuntimeTabOperator.invoke();
+ Node derbynode = new Node(rto.tree(), "Servers|Prelude V3|Resources|JDBC|Connection Pools|DerbyPool");
+ if (derbynode.isPresent()) {
+ System.out.printf("Found JDBC Connection DerbyPool");
+ }
+ else {
+ fail("JDBC Connection DerbyPool missing!");
+ }
+ }
+
+ public void serverProperties() {
+ RuntimeTabOperator rto;
+ String[] serverList;
+ rto = RuntimeTabOperator.invoke();
+ Node snode = new Node(rto.tree(), "Servers");
+ snode.expand();
+ serverList = snode.getChildren();
+ for (String server : serverList) {
+ if (server.compareTo("Payara V3") == 0)
+ System.out.printf("Found the %s:", server);
+ else
+ System.err.printf("Problem %s does not exist", server);
+ }
+ Util.sleep(SLEEP);
+ }
+
+ public void VerifyDefaultDerbyPool() {
+ RuntimeTabOperator rto;
+ rto = RuntimeTabOperator.invoke();
+ Node derbynode = new Node(rto.tree(), "Servers|Payara V3|Resources|JDBC|Connection Pools|DerbyPool");
+ if (derbynode.isPresent()) {
+ System.out.printf("Found JDBC Connection DerbyPool");
+ }
+ else {
+ fail("JDBC Connection DerbyPool missing!");
+ }
+ }
+
+ public void VerifyDefaultTimerResouce() {
+ RuntimeTabOperator rto;
+ rto = RuntimeTabOperator.invoke();
+ Node derbynode = new Node(rto.tree(), "Servers|Payara V3|Resources|JDBC|JDBC Resources|jdbc/__TimerPool");
+ if (derbynode.isPresent()) {
+ System.out.printf("Found JDBC Resouce jdbc/sample");
+ }
+ else {
+ fail("JDBC Resoucec jdbc/sample missing!");
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerTest.java b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerTest.java
new file mode 100644
index 0000000..efa7052
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/ServerTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.test;
+
+import junit.framework.Test;
+import org.netbeans.junit.NbModuleSuite;
+import org.netbeans.junit.NbModuleSuite.Configuration;
+import org.netbeans.junit.NbTestCase;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class ServerTest extends NbTestCase {
+
+ public ServerTest(String testName) {
+ super(testName);
+ }
+
+ public void testBogus() {
+
+ }
+
+ public static Test suite() {
+ Configuration conf = NbModuleSuite.createConfiguration(ServerTest.class).
+ addTest(StartStopServer.class, "startPreludeServer").
+ addTest(ServerResourceProperties.class, "preludeServerProperties").
+ addTest(StartStopServer.class, "restartPreludeServer").
+ addTest(StartStopServer.class, "stopPreludeServer", "startDebugPreludeServer", "stopPreludeServer").
+ addTest(StartStopServer.class, "startPreludeServer").
+ addTest(ServerResourceProperties.class, "VerifyPreludeDerbyPool").
+ addTest(StartStopServer.class, "stopPreludeServer");
+
+ String javaExe = System.getProperty("v3.server.javaExe");
+ if (null != javaExe && javaExe.trim().length() > 0) {
+ conf = conf.addTest(StartStopServer.class, "startServer").
+ addTest(ServerResourceProperties.class, "serverProperties").
+ addTest(StartStopServer.class, "restartServer").
+ addTest(StartStopServer.class, "stopServer", "startDebugServer", "stopServer").
+ addTest(StartStopServer.class, "startServer").
+ addTest(ServerResourceProperties.class, "VerifyDefaultDerbyPool").
+ addTest(ServerResourceProperties.class, "VerifyDefaultTimerResouce").
+ addTest(StartStopServer.class, "stopServer");
+ }
+ return conf.enableModules(".*").clusters(".*").suite();
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/StartStopServer.java b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/StartStopServer.java
new file mode 100644
index 0000000..c80a114
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/StartStopServer.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * @author davisn
+ */
+
+package org.netbeans.modules.payara.jakartaee.test;
+
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.payara.common.PayaraInstanceProvider;
+//import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
+import org.netbeans.modules.payara.spi.PayaraModule;
+import org.netbeans.modules.j2ee.deployment.impl.ServerInstance;
+import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
+import org.netbeans.modules.j2ee.deployment.impl.ui.ProgressUI;
+
+
+public class StartStopServer extends NbTestCase {
+
+ private final int SLEEP = 10000;
+
+ public StartStopServer(String testName) {
+ super(testName);
+ }
+
+ private static final String V_URL = "["+Util._V3_LOCATION+"]deployer:pfv3ee6:localhost:4848";
+
+
+ public void startServer() {
+ try {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ ServerInstance inst = ServerRegistry.getInstance().getServerInstance(V_URL);
+
+ if(inst.isRunning())
+ return;
+
+ org.netbeans.api.server.ServerInstance si = pip.getInstances().get(0);
+ ((PayaraModule) si.getBasicNode().getLookup().lookup(PayaraModule.class)).setEnvironmentProperty(PayaraModule.JAVA_PLATFORM_ATTR,
+ System.getProperty("v3.server.javaExe"), true);
+
+ ProgressUI pui = new ProgressUI("Start Payara", true);
+ inst.start(pui);
+
+ Util.sleep(SLEEP);
+
+ if(!inst.isRunning())
+ throw new Exception("Payara server start failed");
+
+ if (inst.isDebuggable(null))
+ fail("Server started in debug... it should not have done that");
+
+ Util.sleep(SLEEP);
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public void stopServer() {
+ try {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ ServerInstance inst = ServerRegistry.getInstance().getServerInstance(V_URL);
+
+ if(!inst.isRunning())
+ return;
+
+ ProgressUI pui = new ProgressUI("Stop Payara", true);
+ inst.stop(pui);
+
+ Util.sleep(SLEEP);
+
+ if(inst.isRunning())
+ throw new Exception("Payara server stop failed");
+
+ Util.sleep(SLEEP);
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+
+ public void restartServer() {
+ try {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ ServerInstance inst = ServerRegistry.getInstance().getServerInstance(V_URL);
+
+ if(!inst.isRunning())
+ return;
+
+ ProgressUI pui = new ProgressUI("Restart Payara", true);
+ inst.restart(pui);
+
+ Util.sleep(SLEEP);
+
+ if(!inst.isRunning())
+ throw new Exception("Payara server restart failed");
+
+ Util.sleep(SLEEP);
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public void startDebugServer() {
+ try {
+ PayaraInstanceProvider pip = PayaraInstanceProvider.getProvider();
+ ServerInstance inst = ServerRegistry.getInstance().getServerInstance(V_URL);
+
+ if(inst.isRunning())
+ return;
+
+ ProgressUI pui = new ProgressUI("Start Debug Payara", true);
+ inst.startDebug(pui);
+
+ Util.sleep(SLEEP);
+
+ if(!inst.isRunning())
+ throw new Exception("Payara server start debug failed");
+
+ if (!inst.isDebuggable(null))
+ fail("server isn't debuggable...");
+
+ Util.sleep(SLEEP);
+ } catch(Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/Util.java b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/Util.java
new file mode 100644
index 0000000..3207fb0
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/qa-functional/src/org/netbeans/modules/payara/jakartaee/test/Util.java
@@ -0,0 +1,389 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.test;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+import java.net.Proxy;
+import java.net.URL;
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+//import org.netbeans.junit.ide.ProjectSupport;
+//import org.netbeans.modules.project.ui.test.ProjectSupport;
+import org.netbeans.modules.j2ee.deployment.impl.ServerInstance;
+//import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
+//import org.netbeans.modules.j2ee.sun.api.ServerInterface;
+//import org.netbeans.modules.j2ee.sun.dd.api.serverresources.Resources;
+//import org.netbeans.modules.j2ee.sun.ide.sunresources.beans.BaseResourceNode;
+//import org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject;
+//import org.openide.util.Exceptions;
+import org.openide.util.RequestProcessor;
+//import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
+import org.openide.util.RequestProcessor.Task;
+
+/**
+ *
+ * @author Michal Mocnak
+ */
+public class Util {
+
+ // TEST PROPERTIES
+ public static final String EJB_PROJECT_NAME = "SjsasTestEjb";
+ public static final String WEB_PROJECT_NAME = "SjsasTestWeb";
+ public static final String JSF_PROJECT_NAME = "SjsasJSFTest";
+ public static final String MDB_PROJECT_NAME = "SimpleMessage";
+ public static final String WEBSERVICE_PROJECT_NAME = "CalculatorWSApplication";
+ public static final String CUSTOMER_APPLICATION_PROJECT_NAME = "customer-cmp-ear";
+ public static final String CUSTOMER_CLIENT_PROJECT_NAME = "customer-cmp-ear-app-client";
+ public static final String CUSTOMER_WEB_PROJECT_NAME = "customer-cmp-ear-war";
+ public static final String STATEFUL_PROJECT_NAME = "duke-stateful";
+ public static final String STATEFUL_CLIENT_PROJECT_NAME = "duke-stateful-app-client";
+ public static final String EJB_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + EJB_PROJECT_NAME;
+ public static final String WEB_PROJECT_PATH = //System.getProperty("xtest.tmpdir") + File.separator + WEB_PROJECT_NAME;
+ "j2ee.sun.appsrv81" + File.separator + "build" + File.separator + "test" +
+ File.separator + "qa-functional" + File.separator + "data" + File.separator +
+ WEB_PROJECT_NAME;
+ public static final String JSF_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + JSF_PROJECT_NAME;
+ public static final String MDB_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + MDB_PROJECT_NAME;
+ public static final String STATEFUL_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + "duke_stateful";
+ public static final String WEBSERVICE_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + WEBSERVICE_PROJECT_NAME;
+ public static final String CUSTOMER_PROJECT_PATH = System.getProperty("xtest.tmpdir") + File.separator + "customer-cmp-ear";
+ public static final int SLEEP = 15000;
+
+ // SERVER PROPERTIES FOR TESTS
+ public static final String _SEP = System.getProperty("file.separator");
+ public static final String _DISPLAY_NAME = "Sun Java System Application Server";
+ public static final String _PRELUDE_LOCATION = getInstallDirName(System.getProperty("prelude.server.path"));
+ public static final String _V3_LOCATION = getInstallDirName(System.getProperty("v3.server.path"));
+ public static final String _DOMAIN = "domain1";
+ public static final String _HOST = "localhost";
+ //public static final String _PORT = getPort(new File(_INSTALL_LOCATION+_SEP+_DOMAIN+_SEP+"config"+_SEP+"domain.xml"));
+ public static final String _USER_NAME = "admin";
+ public static final String _PASSWORD = System.getProperty("v3.server.password","adminadmin");
+ //public static final String _URL = "["+_PLATFORM_LOCATION+"]deployer:Sun:AppServer::"+_HOST+":"+_PORT;
+
+ // SERVER PROPERTIES FOR APP SERVER REGISTRATION
+ public static final String USER_NAME = "username";
+ public static final String PASSWORD = "password";
+ public static final String HOST = "host";
+ public static final String PORT = "port";
+ public static final String PRELUDE_LOCATION = "platform_location";
+ public static final String INSTALL_LOCATION = "install_location";
+ public static final String DOMAIN = "domain";
+ public static final String TYPE = "type";
+ public static final String PROP_DISPLAY_NAME = "ServInstWizard_displayName";
+ public static final String TEMP_FILE_PREFIX = "DELETEME";
+
+ public static String getInstallDirName(String s) {
+ try {
+ if (null == s) {
+ // the user did not pass in a value
+ s = getDirName();
+ } else if (s.trim().length() < 1) {
+ // the file name is totally bogus
+ s = getDirName();
+ }
+ File f = new File(s);
+ if (f.isFile()) {
+ // need a directory... not a file
+ s = getDirName();
+ f = new File(s);
+ } else if (!f.canWrite()) {
+ // must be able to write into the directory
+ s = getDirName();
+ f = new File(s);
+ }
+ } catch (IOException ioe) {
+ }
+ return s;
+ }
+
+
+ static String getDirName() throws IOException {
+ File f = File.createTempFile(TEMP_FILE_PREFIX, "IAMJUNK");
+ f.delete();
+ return f.getAbsolutePath() + File.separator + "glassfish";
+ }
+ /**
+ * It returns admin port number if the server.
+ */
+ public static String getPort(File domainXml){
+ String adminPort = null;
+ String buffer = null;
+
+ try {
+ FileReader reader = new FileReader(domainXml);
+ BufferedReader br = new BufferedReader(reader);
+
+ while((buffer = br.readLine()) != null) {
+ if(buffer.indexOf("admin-listener") > -1) {
+ int x = buffer.indexOf(34, buffer.indexOf("port"));
+ int y = buffer.indexOf(34, ++x);
+ adminPort = buffer.substring(x, y);
+ break;
+ }
+ }
+
+ br.close();
+ reader.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return adminPort;
+ }
+
+ public static void sleep(int i) {
+ try {
+ Thread.sleep(i);
+ } catch(Exception e) {
+ // Nothing to do
+ }
+ }
+
+// public static TargetModuleID deployModule(final ModuleType moduleType, final String modulePath, final String moduleName) throws Exception {
+// Project project = (Project)openProject(new File(modulePath));
+// TargetModuleID retVal = deployModule(moduleType, project, moduleName);
+// Util.closeProject(moduleName);
+// return retVal;
+// }
+
+// public static TargetModuleID deployModule(final ModuleType moduleType, final Project project, final String moduleName) throws Exception {
+// ActionProvider ap = (ActionProvider)project.getLookup().lookup(ActionProvider.class);
+// J2eeModuleProvider jmp = (J2eeModuleProvider)project.getLookup().lookup(J2eeModuleProvider.class);
+// final ServerInstance si = ServerRegistry.getInstance().getServerInstance(_URL);
+// System.out.println("start deployModule "+new java.util.Date());
+//
+// Runnable startCondition = new Runnable() {
+// public void run() {
+// System.out.println("startCond deployModule "+new java.util.Date());
+// while(!si.isConnected()) {
+// try {
+// System.out.print("S");
+// Thread.sleep(1000);
+// } catch(Exception e) {}
+// }
+// System.out.println("");
+// }
+// };
+//
+// Runnable deployCondition = new Runnable() {
+// public void run() {
+// System.out.println("deployCond deployModule "+new java.util.Date());
+// while(getModuleID(moduleType, moduleName, si, true) == null) {
+// try {
+// System.out.print("D");
+// Thread.sleep(500);
+// } catch(Exception e) {}
+// }
+// System.out.println("");
+// }
+// };
+//
+// Task t = RequestProcessor.getDefault().create(startCondition);
+// // TODO : get this to work
+// // if (moduleType == ModuleType.WAR) {
+// // ap.invokeAction(ap.COMMAND_RUN,project.getLookup());
+// // } else {
+// ap.invokeAction(EjbProjectConstants.COMMAND_REDEPLOY, project.getLookup());
+// // }
+//
+// t.run();
+// if(!t.waitFinished(300000))
+// throw new Exception("Server start timeout");
+//
+//
+// t = RequestProcessor.getDefault().create(deployCondition);
+// t.run();
+// if(!t.waitFinished(300000))
+// throw new Exception("Deploy has timeout");
+//
+// System.out.println("finish deployModule "+new java.util.Date());
+//
+// TargetModuleID tmid = getModuleID(moduleType, moduleName, si, true);
+//
+// if (null != tmid) {
+// si.getDeploymentManager().stop(new TargetModuleID[] {tmid});
+// } else {
+// throw new Exception("the module should be runnable");
+// }
+//
+// return null;
+// }
+
+ public static void undeployModule(final ModuleType moduleType, final String modulePath, final String moduleName, final TargetModuleID moduleID) throws Exception {
+ final ServerInstance si = null; // ServerRegistry.getInstance().getServerInstance(_URL);
+ si.getDeploymentManager().undeploy(new TargetModuleID[] {moduleID});
+
+ Runnable undeployCondition = new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(250);
+ } catch(Exception e) {}
+ System.out.println("undeployCond deployModule "+new java.util.Date());
+ while(getModuleID(moduleType, moduleName, si, false) != null) {
+ try {
+ System.out.print("U");
+ Thread.sleep(500);
+ } catch(Exception e) {}
+ }
+ System.out.println("");
+ }
+ };
+ //sleep(SLEEP);
+
+ Task t = RequestProcessor.getDefault().create(undeployCondition);
+ t.run();
+ if(!t.waitFinished(300000))
+ throw new Exception("Undeploy has timeout");
+ if(getModuleID(moduleType, moduleName, si, false) != null)
+ throw new Exception("Undeploy failed");
+ }
+
+ public static TargetModuleID getModuleID(ModuleType moduleType, String moduleName, ServerInstance si, boolean running) {
+ try {
+ si.refresh();
+ Target target = si.getTargets()[0].getTarget();
+ TargetModuleID[] modules = null;
+ if (running) {
+ modules = si.getDeploymentManager().getRunningModules(moduleType, new Target[] {target});
+ } else {
+ modules = si.getDeploymentManager().getAvailableModules(moduleType, new Target[] {target});
+ }
+
+ for(int i=0;i<modules.length;i++) {
+ if(modules[i].getModuleID().equals(moduleName))
+ return modules[i];
+ }
+
+ return null;
+ } catch(Exception e) {
+ return null;
+ }
+
+ }
+ //return http error code if module is deployed and -1 if module is not deployed
+ public static int executeWebModule(ModuleType moduleType, String moduleName) throws Exception{
+ ServerInstance si = null; //ServerRegistry.getInstance().getServerInstance(_URL);
+ si.refresh();
+ Target target = si.getTargets()[0].getTarget();
+ TargetModuleID[] modules = si.getDeploymentManager().getRunningModules(moduleType, new Target[] {target});
+ for(int i=0;i<modules.length;i++){
+ if(modules[i].getModuleID().equals(moduleName)) {
+ URL url=new URL(modules[i].getWebURL());
+ HttpURLConnection httpConn = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
+ return httpConn.getResponseCode();
+ }
+ }
+ throw new Exception("The module is not deployed");
+ }
+
+// public static Object openProject(File projectDir) {
+// return ProjectSupport.openProject(FileUtil.normalizeFile(projectDir));
+// }
+//
+// public static void closeProject(String projectName) {
+// ProjectSupport.closeProject(projectName);
+// }
+//
+// public static String[] getResourcesNames(String query, String keyProperty, ServerInterface mejb) throws Exception {
+// String MAP_RESOURCES = "com.sun.appserv:type=resources,category=config";
+// ObjectName objName = new ObjectName(MAP_RESOURCES);
+// ObjectName[] beans = (ObjectName[])mejb.invoke(objName, query, null, null);
+// String[] resNames = new String[beans.length];
+// for(int i=0; i<beans.length; i++){
+// String resName = ((ObjectName)beans[i]).getKeyProperty(keyProperty);
+// resNames[i] = resName;
+// }
+//
+// return resNames;
+// }
+//
+// public static Resources getResourcesObject(SunResourceDataObject resourceObj) {
+// BaseResourceNode resNode = (BaseResourceNode)resourceObj.getNodeDelegate();
+// return resNode.getBeanGraph();
+// }
+
+ public static Process runAsadmin(String[] command) throws Exception {
+ String[] cmd = new String[command.length+1];
+ cmd[0] = new File(Util._PRELUDE_LOCATION, "bin").getAbsolutePath();
+
+ if(System.getProperty("os.name").startsWith("Windows"))
+ cmd[0] = new File(cmd[0], "asadmin.bat").getAbsolutePath();
+ else
+ cmd[0] = new File(cmd[0], "asadmin").getAbsolutePath();
+
+ for(int i=1;i<cmd.length;i++) {
+ cmd[i] = command[i-1];
+ }
+
+ ProcessBuilder pb = new ProcessBuilder(cmd);
+ return pb.start();
+ }
+ /** Read a file (< 100Kb) into a String and return the contents.
+ */
+ public static String readFile(File target) throws IOException {
+ char [] buffer = new char[100000];
+ int filelength = 0;
+ Reader reader = null;
+
+ try {
+ reader = new BufferedReader(new FileReader(target));
+ filelength = reader.read(buffer, 0, buffer.length);
+ } finally {
+ if(reader != null) {
+ try {
+ reader.close();
+ } catch(IOException ex) {
+ System.out.println("IOException on closing file: " + target.getName());
+ }
+ }
+ }
+
+ return new String(buffer, 0, filelength);
+ }
+ /* Quick & dirty implementation that reads two files an compares for exact match, regardless
+ * of white space. Files must be < 100K each.
+ */
+ public static boolean compareFile(File beforeFile, File afterFile) throws IOException {
+ String before = readFile(beforeFile);
+ String after = readFile(afterFile);
+
+ return after.equals(before);
+ }
+
+ public static void deleteJunk(File d) {
+ if (!d.exists()) return;
+ if (d.isFile()) {
+ d.delete();
+ } else { // directory
+ for (File cf : d.listFiles()) {
+ deleteJunk(cf);
+ }
+ d.delete();
+ }
+ }
+}
+
diff --git a/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/HK2TestEEModuleImpl.java b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/HK2TestEEModuleImpl.java
new file mode 100644
index 0000000..edaa18b
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/HK2TestEEModuleImpl.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.jakartaee.db;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.Collections;
+import java.util.Iterator;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleImplementation2;
+import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Java EE module for Payara features tests.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class HK2TestEEModuleImpl implements J2eeModuleImplementation2 {
+
+ private final FileObject appRoot;
+ private final File srcDir;
+ private final File configDir;
+ private final J2eeModule.Type moduleType;
+ private final String moduleVersion;
+
+ /** Creates a new instance of TestJ2eeModule
+ * @param appRoot Application root directory.
+ * @param moduleType Java EE module type.
+ * @param moduleVersion Java EE version.
+ */
+ public HK2TestEEModuleImpl(
+ final FileObject appRoot, final J2eeModule.Type moduleType,
+ final String moduleVersion
+ ) {
+ this.appRoot = appRoot;
+ this.srcDir = new File(FileUtil.toFile(appRoot), "src");
+ this.configDir = new File(srcDir, "conf");
+ this.moduleType = moduleType;
+ this.moduleVersion = moduleVersion;
+ }
+
+ @Override
+ public FileObject getArchive() {
+ return null;
+ }
+
+ @Override
+ public Iterator<J2eeModule.RootedEntry> getArchiveContents() {
+ return Collections.<J2eeModule.RootedEntry>emptySet().iterator();
+ }
+
+ @Override
+ public FileObject getContentDirectory() {
+ return appRoot;
+ }
+
+ @Override
+ public J2eeModule.Type getModuleType() {
+ return moduleType;
+ }
+
+ @Override
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ @Override
+ public String getUrl() {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public File getResourceDirectory() {
+ return new File(FileUtil.toFile(appRoot), "setup");
+ }
+
+ @Override
+ public File getDeploymentConfigurationFile(String name) {
+ return new File(configDir, name);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public <T> MetadataModel<T> getMetadataModel(Class<T> type) {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+}
diff --git a/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManagerTest.java b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManagerTest.java
new file mode 100644
index 0000000..094b494
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/Hk2DatasourceManagerTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import org.netbeans.modules.payara.jakartaee.db.Hk2DatasourceManager;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Set;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.netbeans.api.j2ee.core.Profile;
+import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.j2ee.deployment.common.api.Datasource;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleFactory;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ * Payara server data source manager tests.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus
+ */
+public class Hk2DatasourceManagerTest extends NbTestCase {
+
+ private J2eeModule j2eeModule;
+ private HK2TestEEModuleImpl j2eeModuleImpl;
+
+ public Hk2DatasourceManagerTest(String testName) {
+ super(testName);
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ File dataDir = getDataDir();
+ File rootFolder = new File(dataDir, "hk2sample");
+ rootFolder.mkdirs();
+ FileObject rootFolderFO = FileUtil.toFileObject(rootFolder);
+ j2eeModuleImpl = new HK2TestEEModuleImpl(
+ rootFolderFO, J2eeModule.Type.WAR, Profile.JAVA_EE_7_FULL.toPropertiesString());
+ j2eeModule = J2eeModuleFactory.createJ2eeModule(j2eeModuleImpl);
+ }
+
+ @After
+ @Override
+ public void tearDown() {
+ }
+
+
+ /**
+ * Test of getDatasources method, of class Hk2DatasourceManager.
+ */
+ @Test
+ public void testGetDatasources_File() {
+ // expected data in source
+ URL codebase = getClass().getProtectionDomain().getCodeSource().getLocation();
+ if (!codebase.getProtocol().equals("file")) { // NOI18N
+ throw new Error("Cannot find data directory from " + codebase); // NOI18N
+ }
+ File resourceDir = null;
+ try {
+ resourceDir = new File(
+ new File(codebase.toURI()).getParentFile(), "data/178776"); // NOI18N
+ } catch (URISyntaxException x) {
+ throw new Error(x);
+ }
+ Set<Datasource> result = Hk2DatasourceManager.getDatasources(
+ j2eeModule, PayaraVersion.PF_4_1_144);
+// assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ assert null != result : "null result";
+ for (Datasource ds : result) {
+ assertNotNull(ds.getDriverClassName());
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/SunDatasourceTest.java b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/SunDatasourceTest.java
new file mode 100644
index 0000000..55b2366
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/db/SunDatasourceTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.db;
+
+import org.netbeans.modules.payara.jakartaee.db.SunDatasource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author vkraemer
+ */
+public class SunDatasourceTest {
+
+ public SunDatasourceTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of equals method, of class SunDatasource.
+ */
+ @Test
+ public void testEquals() {
+ Object obj = null;
+ String a="A";
+ String b="B";
+ String c="C";
+ String d="D";
+ String e="E";
+ SunDatasource instance = new SunDatasource(a,b,c,d,e);
+ boolean expResult = false;
+ boolean result = instance.equals(obj);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ //fail("The test case is a prototype.");
+ obj = "String";
+ expResult = false;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource("a","b","c","d","e");
+ expResult = false;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource("A","B","C","D","E");
+ expResult = true;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource(a,b,c,d,e);
+ expResult = true;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of equals method, of class SunDatasource, when at least one field
+ * is set to null (resulting from a missing property for example).
+ */
+ @Test
+ public void testEqualsNull() {
+ Object obj = null;
+ String a="A";
+ String b="B";
+ String c="C";
+ String d="D";
+ String e=null;
+ SunDatasource instance = new SunDatasource(a,b,c,d,e);
+ boolean expResult = false;
+ boolean result = instance.equals(obj);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ //fail("The test case is a prototype.");
+ obj = "String";
+ expResult = false;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource("a","b","c","d","e");
+ expResult = false;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource("A","B","C","D",null);
+ expResult = true;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ obj = new SunDatasource(a,b,c,d,e);
+ expResult = true;
+ result = instance.equals(obj);
+ assertEquals(expResult, result);
+ }
+}
diff --git a/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginPropertiesTest.java b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginPropertiesTest.java
new file mode 100644
index 0000000..aeab356
--- /dev/null
+++ b/enterprise/payara.jakartaee/test/unit/src/org/netbeans/modules/payara/jakartaee/ide/Hk2PluginPropertiesTest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.payara.jakartaee.ide;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.junit.After;
+import org.junit.AfterClass;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author vbk
+ */
+public class Hk2PluginPropertiesTest {
+
+ public Hk2PluginPropertiesTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of isRunning method, of class Hk2PluginProperties.
+ */
+ @Test
+ public void testIsRunning() throws IOException {
+ String host = "10.229.117.91";
+ //localhost";
+ if ("localhost".equals(host) || "127.0.0.1".equals(host)) {
+ System.out.println("isRunning");
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ boolean expResult = true;
+ boolean result = NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ assertEquals(expResult, result);
+ ss.close();
+ result = NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ expResult = false;
+ assertEquals(expResult, result);
+ port = 4848;
+ try {
+ ss = new ServerSocket(port);
+ // It looks like there is an app server running, let's pound on it.
+ } catch (IOException ioe) {
+ System.out.println("isRunning " + host + ":4848");
+ poundOnIt(host, port, true);
+ } finally {
+ ss.close();
+ }
+ } else {
+ System.out.println("isRunning "+host+":4848");
+ poundOnIt(host, 4848, NetUtils.isPortListeningRemote(
+ host, 4848, NetUtils.PORT_CHECK_TIMEOUT));
+ }
+ }
+
+ private void poundOnIt(String host, int port, boolean expResult) {
+ boolean result = NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ assertEquals(expResult, result);
+ for (int i = 0; result && i < 4000; i++) {
+ NetUtils.isPortListeningRemote(
+ host, port, NetUtils.PORT_CHECK_TIMEOUT);
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/enterprise/payara.micro/build.xml b/enterprise/payara.micro/build.xml
new file mode 100644
index 0000000..96c6071
--- /dev/null
+++ b/enterprise/payara.micro/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project basedir="." default="build" name="enterprise/payara.micro">
+ <description>Builds, tests, and runs the project org.netbeans.modules.payara.micro</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
\ No newline at end of file
diff --git a/enterprise/payara.micro/licenseinfo.xml b/enterprise/payara.micro/licenseinfo.xml
new file mode 100644
index 0000000..2f5766e
--- /dev/null
+++ b/enterprise/payara.micro/licenseinfo.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<licenseinfo>
+ <fileset>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-build.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean-build.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-debug.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-profile.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-reload.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-restart.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-start.png</file>
+ <file>src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro.png</file>
+ <license ref="Apache-2.0-ASF" />
+ <comment type="COMMENT_UNSUPPORTED" />
+ </fileset>
+</licenseinfo>
diff --git a/enterprise/payara.micro/manifest.mf b/enterprise/payara.micro/manifest.mf
new file mode 100644
index 0000000..eec011b
--- /dev/null
+++ b/enterprise/payara.micro/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.payara.micro/0
+OpenIDE-Module-Layer: org/netbeans/modules/fish/payara/micro/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/fish/payara/micro/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
\ No newline at end of file
diff --git a/enterprise/payara.micro/nbproject/project.properties b/enterprise/payara.micro/nbproject/project.properties
new file mode 100644
index 0000000..0f4ec98
--- /dev/null
+++ b/enterprise/payara.micro/nbproject/project.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/enterprise/payara.micro/nbproject/project.xml b/enterprise/payara.micro/nbproject/project.xml
new file mode 100644
index 0000000..8bcfc73
--- /dev/null
+++ b/enterprise/payara.micro/nbproject/project.xml
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.payara.micro</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.apache.tools.ant.module</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>3</release-version>
+ <specification-version>3.81.1.2</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.27.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.scripting</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.2</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.templates</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.7.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.web.webmodule</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.41.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2ee.core</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>0</release-version>
+ <specification-version>1.27.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeapis</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.35.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.j2eeserver</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>4</release-version>
+ <specification-version>1.116</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.platform</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.41.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>2.20.1.2.2.25.8.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.maven</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>2.133</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.maven.embedder</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>2.58</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.maven.j2ee</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.65</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.maven.model</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.49</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.72</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.88.1.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.projectuiapi.base</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.85.1.9</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.swing.validation</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>2</release-version>
+ <specification-version>1.37</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.32.1.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.awt</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.67.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.dialogs</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.42.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.execution</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.3.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.explorer</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.62.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.10.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.loaders</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.66.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.modules</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.48.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.nodes</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>7.45.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.7.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.33.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.ui</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.6.1</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.windows</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>6.81</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/Bundle.properties b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/Bundle.properties
new file mode 100644
index 0000000..85b0a80
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/Bundle.properties
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+OpenIDE-Module-Name=Payara Micro
+OpenIDE-Module-Display-Category=Java EE
+OpenIDE-Module-Short-Description=Payara Micro support for Java EE projects.
+OpenIDE-Module-Long-Description=Payara Micro plugin enables you to start and stop Payara Micro maven web applications.
\ No newline at end of file
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/layer.xml b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/layer.xml
new file mode 100644
index 0000000..5985dd9
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/layer.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<filesystem>
+ <folder name="Templates">
+ <folder name="PayaraResources">
+ <attr name="displayName" bundlevalue="org.netbeans.modules.fish.payara.micro.plugin.Bundle#Templates/PayaraResources"/>
+ <attr name="position" intvalue="1750"/>
+ </folder>
+ </folder>
+</filesystem>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Bundle.properties b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Bundle.properties
new file mode 100644
index 0000000..24ae75a
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Bundle.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+LBL_PayaraMicroPlugin=Maven Plugin setup
+Templates/PayaraResources=Payara
+Templates/PayaraResources/PayaraMicroMavenPlugin=Payara Micro Maven Plugin
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
new file mode 100644
index 0000000..07edf9e
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Constants.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.plugin;
+
+import org.netbeans.api.annotations.common.StaticResource;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.maven.api.NbMavenProject;
+import org.netbeans.spi.project.ActionProvider;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public interface Constants {
+
+ J2eeModule.Type PROJECT_TYPE = J2eeModule.Type.WAR;
+
+ String PROP_GROUP_ID = "groupId";
+ String PROP_ARTIFACT_ID = "artifactId";
+ String PROP_VERSION = "version";
+ String PROP_PACKAGE = "package";
+
+ String PROP_JAVA_EE_VERSION = "javaeeVersion";
+ String PROP_PAYARA_MICRO_VERSION = "payaraMicroVersion";
+ String PROP_AUTO_BIND_HTTP = "autoBindHttp";
+
+ String VERSION = "version";
+
+ String WAR_PACKAGING = "war";
+
+ String MAVEN_WAR_PROJECT_TYPE = "org-netbeans-modules-maven/" + NbMavenProject.TYPE_WAR;
+
+ String PAYARA_MICRO_MAVEN_PLUGIN = "fish.payara.maven.plugins:payara-micro-maven-plugin";
+
+ String RELOAD_FILE = ".reload";
+ String COMMAND_EXPLODE = "explode";
+
+ String RESOURCES_GOAL = "resources:resources";
+ String COMPILE_GOAL = "compiler:compile";
+ String EXPLODED_GOAL = "war:exploded";
+ String WAR_GOAL = "war:war";
+ String STOP_GOAL = "payara-micro:stop";
+ String START_GOAL = "payara-micro:start";
+
+ String COMPILE_EXPLODE_ACTION = "micro-complie-explode";
+ String EXPLODE_ACTION = "micro-explode";
+ String STOP_ACTION = "micro-stop";
+ String RUN_ACTION = ActionProvider.COMMAND_RUN;
+ String DEBUG_ACTION = ActionProvider.COMMAND_DEBUG;
+ String PROFILE_ACTION = ActionProvider.COMMAND_PROFILE;
+ String RUN_SINGLE_ACTION = ActionProvider.COMMAND_RUN_SINGLE + ".deploy";
+ String DEBUG_SINGLE_ACTION = ActionProvider.COMMAND_DEBUG_SINGLE + ".deploy";
+ String PROFILE_SINGLE_ACTION = ActionProvider.COMMAND_PROFILE_SINGLE + ".deploy";
+
+ String ARCHETYPE_GROUP_ID = "fish.payara.maven.archetypes";
+ String ARCHETYPE_ARTIFACT_ID = "payara-micro-maven-archetype";
+ String ARCHETYPE_REPOSITORY = "https://oss.sonatype.org/content/repositories/snapshots";
+
+ @StaticResource
+ String PROJECT_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro.png";
+
+ @StaticResource
+ String CLEAN_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean.png";
+
+ @StaticResource
+ String BUILD_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-build.png";
+
+ @StaticResource
+ String REBUILD_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean-build.png";
+
+ @StaticResource
+ String START_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-start.png";
+
+ @StaticResource
+ String RESTART_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-restart.png";
+
+ @StaticResource
+ String RELOAD_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-reload.png";
+
+ @StaticResource
+ String DEBUG_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-debug.png";
+
+ @StaticResource
+ String PROFILE_ICON = "org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-profile.png";
+
+ @StaticResource
+ String POM_TEMPLATE = "org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl";
+
+}
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
new file mode 100644
index 0000000..ef905f6
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/MicroPluginWizardDescriptor.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.plugin;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+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;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_AUTO_BIND_HTTP;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_PAYARA_MICRO_VERSION;
+import static org.netbeans.modules.fish.payara.micro.plugin.TemplateUtil.expandTemplate;
+import static org.netbeans.modules.fish.payara.micro.plugin.TemplateUtil.loadResource;
+import org.netbeans.modules.fish.payara.micro.project.MicroApplication;
+import org.netbeans.modules.fish.payara.micro.project.MicroProjectHook;
+import org.netbeans.modules.fish.payara.micro.project.ui.PayaraMicroDescriptor;
+import org.netbeans.modules.maven.api.NbMavenProject;
+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;
+
+@TemplateRegistration(
+ folder = "PayaraResources",
+ displayName = "#Templates/PayaraResources/PayaraMicroMavenPlugin",
+ iconBase = PROJECT_ICON,
+ description = "resources/PayaraMicroPluginDescription.html",
+ category = {"j2ee-types", "web-types"}
+)
+public final class MicroPluginWizardDescriptor implements WizardDescriptor.InstantiatingIterator<WizardDescriptor> {
+
+ private int index;
+
+ private WizardDescriptor descriptor;
+
+ private Project project;
+
+ private List<WizardDescriptor.Panel<WizardDescriptor>> panels;
+
+ public static void updateMicroMavenPlugin(Project project, String payaraMicroVersion, String autoBindHttp) throws IOException {
+ Map<String, Object> params = new HashMap<>();
+ params.put("autoBindHttp", autoBindHttp);
+ params.put("payaraMicroVersion", payaraMicroVersion);
+
+ try (Reader sourceReader = new InputStreamReader(loadResource(POM_TEMPLATE))) {
+ try (Reader targetReader = new StringReader(expandTemplate(sourceReader, params))) {
+ POMManager pomManager = new POMManager(targetReader, project);
+ pomManager.setExtensionOverrideFilter((source, target) -> {
+ if ("option".equalsIgnoreCase(source.getName())) {
+ for (POMExtensibilityElement element : target.getExtensibilityElements()) {
+ if ("key".equals(element.getQName().getLocalPart())) {
+ return source.getChild("key").getValue().equals(element.getElementText());
+ }
+ }
+ }
+ return true;
+ });
+ pomManager.commit();
+ pomManager.reload();
+ }
+ }
+ }
+
+ @Override
+ public void initialize(WizardDescriptor descriptor) {
+ this.descriptor = descriptor;
+ index = 0;
+ if (project == null) {
+ project = Templates.getProject(descriptor);
+ }
+ panels = new ArrayList<>();
+ panels.add(new PayaraMicroDescriptor(PROJECT_TYPE));
+ String[] names = new String[]{
+ NbBundle.getMessage(MicroPluginWizardDescriptor.class, "LBL_PayaraMicroPlugin")
+ };
+
+ descriptor.putProperty("NewFileWizard_Title",
+ NbBundle.getMessage(MicroPluginWizardDescriptor.class, "Templates/PayaraResources/PayaraMicroMavenPlugin"));
+ Wizards.mergeSteps(descriptor, panels.toArray(new WizardDescriptor.Panel[0]), names);
+
+ }
+
+ @Override
+ 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);
+ MicroApplication.registerInstance(project);
+ new MicroProjectHook(project).projectOpened();
+ NbMavenProject.fireMavenProjectReload(project);
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void uninitialize(WizardDescriptor wizard) {
+ panels = null;
+ }
+
+ @Override
+ public WizardDescriptor.Panel current() {
+ return panels.get(index);
+ }
+
+ @Override
+ public String name() {
+ return NbBundle.getMessage(MicroPluginWizardDescriptor.class, "Templates/PayaraResources/PayaraMicroMavenPlugin");
+ }
+
+ @Override
+ public boolean hasNext() {
+ return index < panels.size() - 1;
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ @Override
+ public void nextPanel() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ index++;
+ }
+
+ @Override
+ public void previousPanel() {
+ if (!hasPrevious()) {
+ throw new NoSuchElementException();
+ }
+ index--;
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/POMManager.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/POMManager.java
new file mode 100644
index 0000000..3602ee4
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/POMManager.java
@@ -0,0 +1,484 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.plugin;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.BiFunction;
+import static java.util.stream.Collectors.toSet;
+import javax.swing.SwingUtilities;
+import javax.xml.namespace.QName;
+import org.apache.maven.model.Model;
+import org.netbeans.modules.maven.model.pom.Resource;
+import org.apache.maven.model.io.ModelReader;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.netbeans.api.project.Project;
+import static org.netbeans.modules.fish.payara.micro.plugin.TemplateUtil.loadResource;
+import org.netbeans.modules.maven.api.ModelUtils;
+import org.netbeans.modules.maven.api.NbMavenProject;
+import org.netbeans.modules.maven.embedder.EmbedderFactory;
+import org.netbeans.modules.maven.model.ModelOperation;
+import org.netbeans.modules.maven.model.Utilities;
+import org.netbeans.modules.maven.model.pom.Activation;
+import org.netbeans.modules.maven.model.pom.ActivationProperty;
+import org.netbeans.modules.maven.model.pom.BuildBase;
+import org.netbeans.modules.maven.model.pom.Configuration;
+import org.netbeans.modules.maven.model.pom.Dependency;
+import org.netbeans.modules.maven.model.pom.DependencyContainer;
+import org.netbeans.modules.maven.model.pom.DependencyManagement;
+import org.netbeans.modules.maven.model.pom.Exclusion;
+import org.netbeans.modules.maven.model.pom.POMComponent;
+import org.netbeans.modules.maven.model.pom.POMExtensibilityElement;
+import org.netbeans.modules.maven.model.pom.POMModel;
+import org.netbeans.modules.maven.model.pom.POMModelFactory;
+import org.netbeans.modules.maven.model.pom.Plugin;
+import org.netbeans.modules.maven.model.pom.PluginExecution;
+import org.netbeans.modules.maven.model.pom.Profile;
+import org.netbeans.modules.maven.model.pom.Properties;
+import org.netbeans.modules.maven.model.pom.Repository;
+import org.netbeans.modules.maven.model.pom.RepositoryPolicy;
+import org.openide.filesystems.FileObject;
+import static org.openide.filesystems.FileUtil.toFileObject;
+import org.openide.util.Exceptions;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class POMManager {
+
+ private Project project;
+
+ private FileObject pomFileObject;
+
+ private POMModel pomModel;
+
+ private NbMavenProject mavenProject;
+
+ private Model sourceModel;
+
+ private List<ModelOperation<POMModel>> operations;
+
+ private static final RequestProcessor RP = new RequestProcessor(POMManager.class);
+
+ private BiFunction<Xpp3Dom, POMExtensibilityElement, Boolean> extensionOverrideFilter;
+
+ public POMManager(Project project){
+ this(project, false);
+ }
+
+ public POMManager(Project project, boolean readonly) {
+ this.project = project;
+ mavenProject = project.getLookup().lookup(org.netbeans.modules.maven.api.NbMavenProject.class);
+ pomFileObject = toFileObject(mavenProject.getMavenProject().getFile());
+ pomModel = POMModelFactory.getDefault().createFreshModel(Utilities.createModelSource(pomFileObject));
+ operations = new ArrayList<>();
+ if(!readonly) {
+ pomModel.startTransaction();
+ }
+ }
+
+ public POMManager(String inputResource, Project project) {
+ this(project, false);
+ try {
+ //source
+ ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
+ sourceModel = reader.read(loadResource(inputResource), Collections.singletonMap(ModelReader.IS_STRICT, false));
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ public POMManager(Reader inputResource, Project project) {
+ this(project, false);
+ try {
+ //source
+ ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
+ sourceModel = reader.read(inputResource, Collections.singletonMap(ModelReader.IS_STRICT, false));
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ public void fixDistributionProperties() {
+ org.netbeans.modules.maven.model.pom.Project pomProject = getPOMProject();
+ if (pomProject.getGroupId() != null) {
+ pomProject.setGroupId(pomProject.getGroupId().toLowerCase());
+ }
+ if (pomProject.getArtifactId() != null) {
+ pomProject.setArtifactId(pomProject.getArtifactId().toLowerCase());
+ }
+ if (pomProject.getVersion() != null) {
+ pomProject.setVersion(pomProject.getVersion().toLowerCase());
+ }
+ }
+
+ private org.netbeans.modules.maven.model.pom.Project getPOMProject() {
+ return pomModel.getProject();
+ }
+
+ public String getGroupId() {
+ return getPOMProject().getGroupId();
+ }
+
+ public String getArtifactId() {
+ return getPOMProject().getArtifactId();
+ }
+
+ public String getVersion() {
+ return getPOMProject().getVersion();
+ }
+
+ public void addProperties(java.util.Properties prop) {
+ addProperties(null, prop);
+ }
+
+ public void addProperties(String profile, java.util.Properties prop) {
+ boolean tx = pomModel.isIntransaction();
+ try {
+ if (!tx) {
+ pomModel.startTransaction();
+ }
+ org.netbeans.modules.maven.model.pom.Project pomProject = getPOMProject();
+ if (profile != null) {
+ Profile targetProfile = pomProject.findProfileById(profile);
+ if (targetProfile == null) {
+ throw new IllegalArgumentException(String.format("Profile[%s] not exist", profile));
+ }
+ if (targetProfile.getProperties() == null) {
+ targetProfile.setProperties(pomModel.getFactory().createProperties());
+ }
+ registerProperties(prop, targetProfile.getProperties());
+ } else {
+ registerProperties(prop, pomProject.getProperties());
+ }
+ } finally {
+ if (!tx) {
+ pomModel.endTransaction();
+ }
+ }
+ }
+
+ public void setExtensionOverrideFilter(BiFunction<Xpp3Dom, POMExtensibilityElement, Boolean> extensionOverrideFilter) {
+ this.extensionOverrideFilter = extensionOverrideFilter;
+ }
+
+ public static boolean isMavenProject(Project project) {
+ return project.getLookup().lookup(NbMavenProject.class) != null;
+ }
+
+ public void reload() {
+ reload(project);
+ }
+
+ public static void reload(Project project) {
+ NbMavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class);
+ try {
+ FileObject pomFileObject = toFileObject(mavenProject.getMavenProject().getFile());
+ POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pomFileObject));
+ Utilities.saveChanges(model);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ RP.post(() -> {
+ mavenProject.triggerDependencyDownload();
+ });
+
+ SwingUtilities.invokeLater(() -> NbMavenProject.fireMavenProjectReload(project));
+ }
+
+ private void execute() {
+ if (sourceModel != null) {
+ org.netbeans.modules.maven.model.pom.Project pomProject = getPOMProject();
+ if (pomProject.getProperties() == null) {
+ pomProject.setProperties(pomModel.getFactory().createProperties());
+ }
+ registerProperties(sourceModel.getProperties(), pomProject.getProperties());
+ pomProject.setDependencyManagement(registerDependencyManagement(sourceModel.getDependencyManagement(), pomProject.getDependencyManagement()));
+ registerDependency(sourceModel.getDependencies(), pomProject);
+ registerRepository();
+ registerBuild();
+ registerProfile();
+ }
+ }
+
+ private Properties registerProperties(java.util.Properties source, Properties target) {
+ if (source != null && !source.isEmpty()) {
+ if (target == null) {
+ target = pomModel.getFactory().createProperties();
+ }
+ for (String sourceKey : source.stringPropertyNames()) {
+ String sourceValue = source.getProperty(sourceKey);
+ target.setProperty(sourceKey, sourceValue);
+ }
+ }
+ return target;
+ }
+
+ private void registerBuild() {
+ if (sourceModel.getBuild() != null) {
+ registerBuildBase(sourceModel.getBuild(), getPOMProject().getBuild());
+ }
+ }
+
+ private BuildBase registerBuildBase(org.apache.maven.model.BuildBase sourceBuild, BuildBase targetBuild) {
+ if (sourceBuild == null) {
+ return targetBuild;
+ }
+ if (targetBuild == null) {
+ targetBuild = pomModel.getFactory().createBuild();
+ }
+ if (sourceBuild.getFinalName() != null) {
+ targetBuild.setFinalName(sourceBuild.getFinalName());
+ }
+ if (sourceBuild.getResources()!= null && !sourceBuild.getResources().isEmpty()) {
+ for (org.apache.maven.model.Resource sourceResource : sourceBuild.getResources()) {
+ Resource targetResource = pomModel.getFactory().createResource();
+ targetResource.setFiltering(Boolean.parseBoolean(sourceResource.getFiltering()));
+ targetResource.setDirectory(sourceResource.getDirectory());
+ targetBuild.addResource(targetResource);
+ }
+ }
+ if (sourceBuild.getPlugins() != null && !sourceBuild.getPlugins().isEmpty()) {
+ for (org.apache.maven.model.Plugin sourcePlugin : sourceBuild.getPlugins()) {
+ Plugin targetPlugin = targetBuild.findPluginById(sourcePlugin.getGroupId(), sourcePlugin.getArtifactId());
+ if (targetPlugin == null) {
+ targetPlugin = pomModel.getFactory().createPlugin();
+ targetPlugin.setGroupId(sourcePlugin.getGroupId());
+ targetPlugin.setArtifactId(sourcePlugin.getArtifactId());
+ targetBuild.addPlugin(targetPlugin);
+ }
+ if (sourcePlugin.getExtensions() != null) {
+ targetPlugin.setExtensions(Boolean.TRUE);
+ }
+ registerDependency(sourcePlugin.getDependencies(), targetPlugin);
+ targetPlugin.setConfiguration(registerConfiguration(sourcePlugin.getConfiguration(), targetPlugin.getConfiguration()));
+ if (sourcePlugin.getExecutions() != null && !sourcePlugin.getExecutions().isEmpty()) {
+ for (org.apache.maven.model.PluginExecution sourceExecution : sourcePlugin.getExecutions()) {
+ PluginExecution targetExecution = targetPlugin.findExecutionById(sourceExecution.getId());
+ if (targetExecution == null) {
+ targetExecution = pomModel.getFactory().createExecution();
+ targetExecution.setId(sourceExecution.getId());
+ sourceExecution.getGoals().forEach(targetExecution::addGoal);
+ targetPlugin.addExecution(targetExecution);
+ }
+ targetExecution.setPhase(sourceExecution.getPhase());
+ targetExecution.setConfiguration(registerConfiguration(sourceExecution.getConfiguration(), targetExecution.getConfiguration()));
+
+ }
+ }
+ targetPlugin.setVersion(sourcePlugin.getVersion());
+ }
+ }
+ return targetBuild;
+ }
+
+ private Configuration registerConfiguration(Object sourceConfig, Configuration targetConfig) {
+ if (sourceConfig != null) {
+ Xpp3Dom parentDOM = (Xpp3Dom) sourceConfig;
+ if (targetConfig == null) {
+ targetConfig = pomModel.getFactory().createConfiguration();
+ }
+ loadDom(parentDOM, targetConfig);
+ }
+ return targetConfig;
+ }
+
+ private void loadDom(Xpp3Dom source, POMComponent target) {
+
+ for (Xpp3Dom childDOM : source.getChildren()) {
+ if (childDOM.getValue() != null) {
+ if (target instanceof Configuration) {
+ ((Configuration) target).setSimpleParameter(childDOM.getName(), childDOM.getValue());
+ } else if (target instanceof POMExtensibilityElement) {
+ Optional<POMComponent> targetComponentOptioal = ((POMExtensibilityElement) target).getChildren()
+ .stream()
+ .filter(targetElement -> {
+ String nodeName = targetElement.getPeer().getNodeName();
+ nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
+ String nodeValue = targetElement.getPeer().getChildNodes().item(0).getNodeValue();
+ return nodeName != null && nodeName.equals(childDOM.getName())
+ && nodeValue != null && nodeValue.equals(childDOM.getValue());
+ })
+ .findAny();
+ if (!targetComponentOptioal.isPresent()) {
+ POMExtensibilityElement element = pomModel.getFactory().createPOMExtensibilityElement(new QName(childDOM.getName()));
+ element.setElementText(childDOM.getValue());
+ target.addExtensibilityElement(element);
+ }
+ } else {
+ target.setChildElementText("propertyName", childDOM.getValue(), new QName(childDOM.getName()));
+ }
+ } else {
+ Optional<POMExtensibilityElement> targetElementOptioal = target.getExtensibilityElements()
+ .stream()
+ .filter(targetElement -> targetElement.getQName().getLocalPart().equals(childDOM.getName()))
+ .filter(targetElement -> extensionOverrideFilter == null || extensionOverrideFilter.apply(childDOM, targetElement))
+ .findAny();
+
+ POMExtensibilityElement element;
+ if (targetElementOptioal.isPresent()) {
+ element = targetElementOptioal.get();
+ } else {
+ element = pomModel.getFactory().createPOMExtensibilityElement(new QName(childDOM.getName()));
+ target.addExtensibilityElement(element);
+ }
+ loadDom(childDOM, element);
+ }
+ }
+ }
+
+ private void registerProfile() {
+ if (!sourceModel.getProfiles().isEmpty()) {
+ org.netbeans.modules.maven.model.pom.Project pomProject = getPOMProject();
+ for (org.apache.maven.model.Profile sourceProfile : sourceModel.getProfiles()) {
+ Profile targetProfile = pomProject.findProfileById(sourceProfile.getId());
+ if (targetProfile == null) {
+ targetProfile = pomModel.getFactory().createProfile();
+ pomProject.addProfile(targetProfile);
+ targetProfile.setId(sourceProfile.getId());
+ targetProfile.setProperties(registerProperties(sourceProfile.getProperties(), targetProfile.getProperties()));
+ if (sourceProfile.getActivation() != null) {
+ Activation activation = pomModel.getFactory().createActivation();
+ targetProfile.setActivation(activation);
+ if (sourceProfile.getActivation().getProperty() != null) {
+ org.apache.maven.model.ActivationProperty sourceProperty = sourceProfile.getActivation().getProperty();
+ ActivationProperty targetProperty = pomModel.getFactory().createActivationProperty();
+ activation.setActivationProperty(targetProperty);
+ targetProperty.setName(sourceProperty.getName());
+ targetProperty.setValue(sourceProperty.getValue());
+ } else {
+ activation.setChildElementText("activeByDefault", Boolean.toString(sourceProfile.getActivation().isActiveByDefault()), new QName("activeByDefault"));
+ }
+ }
+ }
+ targetProfile.setDependencyManagement(registerDependencyManagement(sourceProfile.getDependencyManagement(), targetProfile.getDependencyManagement()));
+ registerDependency(sourceProfile.getDependencies(), targetProfile);
+ targetProfile.setBuildBase(registerBuildBase(sourceProfile.getBuild(), targetProfile.getBuildBase()));
+ }
+ }
+ }
+
+ private DependencyManagement registerDependencyManagement(org.apache.maven.model.DependencyManagement source, DependencyManagement target) {
+ if (source != null) {
+ if (target == null) {
+ target = pomModel.getFactory().createDependencyManagement();
+ }
+ registerDependency(source.getDependencies(), target);
+ }
+ return target;
+ }
+
+ private void registerDependency(List<org.apache.maven.model.Dependency> source, DependencyContainer target) {
+ source.forEach((sourceDependency) -> {
+ org.netbeans.modules.maven.model.pom.Dependency targetDependency = target.findDependencyById(sourceDependency.getGroupId(), sourceDependency.getArtifactId(), null);
+ if (targetDependency == null) {
+ targetDependency = createDependency(sourceDependency);
+ target.addDependency(targetDependency);
+ }
+ updateDependency(sourceDependency, targetDependency);
+ });
+ }
+
+ public void registerDependency(String groupId, String artifactId, String version, String type, String classifier, String scope) {
+ org.apache.maven.model.Dependency dependency = new org.apache.maven.model.Dependency();
+ dependency.setGroupId(groupId);
+ dependency.setArtifactId(artifactId);
+ dependency.setVersion(version);
+ dependency.setType(type);
+ dependency.setClassifier(classifier);
+ dependency.setScope(scope);
+ registerDependency(Collections.singletonList(dependency), getPOMProject());
+ }
+
+ private Dependency createDependency(org.apache.maven.model.Dependency source) {
+ Dependency target = pomModel.getFactory().createDependency();
+ target.setGroupId(source.getGroupId());
+ target.setArtifactId(source.getArtifactId());
+ target.setClassifier(source.getClassifier());
+ if (!"jar".equals(source.getType())) {
+ target.setType(source.getType());
+ }
+ target.setScope(source.getScope());
+ return target;
+ }
+
+ private void updateDependency(org.apache.maven.model.Dependency source, Dependency target) {
+ target.setVersion(source.getVersion());
+ if (source.getExclusions() != null && !source.getExclusions().isEmpty()) {
+ for (org.apache.maven.model.Exclusion sourceExclusion : source.getExclusions()) {
+ Exclusion targetExclusion = target.findExclusionById(sourceExclusion.getGroupId(), sourceExclusion.getArtifactId());
+ if (targetExclusion == null) {
+ targetExclusion = pomModel.getFactory().createExclusion();
+ targetExclusion.setGroupId(sourceExclusion.getGroupId());
+ targetExclusion.setArtifactId(sourceExclusion.getArtifactId());
+ target.addExclusion(targetExclusion);
+ }
+ }
+ }
+ }
+
+ private void registerRepository() {
+ if (sourceModel.getRepositories().size() > 0) {
+ operations.add(pomModel -> {
+ Set<String> existingRepositories = getPOMProject().getRepositories() != null ?
+ getPOMProject().getRepositories()
+ .stream()
+ .map(Repository::getId)
+ .collect(toSet())
+ : Collections.EMPTY_SET;
+ for (org.apache.maven.model.Repository repository : sourceModel.getRepositories()) {
+ if (!existingRepositories.contains(repository.getId())) {
+ Repository repo = pomModel.getFactory().createRepository();
+ repo.setId(repository.getId());
+ repo.setName(repository.getName());
+ repo.setLayout(repository.getLayout());
+ repo.setUrl(repository.getUrl());
+ if (repository.getSnapshots() != null) {
+ RepositoryPolicy policy = pomModel.getFactory().createReleaseRepositoryPolicy();
+ policy.setEnabled(Boolean.valueOf(repository.getSnapshots().getEnabled()));
+ repo.setReleases(policy);
+ }
+ getPOMProject().addRepository(repo);
+ }
+ }
+ });
+ }
+ }
+
+ public void setSourceVersion(final String version) {
+ operations.add(pomModel -> ModelUtils.setSourceLevel(pomModel, version));
+ }
+
+ public void commit() {
+ execute();
+ if (operations.size() > 0) {
+ Utilities.performPOMModelOperations(pomFileObject, operations);
+ }
+ pomModel.endTransaction();
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/TemplateUtil.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/TemplateUtil.java
new file mode 100644
index 0000000..4579a65
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/TemplateUtil.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.plugin;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Map;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.netbeans.api.scripting.Scripting;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class TemplateUtil {
+
+ private static final String ENCODING_PROPERTY_NAME = "encoding"; //NOI18N
+
+ private static URL getResourceURL(String resource) {
+ ClassLoader loader = Lookup.getDefault().lookup(ClassLoader.class);
+ if (loader == null) {
+ loader = Thread.currentThread().getContextClassLoader();
+ }
+ return loader.getResource(resource.startsWith("/") ? resource.substring(1) : resource);
+ }
+
+ public static InputStream loadResource(String resource) {
+ InputStream inputStream = null;
+ try {
+ inputStream = getResourceURL(resource).openStream();
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ return inputStream;
+ }
+
+ public static String expandTemplate(Reader reader, Map<String, Object> values) {
+ StringWriter writer = new StringWriter();
+ ScriptEngine eng = getScriptEngine();
+ Bindings bind = eng.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
+ if (values != null) {
+ bind.putAll(values);
+ }
+ bind.put(ENCODING_PROPERTY_NAME, Charset.defaultCharset().name());
+ eng.getContext().setWriter(writer);
+ try {
+ eng.eval(reader);
+ } catch (ScriptException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ return writer.toString();
+ }
+
+
+ private static ScriptEngine getScriptEngine() {
+ return Scripting.createManager().getEngineByName("freemarker"); // NOI18N
+ }
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Wizards.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Wizards.java
new file mode 100644
index 0000000..1cb873d
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/Wizards.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.plugin;
+
+import javax.swing.JComponent;
+import org.openide.WizardDescriptor;
+import org.openide.util.Parameters;
+
+/**
+ * This class consists of static utility methods for manipulating wizards.
+ *
+ */
+public final class Wizards {
+
+ private static final String WIZARD_PANEL_CONTENT_DATA = WizardDescriptor.PROP_CONTENT_DATA; // NOI18N
+ private static final String WIZARD_PANEL_CONTENT_SELECTED_INDEX = WizardDescriptor.PROP_CONTENT_SELECTED_INDEX; //NOI18N;
+
+ private Wizards() {
+ }
+
+ /**
+ * Merges the given <code>steps</code> with the given <code>panels</code>
+ * into the given <code>wizard</code>. If the wizard has existing steps, the
+ * new steps will be added after them.
+ *
+ * @param wizard the wizard to which to merge; must not be null.
+ * @param panels the panels to merge; must not be null.
+ * @param steps the steps to merge or null if the steps should be taken from
+ * the {@link JComponent#getName names} of the panels components.
+ */
+ public static void mergeSteps(WizardDescriptor wizard, WizardDescriptor.Panel[] panels, String[] steps) {
+ Parameters.notNull("wizard", wizard); //NOI18N
+ Parameters.notNull("panels", panels); //NOI18N
+
+ Object prop = wizard.getProperty(WIZARD_PANEL_CONTENT_DATA);
+ String[] beforeSteps;
+ int offset;
+ if (prop instanceof String[]) {
+ beforeSteps = (String[]) prop;
+ offset = beforeSteps.length;
+ if (offset > 0 && ("...".equals(beforeSteps[offset - 1]))) {// NOI18N
+ offset--;
+ }
+ } else {
+ beforeSteps = null;
+ offset = 0;
+ }
+ String[] resultSteps = new String[(offset) + panels.length];
+ for (int i = 0; i < offset; i++) {
+ resultSteps[i] = beforeSteps[i];
+ }
+ setSteps(panels, steps, resultSteps, offset);
+ }
+
+ private static void setSteps(WizardDescriptor.Panel[] panels, String[] steps, String[] resultSteps, int offset) {
+ int n = steps == null ? 0 : steps.length;
+ for (int i = 0; i < panels.length; i++) {
+ final JComponent component = (JComponent) panels[i].getComponent();
+ String step = i < n ? steps[i] : null;
+ if (step == null) {
+ step = component.getName();
+ }
+ component.putClientProperty(WIZARD_PANEL_CONTENT_DATA, resultSteps);
+ component.putClientProperty(WIZARD_PANEL_CONTENT_SELECTED_INDEX, i);
+ component.getAccessibleContext().setAccessibleDescription(step);
+ resultSteps[i + offset] = step;
+ }
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/PayaraMicroPluginDescription.html b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/PayaraMicroPluginDescription.html
new file mode 100644
index 0000000..dee57ca
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/PayaraMicroPluginDescription.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html>
+ <body>
+ <div>
+ Payara Micro maven plugin can start & stop Payara Micro instance and create an Uber JAR bundle of the application and Payara Micro.
+ </div>
+ </body>
+</html>
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
new file mode 100644
index 0000000..1173b02
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/plugin/resources/pom.xml.ftl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>fish.payara.micro</groupId>
+ <artifactId>payara-micro-sample</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <properties>
+ <version.payara>${payaraMicroVersion}</version.payara>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>fish.payara.maven.plugins</groupId>
+ <artifactId>payara-micro-maven-plugin</artifactId>
+ <version>1.0.5</version>
+ <configuration>
+ <payaraVersion>${r"${version.payara}"}</payaraVersion>
+ <deployWar>false</deployWar>
+ <commandLineOptions>
+<#if autoBindHttp == "true">
+ <option>
+ <key>--autoBindHttp</key>
+ </option>
+</#if>
+ <option>
+ <key>--deploy</key>
+ <value>${r"${project.build.directory}"}/${r"${project.build.finalName}"}</value>
+ </option>
+ </commandLineOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ActionType.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ActionType.java
new file mode 100644
index 0000000..a664ae0
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ActionType.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.BUILD_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.CLEAN_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEBUG_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROFILE_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.REBUILD_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.START_ICON;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public enum ActionType {
+
+ CLEAN(CLEAN_ICON),
+ BUILD(BUILD_ICON),
+ BUILD_WITH_DEPENDENCIES(BUILD_ICON),
+ REBUILD(REBUILD_ICON),
+
+ MICRO_COMPLIE_EXPLODE(RELOAD_ICON),
+ MICRO_EXPLODE(RELOAD_ICON),
+
+ RUN(START_ICON),
+ DEBUG(DEBUG_ICON),
+ PROFILE(PROFILE_ICON);
+
+ private final String icon;
+
+ private ActionType(String icon) {
+ this.icon = icon;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public static ActionType toAction(String actionType) {
+ return ActionType.valueOf(actionType.toUpperCase());
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/Bundle.properties b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/Bundle.properties
new file mode 100644
index 0000000..8f2e73f
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/Bundle.properties
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+MSG_DeployOnSave_Deployed={0} deployed.
+MSG_DeployOnSave_Failed={0} failed.
+MicroPropertiesPanel.microVersionLabel.text=Payara Micro Version:
+MSG_IncrementalDeployFailed=Error during incremental deploy\: {0}
+TXT_Reload=Reload ({0})
+ERR_Compile_On_Save_Not_Enabled=Reload Error ({0} : Compile on save not enabled)
+ERR_Payara_Micro_Plugin_Not_Found=Reload Error ({0} : Payara Micro plugin not found)
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/DeployOnSaveManager.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/DeployOnSaveManager.java
new file mode 100644
index 0000000..77a316e
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/DeployOnSaveManager.java
@@ -0,0 +1,656 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import static java.util.Collections.unmodifiableList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.java.source.BuildArtifactMapper;
+import org.netbeans.api.java.source.BuildArtifactMapper.ArtifactsUpdated;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.ArtifactListener;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.ArtifactListener.Artifact;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeApplicationProvider;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.ConfigSupport.DeployOnSaveListener;
+import org.netbeans.modules.maven.j2ee.utils.MavenProjectSupport;
+import org.openide.awt.StatusDisplayer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import static org.openide.util.NbBundle.getMessage;
+
+public final class DeployOnSaveManager {
+
+ public static enum DeploymentState {
+
+ MODULE_NOT_DEPLOYED,
+ MODULE_UPDATED,
+ DEPLOYMENT_FAILED
+
+ }
+
+ private static final Logger LOGGER = Logger.getLogger(DeployOnSaveManager.class.getName());
+
+ private static final int DELAY = 300;
+
+ private static DeployOnSaveManager instance;
+
+ private final WeakHashMap<J2eeModuleProvider, CompileOnSaveListener> compileListeners = new WeakHashMap<>();
+
+ private final WeakHashMap<J2eeModuleProvider, CopyOnSaveListener> copyListeners = new WeakHashMap<>();
+
+ private final WeakHashMap<J2eeModuleProvider, List<DeployOnSaveListener>> projectListeners = new WeakHashMap<>();
+
+ /**
+ * We need a custom thread factory because the default one stores the
+ * ThreadGroup in constructor. If the group is destroyed in between the
+ * submit throws IllegalThreadStateException.
+ */
+ private final ExecutorService EXECUTOR = Executors.newFixedThreadPool(1, runnable -> {
+ Thread t = new Thread(runnable);
+
+ if (t.isDaemon()) {
+ t.setDaemon(false);
+ }
+ if (t.getPriority() != Thread.NORM_PRIORITY) {
+ t.setPriority(Thread.NORM_PRIORITY);
+ }
+ return t;
+ });
+
+ //private final ExecutorService EXECUTOR = Executors.newFixedThreadPool(1);
+ /** <i>GuardedBy("this")</i>
+ */
+ private Map<J2eeModuleProvider, Set<Artifact>> toDeploy = new HashMap<>();
+
+ /** <i>GuardedBy("this")</i>
+ */
+ private final Map<J2eeModuleProvider, DeploymentState> lastDeploymentStates = new HashMap<>();
+
+ /** <i>GuardedBy("this")</i>
+ */
+ private Future<?> current;
+
+ private DeployOnSaveManager() {
+ }
+
+ public static synchronized DeployOnSaveManager getDefault() {
+ if (instance == null) {
+ instance = new DeployOnSaveManager();
+ }
+ return instance;
+ }
+
+ public void startListening(Project project, J2eeModuleProvider j2eeProvider) {
+ synchronized (this) {
+ if (compileListeners.containsKey(j2eeProvider)) {
+ // this is due to EAR childs :(
+ if (j2eeProvider instanceof J2eeApplicationProvider) {
+ stopListening(project, j2eeProvider);
+ } else {
+ LOGGER.log(Level.FINE, "Already listening on {0}", j2eeProvider);
+ return;
+ }
+ }
+
+ List<J2eeModuleProvider> providers = new ArrayList<>(4);
+ providers.add(j2eeProvider);
+
+ if (j2eeProvider instanceof J2eeApplicationProvider) {
+ Collections.addAll(providers,
+ ((J2eeApplicationProvider) j2eeProvider).getChildModuleProviders());
+ }
+
+ // get all binary urls
+ List<URL> urls = new ArrayList<>();
+ for (J2eeModuleProvider provider : providers) {
+ for (FileObject file : provider.getSourceFileMap().getSourceRoots()) {
+ URL url = URLMapper.findURL(file, URLMapper.EXTERNAL);
+ if (url != null) {
+ urls.add(url);
+ }
+ }
+ }
+
+ // register CLASS listener
+ CompileOnSaveListener listener = new CompileOnSaveListener(project, j2eeProvider, urls);
+ for (URL url : urls) {
+ BuildArtifactMapper.addArtifactsUpdatedListener(url, listener);
+ }
+ compileListeners.put(j2eeProvider, listener);
+
+ // register WEB listener
+ J2eeModuleProvider.DeployOnSaveSupport support = j2eeProvider.getDeployOnSaveSupport();
+ if (support != null) {
+ CopyOnSaveListener copyListener = new CopyOnSaveListener(project, j2eeProvider);
+ support.addArtifactListener(copyListener);
+ copyListeners.put(j2eeProvider, copyListener);
+ }
+ }
+ }
+
+ public void stopListening(Project project, J2eeModuleProvider j2eeProvider) {
+ synchronized (this) {
+ CompileOnSaveListener removed = compileListeners.remove(j2eeProvider);
+ if (removed == null) {
+ LOGGER.log(Level.FINE, "Not compile-listening on {0}", j2eeProvider);
+ } else {
+ for (URL url : removed.getRegistered()) {
+ BuildArtifactMapper.removeArtifactsUpdatedListener(url, removed);
+ }
+ }
+
+ CopyOnSaveListener copyRemoved = copyListeners.remove(j2eeProvider);
+ if (removed == null) {
+ LOGGER.log(Level.FINE, "Not copy-listening on {0}", j2eeProvider);
+ } else {
+ J2eeModuleProvider.DeployOnSaveSupport support = j2eeProvider.getDeployOnSaveSupport();
+ if (support != null) {
+ support.removeArtifactListener(copyRemoved);
+ }
+ }
+ }
+ }
+
+ public void addDeployOnSaveListener(J2eeModuleProvider provider, DeployOnSaveListener listener) {
+ synchronized (this) {
+ List<DeployOnSaveListener> listeners = projectListeners.get(provider);
+ if (listeners == null) {
+ listeners = new ArrayList<>();
+ projectListeners.put(provider, listeners);
+ }
+ listeners.add(listener);
+ }
+ }
+
+ public void removeDeployOnSaveListener(J2eeModuleProvider provider, DeployOnSaveListener listener) {
+ synchronized (this) {
+ List<DeployOnSaveListener> listeners = projectListeners.get(provider);
+ if (listeners == null) {
+ return;
+ }
+ listeners.remove(listener);
+ if (listeners.isEmpty()) {
+ projectListeners.remove(provider);
+ }
+ }
+ }
+
+ public void notifyInitialDeployment(Project project, J2eeModuleProvider provider) {
+ synchronized (this) {
+ if (compileListeners.containsKey(provider)) {
+ // this is due to EAR childs :(
+ if (provider instanceof J2eeApplicationProvider) {
+ startListening(project, provider);
+ }
+ }
+
+ if (!lastDeploymentStates.containsKey(provider)) {
+ lastDeploymentStates.put(provider, DeploymentState.MODULE_UPDATED);
+ }
+ }
+ }
+
+ public void submitChangedArtifacts(J2eeModuleProvider provider, Iterable<Artifact> artifacts) {
+ assert provider != null;
+ assert artifacts != null;
+
+ synchronized (this) {
+ Set<Artifact> preparedArtifacts = toDeploy.get(provider);
+ if (preparedArtifacts == null) {
+ preparedArtifacts = new HashSet<>();
+ toDeploy.put(provider, preparedArtifacts);
+ }
+ for (Artifact artifact : artifacts) {
+ preparedArtifacts.add(artifact);
+ }
+
+ boolean delayed = true;
+ if (current != null && !current.isDone()) {
+ // TODO interruption throws exception to user from lower levels :((
+ // this is dummy interruption signal handling :(
+ current.cancel(false);
+ delayed = false;
+ }
+
+ current = EXECUTOR.submit(new DeployTask(delayed));
+ }
+ }
+
+ private final class CompileOnSaveListener implements ArtifactsUpdated {
+
+ private final WeakReference<Project> project;
+
+ private final WeakReference<J2eeModuleProvider> provider;
+
+ private final List<URL> registered;
+
+ public CompileOnSaveListener(Project project, J2eeModuleProvider provider, List<URL> registered) {
+ this.project = new WeakReference<>(project);
+ this.provider = new WeakReference<>(provider);
+ this.registered = registered;
+ }
+
+ public List<URL> getRegistered() {
+ return unmodifiableList(registered);
+ }
+
+ @Override
+ public void artifactsUpdated(Iterable<File> artifacts) {
+ Project realProject = project.get();
+ J2eeModuleProvider realProvider = provider.get();
+
+ if (realProject == null
+ || realProvider == null
+ || !MavenProjectSupport.isDeployOnSave(realProject)) {
+ return;
+ }
+
+ MicroApplication microApplication = MicroApplication.getInstance(realProject);
+ if (microApplication != null) {
+ microApplication.setLoading(true);
+ }
+
+ J2eeModuleProvider.DeployOnSaveClassInterceptor interceptor = realProvider.getDeployOnSaveClassInterceptor();
+
+ Set<Artifact> realArtifacts = new HashSet<>();
+ for (File file : artifacts) {
+ if (file != null) {
+ Artifact a = Artifact.forFile(file);
+ if (interceptor != null) {
+ a = interceptor.convert(a);
+ }
+ realArtifacts.add(a);
+ }
+ }
+
+ if (LOGGER.isLoggable(Level.FINE)) {
+ for (Artifact artifact : realArtifacts) {
+ LOGGER.log(Level.FINE, "Delivered compile artifact: {0}", artifact);
+ }
+ }
+ DeployOnSaveManager.getDefault().submitChangedArtifacts(realProvider, realArtifacts);
+
+ try {
+ current.get();
+ if (microApplication != null) {
+ microApplication.setLoading(false);
+ }
+ } catch (InterruptedException | ExecutionException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ }
+
+ private final class CopyOnSaveListener implements ArtifactListener {
+
+ private final WeakReference<Project> project;
+
+ private final WeakReference<J2eeModuleProvider> provider;
+
+ public CopyOnSaveListener(Project project, J2eeModuleProvider provider) {
+ this.project = new WeakReference<>(project);
+ this.provider = new WeakReference<>(provider);
+ }
+
+ @Override
+ public void artifactsUpdated(Iterable<Artifact> artifacts) {
+ Project realProject = project.get();
+ J2eeModuleProvider realProvider = provider.get();
+
+ if (realProject == null
+ || realProvider == null
+ || !MavenProjectSupport.isDeployOnSave(realProject)) {
+ return;
+ }
+
+ MicroApplication microApplication = MicroApplication.getInstance(realProject);
+ if (microApplication != null) {
+ microApplication.setLoading(true);
+ }
+
+ if (LOGGER.isLoggable(Level.FINE)) {
+ for (Artifact artifact : artifacts) {
+ LOGGER.log(Level.FINE, "Delivered copy artifact: {0}", artifact);
+ }
+ }
+ DeployOnSaveManager.getDefault().submitChangedArtifacts(realProvider, artifacts);
+
+ try {
+ current.get();
+ if (microApplication != null) {
+ microApplication.setLoading(false);
+ }
+ } catch (InterruptedException | ExecutionException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ }
+
+ private class DeployTask implements Runnable {
+
+ private final boolean delayed;
+
+ public DeployTask(boolean delayed) {
+ this.delayed = delayed;
+ }
+
+ @Override
+ public void run() {
+ if (delayed) {
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ return;
+ }
+ }
+
+ LOGGER.log(Level.FINE, "Performing pending deployments");
+
+ Map<J2eeModuleProvider, Set<Artifact>> deployNow;
+ Map<J2eeModuleProvider, List<DeployOnSaveListener>> listeners = new HashMap<>();
+ synchronized (DeployOnSaveManager.this) {
+ if (toDeploy.isEmpty()) {
+ return;
+ }
+
+ deployNow = toDeploy;
+ toDeploy = new HashMap<>();
+
+ // copy the listeners
+ for (Map.Entry<J2eeModuleProvider, List<DeployOnSaveListener>> entry : projectListeners.entrySet()) {
+ if (!deployNow.containsKey(entry.getKey())) {
+ continue;
+ }
+ listeners.put(entry.getKey(), new ArrayList<>(entry.getValue()));
+ }
+ }
+
+ for (Map.Entry<J2eeModuleProvider, Set<Artifact>> entry : deployNow.entrySet()) {
+ if (entry.getValue().isEmpty()) {
+ continue;
+ }
+ try {
+ boolean updated = notifyServer(entry.getKey(), entry.getValue());
+ if (updated) {
+ // run nbjpdaapprealoaded task.
+ runJPDAAppReloaded();
+
+ List<DeployOnSaveListener> toFire = listeners.get(entry.getKey());
+ if (toFire != null) {
+ toFire.forEach(listener -> listener.deployed(entry.getValue()));
+ }
+ }
+ } catch (Throwable t) {
+ // do not throw away any exception:
+ LOGGER.log(Level.SEVERE, null, t);
+ }
+ }
+ }
+
+ private boolean notifyServer(J2eeModuleProvider provider, Iterable<Artifact> artifacts) {
+ if (LOGGER.isLoggable(Level.FINEST)) {
+ StringBuilder builder = new StringBuilder("Artifacts updated: [");
+ for (Artifact artifact : artifacts) {
+ builder.append(artifact.getFile().getAbsolutePath()).append(",");
+ }
+ builder.setLength(builder.length() - 1);
+ builder.append("]");
+ LOGGER.log(Level.FINEST, builder.toString());
+ }
+
+ DeploymentState state;
+ try {
+ distributeOnSave(FileUtil.toFile(provider.getJ2eeModule().getContentDirectory()), artifacts);
+ ReloadAction.reloadApplication(provider.getJ2eeModule().getContentDirectory().getPath());
+ state = DeploymentState.MODULE_UPDATED;
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ state = DeploymentState.DEPLOYMENT_FAILED;
+ }
+
+ String message;
+ switch (state) {
+ case MODULE_UPDATED:
+ message = getMessage(DeployOnSaveManager.class, "MSG_DeployOnSave_Deployed", provider.getDeploymentName());
+ break;
+ case DEPLOYMENT_FAILED:
+ message = getMessage(DeployOnSaveManager.class, "MSG_DeployOnSave_Failed", provider.getDeploymentName());
+ break;
+ default:
+ message = null;
+ }
+
+ if (message != null) {
+ StatusDisplayer.getDefault().setStatusText(message);
+ }
+
+ LOGGER.log(Level.FINE, "Deployment state {0}", state);
+ synchronized (this) {
+ lastDeploymentStates.put(provider, state);
+ }
+ return state == DeploymentState.MODULE_UPDATED;
+ }
+
+ private void runJPDAAppReloaded() {
+ // Hack: run nbjpdaappreloaded ANT task after deploy to fix breakpoints.
+ String reloadedClassName = org.apache.tools.ant.module.api.IntrospectedInfo.getKnownInfo().getDefs("task").get("nbjpdaappreloaded"); // NOI18N
+ if (reloadedClassName == null) {
+ // seems to be null during some unit tests
+ return;
+ }
+ String reloadedPackageName = reloadedClassName.substring(0, reloadedClassName.lastIndexOf('.'));
+ try {
+ Map<String, ClassLoader> customDefClassLoaders = (Map<String, ClassLoader>) Lookup.getDefault().lookup(ClassLoader.class).
+ loadClass("org.apache.tools.ant.module.bridge.AntBridge"). // NOI18N
+ getMethod("getCustomDefClassLoaders").invoke(null); // NOI18N
+ //Class reloadedClass = org.apache.tools.ant.module.bridge.AntBridge.getCustomDefClassLoaders().get(reloadedPackageName).loadClass(reloadedClassName);
+ ClassLoader reloadedClassLoader = customDefClassLoaders.get(reloadedPackageName);
+ if (reloadedClassLoader != null) {
+ Class reloadedClass = reloadedClassLoader.loadClass(reloadedClassName);
+ reloadedClass.getMethod("execute").invoke(reloadedClass.newInstance());
+ }
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ private void distributeOnSave(File destDir, Iterable<Artifact> artifacts) throws IOException {
+
+ try {
+ FileObject destRoot = FileUtil.createFolder(destDir);
+
+ // create target FOs map keyed by relative paths
+ java.util.Enumeration destFiles = destRoot.getChildren(true);
+ Map destMap = new HashMap();
+ int rootPathLen = destRoot.getPath().length();
+ for (; destFiles.hasMoreElements();) {
+ FileObject destFO = (FileObject) destFiles.nextElement();
+ destMap.put(destFO.getPath().substring(rootPathLen + 1), destFO);
+ }
+
+ FileObject contentDirectory = destRoot;
+ assert contentDirectory != null;
+
+ for (Artifact artifact : artifacts) {
+ File fsFile = artifact.getFile();
+ File altDistFile = artifact.getDistributionPath();
+ if (altDistFile == null) {
+ String classes = "target" + File.separator + "classes";
+ String filePath = artifact.getFile().getPath();
+ String altDistRelativePath = filePath.substring(filePath.indexOf(classes) + classes.length());
+ altDistFile = new File(destRoot.getPath() + File.separator + "WEB-INF" + File.separator + "classes" + altDistRelativePath);
+ }
+
+ FileObject file = FileUtil.toFileObject(FileUtil.normalizeFile(fsFile));
+
+ FileObject checkFile = FileUtil.toFileObject(FileUtil.normalizeFile(altDistFile));
+ if (checkFile == null && file != null) { //#165045
+ checkFile = FileUtil.createData(altDistFile);
+ }
+
+ if (checkFile != null && file != null) {
+ String relative = FileUtil.getRelativePath(contentDirectory, checkFile);
+ if (relative != null) {
+ FileObject targetFO = (FileObject) destMap.get(relative);
+ if (file.isFolder()) {
+ destMap.remove(relative);
+ //continue;
+ }
+
+ createOrReplace(file, targetFO, destRoot, relative, destMap, false);
+ }
+ } else if (checkFile != null && file == null) {
+ checkFile.delete();
+ }
+ }
+
+ } catch (Exception e) {
+ String msg = NbBundle.getMessage(DeployOnSaveManager.class, "MSG_IncrementalDeployFailed", e);
+ throw new RuntimeException(msg, e);
+ }
+ }
+
+ private void createOrReplace(
+ FileObject sourceFO,
+ FileObject targetFO,
+ FileObject destRoot,
+ String relativePath,
+ Map destMap, boolean checkTimeStamps) throws IOException {
+
+ FileObject destFolder;
+ OutputStream destStream = null;
+ InputStream sourceStream = null;
+
+ try {
+ // double check that the target does not exist... 107526
+ // the destMap seems to be incomplete....
+ if (targetFO == null) {
+ targetFO = destRoot.getFileObject(relativePath);
+ }
+ if (targetFO == null) {
+ destFolder = findOrCreateParentFolder(destRoot, relativePath);
+ } else {
+ // remove from map to form of to-remove-target-list
+ destMap.remove(relativePath);
+
+ //check timestamp
+ if (checkTimeStamps) {
+ if (!sourceFO.lastModified().after(targetFO.lastModified())) {
+ return;
+ }
+ }
+ if (targetFO.equals(sourceFO)) {
+ // do not write a file onto itself...
+ return;
+ }
+ destFolder = targetFO.getParent();
+
+ // we need to rewrite the content of the file here... thanks,
+ // to windows file locking.
+ destStream = targetFO.getOutputStream();
+
+ }
+
+ if (sourceFO.isFolder()) {
+ FileUtil.createFolder(destFolder, sourceFO.getNameExt());
+ return;
+ }
+ try {
+ if (null == destStream) {
+ FileUtil.copyFile(sourceFO, destFolder, sourceFO.getName());
+ } else {
+ // this is where we need to push the content into the file....
+ sourceStream = sourceFO.getInputStream();
+ FileUtil.copy(sourceStream, destStream);
+ }
+ } catch (FileNotFoundException ex) {
+ // this may happen when the source file disappears
+ // perhaps when source is changing rapidly ?
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ } finally {
+ if (null != sourceStream) {
+ try {
+ sourceStream.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.WARNING, null, ioe);
+ }
+ }
+ if (null != destStream) {
+ try {
+ destStream.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.WARNING, null, ioe);
+ }
+ }
+ }
+ }
+
+ /**
+ * Find or create parent folder of a file given its root and its
+ * relative path. The target file does not need to exist.
+ *
+ * @param dest FileObject for the root of the target file
+ * @param relativePath relative path of the target file
+ * @return the FileObject for the parent folder target file.
+ * @throws java.io.IOException
+ */
+ private FileObject findOrCreateParentFolder(FileObject dest, String relativePath) throws IOException {
+ File parentRelativePath = (new File(relativePath)).getParentFile();
+ if (parentRelativePath == null) {
+ return dest;
+ }
+
+ FileObject folder = FileUtil.createFolder(dest, parentRelativePath.getPath());
+ if (folder.isData()) {
+ LOGGER.log(Level.FINER, "found file {0} when a folder was expecetd", folder.getPath());
+ folder = null;
+ }
+ return folder;
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ExecutionChecker.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ExecutionChecker.java
new file mode 100644
index 0000000..64be20e
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ExecutionChecker.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMMAND_EXPLODE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMPILE_EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEBUG_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.MAVEN_WAR_PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROFILE_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RUN_SINGLE_ACTION;
+import java.io.File;
+import static java.util.Arrays.asList;
+import java.util.HashSet;
+import java.util.Set;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.maven.api.execute.ExecutionContext;
+import org.netbeans.modules.maven.api.execute.ExecutionResultChecker;
+import org.netbeans.modules.maven.api.execute.PrerequisitesChecker;
+import org.netbeans.modules.maven.api.execute.RunConfig;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_BUILD;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_CLEAN;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_DEBUG;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_PROFILE;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_REBUILD;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_RUN;
+import org.netbeans.spi.project.ProjectServiceProvider;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@ProjectServiceProvider(
+ service = {
+ ExecutionResultChecker.class,
+ PrerequisitesChecker.class
+ },
+ projectType = MAVEN_WAR_PROJECT_TYPE
+)
+public class ExecutionChecker implements ExecutionResultChecker, PrerequisitesChecker {
+
+ private static final String COMMAND_BUILD_WITH_DEPENDENCIES = "build-with-dependencies";
+
+ private static final Set<String> BUILD_ACTIONS = new HashSet<>(asList(new String[]{
+ COMMAND_CLEAN,
+ COMMAND_BUILD,
+ COMMAND_REBUILD,
+ COMMAND_BUILD_WITH_DEPENDENCIES,
+ COMPILE_EXPLODE_ACTION,
+ EXPLODE_ACTION
+ }));
+
+ private static final Set<String> RUN_ACTIONS = new HashSet<>(asList(new String[]{
+ COMMAND_RUN,
+ COMMAND_DEBUG,
+ COMMAND_PROFILE,
+ RUN_SINGLE_ACTION,
+ DEBUG_SINGLE_ACTION,
+ PROFILE_SINGLE_ACTION
+ }));
+
+
+ @Override
+ public boolean checkRunConfig(RunConfig config) {
+ Project project = config.getProject();
+ MicroApplication microApplication = MicroApplication.getInstance(project);
+ if (microApplication != null) {
+ if (BUILD_ACTIONS.contains(config.getActionName())) {
+ microApplication.setBuilding(true, config.getActionName());
+ }else if (RUN_ACTIONS.contains(config.getActionName())) {
+ microApplication.setRunning(true, config.getActionName());
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void executionResult(RunConfig config, ExecutionContext res, int resultCode) {
+ Project project = config.getProject();
+ MicroApplication microApplication = MicroApplication.getInstance(project);
+ if (microApplication != null) {
+ if (BUILD_ACTIONS.contains(config.getActionName())) {
+ if(config.getActionName().contains(COMMAND_BUILD)
+ || config.getActionName().contains(COMMAND_EXPLODE) ){
+ reloadApplication(microApplication);
+ }
+ microApplication.setBuilding(false);
+ } else if (RUN_ACTIONS.contains(config.getActionName())) {
+ microApplication.setRunning(false);
+ }
+ }
+ }
+
+ public static void reloadApplication(MicroApplication application) {
+ if (!application.isRunning()) {
+ return;
+ }
+ String buildPath = application.getMavenProject().getBuild().getDirectory()
+ + File.separator
+ + application.getMavenProject().getBuild().getFinalName();
+ ReloadAction.reloadApplication(buildPath);
+ }
+
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/LookupProviderImpl.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/LookupProviderImpl.java
new file mode 100644
index 0000000..5623345
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/LookupProviderImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import org.netbeans.api.project.Project;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.MAVEN_WAR_PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.project.MicroApplication.isPayaraMicroProject;
+import org.netbeans.spi.project.LookupProvider;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@LookupProvider.Registration(projectType = MAVEN_WAR_PROJECT_TYPE)
+public class LookupProviderImpl implements LookupProvider {
+
+ @Override
+ public Lookup createAdditionalLookup(Lookup lookup) {
+ Project project = lookup.lookup(Project.class);
+ MicroApplication application = null;
+ if (isPayaraMicroProject(project)) {
+ application = new MicroApplication(project);
+ }
+ return Lookups.singleton(new MicroApplicationContent(application));
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroActionsProvider.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroActionsProvider.java
new file mode 100644
index 0000000..c0ea156
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroActionsProvider.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEBUG_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.MAVEN_WAR_PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROFILE_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RUN_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.WAR_PACKAGING;
+import org.netbeans.modules.fish.payara.micro.project.MicroApplication;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.prefs.Preferences;
+import org.netbeans.api.annotations.common.StaticResource;
+import org.netbeans.api.project.Project;
+import static org.netbeans.api.project.ProjectUtils.getPreferences;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMPILE_EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMPILE_GOAL;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEBUG_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODED_GOAL;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROFILE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RESOURCES_GOAL;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RUN_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.START_GOAL;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.STOP_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.STOP_GOAL;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.VERSION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.WAR_GOAL;
+import org.netbeans.modules.maven.api.NbMavenProject;
+import org.netbeans.modules.maven.api.execute.RunConfig;
+import org.netbeans.modules.maven.execute.model.NetbeansActionMapping;
+import org.netbeans.modules.maven.spi.actions.AbstractMavenActionsProvider;
+import org.netbeans.modules.maven.spi.actions.MavenActionsProvider;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_DEBUG;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_PROFILE;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_RUN;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@ProjectServiceProvider(
+ service = MavenActionsProvider.class,
+ projectType = MAVEN_WAR_PROJECT_TYPE
+)
+public class MicroActionsProvider implements MavenActionsProvider {
+
+ @StaticResource
+ private static final String ACTION_MAPPINGS = "org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml";
+
+ private final AbstractMavenActionsProvider actionsProvider = new AbstractMavenActionsProvider() {
+ @Override
+ protected InputStream getActionDefinitionStream() {
+ return MicroActionsProvider.class
+ .getClassLoader()
+ .getResourceAsStream(ACTION_MAPPINGS);
+ }
+
+ @Override
+ public boolean isActionEnable(String action, Project project, Lookup lookup) {
+ NbMavenProject nbMavenProject = project.getLookup().lookup(NbMavenProject.class);
+ final String packagingType = nbMavenProject.getPackagingType();
+ if (!WAR_PACKAGING.equals(packagingType)) {
+ return false;
+ }
+ switch (action) {
+ case COMMAND_RUN:
+ case COMMAND_DEBUG:
+ case COMMAND_PROFILE:
+ case RUN_SINGLE_ACTION:
+ case DEBUG_SINGLE_ACTION:
+ case PROFILE_SINGLE_ACTION:
+ break;
+ default:
+ return false;
+ }
+ return MicroApplication.getInstance(project) != null;
+ }
+
+ };
+
+ @Override
+ public RunConfig createConfigForDefaultAction(String actionName, Project project, Lookup lookup) {
+ Preferences pref = getPreferences(project, MicroApplication.class, true);
+ String microVersionText = pref.get(VERSION, "");
+ RunConfig config = actionsProvider.createConfigForDefaultAction(actionName, project, lookup);
+ if(!microVersionText.isEmpty()){
+ config.setProperty("version.payara", microVersionText);
+ }
+ config.getGoals().addAll(getGoals(actionName));
+ return config;
+ }
+
+ @Override
+ public NetbeansActionMapping getMappingForAction(String actionName, Project project) {
+ return actionsProvider.getMappingForAction(actionName, project);
+ }
+
+ @Override
+ public boolean isActionEnable(String action, Project project, Lookup lookup) {
+ return actionsProvider.isActionEnable(action, project, lookup);
+ }
+
+ @Override
+ public Set<String> getSupportedDefaultActions() {
+ return actionsProvider.getSupportedDefaultActions();
+ }
+
+ public static List<String> getGoals(String actionName) {
+ List<String> goals = new ArrayList<>();
+ if (null != actionName) {
+ switch (actionName) {
+ case RUN_ACTION:
+ case RUN_SINGLE_ACTION:
+ goals.add(RESOURCES_GOAL);
+ goals.add(COMPILE_GOAL);
+ goals.add(EXPLODED_GOAL);
+ goals.add(STOP_GOAL);
+ goals.add(START_GOAL);
+ break;
+ case DEBUG_ACTION:
+ case DEBUG_SINGLE_ACTION:
+ case PROFILE_ACTION:
+ case PROFILE_SINGLE_ACTION:
+ goals.add(WAR_GOAL);
+ goals.add(STOP_GOAL);
+ goals.add(START_GOAL);
+ break;
+ case COMPILE_EXPLODE_ACTION:
+ goals.add(RESOURCES_GOAL);
+ goals.add(COMPILE_GOAL);
+ goals.add(EXPLODED_GOAL);
+ break;
+ case EXPLODE_ACTION:
+ goals.add(EXPLODED_GOAL);
+ break;
+ case STOP_ACTION:
+ goals.add(STOP_GOAL);
+ break;
+ default:
+ break;
+ }
+ }
+ return goals;
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplication.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplication.java
new file mode 100644
index 0000000..43ef4c3
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplication.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.maven.project.MavenProject;
+import org.netbeans.api.project.Project;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PAYARA_MICRO_MAVEN_PLUGIN;
+import org.netbeans.modules.maven.api.NbMavenProject;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class MicroApplication {
+
+ private final Project project;
+
+ private final MavenProject mavenProject;
+
+ private ActionType buildActionType;
+
+ private boolean buildAction;
+
+ private ActionType runActionType;
+
+ private final AtomicInteger runActionCount = new AtomicInteger();
+
+ private boolean reloadAction;
+
+ private static final String SINGLE = ".single.deploy";
+
+ public MicroApplication(Project project) {
+ this.project = project;
+ NbMavenProject nbMavenProject = project.getLookup().lookup(NbMavenProject.class);
+ this.mavenProject = nbMavenProject.getMavenProject();
+ }
+
+ public Project getProject() {
+ return project;
+ }
+
+ public MavenProject getMavenProject() {
+ return mavenProject;
+ }
+
+ public void setBuilding(boolean buildAction, String actionType) {
+ this.buildActionType = ActionType.toAction(actionType.replace("-", "_"));
+ setBuilding(buildAction);
+ }
+
+ public void setBuilding(boolean buildAction) {
+ this.buildAction = buildAction;
+ NbMavenProject.fireMavenProjectReload(project);
+ }
+
+ public ActionType getBuildActionType() {
+ return buildActionType;
+ }
+
+ public boolean isBuilding() {
+ return buildAction;
+ }
+
+ public void setRunning(boolean running, String actionType) {
+ this.runActionType = ActionType.toAction(actionType.replace(SINGLE, ""));
+ setRunning(running);
+ }
+
+ public void setRunning(boolean running) {
+ if (running) {
+ runActionCount.incrementAndGet();
+ } else if (isRunning()) { // skip negative decrement
+ runActionCount.decrementAndGet();
+ }
+ NbMavenProject.fireMavenProjectReload(project);
+ }
+
+ public boolean isRunning() {
+// runActionCount.getAndSet(calcRunningInstanceCount());
+ return runActionCount.get() > 0;
+ }
+
+ private int calcRunningInstanceCount() {
+ System.out.println("calcRunningInstanceCount");
+ List<String> processIds = new ArrayList<>();
+ String executorFilter = "gav=" + mavenProject.getGroupId() + ":" + mavenProject.getArtifactId() + ":" + mavenProject.getVersion();
+ final Runtime re = Runtime.getRuntime();
+ try {
+ Process jpsProcess = re.exec("jps -v");
+ InputStream inputStream = jpsProcess.getInputStream();
+ BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
+ String line;
+ while ((line = in.readLine()) != null) {
+ if (line.contains(executorFilter)) {
+ String[] split = line.split(" ");
+ processIds.add(split[0]);
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return processIds.size();
+ }
+
+ public int getRunningInstanceCount() {
+ return runActionCount.get();
+ }
+
+ public ActionType getRunActionType() {
+ return runActionType;
+ }
+
+ public void setLoading(boolean loading) {
+ this.reloadAction = loading;
+ NbMavenProject.fireMavenProjectReload(project);
+ }
+
+ public boolean isLoading() {
+ return reloadAction;
+ }
+
+ public static MicroApplication getInstance(Project project) {
+ MicroApplication microApplication = null;
+ if (project != null) {
+ MicroApplicationContent content = project.getLookup().lookup(MicroApplicationContent.class);
+ microApplication = content.getMicroApplication();
+ }
+ return microApplication;
+ }
+
+ public static MicroApplication registerInstance(Project project) {
+ MicroApplication microApplication = null;
+ if (project != null) {
+ MicroApplicationContent content = project.getLookup().lookup(MicroApplicationContent.class);
+ if(content != null) {
+ microApplication = new MicroApplication(project);
+ content.setMicroApplication(microApplication);
+ }
+ }
+ return microApplication;
+ }
+
+ public static boolean isPayaraMicroProject(Project project) {
+ NbMavenProject nbMavenProject = project.getLookup().lookup(NbMavenProject.class);
+ MavenProject mavenProject = nbMavenProject.getMavenProject();
+ return mavenProject.getPluginArtifactMap()
+ .get(PAYARA_MICRO_MAVEN_PLUGIN) != null;
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplicationContent.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplicationContent.java
new file mode 100644
index 0000000..4a92c97
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroApplicationContent.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class MicroApplicationContent {
+
+ private MicroApplication microApplication;
+
+ public MicroApplicationContent(MicroApplication microApplication) {
+ this.microApplication = microApplication;
+ }
+
+ public MicroApplication getMicroApplication() {
+ return microApplication;
+ }
+
+ void setMicroApplication(MicroApplication microApplication) {
+ this.microApplication = microApplication;
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroIcon.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroIcon.java
new file mode 100644
index 0000000..c531c1c
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroIcon.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.MAVEN_WAR_PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROJECT_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RESTART_ICON;
+import javax.swing.Icon;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.maven.j2ee.ui.EEIcons.WarIcon;
+import org.netbeans.modules.maven.spi.nodes.SpecialIcon;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import static org.openide.util.ImageUtilities.loadImageIcon;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@ProjectServiceProvider(
+ service = SpecialIcon.class,
+ projectType = MAVEN_WAR_PROJECT_TYPE
+)
+public class MicroIcon extends WarIcon {
+
+ private Project project;
+
+ public void setProject(Project project) {
+ this.project = project;
+ }
+
+ @Override
+ public Icon getIcon() {
+ MicroApplication microApplication = MicroApplication.getInstance(project);
+ String icon = PROJECT_ICON;
+ if (microApplication == null) {
+ return super.getIcon();
+ } else if (microApplication.isLoading()) {
+ icon = RELOAD_ICON;
+ } else if (microApplication.isBuilding() && microApplication.getBuildActionType() != null) {
+ icon = microApplication.getBuildActionType().getIcon();
+ } else if (microApplication.isRunning()) {
+ if (microApplication.getRunningInstanceCount() > 1) {
+ icon = RESTART_ICON;
+ } else if (microApplication.getRunActionType() != null) {
+ icon = microApplication.getRunActionType().getIcon();
+ }
+ }
+ return loadImageIcon(icon, true);
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroProjectHook.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroProjectHook.java
new file mode 100644
index 0000000..8e22f3c
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroProjectHook.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.MAVEN_WAR_PROJECT_TYPE;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
+import org.netbeans.modules.maven.spi.nodes.SpecialIcon;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.netbeans.spi.project.ui.ProjectOpenedHook;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@ProjectServiceProvider(
+ service = ProjectOpenedHook.class,
+ projectType = MAVEN_WAR_PROJECT_TYPE
+)
+public class MicroProjectHook extends ProjectOpenedHook {
+
+ private final Project project;
+
+ public MicroProjectHook(Project project) {
+ this.project = project;
+ }
+
+ @Override
+ public void projectOpened() {
+ if (MicroApplication.getInstance(project) != null) {
+ addDeployOnSaveManager(project);
+ updateMicroIcon();
+ }
+ }
+
+ @Override
+ public void projectClosed() {
+ if (MicroApplication.getInstance(project) != null) {
+ removeDeployOnSaveManager(project);
+ }
+ }
+
+ private void updateMicroIcon() {
+ SpecialIcon specialIcon = project.getLookup().lookup(SpecialIcon.class);
+ MicroIcon microIcon;
+ if (specialIcon instanceof MicroIcon) {
+ microIcon = (MicroIcon) specialIcon;
+ } else {
+ return;
+ }
+ microIcon.setProject(project);
+ }
+
+ private void addDeployOnSaveManager(Project project) {
+ J2eeModuleProvider moduleProvider = project.getLookup().lookup(J2eeModuleProvider.class);
+ if (moduleProvider != null) {
+ DeployOnSaveManager.getDefault().startListening(project, moduleProvider);
+ }
+ }
+
+ private void removeDeployOnSaveManager(Project project) {
+ J2eeModuleProvider moduleProvider = project.getLookup().lookup(J2eeModuleProvider.class);
+ if (moduleProvider != null) {
+ DeployOnSaveManager.getDefault().stopListening(project, moduleProvider);
+ }
+ }
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.form b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.form
new file mode 100644
index 0000000..d11522e
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.form
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="microVersionLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="microVersionCombobox" pref="272" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="microVersionCombobox" min="-2" max="-2" attributes="0"/>
+ <Component id="microVersionLabel" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="117" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="microVersionLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/netbeans/modules/fish/payara/micro/project/Bundle.properties" key="MicroPropertiesPanel.microVersionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="microVersionCombobox">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new DefaultComboBoxModel(getMicroVersion())" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.java
new file mode 100644
index 0000000..61df9a3
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanel.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.prefs.Preferences;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import org.netbeans.api.project.Project;
+import static org.netbeans.api.project.ProjectUtils.getPreferences;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.VERSION;
+import org.netbeans.modules.maven.api.customizer.ModelHandle2;
+import org.netbeans.modules.maven.api.customizer.support.ComboBoxUpdater;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class MicroPropertiesPanel extends JPanel {
+
+ private static final MicroVersion DEFAULT_VERSION = new MicroVersion("", "", "defined in pom.xml");
+
+ private final Preferences pref;
+
+ private final ComboBoxUpdater<MicroVersion> microVersionComboBoxUpdater;
+
+ private MicroVersion selectedMicroVersion;
+
+ public MicroPropertiesPanel(ModelHandle2 handle, Project project) {
+ pref = getPreferences(project, MicroApplication.class, true);
+ initComponents();
+ String microVersionText = pref.get(VERSION, "");
+ Optional<MicroVersion> microVersionOptional = VersionRepository.toMicroVersion(microVersionText);
+ microVersionComboBoxUpdater = new ComboBoxUpdater<MicroVersion>(microVersionCombobox, microVersionLabel) {
+ @Override
+ public MicroVersion getValue() {
+ return microVersionOptional.orElse(DEFAULT_VERSION);
+ }
+
+ @Override
+ public MicroVersion getDefaultValue() {
+ return DEFAULT_VERSION;
+ }
+
+ @Override
+ public void setValue(MicroVersion microVersion) {
+ selectedMicroVersion = microVersion;
+ }
+ };
+ }
+
+ private MicroVersion[] getMicroVersion() {
+ List<MicroVersion> microVersions = new ArrayList<>();
+ microVersions.add(DEFAULT_VERSION);
+ microVersions.addAll(VersionRepository.getInstance().getMicroVersion());
+ return microVersions.toArray(new MicroVersion[]{});
+ }
+
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ microVersionLabel = new javax.swing.JLabel();
+ microVersionCombobox = new javax.swing.JComboBox();
+
+ org.openide.awt.Mnemonics.setLocalizedText(microVersionLabel, org.openide.util.NbBundle.getMessage(MicroPropertiesPanel.class, "MicroPropertiesPanel.microVersionLabel.text")); // NOI18N
+
+ microVersionCombobox.setModel(new DefaultComboBoxModel(getMicroVersion()));
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(microVersionLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(microVersionCombobox, 0, 272, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(microVersionCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(microVersionLabel))
+ .addContainerGap(117, Short.MAX_VALUE))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JComboBox microVersionCombobox;
+ private javax.swing.JLabel microVersionLabel;
+ // End of variables declaration//GEN-END:variables
+
+ public void applyChanges() {
+ pref.put(VERSION, selectedMicroVersion.getVersion());
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanelProvider.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanelProvider.java
new file mode 100644
index 0000000..fb3c1e2
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroPropertiesPanelProvider.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import javax.swing.JComponent;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.maven.api.customizer.ModelHandle2;
+import org.netbeans.spi.project.ui.support.ProjectCustomizer;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class MicroPropertiesPanelProvider implements ProjectCustomizer.CompositeCategoryProvider {
+
+ @ProjectCustomizer.CompositeCategoryProvider.Registration(
+ projectType = "org-netbeans-modules-maven",
+ position = 305
+ )
+ public static MicroPropertiesPanelProvider createRun() {
+ return new MicroPropertiesPanelProvider();
+ }
+
+ @Override
+ public ProjectCustomizer.Category createCategory(Lookup context) {
+ Project project = context.lookup(Project.class);
+ if (MicroApplication.getInstance(project) == null) {
+ return null;
+ }
+ return ProjectCustomizer.Category.create("PayaraMicro", "Payara Micro", null); // NOI18N
+ }
+
+ @Override
+ public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
+ ModelHandle2 handle = context.lookup(ModelHandle2.class);
+ final Project project = context.lookup(Project.class);
+ if (MicroApplication.getInstance(project) == null) {
+ return null;
+ }
+
+ MicroPropertiesPanel microPanel = new MicroPropertiesPanel(handle, project);
+ category.setOkButtonListener(event -> microPanel.applyChanges());
+ category.setStoreListener(event -> microPanel.applyChanges());
+ return microPanel;
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroVersion.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroVersion.java
new file mode 100644
index 0000000..862200d
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroVersion.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class MicroVersion {
+
+ private final String version;
+
+ private final String javaeeVersion;
+
+ private final String displayName;
+
+ public MicroVersion(String version, String javaeeVersion) {
+ this.version = version;
+ this.javaeeVersion = javaeeVersion;
+ this.displayName = version;
+ }
+
+ public MicroVersion(String version, String javaeeVersion, String displayName) {
+ this.version = version;
+ this.javaeeVersion = javaeeVersion;
+ this.displayName = displayName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getJavaeeVersion() {
+ return javaeeVersion;
+ }
+
+ @Override
+ public String toString() {
+ return displayName;
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ReloadAction.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ReloadAction.java
new file mode 100644
index 0000000..8155b7c
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ReloadAction.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.AbstractAction;
+import org.apache.maven.project.MavenProject;
+import org.netbeans.api.project.Project;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMPILE_EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_FILE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_ICON;
+import org.netbeans.modules.fish.payara.micro.project.MicroApplication;
+import org.netbeans.modules.maven.api.NbMavenProject;
+import org.netbeans.modules.maven.api.execute.RunUtils;
+import static org.netbeans.modules.maven.api.execute.RunUtils.isCompileOnSaveEnabled;
+import org.netbeans.modules.maven.execute.ActionToGoalUtils;
+import org.netbeans.modules.maven.execute.ModelRunConfig;
+import org.netbeans.modules.maven.execute.model.NetbeansActionMapping;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.awt.StatusDisplayer;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle.Messages;
+import static org.openide.util.NbBundle.getMessage;
+import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@ActionID(
+ id = ReloadAction.ID,
+ category = ReloadAction.CATEGORY
+)
+@ActionRegistration(
+ displayName = "#CTL_ReloadAppAction",
+ iconBase = RELOAD_ICON,
+ lazy = true
+)
+@ActionReferences({
+ @ActionReference(path = "Menu/BuildProject", position = 55)
+ ,
+ @ActionReference(path = "Toolbars/Build", position = 325)
+ ,
+ @ActionReference(path = "Projects/org-netbeans-modules-maven/Actions", position = 1000)
+ ,
+ @ActionReference(path = "Shortcuts", name = "DS-A")
+})
+@Messages("CTL_ReloadAppAction=Reload")
+public class ReloadAction extends AbstractAction {
+
+ static final String CATEGORY = "Build";
+
+ static final String ID = "org.netbeans.modules.payara.micro.action.reload";
+
+ private static final RequestProcessor RP = new RequestProcessor(ReloadAction.class.getName());
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Lookup context = Utilities.actionsGlobalContext();
+ Project project = context.lookup(Project.class);
+ if(project == null) {
+ return;
+ }
+ NbMavenProject nbMavenProject = project.getLookup().lookup(NbMavenProject.class);
+ MavenProject mavenProject = nbMavenProject.getMavenProject();
+
+ MicroApplication microApplication = MicroApplication.getInstance(project);
+ if (microApplication == null) {
+ StatusDisplayer.getDefault()
+ .setStatusText(getMessage(ReloadAction.class, "ERR_Payara_Micro_Plugin_Not_Found", mavenProject.getArtifactId()));
+ } else if (!isCompileOnSaveEnabled(microApplication.getProject())) {
+ StatusDisplayer.getDefault()
+ .setStatusText(getMessage(ReloadAction.class, "ERR_Compile_On_Save_Not_Enabled", mavenProject.getArtifactId()));
+ } else {
+ RP.post(() -> {
+ String action = RunUtils.isCompileOnSaveEnabled(project) ? EXPLODE_ACTION : COMPILE_EXPLODE_ACTION;
+ NetbeansActionMapping mapping = ActionToGoalUtils.getDefaultMapping(action, project);
+ ModelRunConfig rc = new ModelRunConfig(project, mapping, mapping.getActionName(), null, Lookup.EMPTY, false);
+ rc.setTaskDisplayName(getMessage(ReloadAction.class, "TXT_Reload", mavenProject.getArtifactId()));
+ rc.getGoals().addAll(MicroActionsProvider.getGoals(action));
+ RunUtils.run(rc);
+ });
+ }
+ }
+
+ public static void reloadApplication(String buildPath) {
+ File check = new File(buildPath, RELOAD_FILE);
+ if (check.exists()) {
+ check.setLastModified(System.currentTimeMillis());
+ } else {
+ try {
+ check.createNewFile();
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ }
+
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/VersionRepository.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/VersionRepository.java
new file mode 100644
index 0000000..eee3e13
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/VersionRepository.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project;
+
+import java.util.ArrayList;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class VersionRepository {
+
+ private static VersionRepository versionRepository;
+ private static final List<MicroVersion> MICRO_VERSIONS = new ArrayList<>();
+
+ private VersionRepository() {
+ MICRO_VERSIONS.add(new MicroVersion("5.192", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("5.191", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("5.184", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("5.183", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("5.182", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("5.181", "8.0"));
+ MICRO_VERSIONS.add(new MicroVersion("4.1.2.181", "7.0"));
+ MICRO_VERSIONS.add(new MicroVersion("4.1.2.174", "7.0"));
+ }
+
+ public static VersionRepository getInstance() {
+ if (versionRepository == null) {
+ versionRepository = new VersionRepository();
+ }
+ return versionRepository;
+ }
+
+ public List<MicroVersion> getMicroVersion() {
+ return unmodifiableList(MICRO_VERSIONS);
+ }
+
+ public static Optional<MicroVersion> toMicroVersion(String microVersion) {
+ return MICRO_VERSIONS
+ .stream()
+ .filter(micro -> micro.getVersion().equals(microVersion))
+ .findAny();
+ }
+
+ public String getJavaEEVersion(String microVersion) {
+ return MICRO_VERSIONS.stream()
+ .filter(micro -> micro.getVersion().equals(microVersion))
+ .map(MicroVersion::getJavaeeVersion)
+ .findAny().get();
+ }
+
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/PayaraMicroProjectDescription.html b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/PayaraMicroProjectDescription.html
new file mode 100644
index 0000000..caaa492
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/PayaraMicroProjectDescription.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html>
+ <body>
+ <div>
+ Maven Payara Micro Application project template, created with Maven Archetype Plugin.<br/>
+ Payara Micro is designed for running Java EE applications in a modern virtualized infrastructure and perfect for microservice and cloud environments..
+ </div>
+ </body>
+</html>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml
new file mode 100644
index 0000000..b84d926
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<actions>
+ <action>
+ <actionName>run</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ </action>
+ <action>
+ <actionName>run.single.deploy</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ <properties>
+ <netbeans.deploy.clientUrlPart>${webpagePath}</netbeans.deploy.clientUrlPart>
+ </properties>
+ </action>
+ <action>
+ <actionName>debug</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ <properties>
+ <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</exec.args>
+ <jpda.listen>true</jpda.listen>
+ <netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
+ </properties>
+ </action>
+ <action>
+ <actionName>debug.single.deploy</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ <properties>
+ <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</exec.args>
+ <jpda.listen>true</jpda.listen>
+ <netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
+ <netbeans.deploy.clientUrlPart>${webpagePath}</netbeans.deploy.clientUrlPart>
+ </properties>
+ </action>
+ <action>
+ <actionName>profile</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ <properties>
+ <exec.args></exec.args>
+ <exec.executable>java</exec.executable>
+ <netbeans.deploy.profilemode>true</netbeans.deploy.profilemode>
+ </properties>
+ </action>
+ <action>
+ <actionName>profile.single.deploy</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ <properties>
+ <exec.args></exec.args>
+ <exec.executable>java</exec.executable>
+ <netbeans.deploy.profilemode>true</netbeans.deploy.profilemode>
+ <netbeans.deploy.clientUrlPart>${webpagePath}</netbeans.deploy.clientUrlPart>
+ </properties>
+ </action>
+
+ <action>
+ <actionName>micro-complie-explode</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ </action>
+ <action>
+ <actionName>micro-explode</actionName>
+ <packagings>
+ <packaging>war</packaging>
+ </packagings>
+ </action>
+ <action>
+ <actionName>micro-stop</actionName>
+ </action>
+</actions>
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-build.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-build.png
new file mode 100644
index 0000000..b42e45e
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-build.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean-build.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean-build.png
new file mode 100644
index 0000000..c541df5
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean-build.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean.png
new file mode 100644
index 0000000..6d9f100
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-clean.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-debug.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-debug.png
new file mode 100644
index 0000000..eff2818
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-debug.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-profile.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-profile.png
new file mode 100644
index 0000000..4387ea9
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-profile.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-reload.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-reload.png
new file mode 100644
index 0000000..44174e4
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-reload.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-restart.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-restart.png
new file mode 100644
index 0000000..361b3f8
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-restart.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-start.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-start.png
new file mode 100644
index 0000000..a449bee
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro-start.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro.png b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro.png
new file mode 100644
index 0000000..c693da6
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/payara-micro.png
Binary files differ
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/BaseWizardIterator.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/BaseWizardIterator.java
new file mode 100644
index 0000000..1c46176
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/BaseWizardIterator.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project.ui;
+
+import java.awt.Component;
+import java.util.NoSuchElementException;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.validation.adapters.WizardDescriptorAdapter;
+import org.netbeans.validation.api.ui.ValidationGroup;
+import org.openide.WizardDescriptor;
+import static org.openide.util.NbBundle.getMessage;
+
+/**
+ * Base abstract class for all types of Maven enterprise projects.
+ * Encapsulates some Wizard related stuffs and few methods common for every project type
+ *
+ * @author Martin Janicek
+ */
+public abstract class BaseWizardIterator implements WizardDescriptor.BackgroundInstantiatingIterator {
+
+ protected WizardDescriptor descriptor;
+ private int index;
+ private WizardDescriptor.Panel[] panels;
+
+ protected abstract WizardDescriptor.Panel[] createPanels(ValidationGroup validationGroup);
+
+ @Override
+ public void initialize(WizardDescriptor descriptor) {
+ this.descriptor = descriptor;
+ this.index = 0;
+ panels = createPanels(ValidationGroup.create(new WizardDescriptorAdapter(descriptor)));
+ updateSteps();
+ }
+
+ @Override
+ public void uninitialize(WizardDescriptor wiz) {
+ this.descriptor.putProperty("projdir", null); //NOI18N
+ this.descriptor.putProperty("name", null); //NOI18N
+ this.descriptor = null;
+ panels = null;
+ }
+
+ @Override
+ public String name() {
+ return getMessage(BaseWizardIterator.class, "LBL_NameFormat", index + 1, panels.length);
+ }
+
+ @Override
+ public boolean hasNext() {
+ return index < panels.length - 1;
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ @Override
+ public void nextPanel() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ index++;
+ }
+
+ @Override
+ public void previousPanel() {
+ if (!hasPrevious()) {
+ throw new NoSuchElementException();
+ }
+ index--;
+ }
+
+ @Override
+ public WizardDescriptor.Panel current() {
+ return panels[index];
+ }
+
+ @Override
+ public final void addChangeListener(ChangeListener l) {
+ }
+
+ @Override
+ public final void removeChangeListener(ChangeListener l) {
+ }
+
+ private void updateSteps() {
+ // Make sure list of steps is accurate.
+ String[] steps = new String[panels.length];
+ String[] basicOnes = new String[]{
+ getMessage(BaseWizardIterator.class, "LBL_MavenProjectSettings"),
+ getMessage(BaseWizardIterator.class, "LBL_PayaraMicroSettings")
+ };
+ System.arraycopy(basicOnes, 0, steps, 0, basicOnes.length);
+ for (int i = 0; i < panels.length; i++) {
+ Component c = panels[i].getComponent();
+ if (i >= basicOnes.length || steps[i] == null) {
+ // Default step name to component name of panel.
+ // Mainly useful for getting the name of the target
+ // chooser to appear in the list of steps.
+ steps[i] = c.getName();
+ }
+ if (c instanceof JComponent) {
+ // assume Swing components
+ JComponent jc = (JComponent) c;
+ // Step #.
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", i); //NOI18N
+ // Step name (actually the whole list for reference).
+ jc.putClientProperty("WizardPanel_contentData", steps); //NOI18N
+ }
+ }
+ }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..a10edd3
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/Bundle.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+PayaraMicroPanel.microVersionLabel.text=Payara Micro Version:
+PayaraMicroPanel.autoBindHttpCheckBox.text=
+PayaraMicroPanel.autoBindHttpLabel.text=Auto Bind Http:
+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
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
new file mode 100644
index 0000000..d3f96f9
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/MicroProjectWizardIterator.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project.ui;
+
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.ARCHETYPE_ARTIFACT_ID;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.ARCHETYPE_GROUP_ID;
+import org.netbeans.modules.fish.payara.micro.project.VersionRepository;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.api.templates.TemplateRegistration;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROJECT_ICON;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROJECT_TYPE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_ARTIFACT_ID;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_AUTO_BIND_HTTP;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_GROUP_ID;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_JAVA_EE_VERSION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_PACKAGE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_PAYARA_MICRO_VERSION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_VERSION;
+import static org.netbeans.modules.fish.payara.micro.plugin.MicroPluginWizardDescriptor.updateMicroMavenPlugin;
+import org.netbeans.modules.maven.api.archetype.Archetype;
+import org.netbeans.modules.maven.api.archetype.ArchetypeWizards;
+import org.netbeans.modules.maven.api.archetype.ProjectInfo;
+import org.netbeans.modules.maven.j2ee.utils.MavenProjectSupport;
+import org.netbeans.validation.api.ui.ValidationGroup;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle.Messages;
+import static org.openide.util.NbBundle.getMessage;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+@TemplateRegistration(
+ folder = ArchetypeWizards.TEMPLATE_FOLDER,
+ position = 200,
+ displayName = "#TTL_NewProjectWizard",
+ iconBase = PROJECT_ICON,
+ description = "../resources/PayaraMicroProjectDescription.html"
+)
+public final class MicroProjectWizardIterator extends BaseWizardIterator {
+
+ @Override
+ public Set<FileObject> instantiate() throws IOException {
+ ProjectInfo projectInfo = new ProjectInfo(
+ (String) descriptor.getProperty(PROP_GROUP_ID),
+ (String) descriptor.getProperty(PROP_ARTIFACT_ID),
+ (String) descriptor.getProperty(PROP_VERSION),
+ (String) descriptor.getProperty(PROP_PACKAGE)
+ );
+ String payaraMicroVersion = (String) descriptor.getProperty(PROP_PAYARA_MICRO_VERSION);
+ String autoBindHttp = (String) descriptor.getProperty(PROP_AUTO_BIND_HTTP);
+ 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);
+
+ ArchetypeWizards.logUsage(archetype.getGroupId(), archetype.getArtifactId(), archetype.getVersion());
+
+ File rootFile = FileUtil.normalizeFile((File) descriptor.getProperty("projdir")); // NOI18N
+ ArchetypeWizards.createFromArchetype(rootFile, projectInfo, archetype, properties, true);
+
+ Set<FileObject> projects = ArchetypeWizards.openProjects(rootFile, rootFile);
+ for (FileObject projectFile : projects) {
+ Project project = ProjectManager.getDefault().findProject(projectFile);
+ if (project == null) {
+ continue;
+ }
+ MavenProjectSupport.changeServer(project, true);
+ updateMicroMavenPlugin(project, payaraMicroVersion, autoBindHttp);
+ }
+
+ return projects;
+ }
+
+ private Archetype createMojoArchetype() {
+ Archetype archetype = new Archetype();
+ archetype.setGroupId(ARCHETYPE_GROUP_ID);
+ archetype.setArtifactId(ARCHETYPE_ARTIFACT_ID);
+ // latest version of archetype automatically fetched from remote catalog
+ return archetype;
+ }
+
+ @Override
+ public void initialize(WizardDescriptor wiz) {
+ super.initialize(wiz);
+ wiz.putProperty("NewProjectWizard_Title", getMessage(MicroProjectWizardIterator.class, "TTL_NewProjectWizard"));
+ }
+
+ @Override
+ protected WizardDescriptor.Panel[] createPanels(ValidationGroup vg) {
+ return new WizardDescriptor.Panel[]{
+ ArchetypeWizards.basicWizardPanel(vg, false, null),
+ new PayaraMicroDescriptor(PROJECT_TYPE)
+ };
+ }
+}
diff --git a/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroDescriptor.java b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroDescriptor.java
new file mode 100644
index 0000000..3864be6
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroDescriptor.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project.ui;
+
+import java.awt.Component;
+import javax.swing.event.ChangeListener;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule.Type;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+public class PayaraMicroDescriptor implements WizardDescriptor.FinishablePanel<WizardDescriptor> {
+
+ private final PayaraMicroPanel panel;
+
+ public PayaraMicroDescriptor(Type projectType) {
+ panel = new PayaraMicroPanel(projectType);
+ }
+
+ @Override
+ public Component getComponent() {
+ return panel;
+ }
+
+ @Override
+ public void readSettings(WizardDescriptor wizardDescriptor) {
+ panel.readSettings(wizardDescriptor);
+ }
+
+ @Override
+ public void storeSettings(WizardDescriptor wizardDescriptor) {
+ panel.storeSettings(wizardDescriptor);
+ }
+
+ @Override
+ public boolean isFinishPanel() {
+ return true;
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public HelpCtx getHelp() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ }
+
+}
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
new file mode 100644
index 0000000..1138649
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.form
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ 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"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <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"/>
+ </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"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="microVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="microVersionCombobox" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <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"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JComboBox" name="microVersionCombobox">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new DefaultComboBoxModel(VersionRepository.getInstance().getMicroVersion().toArray())" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="microVersionLabel">
+ <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.microVersionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="autoBindHttpLabel">
+ <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.autoBindHttpLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </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="TLTP_AUTO_BIND_HTTP" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="autoBindHttpCheckBox">
+ <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.autoBindHttpCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </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="TLTP_AUTO_BIND_HTTP" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </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
new file mode 100644
index 0000000..97049f1
--- /dev/null
+++ b/enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/ui/PayaraMicroPanel.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.fish.payara.micro.project.ui;
+
+import org.netbeans.modules.fish.payara.micro.project.VersionRepository;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_AUTO_BIND_HTTP;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROP_PAYARA_MICRO_VERSION;
+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;
+
+/**
+ *
+ * @author Gaurav Gupta <gaurav.gupta@payara.fish>
+ */
+class PayaraMicroPanel extends JPanel {
+
+ PayaraMicroPanel(J2eeModule.Type projectType) {
+ initComponents();
+ getAccessibleContext().setAccessibleDescription(getName());
+ }
+
+ @Override
+ public String getName() {
+ return getMessage(PayaraMicroPanel.class, "LBL_MavenProjectSettings");
+ }
+
+ void readSettings(WizardDescriptor descriptor) {
+ String microVersionText = (String) descriptor.getProperty(PROP_PAYARA_MICRO_VERSION);
+ if (microVersionText != null) {
+ VersionRepository.toMicroVersion(microVersionText)
+ .ifPresent(microVersion -> microVersionCombobox.setSelectedItem(microVersion));
+ }
+
+ String autoBindHTTP = (String)descriptor.getProperty(PROP_AUTO_BIND_HTTP);
+ if(autoBindHTTP == null){
+ autoBindHTTP = Boolean.TRUE.toString();
+ }
+ autoBindHttpCheckBox.setSelected(Boolean.valueOf(autoBindHTTP));
+ }
+
+ void storeSettings(WizardDescriptor descriptor) {
+ descriptor.putProperty(PROP_PAYARA_MICRO_VERSION, ((MicroVersion)microVersionCombobox.getSelectedItem()).getVersion());
+ descriptor.putProperty(PROP_AUTO_BIND_HTTP, String.valueOf(autoBindHttpCheckBox.isSelected()));
+ }
+
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ microVersionCombobox = new javax.swing.JComboBox();
+ microVersionLabel = new javax.swing.JLabel();
+ autoBindHttpLabel = new javax.swing.JLabel();
+ autoBindHttpCheckBox = new javax.swing.JCheckBox();
+
+ microVersionCombobox.setModel(new DefaultComboBoxModel(VersionRepository.getInstance().getMicroVersion().toArray()));
+
+ org.openide.awt.Mnemonics.setLocalizedText(microVersionLabel, org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class, "PayaraMicroPanel.microVersionLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(autoBindHttpLabel, org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class, "PayaraMicroPanel.autoBindHttpLabel.text")); // NOI18N
+ autoBindHttpLabel.setToolTipText(org.openide.util.NbBundle.getMessage(PayaraMicroPanel.class, "TLTP_AUTO_BIND_HTTP")); // NOI18N
+
+ 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
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(microVersionLabel)
+ .addComponent(autoBindHttpLabel))
+ .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))))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(microVersionLabel)
+ .addComponent(microVersionCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(autoBindHttpCheckBox)
+ .addComponent(autoBindHttpLabel))
+ .addContainerGap(255, 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.JComboBox microVersionCombobox;
+ private javax.swing.JLabel microVersionLabel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/enterprise/payara.tooling/build.xml b/enterprise/payara.tooling/build.xml
new file mode 100644
index 0000000..65d2155
--- /dev/null
+++ b/enterprise/payara.tooling/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project basedir="." default="build" name="enterprise/payara.tooling">
+ <description>Builds, tests, and runs the project org.netbeans.modules.payara.tooling</description>
+ <import file="../../nbbuild/templates/projectized.xml"/>
+</project>
\ No newline at end of file
diff --git a/enterprise/payara.tooling/licenseinfo.xml b/enterprise/payara.tooling/licenseinfo.xml
new file mode 100644
index 0000000..e802d34
--- /dev/null
+++ b/enterprise/payara.tooling/licenseinfo.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<licenseinfo>
+ <fileset>
+ <file>test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.json</file>
+ <file>test/unit/src/org/netbeans/modules/payara/tooling/admin/response/location.json</file>
+ <license ref="Apache-2.0-ASF" />
+ <comment type="COMMENT_UNSUPPORTED" />
+ </fileset>
+</licenseinfo>
diff --git a/enterprise/payara.tooling/manifest.mf b/enterprise/payara.tooling/manifest.mf
new file mode 100644
index 0000000..fb66eaf
--- /dev/null
+++ b/enterprise/payara.tooling/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.payara.tooling/0
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/payara/tooling/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/enterprise/payara.tooling/nbproject/org-netbeans-modules-payara-tooling.sig b/enterprise/payara.tooling/nbproject/org-netbeans-modules-payara-tooling.sig
new file mode 100644
index 0000000..ee1e0f6
--- /dev/null
+++ b/enterprise/payara.tooling/nbproject/org-netbeans-modules-payara-tooling.sig
@@ -0,0 +1,2449 @@
+#Signature file v4.1
+#Version 1.10.1
+
+CLSS public abstract interface java.io.Closeable
+intf java.lang.AutoCloseable
+meth public abstract void close() throws java.io.IOException
+
+CLSS public abstract interface java.io.FileFilter
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract boolean accept(java.io.File)
+
+CLSS public abstract interface java.io.Serializable
+
+CLSS public abstract interface java.lang.AutoCloseable
+meth public abstract void close() throws java.lang.Exception
+
+CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object>
+meth public abstract int compareTo({java.lang.Comparable%0})
+
+CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
+cons protected init(java.lang.String,int)
+intf java.io.Serializable
+intf java.lang.Comparable<{java.lang.Enum%0}>
+meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected final void finalize()
+meth public final boolean equals(java.lang.Object)
+meth public final int compareTo({java.lang.Enum%0})
+meth public final int hashCode()
+meth public final int ordinal()
+meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
+meth public final java.lang.String name()
+meth public java.lang.String toString()
+meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
+supr java.lang.Object
+hfds name,ordinal
+
+CLSS public java.lang.Exception
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Throwable
+hfds serialVersionUID
+
+CLSS public abstract interface !annotation java.lang.FunctionalInterface
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public java.lang.Object
+cons public init()
+meth protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
+meth protected void finalize() throws java.lang.Throwable
+meth public boolean equals(java.lang.Object)
+meth public final java.lang.Class<?> getClass()
+meth public final void notify()
+meth public final void notifyAll()
+meth public final void wait() throws java.lang.InterruptedException
+meth public final void wait(long) throws java.lang.InterruptedException
+meth public final void wait(long,int) throws java.lang.InterruptedException
+meth public int hashCode()
+meth public java.lang.String toString()
+
+CLSS public java.lang.RuntimeException
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+supr java.lang.Exception
+hfds serialVersionUID
+
+CLSS public java.lang.Throwable
+cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+cons public init(java.lang.Throwable)
+intf java.io.Serializable
+meth public final java.lang.Throwable[] getSuppressed()
+meth public final void addSuppressed(java.lang.Throwable)
+meth public java.lang.StackTraceElement[] getStackTrace()
+meth public java.lang.String getLocalizedMessage()
+meth public java.lang.String getMessage()
+meth public java.lang.String toString()
+meth public java.lang.Throwable fillInStackTrace()
+meth public java.lang.Throwable getCause()
+meth public java.lang.Throwable initCause(java.lang.Throwable)
+meth public void printStackTrace()
+meth public void printStackTrace(java.io.PrintStream)
+meth public void printStackTrace(java.io.PrintWriter)
+meth public void setStackTrace(java.lang.StackTraceElement[])
+supr java.lang.Object
+hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
+hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter
+
+CLSS public abstract interface java.lang.annotation.Annotation
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int hashCode()
+meth public abstract java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
+meth public abstract java.lang.String toString()
+
+CLSS public abstract interface !annotation java.lang.annotation.Documented
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+
+CLSS public abstract interface !annotation java.lang.annotation.Retention
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.RetentionPolicy value()
+
+CLSS public abstract interface !annotation java.lang.annotation.Target
+ anno 0 java.lang.annotation.Documented()
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[ANNOTATION_TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract java.lang.annotation.ElementType[] value()
+
+CLSS public abstract interface java.util.Comparator<%0 extends java.lang.Object>
+ anno 0 java.lang.FunctionalInterface()
+meth public <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.function.Function<? super {java.util.Comparator%0},? extends {%%0}>)
+meth public <%0 extends java.lang.Object> java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.function.Function<? super {java.util.Comparator%0},? extends {%%0}>,java.util.Comparator<? super {%%0}>)
+meth public abstract boolean equals(java.lang.Object)
+meth public abstract int compare({java.util.Comparator%0},{java.util.Comparator%0})
+meth public java.util.Comparator<{java.util.Comparator%0}> reversed()
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparing(java.util.Comparator<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingDouble(java.util.function.ToDoubleFunction<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingInt(java.util.function.ToIntFunction<? super {java.util.Comparator%0}>)
+meth public java.util.Comparator<{java.util.Comparator%0}> thenComparingLong(java.util.function.ToLongFunction<? super {java.util.Comparator%0}>)
+meth public static <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{%%0}> naturalOrder()
+meth public static <%0 extends java.lang.Comparable<? super {%%0}>> java.util.Comparator<{%%0}> reverseOrder()
+meth public static <%0 extends java.lang.Object, %1 extends java.lang.Comparable<? super {%%1}>> java.util.Comparator<{%%0}> comparing(java.util.function.Function<? super {%%0},? extends {%%1}>)
+meth public static <%0 extends java.lang.Object, %1 extends java.lang.Object> java.util.Comparator<{%%0}> comparing(java.util.function.Function<? super {%%0},? extends {%%1}>,java.util.Comparator<? super {%%1}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingDouble(java.util.function.ToDoubleFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingInt(java.util.function.ToIntFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> comparingLong(java.util.function.ToLongFunction<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> nullsFirst(java.util.Comparator<? super {%%0}>)
+meth public static <%0 extends java.lang.Object> java.util.Comparator<{%%0}> nullsLast(java.util.Comparator<? super {%%0}>)
+
+CLSS public abstract interface java.util.concurrent.Callable<%0 extends java.lang.Object>
+ anno 0 java.lang.FunctionalInterface()
+meth public abstract {java.util.concurrent.Callable%0} call() throws java.lang.Exception
+
+CLSS public org.netbeans.modules.payara.tooling.PayaraIdeException
+cons public !varargs init(java.lang.String,java.lang.Object[])
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+supr java.lang.RuntimeException
+hfds LOGGER
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.PayaraStatus
+fld public final static int length
+fld public final static org.netbeans.modules.payara.tooling.PayaraStatus OFFLINE
+fld public final static org.netbeans.modules.payara.tooling.PayaraStatus ONLINE
+fld public final static org.netbeans.modules.payara.tooling.PayaraStatus SHUTDOWN
+fld public final static org.netbeans.modules.payara.tooling.PayaraStatus STARTUP
+fld public final static org.netbeans.modules.payara.tooling.PayaraStatus UNKNOWN
+meth public !varargs static boolean add(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener,boolean,org.netbeans.modules.payara.tooling.PayaraStatus[])
+meth public !varargs static boolean addChangeListener(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener,org.netbeans.modules.payara.tooling.PayaraStatus[])
+meth public !varargs static boolean addListener(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener,boolean,org.netbeans.modules.payara.tooling.PayaraStatus[])
+meth public !varargs static boolean start(org.netbeans.modules.payara.tooling.data.PayaraServer,boolean,org.netbeans.modules.payara.tooling.PayaraStatusListener,org.netbeans.modules.payara.tooling.PayaraStatus[])
+meth public java.lang.String toString()
+meth public static boolean add(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean addCheckListener(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener)
+meth public static boolean addErrorListener(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener)
+meth public static boolean remove(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean removeListener(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener)
+meth public static boolean shutdown(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean start(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean suspend(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.PayaraStatus getStatus(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.PayaraStatus getStatus(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener)
+meth public static org.netbeans.modules.payara.tooling.PayaraStatus toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.PayaraStatus valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.PayaraStatus[] values()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraServerStatus get(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraServerStatus get(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatusListener)
+meth public static void initScheduler(java.util.concurrent.ScheduledThreadPoolExecutor)
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.PayaraStatus>
+hfds LOGGER,OFFLINE_STR,ONLINE_STR,SHUTDOWN_STR,STARTUP_STR,UNKNOWN_STR,stringValuesMap
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.PayaraStatusListener
+meth public abstract void added()
+meth public abstract void currentState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void error(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void newState(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.PayaraStatus,org.netbeans.modules.payara.tooling.data.PayaraStatusTask)
+meth public abstract void removed()
+
+CLSS public org.netbeans.modules.payara.tooling.PayaraToolsConfig
+cons public init()
+meth public static boolean getProxyForLoopback()
+meth public static void noProxyForLoopback()
+meth public static void useProxyForLoopback()
+supr java.lang.Object
+hfds LOGGER,proxyForLoopback
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.TaskEvent
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent AUTH_FAILED
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent AUTH_FAILED_HTTP
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent BAD_GATEWAY
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent CMD_COMPLETED
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent CMD_EXCEPTION
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent CMD_FAILED
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent CMD_RUNNING
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent EMPTY_MESSAGE
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent EXCEPTION
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent ILLEGAL_STATE
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent JAVA_VM_EXEC_FAILED
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent NO_JAVA_VM
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent PROCESS_NOT_EXISTS
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent PROCESS_NOT_RUNNING
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent START
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent SUBMIT
+fld public final static org.netbeans.modules.payara.tooling.TaskEvent WRONG_JAVA_VM
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.TaskEvent toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.TaskEvent valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.TaskEvent[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.TaskEvent>
+hfds AUTH_FAILED_HTTP_STR,AUTH_FAILED_STR,BAD_GATEWAY_STR,CMD_COMPLETED_STR,CMD_EXCEPTION_STR,CMD_FAILED_STR,CMD_RUNNING_STR,EMPTY_MESSAGE_STR,EXCEPTION_STR,ILLEGAL_STATE_STR,JAVA_VM_EXEC_FAILED_STR,NO_JAVA_VM_STR,PROCESS_NOT_EXISTS_STR,PROCESS_NOT_RUNNING_STR,START_STR,SUBMIT_STR,WRONG_JAVA_VM_STR,stringValuesMap
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.TaskState
+fld public final static org.netbeans.modules.payara.tooling.TaskState COMPLETED
+fld public final static org.netbeans.modules.payara.tooling.TaskState FAILED
+fld public final static org.netbeans.modules.payara.tooling.TaskState READY
+fld public final static org.netbeans.modules.payara.tooling.TaskState RUNNING
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.TaskState toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.TaskState valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.TaskState[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.TaskState>
+hfds COMPLETED_STR,FAILED_STR,READY_STR,RUNNING_STR,stringValuesMap
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.TaskStateListener
+meth public abstract !varargs void operationStateChanged(org.netbeans.modules.payara.tooling.TaskState,org.netbeans.modules.payara.tooling.TaskEvent,java.lang.String[])
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.admin.ActionReport
+innr public final static !enum ExitCode
+meth public abstract java.lang.String getCommand()
+meth public abstract java.lang.String getMessage()
+meth public abstract org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode getExitCode()
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode
+ outer org.netbeans.modules.payara.tooling.admin.ActionReport
+fld public final static org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode FAILURE
+fld public final static org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode SUCCESS
+fld public final static org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode WARNING
+meth public static org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.ActionReport$ExitCode>
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.AdminFactory
+cons public init()
+meth public abstract org.netbeans.modules.payara.tooling.admin.Runner getRunner(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth public static org.netbeans.modules.payara.tooling.admin.AdminFactory getInstance(org.netbeans.modules.payara.tooling.data.PayaraAdminInterface)
+supr java.lang.Object
+hfds LOGGER
+
+CLSS public org.netbeans.modules.payara.tooling.admin.AdminFactoryHttp
+cons public init()
+meth public org.netbeans.modules.payara.tooling.admin.Runner getRunner(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.AdminFactory
+hfds instance
+
+CLSS public org.netbeans.modules.payara.tooling.admin.AdminFactoryRest
+cons public init()
+meth public org.netbeans.modules.payara.tooling.admin.Runner getRunner(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.AdminFactory
+hfds instance
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.Command
+cons protected init(java.lang.String)
+fld protected boolean retry
+fld protected java.lang.String command
+meth public boolean retry()
+meth public java.lang.String getCommand()
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandAddResources
+cons public init(java.io.File,java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString addResource(org.netbeans.modules.payara.tooling.data.PayaraServer,java.io.File,java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString addResource(org.netbeans.modules.payara.tooling.data.PayaraServer,java.io.File,java.lang.String,long)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,LOGGER,xmlResFile
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandChangeAdminPassword
+cons public init(java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandJava
+hfds COMMAND,password
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateAdminObject
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,boolean)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,enabled,jndiName,properties,raName,resType
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateCluster
+cons public init(java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateConnector
+cons public init(java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+cons public init(java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,boolean)
+cons public init(java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,boolean,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,enabled,jndiName,poolName,properties
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateConnectorConnectionPool
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,connectionDefinition,poolName,properties,raName
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateInstance
+cons public init(java.lang.String,java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND,node
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateJDBCConnectionPool
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString createJDBCConnectionPool(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString createJDBCConnectionPool(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,long)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,ERROR_MESSAGE,connectionPoolId,dataSourceClassName,properties,resType
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandCreateJDBCResource
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString createJDBCResource(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString createJDBCResource(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,long)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,ERROR_MESSAGE,connectionPoolId,jndiName,properties,target
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandDeleteCluster
+cons public init(java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandDeleteInstance
+cons public init(java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandDeleteResource
+cons public init(java.lang.String,java.lang.String,java.lang.String,boolean)
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND_PREFIX,cascade,cmdPropertyName,name
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandDeploy
+cons public init(java.lang.String,java.lang.String,java.io.File,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,java.io.File[])
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString deploy(org.netbeans.modules.payara.tooling.data.PayaraServer,java.io.File,org.netbeans.modules.payara.tooling.TaskStateListener)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND,ERROR_MESSAGE,contextRoot,dirDeploy,libraries,path,properties
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandDisable
+cons public init(java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandEnable
+cons public init(java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandException
+cons public !varargs init(java.lang.String,java.lang.Object[])
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+fld public final static java.lang.String INVALID_BOOLEAN_CONSTANT = "Invalid String representing boolean constant."
+fld public final static java.lang.String MANIFEST_INVALID_COMPONENT_ITEM = "Invalid component item"
+supr org.netbeans.modules.payara.tooling.PayaraIdeException
+hfds HTTP_RESP_IO_EXCEPTION,HTTP_RESP_UNS_ENC_EXCEPTION,ILLEGAL_COMAND_INSTANCE,ILLEGAL_NULL_VALUE,RUNNER_HTTP_HEADERS,RUNNER_HTTP_URL,RUNNER_INIT,UNKNOWN_ADMIN_INTERFACE,UNKNOWN_VERSION,UNSUPPORTED_OPERATION,UNSUPPORTED_VERSION
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandFetchLogData
+cons public init()
+cons public init(java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,paramsAppendNext
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandGetProperty
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String> getProperties(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String> getProperties(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,long)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,LOGGER,propertyPattern
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.CommandJava
+cons public init(java.lang.String,java.lang.String)
+meth public java.lang.String getJavaHome()
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds javaHome
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.CommandJavaClassPath
+cons public init(java.lang.String,java.lang.String,java.lang.String)
+meth public java.lang.String getClassPath()
+supr org.netbeans.modules.payara.tooling.admin.CommandJava
+hfds classPath
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandListComponents
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.util.List<java.lang.String>> listComponents(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandListResources
+cons public init(java.lang.String,java.lang.String)
+meth public static java.lang.String command(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultList<java.lang.String> listResources(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND_PREFIX,COMMAND_SUFFIX,LOGGER
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandListWebServices
+cons public init()
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandLocation
+cons public init()
+fld public final static java.lang.String BASIC_ROOT_RESULT_KEY = "Base-Root_value"
+fld public final static java.lang.String DOMAIN_ROOT_RESULT_KEY = "Domain-Root_value"
+meth public static boolean verifyResult(org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String>,org.netbeans.modules.payara.tooling.data.PayaraServer)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandRedeploy
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.util.Map<java.lang.String,java.lang.String>,java.io.File[],boolean)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND,contextRoot,keepState,libraries,properties
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandRestartDAS
+cons public init(boolean)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString restartDAS(org.netbeans.modules.payara.tooling.data.PayaraServer,boolean)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,ERROR_MESSAGE,debug
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandRestoreDomain
+cons public init(java.lang.String,java.io.File)
+supr org.netbeans.modules.payara.tooling.admin.CommandJava
+hfds COMMAND,domainBackup
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandSetProperty
+cons public init(java.lang.String,java.lang.String)
+cons public init(java.lang.String,java.lang.String,java.lang.String)
+meth public java.lang.String getProperty()
+meth public java.lang.String getValue()
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString setProperty(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.CommandSetProperty)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString setProperty(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.CommandSetProperty,long)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,ERROR_MESSAGE_MIDDLE,ERROR_MESSAGE_PREFIX,format,property,value
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStartCluster
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString startCluster(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStartDAS
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandJavaClassPath
+hfds COMMAND,domainDir,payaraArgs,javaOpts
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStartInstance
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString startInstance(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStopCluster
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString stopCluster(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStopDAS
+cons public init()
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString stopDAS(org.netbeans.modules.payara.tooling.data.PayaraServer)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandStopInstance
+cons public init(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString stopInstance(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds COMMAND,ERROR_MESSAGE
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.CommandTarget
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds target
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.CommandTargetName
+supr org.netbeans.modules.payara.tooling.admin.CommandTarget
+hfds name
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandUndeploy
+cons public init(java.lang.String,java.lang.String)
+supr org.netbeans.modules.payara.tooling.admin.CommandTargetName
+hfds COMMAND
+
+CLSS public org.netbeans.modules.payara.tooling.admin.CommandVersion
+cons public init()
+meth public static boolean verifyResult(org.netbeans.modules.payara.tooling.admin.ResultString,org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString getVersion(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraVersion getPayaraVersion(org.netbeans.modules.payara.tooling.data.PayaraServer)
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds COMMAND,LOGGER
+
+CLSS public org.netbeans.modules.payara.tooling.admin.MessagePart
+cons public init()
+meth public java.lang.String getMessage()
+meth public java.util.List<org.netbeans.modules.payara.tooling.admin.MessagePart> getChildren()
+meth public java.util.Properties getProps()
+supr java.lang.Object
+hfds children,message,props
+
+CLSS public org.netbeans.modules.payara.tooling.admin.PasswordFile
+fld public final static java.lang.String PASSWORD_FILE_NAME = "password-file"
+meth public boolean write()
+meth public java.lang.String getAdminNewPassword()
+meth public java.lang.String getAdminPassword()
+meth public java.lang.String getFilePath()
+meth public java.lang.String getMasterPassword()
+meth public static java.nio.file.Path buildPasswordFilePath(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public void setAdminNewPassword(java.lang.String)
+meth public void setAdminPassword(java.lang.String)
+meth public void setMasterPassword(java.lang.String)
+supr java.lang.Object
+hfds ASSIGN_VALUE,AS_ADMIN_MASTERPASSWORD,AS_ADMIN_NEWPASSWORD,AS_ADMIN_PASSWORD,CREATE_FILE_PERMISSIONS,FINAL_FILE_PERMISSIONS,LOGGER,adminNewPassword,adminPassword,file,masterPassword
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ProcessIOContent
+cons public init()
+cons public init(java.lang.String)
+innr protected abstract static Token
+innr protected static InputToken
+innr protected static OutputToken
+innr protected static TreeNode
+meth public java.lang.String getCurrentPrompt()
+meth public java.lang.String getPrompt()
+meth public org.netbeans.modules.payara.tooling.admin.ProcessIOContent$Token firstToken()
+meth public org.netbeans.modules.payara.tooling.admin.ProcessIOContent$Token nextToken()
+meth public void addInput(java.lang.String,java.lang.String)
+meth public void addInput(java.lang.String,java.lang.String,java.lang.String)
+meth public void addInput(java.lang.String,java.lang.String[],java.lang.String)
+meth public void addInput(java.lang.String[],java.lang.String)
+meth public void addOutput(java.lang.String[])
+meth public void addOutput(java.lang.String[],java.lang.String[])
+supr java.lang.Object
+hfds LOGGER,prompt,tokens
+
+CLSS protected static org.netbeans.modules.payara.tooling.admin.ProcessIOContent$InputToken
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOContent
+cons protected init(java.lang.String,java.lang.String[],java.lang.String)
+meth protected java.lang.String getPrompt()
+supr org.netbeans.modules.payara.tooling.admin.ProcessIOContent$Token
+hfds prompt
+
+CLSS protected static org.netbeans.modules.payara.tooling.admin.ProcessIOContent$OutputToken
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOContent
+cons protected init(java.lang.String[],java.lang.String[])
+supr org.netbeans.modules.payara.tooling.admin.ProcessIOContent$Token
+
+CLSS protected abstract static org.netbeans.modules.payara.tooling.admin.ProcessIOContent$Token
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOContent
+cons protected init(java.lang.String[],java.lang.String[])
+meth protected boolean isSuccess()
+meth protected boolean[] getMatchError()
+meth protected int getMaxLen()
+meth protected java.lang.String getPrompt()
+meth protected org.netbeans.modules.payara.tooling.admin.ProcessIOResult match(java.lang.CharSequence,int)
+meth protected org.netbeans.modules.payara.tooling.utils.StringPrefixTree<org.netbeans.modules.payara.tooling.admin.ProcessIOContent$TreeNode> getOutputStrings()
+supr java.lang.Object
+hfds matchError,matchSuccess,maxLen,outputStrings
+
+CLSS protected static org.netbeans.modules.payara.tooling.admin.ProcessIOContent$TreeNode
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOContent
+supr java.lang.Object
+hfds index,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ProcessIOParser
+cons public init(java.io.Writer,java.io.Reader,org.netbeans.modules.payara.tooling.admin.ProcessIOContent)
+innr protected static Parser
+meth public java.lang.String getOutput()
+meth public org.netbeans.modules.payara.tooling.admin.ProcessIOResult verify() throws java.io.IOException
+supr java.lang.Object
+hfds BUFF_SIZE,LOGGER,outBuff,outLen,outParser,stdIn,stdOut,verifydone
+
+CLSS protected static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOParser
+cons protected init(org.netbeans.modules.payara.tooling.admin.ProcessIOContent)
+innr protected final static !enum Input
+innr protected final static !enum State
+meth protected java.lang.String getOutputString()
+meth protected org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State action(char)
+meth protected org.netbeans.modules.payara.tooling.admin.ProcessIOResult result()
+meth protected void endOfLine(char)
+meth protected void finish()
+meth protected void firstChar(char)
+meth protected void nextChar(char)
+meth protected void nextCharWithCR(char)
+meth protected void parse(char[],short)
+supr java.lang.Object
+hfds content,line,output,promptBuff,promptLen,result,state,token
+
+CLSS protected final static !enum org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser
+fld protected final static int length
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input CR
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input LF
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input PROMPT
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input STRING
+meth protected static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input value(char,java.lang.String,org.netbeans.modules.payara.tooling.utils.CyclicStringBuffer)
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input>
+
+CLSS protected final static !enum org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State
+ outer org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser
+fld protected final static int length
+fld protected final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State[][] transition
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State CR
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State ERROR
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State LINE
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State START
+meth protected static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State next(org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State,org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$Input)
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.ProcessIOParser$Parser$State>
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.admin.ProcessIOResult
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOResult ERROR
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOResult SUCCESS
+fld public final static org.netbeans.modules.payara.tooling.admin.ProcessIOResult UNKNOWN
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOResult valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.ProcessIOResult[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.ProcessIOResult>
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.Result<%0 extends java.lang.Object>
+meth public abstract {org.netbeans.modules.payara.tooling.admin.Result%0} getValue()
+meth public boolean isAuth()
+meth public org.netbeans.modules.payara.tooling.TaskState getState()
+meth public void setAuth(boolean)
+supr java.lang.Object
+hfds auth,state
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ResultList<%0 extends java.lang.Object>
+meth public java.util.List<{org.netbeans.modules.payara.tooling.admin.ResultList%0}> getValue()
+supr org.netbeans.modules.payara.tooling.admin.Result<java.util.List<{org.netbeans.modules.payara.tooling.admin.ResultList%0}>>
+hfds value
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ResultLog
+meth public org.netbeans.modules.payara.tooling.admin.ValueLog getValue()
+supr org.netbeans.modules.payara.tooling.admin.Result<org.netbeans.modules.payara.tooling.admin.ValueLog>
+hfds value
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ResultMap<%0 extends java.lang.Object, %1 extends java.lang.Object>
+meth public java.util.Map<{org.netbeans.modules.payara.tooling.admin.ResultMap%0},{org.netbeans.modules.payara.tooling.admin.ResultMap%1}> getValue()
+supr org.netbeans.modules.payara.tooling.admin.Result<java.util.Map<{org.netbeans.modules.payara.tooling.admin.ResultMap%0},{org.netbeans.modules.payara.tooling.admin.ResultMap%1}>>
+hfds value
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ResultProcess
+meth public org.netbeans.modules.payara.tooling.admin.ValueProcess getValue()
+supr org.netbeans.modules.payara.tooling.admin.Result<org.netbeans.modules.payara.tooling.admin.ValueProcess>
+hfds value
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ResultString
+meth public java.lang.String getValue()
+supr org.netbeans.modules.payara.tooling.admin.Result<java.lang.String>
+hfds value
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.Runner
+fld protected boolean silentFailureAllowed
+fld protected java.lang.String path
+fld protected org.netbeans.modules.payara.tooling.TaskStateListener[] stateListeners
+fld protected org.netbeans.modules.payara.tooling.data.PayaraServer server
+fld public final static int HTTP_CONNECTION_TIMEOUT = 3000
+fld public final static int HTTP_RETRY_DELAY = 3000
+innr protected static StateChange
+intf java.util.concurrent.Callable<org.netbeans.modules.payara.tooling.admin.Result>
+meth protected abstract boolean processResponse()
+meth protected abstract boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+meth protected abstract java.lang.String constructCommandUrl()
+meth protected abstract java.lang.String getRequestMethod()
+meth protected abstract org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected abstract void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth protected boolean handleReceive(java.net.HttpURLConnection) throws java.io.IOException
+meth protected boolean isSilentFailureAllowed()
+meth protected void handleSecureConnection(javax.net.ssl.HttpsURLConnection)
+meth protected void prepareHttpConnection(java.net.HttpURLConnection)
+meth public abstract boolean acceptsGzip()
+meth public abstract boolean getDoOutput()
+meth public java.lang.String getContentType()
+meth public org.netbeans.modules.payara.tooling.admin.Result call()
+meth public org.netbeans.modules.payara.tooling.admin.Result getResult()
+meth public static void init(java.net.Authenticator)
+meth public void setReadyState()
+meth public void setSilentFailureAllowed(boolean)
+meth public void setStateListeners(org.netbeans.modules.payara.tooling.TaskStateListener[])
+supr java.lang.Object
+hfds FALSE_VALUE,ITEM_SEPARATOR,LOGGER,PARAM_ASSIGN_VALUE,PARAM_SEPARATOR,QUERY_SEPARATOR,TRUE_VALUE,auth,authenticator,command,conn,executor,hconn,query,result,retry,urlToConnectTo
+
+CLSS protected static org.netbeans.modules.payara.tooling.admin.Runner$StateChange
+ outer org.netbeans.modules.payara.tooling.admin.Runner
+cons protected !varargs init(org.netbeans.modules.payara.tooling.admin.Runner,org.netbeans.modules.payara.tooling.TaskState,org.netbeans.modules.payara.tooling.TaskEvent,java.lang.String[])
+meth protected org.netbeans.modules.payara.tooling.admin.Result handleStateChange()
+supr java.lang.Object
+hfds args,runner,taskEvent,taskState
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.RunnerAsadmin
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,java.lang.String)
+fld protected java.io.Reader stdErr
+fld protected java.io.Reader stdOut
+fld protected java.io.Writer stdIn
+fld protected org.netbeans.modules.payara.tooling.admin.PasswordFile passwordFile
+fld protected org.netbeans.modules.payara.tooling.admin.ProcessIOContent processIO
+fld protected org.netbeans.modules.payara.tooling.admin.ResultString result
+meth protected abstract org.netbeans.modules.payara.tooling.admin.ProcessIOContent createProcessIOContent()
+meth protected boolean processResponse()
+meth protected boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+meth protected java.lang.String constructCommandUrl()
+meth protected java.lang.String getRequestMethod()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth public boolean acceptsGzip()
+meth public boolean getDoOutput()
+meth public org.netbeans.modules.payara.tooling.admin.Result call()
+supr org.netbeans.modules.payara.tooling.admin.Runner
+hfds LOGGER,PASSWORD_FILE_PARAM,USER_PARAM,asadminJar
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerAsadminChangeAdminPassword
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected org.netbeans.modules.payara.tooling.admin.ProcessIOContent createProcessIOContent()
+supr org.netbeans.modules.payara.tooling.admin.RunnerAsadmin
+hfds DOMAINDIR_PARAM,DOMAIN_NAME_PARAM,LOGGER,command
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerAsadminRestoreDomain
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected org.netbeans.modules.payara.tooling.admin.ProcessIOContent createProcessIOContent()
+supr org.netbeans.modules.payara.tooling.admin.RunnerAsadmin
+hfds BACKUP_DIR_PARAM,BACKUP_FILE_PARAM,DOMAIN_DIR_PARAM,FORCE_PARAM,LOGGER,command
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttp
+cons protected init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,java.lang.String,java.lang.String)
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+meth protected java.lang.String constructCommandUrl()
+meth protected java.lang.String getRequestMethod()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth protected void prepareHttpConnection(java.net.HttpURLConnection)
+meth public boolean acceptsGzip()
+meth public boolean getDoOutput()
+meth public java.lang.String getLastModified()
+supr org.netbeans.modules.payara.tooling.admin.Runner
+hfds LIBRARY_SEPARATOR,manifest,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpAddResources
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+
+CLSS public abstract interface !annotation org.netbeans.modules.payara.tooling.admin.RunnerHttpClass
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.Class runner()
+meth public abstract !hasdefault java.lang.String command()
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateAdminObject
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds ENABLED_PARAM,JNDI_NAME_PARAM,PROPERTY_PARAM,RA_NAME_PARAM,RESOURCE_TYPE_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateConnector
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds ENABLED_PARAM,JNDI_NAME_PARAM,POOL_NAME_PARAM,PROPERTY_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateConnectorConnectionPool
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CONNECTION_DEFINITION_PARAM,POOL_NAME_PARAM,PROPERTY_PARAM,RA_NAME_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CLUSTER_PARAM,DEFAULT_PARAM,LOGGER,NODE_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateJDBCConnectionPool
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CONN_POOL_ID_PARAM,DS_CLASS_NAME_PARAM,PROPERTY_PARAM,RESOURCE_TYPE_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpCreateJDBCResource
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CONN_POOL_ID_PARAM,JNDI_NAME_PARAM,PROPERTY_PARAM,TARGET_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpDeleteInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttpTarget
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpDeleteResource
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds DEFAULT_PARAM,LOGGER
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpDeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth public boolean getDoOutput()
+meth public java.io.InputStream getInputStream()
+meth public java.lang.String getContentType()
+meth public java.lang.String getLastModified()
+meth public java.lang.String getRequestMethod()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CTXROOT_PARAM,DEFAULT_PARAM,FORCE_PARAM,FORCE_VALUE,LIBRARIES_PARAM,LOGGER,NAME_PARAM,PROPERTIES_PARAM,TARGET_PARAM,command
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpEnableDisable
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds DEFAULT_PARAM,TARGET_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpGetProperty
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String> createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds LOGGER,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpListComponents
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.util.List<java.lang.String>> createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttpTarget
+hfds result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpListResources
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultList<java.lang.String> createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttpTarget
+hfds result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpListWebServices
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultList<java.lang.String> createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpLocation
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpRedeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds CTXROOT_PARAM,KEEP_STATE_PARAM,LIBRARIES_PARAM,NAME_PARAM,PROPERTIES_PARAM,TARGET_PARAM,command
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpRestartDAS
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds DEBUG_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpSetProperty
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpTarget
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds DEFAULT_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerHttpUndeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+hfds DEFAULT_PARAM,TARGET_PARAM
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerLocal
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+meth protected java.lang.String constructCommandUrl()
+meth protected java.lang.String getRequestMethod()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth public boolean acceptsGzip()
+meth public boolean getDoOutput()
+meth public org.netbeans.modules.payara.tooling.admin.Result call()
+supr org.netbeans.modules.payara.tooling.admin.Runner
+hfds MAIN_CLASS,arguments,command,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRest
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,java.lang.String)
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,java.lang.String,java.lang.String)
+fld protected org.netbeans.modules.payara.tooling.admin.ResultString result
+meth protected boolean isSuccess()
+meth protected boolean processResponse()
+meth protected boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+meth protected java.lang.String constructCommandUrl()
+meth protected java.lang.String getRequestMethod()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected org.netbeans.modules.payara.tooling.admin.response.ResponseContentType getResponseType()
+meth protected void appendIfNotEmpty(java.lang.StringBuilder,java.lang.String,java.lang.String)
+meth protected void appendProperties(java.lang.StringBuilder,java.util.Map<java.lang.String,java.lang.String>,java.lang.String,boolean)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth protected void prepareHttpConnection(java.net.HttpURLConnection)
+meth public boolean acceptsGzip()
+meth public boolean getDoOutput()
+supr org.netbeans.modules.payara.tooling.admin.Runner
+hfds parser,report
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestAddResources
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public abstract interface !annotation org.netbeans.modules.payara.tooling.admin.RunnerRestClass
+ anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME)
+ anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[TYPE])
+intf java.lang.annotation.Annotation
+meth public abstract !hasdefault java.lang.Class runner()
+meth public abstract !hasdefault java.lang.String command()
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateCluster
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected java.lang.String constructCommandUrl()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateConnector
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean isSuccess()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateConnectorPool
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean isSuccess()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateJDBCConnectionPool
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean isSuccess()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestCreateJDBCResource
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean isSuccess()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestDeleteCluster
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestDeleteInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestDeleteResource
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestDeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+meth protected void prepareHttpConnection(java.net.HttpURLConnection)
+meth public java.io.InputStream getInputStream()
+meth public java.lang.String getContentType()
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds NEWLINE,command,multipartBoundary
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestDisable
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestEnable
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestFetchLogData
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected java.lang.String getRequestMethod()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+meth protected org.netbeans.modules.payara.tooling.admin.response.ResponseContentType getResponseType()
+meth public boolean acceptsGzip()
+meth public boolean getDoOutput()
+meth public boolean readResponse(java.io.InputStream,java.net.HttpURLConnection)
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds headerAppendNext,lines,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestGetProperty
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String> createResult()
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds LOGGER,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestList
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.ResultList<java.lang.String> createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestListApplications
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerRestList
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestListResources
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerRestList
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestListWebServices
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerRestList
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestLocation
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected boolean processResponse()
+meth protected org.netbeans.modules.payara.tooling.admin.Result createResult()
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds command,result
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestSetProperty
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestStartCluster
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestStartInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestStopCluster
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestStopDAS
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestStopInstance
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.RunnerRestUndeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ServerAdmin
+cons public init()
+meth public !varargs static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public !varargs static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.data.IdeContext,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public !varargs static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public !varargs static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.data.IdeContext,org.netbeans.modules.payara.tooling.TaskStateListener[])
+meth public static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth public static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.data.IdeContext)
+meth public static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth public static <%0 extends org.netbeans.modules.payara.tooling.admin.Result> java.util.concurrent.Future<{%%0}> exec(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command,org.netbeans.modules.payara.tooling.data.IdeContext)
+meth public static java.util.concurrent.ExecutorService executor(int)
+meth public static void init(java.net.Authenticator)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ValueLog
+meth public java.lang.String getParamsAppendNext()
+meth public java.lang.String toString()
+meth public java.util.List<java.lang.String> getLines()
+supr java.lang.Object
+hfds lines,paramsAppendNext
+
+CLSS public org.netbeans.modules.payara.tooling.admin.ValueProcess
+meth public java.lang.Process getProcess()
+meth public java.lang.String getArguments()
+meth public java.lang.String getProcessName()
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds arguments,process,processName
+
+CLSS public org.netbeans.modules.payara.tooling.admin.cloud.CloudTasks
+cons public init()
+meth public static org.netbeans.modules.payara.tooling.admin.ResultString deploy(org.netbeans.modules.payara.tooling.data.PayaraServer,java.lang.String,java.io.File,org.netbeans.modules.payara.tooling.TaskStateListener)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.admin.cloud.CommandCloud
+meth public java.lang.String getAccount()
+supr org.netbeans.modules.payara.tooling.admin.Command
+hfds account
+
+CLSS public org.netbeans.modules.payara.tooling.admin.cloud.CommandCloudDeploy
+cons public init(java.lang.String,java.io.File)
+supr org.netbeans.modules.payara.tooling.admin.cloud.CommandCloud
+hfds COMMAND,path
+
+CLSS public org.netbeans.modules.payara.tooling.admin.cloud.RunnerHttpCloud
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.cloud.CommandCloud)
+supr org.netbeans.modules.payara.tooling.admin.RunnerHttp
+
+CLSS public org.netbeans.modules.payara.tooling.admin.cloud.RunnerRestCloudDeploy
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.admin.Command)
+meth protected void handleSend(java.net.HttpURLConnection) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.RunnerRest
+hfds NEWLINE,command,multipartBoundary
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.admin.response.ActionReport
+innr public final static !enum ExitCode
+meth public abstract java.lang.String getCommand()
+meth public abstract java.lang.String getMessage()
+meth public abstract org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode getExitCode()
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode
+ outer org.netbeans.modules.payara.tooling.admin.response.ActionReport
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode FAILURE
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode NA
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode SUCCESS
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode WARNING
+meth public static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode>
+
+CLSS public org.netbeans.modules.payara.tooling.admin.response.MessagePart
+cons public init()
+meth public java.lang.String getMessage()
+meth public java.util.List<org.netbeans.modules.payara.tooling.admin.response.MessagePart> getChildren()
+meth public java.util.Properties getProperties()
+meth public void setProperties(java.util.Properties)
+supr java.lang.Object
+hfds children,message,props
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.admin.response.ResponseContentType
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ResponseContentType APPLICATION_JSON
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ResponseContentType APPLICATION_XML
+fld public final static org.netbeans.modules.payara.tooling.admin.response.ResponseContentType TEXT_PLAIN
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.admin.response.ResponseContentType valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.admin.response.ResponseContentType[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.admin.response.ResponseContentType>
+hfds type
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.admin.response.ResponseParser
+meth public abstract org.netbeans.modules.payara.tooling.admin.response.ActionReport parse(java.io.InputStream)
+
+CLSS public org.netbeans.modules.payara.tooling.admin.response.ResponseParserFactory
+cons public init()
+meth public static org.netbeans.modules.payara.tooling.admin.response.RestResponseParser getRestParser(org.netbeans.modules.payara.tooling.admin.response.ResponseContentType)
+supr java.lang.Object
+hfds jsonParser,xmlParser
+
+CLSS public org.netbeans.modules.payara.tooling.admin.response.RestActionReport
+cons public init()
+intf org.netbeans.modules.payara.tooling.admin.response.ActionReport
+meth public boolean isSuccess()
+meth public java.lang.String getCommand()
+meth public java.lang.String getMessage()
+meth public java.util.List<? extends org.netbeans.modules.payara.tooling.admin.response.ActionReport> getSubActionsReport()
+meth public org.netbeans.modules.payara.tooling.admin.response.ActionReport$ExitCode getExitCode()
+meth public org.netbeans.modules.payara.tooling.admin.response.MessagePart getTopMessagePart()
+supr java.lang.Object
+hfds actionDescription,exitCode,subActions,topMessagePart
+
+CLSS public org.netbeans.modules.payara.tooling.admin.response.RestJSONResponseParser
+cons public init()
+meth public org.netbeans.modules.payara.tooling.admin.response.RestActionReport parse(java.io.InputStream)
+meth public static void copy(java.io.InputStream,java.io.OutputStream) throws java.io.IOException
+supr org.netbeans.modules.payara.tooling.admin.response.RestResponseParser
+
+CLSS public abstract org.netbeans.modules.payara.tooling.admin.response.RestResponseParser
+cons public init()
+intf org.netbeans.modules.payara.tooling.admin.response.ResponseParser
+meth public abstract org.netbeans.modules.payara.tooling.admin.response.RestActionReport parse(java.io.InputStream)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.admin.response.RestXMLResponseParser
+cons public init()
+meth public org.netbeans.modules.payara.tooling.admin.response.RestActionReport parse(java.io.InputStream)
+supr org.netbeans.modules.payara.tooling.admin.response.RestResponseParser
+hfds ENTRY,MAP,factory,filter
+hcls RestXMLResponseFilter
+
+CLSS public org.netbeans.modules.payara.tooling.data.DataException
+cons public !varargs init(java.lang.String,java.lang.Object[])
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+fld public final static java.lang.String INVALID_URL = "Invalid Payara URL"
+supr org.netbeans.modules.payara.tooling.PayaraIdeException
+hfds INVALID_ADMIN_INTERFACE,INVALID_CONTAINER,SERVER_HOME_NONEXISTENT,SERVER_HOME_NO_VERSION,SERVER_HOME_NULL,SERVER_ROOT_NONEXISTENT,SERVER_ROOT_NULL,SERVER_URL_NULL
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.data.PayaraAdminInterface
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraAdminInterface HTTP
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraAdminInterface REST
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraAdminInterface toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraAdminInterface valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraAdminInterface[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraAdminInterface>
+hfds HTTP_STR,REST_STR,stringValuesMap
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.PayaraConfig
+meth public abstract java.util.List<org.netbeans.modules.payara.tooling.server.config.LibraryNode> getLibrary()
+meth public abstract org.netbeans.modules.payara.tooling.data.ToolsConfig getTools()
+meth public abstract org.netbeans.modules.payara.tooling.server.config.JavaEESet getJavaEE()
+meth public abstract org.netbeans.modules.payara.tooling.server.config.JavaSESet getJavaSE()
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.data.PayaraContainer
+fld public final static char SEPARATOR = ','
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer APPCLIENT
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer CONNECTOR
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer EAR
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer EJB
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer JRUBY
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer UNKNOWN
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraContainer WEB
+intf java.util.Comparator<org.netbeans.modules.payara.tooling.data.PayaraContainer>
+meth public int compare(org.netbeans.modules.payara.tooling.data.PayaraContainer,org.netbeans.modules.payara.tooling.data.PayaraContainer)
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraContainer toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraContainer valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraContainer[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraContainer>
+hfds APPCLIENT_STR,CONNECTOR_STR,EAR_STR,EJB_STR,JRUBY_STR,UNKNOWN_STR,WEB_STR,stringValuesMap
+
+CLSS public org.netbeans.modules.payara.tooling.data.PayaraJavaEEConfig
+cons public init(org.netbeans.modules.payara.tooling.server.config.JavaEESet,java.io.File)
+meth public java.lang.String getVersion()
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.JavaEEProfile> getProfiles()
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.ModuleType> getModuleTypes()
+supr java.lang.Object
+hfds modules,profiles,version
+
+CLSS public org.netbeans.modules.payara.tooling.data.PayaraJavaSEConfig
+cons public init(org.netbeans.modules.payara.tooling.server.config.JavaSESet)
+meth public java.lang.String getVersion()
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform> getPlatforms()
+supr java.lang.Object
+hfds platforms,version
+
+CLSS public org.netbeans.modules.payara.tooling.data.PayaraLibrary
+cons public init(java.lang.String,java.util.List<java.net.URL>,java.util.List<java.net.URL>,java.util.List<java.lang.String>,java.util.List<java.net.URL>,java.util.List<org.netbeans.modules.payara.tooling.data.PayaraLibrary$Maven>)
+innr public static Maven
+meth public java.lang.String getLibraryID()
+meth public java.lang.String getMavenDeps()
+meth public java.util.List<java.lang.String> getJavadocLookups()
+meth public java.util.List<java.net.URL> getClasspath()
+meth public java.util.List<java.net.URL> getJavadocs()
+meth public java.util.List<java.net.URL> getSources()
+supr java.lang.Object
+hfds classpath,javadocLookups,javadocs,libraryID,maven,sources
+
+CLSS public static org.netbeans.modules.payara.tooling.data.PayaraLibrary$Maven
+ outer org.netbeans.modules.payara.tooling.data.PayaraLibrary
+cons public init(java.lang.String,java.lang.String,java.lang.String)
+supr java.lang.Object
+hfds artifactId,groupId,version
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.PayaraServer
+meth public abstract boolean isRemote()
+meth public abstract int getAdminPort()
+meth public abstract int getPort()
+meth public abstract java.lang.String getAdminPassword()
+meth public abstract java.lang.String getAdminUser()
+meth public abstract java.lang.String getDomainName()
+meth public abstract java.lang.String getDomainsFolder()
+meth public abstract java.lang.String getHost()
+meth public abstract java.lang.String getName()
+meth public abstract java.lang.String getServerHome()
+meth public abstract java.lang.String getServerRoot()
+meth public abstract java.lang.String getUrl()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraAdminInterface getAdminInterface()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraVersion getVersion()
+
+CLSS public org.netbeans.modules.payara.tooling.data.PayaraServerEntity
+cons public init()
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
+intf org.netbeans.modules.payara.tooling.data.PayaraServer
+meth public boolean isRemote()
+meth public int getAdminPort()
+meth public int getPort()
+meth public java.lang.String getAdminPassword()
+meth public java.lang.String getAdminUser()
+meth public java.lang.String getDomainName()
+meth public java.lang.String getDomainsFolder()
+meth public java.lang.String getHost()
+meth public java.lang.String getName()
+meth public java.lang.String getServerHome()
+meth public java.lang.String getServerRoot()
+meth public java.lang.String getUrl()
+meth public org.netbeans.modules.payara.tooling.data.PayaraAdminInterface getAdminInterface()
+meth public org.netbeans.modules.payara.tooling.data.PayaraVersion getVersion()
+meth public void setAdminInterface(org.netbeans.modules.payara.tooling.data.PayaraAdminInterface)
+meth public void setAdminPassword(java.lang.String)
+meth public void setAdminPort(int)
+meth public void setAdminUser(java.lang.String)
+meth public void setDomainName(java.lang.String)
+meth public void setDomainsFolder(java.lang.String)
+meth public void setHost(java.lang.String)
+meth public void setName(java.lang.String)
+meth public void setPort(int)
+meth public void setServerHome(java.lang.String)
+meth public void setServerRoot(java.lang.String)
+meth public void setUrl(java.lang.String)
+meth public void setVersion(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+supr java.lang.Object
+hfds adminInterface,adminPassword,adminPort,adminUser,domainName,domainsFolder,host,name,port,serverHome,serverRoot,url,version
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.PayaraServerStatus
+meth public abstract org.netbeans.modules.payara.tooling.PayaraStatus getStatus()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraServer getServer()
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.data.PayaraStatusCheck
+fld public final static int length
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck LOCATIONS
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck PORT
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck VERSION
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheck[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraStatusCheck>
+hfds LOCATIONS_STR,LOGGER,PORT_STR,VERSION_STR,stringValuesMap
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult FAILED
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult SUCCESS
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult and(org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult and(org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult or(org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult or(org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult,org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult>
+hfds and,or
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.PayaraStatusTask
+meth public abstract org.netbeans.modules.payara.tooling.TaskEvent getEvent()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraStatusCheck getType()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult getStatus()
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.data.PayaraVersion
+fld public final static char SEPARATOR = '.'
+fld public final static int length
+fld public final static java.lang.String SEPARATOR_PATTERN = "\u005c."
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_144
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_151
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_152
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_153
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_154
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_161
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_162
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_163
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_164
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_1_171
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_2_172
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_2_173
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_2_174
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_4_1_2_181
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_181
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_182
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_183
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_184
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_191
+fld public final static org.netbeans.modules.payara.tooling.data.PayaraVersion PF_5_192
+meth public boolean equals(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public boolean equalsMajorMinor(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public java.lang.String toFullString()
+meth public java.lang.String toString()
+meth public short getBuild()
+meth public short getMajor()
+meth public short getMinor()
+meth public short getUpdate()
+meth public static boolean eq(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static boolean ge(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static boolean gt(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static boolean le(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static boolean lt(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static boolean ne(java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>,java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraVersion toValue(java.lang.String)
+ anno 0 org.netbeans.api.annotations.common.CheckForNull()
+ anno 1 org.netbeans.api.annotations.common.NonNull()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraVersion valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.data.PayaraVersion[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.data.PayaraVersion>
+hfds PF_4_1_144_STR,PF_4_1_144_STR_NEXT,PF_4_1_151_STR,PF_4_1_151_STR_NEXT,PF_4_1_152_STR,PF_4_1_152_STR_NEXT,PF_4_1_153_STR,PF_4_1_153_STR_NEXT,PF_4_1_1_154_STR,PF_4_1_1_154_STR_NEXT,PF_4_1_1_161_STR,PF_4_1_1_161_STR_NEXT,PF_4_1_1_162_STR,PF_4_1_1_162_STR_NEXT,PF_4_1_1_163_STR,PF_4_1_1_163_STR_NEXT,PF_4_1_1_164_STR,PF_4_1_1_164_STR_NEXT,PF_4_1_1_171_STR,PF_4_1_1_171_STR_NEXT,PF_4_1_2_172_STR,PF_4_1_2_172_STR_NEXT,PF_4_1_2_173_STR,PF_4_1_2_173_STR_NEXT,PF_4_1_2_174_STR,PF_4_1_2_174_STR_NEXT,PF_4_1_2_181_STR,PF_4_1_2_181_STR_NEXT,PF_5_181_STR,PF_5_181_STR_NEXT,PF_5_182_STR,PF_5_182_STR_NEXT,PF_5_183_STR,PF_5_183_STR_NEXT,PF_5_184_STR,PF_5_184_STR_NEXT,PF_5_191_STR,PF_5_191_STR_NEXT,PF_5_192_STR,PF_5_192_STR_NEXT,build,major,minor,stringValuesMap,update,value
+
+CLSS public org.netbeans.modules.payara.tooling.data.IdeContext
+cons public init()
+supr java.lang.Object
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.StartupArgs
+meth public abstract java.lang.String getJavaHome()
+meth public abstract java.util.List<java.lang.String> getPayaraArgs()
+meth public abstract java.util.List<java.lang.String> getJavaArgs()
+meth public abstract org.netbeans.modules.payara.tooling.data.JDKVersion getJavaVersion()
+meth public abstract java.util.Map<java.lang.String,java.lang.String> getEnvironmentVars()
+
+CLSS public org.netbeans.modules.payara.tooling.data.StartupArgsEntity
+cons public init()
+cons public init(java.util.List<java.lang.String>,java.util.List<java.lang.String>,java.util.Map<java.lang.String,java.lang.String>,java.lang.String)
+intf org.netbeans.modules.payara.tooling.data.StartupArgs
+meth public java.lang.String getJavaHome()
+meth public java.util.List<java.lang.String> getPayaraArgs()
+meth public java.util.List<java.lang.String> getJavaArgs()
+meth public org.netbeans.modules.payara.tooling.data.JDKVersion getJavaVersion()
+meth public java.util.Map<java.lang.String,java.lang.String> getEnvironmentVars()
+meth public void getJavaArgs(java.util.List<java.lang.String>)
+meth public void getJavaHome(java.lang.String)
+meth public void setEnvironmentVars(java.util.Map<java.lang.String,java.lang.String>)
+meth public void setPayaraArgs(java.util.List<java.lang.String>)
+supr java.lang.Object
+hfds environmentVars,payaraArgs,javaArgs,javaHome
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.ToolConfig
+meth public abstract java.lang.String getJar()
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.ToolsConfig
+meth public abstract org.netbeans.modules.payara.tooling.data.ToolConfig getAsadmin()
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.cloud.PayaraAccount
+meth public abstract java.lang.String getAcount()
+meth public abstract java.lang.String getName()
+meth public abstract java.lang.String getUrl()
+meth public abstract java.lang.String getUserName()
+meth public abstract java.lang.String getUserPassword()
+meth public abstract org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud getCloudEntity()
+
+CLSS public org.netbeans.modules.payara.tooling.data.cloud.PayaraAccountEntity
+cons public init()
+cons public init(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud)
+fld protected java.lang.String account
+fld protected java.lang.String name
+fld protected java.lang.String userName
+fld protected java.lang.String userPassword
+fld protected org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud cloudEntity
+intf org.netbeans.modules.payara.tooling.data.cloud.PayaraAccount
+meth public java.lang.String getAcount()
+meth public java.lang.String getName()
+meth public java.lang.String getUrl()
+meth public java.lang.String getUserName()
+meth public java.lang.String getUserPassword()
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud getCloudEntity()
+meth public void setAcount(java.lang.String)
+meth public void setCloudEntity(org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud)
+meth public void setName(java.lang.String)
+meth public void setUrl(java.lang.String)
+meth public void setUserName(java.lang.String)
+meth public void setUserPassword(java.lang.String)
+supr java.lang.Object
+hfds url
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud
+meth public abstract int getPort()
+meth public abstract java.lang.String getHost()
+meth public abstract java.lang.String getName()
+meth public abstract org.netbeans.modules.payara.tooling.data.PayaraServer getLocalServer()
+
+CLSS public org.netbeans.modules.payara.tooling.data.cloud.PayaraCloudEntity
+cons public init()
+cons public init(java.lang.String,java.lang.String,int,org.netbeans.modules.payara.tooling.data.PayaraServer)
+fld protected int port
+fld protected java.lang.String host
+fld protected java.lang.String name
+fld protected org.netbeans.modules.payara.tooling.data.PayaraServer localServer
+intf org.netbeans.modules.payara.tooling.data.cloud.PayaraCloud
+meth public int getPort()
+meth public java.lang.String getHost()
+meth public java.lang.String getName()
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.tooling.data.PayaraServer getLocalServer()
+meth public void setHost(java.lang.String)
+meth public void setLocalServer(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public void setName(java.lang.String)
+meth public void setPort(int)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.logging.Logger
+cons public init(java.lang.Class)
+meth public !varargs java.lang.String excMsg(java.lang.String,java.lang.String,java.lang.String[])
+meth public boolean isLoggable(java.util.logging.Level)
+meth public java.lang.String buildKey(java.lang.String,java.lang.String)
+meth public java.lang.String excMsg(java.lang.String,java.lang.String)
+meth public static boolean loggable(java.util.logging.Level)
+meth public static java.lang.String excMsg(java.lang.Class,java.lang.String)
+meth public static java.lang.String logMsg(java.lang.Class,java.lang.String)
+meth public static java.util.logging.Logger getLogger()
+meth public static void log(java.util.logging.Level,java.lang.String,java.lang.Object)
+meth public static void log(java.util.logging.Level,java.lang.String,java.lang.Object[])
+meth public static void log(java.util.logging.Level,java.lang.String,java.lang.Throwable)
+meth public void exception(java.util.logging.Level,java.lang.String)
+meth public void log(java.util.logging.Level,java.lang.String,java.lang.String)
+meth public void log(java.util.logging.Level,java.lang.String,java.lang.String,java.lang.Object)
+meth public void log(java.util.logging.Level,java.lang.String,java.lang.String,java.lang.Object[])
+meth public void log(java.util.logging.Level,java.lang.String,java.lang.String,java.lang.Throwable)
+supr java.lang.Object
+hfds EXCEPTIONS_FILE,KEY_SEPARATOR,LOGGER_NAME,MESSAGES_FILE,PROPERTIES_FILE_SUFFIX,cl,excProps,logProps,logger,name
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.FetchLog
+meth public java.io.InputStream getInputStream()
+meth public void close()
+supr java.lang.Object
+hfds LOGGER,in,server,skip
+
+CLSS public org.netbeans.modules.payara.tooling.server.FetchLogEvent
+meth public org.netbeans.modules.payara.tooling.TaskState getState()
+supr java.lang.Object
+hfds state
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.server.FetchLogEventListener
+meth public abstract void stateChanged(org.netbeans.modules.payara.tooling.server.FetchLogEvent)
+
+CLSS public org.netbeans.modules.payara.tooling.server.FetchLogException
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+supr org.netbeans.modules.payara.tooling.PayaraIdeException
+
+CLSS public org.netbeans.modules.payara.tooling.server.FetchLogLocal
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.tooling.server.FetchLogPiped
+hfds LOGGER
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.FetchLogPiped
+intf java.util.concurrent.Callable<org.netbeans.modules.payara.tooling.TaskState>
+meth public boolean isRunning()
+meth public final boolean removeListener(org.netbeans.modules.payara.tooling.server.FetchLogEventListener)
+meth public final void addListener(org.netbeans.modules.payara.tooling.server.FetchLogEventListener)
+meth public static org.netbeans.modules.payara.tooling.server.FetchLogPiped create(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.server.FetchLogPiped create(java.util.concurrent.ExecutorService,org.netbeans.modules.payara.tooling.data.PayaraServer,boolean)
+meth public static org.netbeans.modules.payara.tooling.server.FetchLogPiped create(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static org.netbeans.modules.payara.tooling.server.FetchLogPiped create(org.netbeans.modules.payara.tooling.data.PayaraServer,boolean)
+meth public void close()
+supr org.netbeans.modules.payara.tooling.server.FetchLog
+hfds LOGGER,LOG_REFRESH_DELAY,PIPE_BUFFER_SIZE,eventListeners,executor,internalExecutor,out,taksExecute,task
+
+CLSS public org.netbeans.modules.payara.tooling.server.FetchLogRemote
+meth public org.netbeans.modules.payara.tooling.TaskState call()
+supr org.netbeans.modules.payara.tooling.server.FetchLogPiped
+hfds LOGGER
+
+CLSS public org.netbeans.modules.payara.tooling.server.FetchLogSimple
+cons public init(java.io.InputStream)
+supr org.netbeans.modules.payara.tooling.server.FetchLog
+
+CLSS public org.netbeans.modules.payara.tooling.server.JpaSupport
+cons public init()
+innr public static ApiVersion
+meth public static org.netbeans.modules.payara.tooling.server.JpaSupport$ApiVersion getApiVersion(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+supr java.lang.Object
+hfds JPA_PROVIDER_SINCE_V1,JPA_PROVIDER_SINCE_V3,jpaSupport
+
+CLSS public static org.netbeans.modules.payara.tooling.server.JpaSupport$ApiVersion
+ outer org.netbeans.modules.payara.tooling.server.JpaSupport
+meth public boolean is10()
+meth public boolean is20()
+meth public boolean is21()
+meth public java.lang.String getProvider()
+supr java.lang.Object
+hfds _1_0,_2_0,_2_1,provider
+
+CLSS public org.netbeans.modules.payara.tooling.server.ServerStatus
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraServer,boolean)
+innr public final static !enum Status
+innr public static Result
+innr public static ResultLocations
+innr public static ResultVersion
+intf java.io.Closeable
+meth public org.netbeans.modules.payara.tooling.server.ServerStatus$Result getAdminPortResult()
+meth public org.netbeans.modules.payara.tooling.server.ServerStatus$ResultLocations getLocationsResult()
+meth public org.netbeans.modules.payara.tooling.server.ServerStatus$ResultVersion getVersionResult()
+meth public void check()
+meth public void close()
+supr java.lang.Object
+hfds COMAND_STARTUP_TIMEOUT,COMAND_TIMEOUT,COMAND_TIMEOUT_MIN,CONNECT_TIMEOUT,EXECUTOR_POOL_SIZE,LOGGER,adminPortTask,executor,locationsTask,versionTask
+hcls AdminPortTask,LocationsTask,Task,VersionTask
+
+CLSS public static org.netbeans.modules.payara.tooling.server.ServerStatus$Result
+ outer org.netbeans.modules.payara.tooling.server.ServerStatus
+meth public java.lang.String getExceptionMeasage()
+meth public java.lang.String getServerName()
+meth public org.netbeans.modules.payara.tooling.TaskEvent getFailureEvent()
+meth public org.netbeans.modules.payara.tooling.server.ServerStatus$Status getStatus()
+supr java.lang.Object
+hfds ex,exceptionMeasage,failureEvent,ioe,serverName,status
+
+CLSS public static org.netbeans.modules.payara.tooling.server.ServerStatus$ResultLocations
+ outer org.netbeans.modules.payara.tooling.server.ServerStatus
+meth public org.netbeans.modules.payara.tooling.admin.ResultMap<java.lang.String,java.lang.String> getResult()
+supr org.netbeans.modules.payara.tooling.server.ServerStatus$Result
+hfds result
+
+CLSS public static org.netbeans.modules.payara.tooling.server.ServerStatus$ResultVersion
+ outer org.netbeans.modules.payara.tooling.server.ServerStatus
+meth public org.netbeans.modules.payara.tooling.admin.ResultString getResult()
+supr org.netbeans.modules.payara.tooling.server.ServerStatus$Result
+hfds result
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.server.ServerStatus$Status
+ outer org.netbeans.modules.payara.tooling.server.ServerStatus
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status EXCEPTION
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status FAILED
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status FATAL
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status INVALID
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status SUCCESS
+fld public final static org.netbeans.modules.payara.tooling.server.ServerStatus$Status TIMEOUT
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.server.ServerStatus$Status valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.ServerStatus$Status[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.ServerStatus$Status>
+
+CLSS public org.netbeans.modules.payara.tooling.server.ServerTasks
+cons public init()
+innr public final static !enum StartMode
+meth public static org.netbeans.modules.payara.tooling.admin.ResultProcess startServer(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.data.StartupArgs)
+meth public static org.netbeans.modules.payara.tooling.admin.ResultProcess startServer(org.netbeans.modules.payara.tooling.data.PayaraServer,org.netbeans.modules.payara.tooling.data.StartupArgs,org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode)
+supr java.lang.Object
+hfds DAS_NAME,LOGGER
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode
+ outer org.netbeans.modules.payara.tooling.server.ServerTasks
+fld public final static org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode DEBUG
+fld public final static org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode PROFILE
+fld public final static org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode START
+meth public static org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.ServerTasks$StartMode>
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.AsadminTool
+cons public init(java.lang.String,java.lang.String)
+intf org.netbeans.modules.payara.tooling.data.ToolConfig
+meth public java.lang.String getJar()
+supr org.netbeans.modules.payara.tooling.server.config.PayaraTool
+hfds jar
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.Config
+cons public !varargs init(java.net.URL,org.netbeans.modules.payara.tooling.server.config.Config$Next[])
+innr public static Next
+supr java.lang.Object
+hfds configFiles,index
+
+CLSS public static org.netbeans.modules.payara.tooling.server.config.Config$Next
+ outer org.netbeans.modules.payara.tooling.server.config.Config
+cons public init(org.netbeans.modules.payara.tooling.data.PayaraVersion,java.net.URL)
+supr java.lang.Object
+hfds configFile,version
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.ConfigBuilder
+meth public java.util.List<org.netbeans.modules.payara.tooling.data.PayaraLibrary> getLibraries(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public org.netbeans.modules.payara.tooling.data.PayaraJavaEEConfig getJavaEEConfig(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public org.netbeans.modules.payara.tooling.data.PayaraJavaSEConfig getJavaSEConfig(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+supr java.lang.Object
+hfds classpathHome,config,javaEEConfigCache,javaSEConfigCache,javadocsHome,libraryCache,srcHome,version
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider
+cons public init()
+meth public static java.net.URL getBuilderConfig(org.netbeans.modules.payara.tooling.data.PayaraVersion)
+meth public static org.netbeans.modules.payara.tooling.server.config.ConfigBuilder getBuilder(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static void destroyBuilder(org.netbeans.modules.payara.tooling.data.PayaraServer)
+supr java.lang.Object
+hfds CONFIG_V3,CONFIG_V4,CONFIG_V4_1,builders,config
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.ConfigUtils
+cons public init()
+supr java.lang.Object
+hfds MVN_PROPS_PATTERN,MVN_PROP_ARTIFACT_ID,MVN_PROP_GROUP_ID,MVN_PROP_VERSION
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.FileSet
+cons public init(java.util.List<java.lang.String>,java.util.List<java.lang.String>,java.util.Map<java.lang.String,java.util.List<java.lang.String>>,java.util.List<java.lang.String>)
+cons public init(java.util.List<java.lang.String>,java.util.Map<java.lang.String,java.util.List<java.lang.String>>)
+meth public java.util.List<java.lang.String> getLinks()
+meth public java.util.List<java.lang.String> getLookups()
+meth public java.util.List<java.lang.String> getPaths()
+meth public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFilesets()
+supr java.lang.Object
+hfds filesets,links,lookups,paths
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.PayaraConfigManager
+cons public init()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraConfig getConfig(java.net.URL)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.PayaraConfigXMLImpl
+cons public init(java.net.URL)
+intf org.netbeans.modules.payara.tooling.data.PayaraConfig
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.config.LibraryNode> getLibrary()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaEESet getJavaEE()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaSESet getJavaSE()
+meth public org.netbeans.modules.payara.tooling.server.config.Tools getTools()
+supr java.lang.Object
+hfds configFile,readDone,reader
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.config.PayaraTool
+cons public init(java.lang.String)
+meth public java.lang.String getLib()
+supr java.lang.Object
+hfds lib
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.server.config.JavaEEProfile
+fld public final static char TYPE_SEPARATOR = '-'
+fld public final static int length
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_2
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_3
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_4
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_5
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_6
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_6_web
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_7
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile v1_7_web
+innr public final static !enum Type
+innr public final static !enum Version
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type getType()
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile toValue(java.lang.String,java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.config.JavaEEProfile>
+hfds name,stringValuesMap,type,version
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type
+ outer org.netbeans.modules.payara.tooling.server.config.JavaEEProfile
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type FULL
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type WEB
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Type>
+hfds name
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version
+ outer org.netbeans.modules.payara.tooling.server.config.JavaEEProfile
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_2
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_3
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_4
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_5
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_6
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version v1_7
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.config.JavaEEProfile$Version>
+hfds name
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.JavaEESet
+cons public init(java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader$Module>,java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader$Profile>,java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileCheckReader$Check>,java.lang.String)
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader$Module> getModules()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader$Profile> getProfiles()
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.JavaEEProfile> profiles(java.io.File)
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.ModuleType> moduleTypes(java.io.File)
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.config.JavaSet
+hfds checkResults,checks,modules,profiles
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform
+fld public final static char SEPARATOR = '.'
+fld public final static int length
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_1
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_2
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_3
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_4
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_5
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_6
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_7
+fld public final static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform v1_8
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform>
+hfds V1_1_STR,V1_2_STR,V1_3_STR,V1_4_STR,V1_5_STR,V1_6_STR,V1_7_STR,V1_8_STR,stringValuesMap
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.JavaSESet
+cons public init(java.util.List<java.lang.String>,java.lang.String)
+meth public java.util.List<java.lang.String> getPlatforms()
+meth public java.util.Set<org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform> platforms()
+supr org.netbeans.modules.payara.tooling.server.config.JavaSet
+hfds platforms
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.config.JavaSet
+cons public init(java.lang.String)
+meth public java.lang.String getVersion()
+supr java.lang.Object
+hfds version
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.LibraryNode
+cons public init(java.lang.String,org.netbeans.modules.payara.tooling.server.config.FileSet,org.netbeans.modules.payara.tooling.server.config.FileSet,org.netbeans.modules.payara.tooling.server.config.FileSet)
+supr java.lang.Object
+hfds classpath,javadocs,libraryID,sources
+
+CLSS public final !enum org.netbeans.modules.payara.tooling.server.config.ModuleType
+fld public final static int length
+fld public final static org.netbeans.modules.payara.tooling.server.config.ModuleType CAR
+fld public final static org.netbeans.modules.payara.tooling.server.config.ModuleType EAR
+fld public final static org.netbeans.modules.payara.tooling.server.config.ModuleType EJB
+fld public final static org.netbeans.modules.payara.tooling.server.config.ModuleType RAR
+fld public final static org.netbeans.modules.payara.tooling.server.config.ModuleType WAR
+meth public java.lang.String toString()
+meth public static org.netbeans.modules.payara.tooling.server.config.ModuleType toValue(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.ModuleType valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.config.ModuleType[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.config.ModuleType>
+hfds CAR_STR,EAR_STR,EJB_STR,RAR_STR,WAR_STR,stringValuesMap
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.ServerConfigException
+cons public !varargs init(java.lang.String,java.lang.Object[])
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+supr org.netbeans.modules.payara.tooling.PayaraIdeException
+hfds INVALID_EE_PLATFORM_TYPE,INVALID_MODULE_TYPE_NAME,INVALID_SE_PLATFORM_VERSION
+
+CLSS public org.netbeans.modules.payara.tooling.server.config.Tools
+cons public init(org.netbeans.modules.payara.tooling.server.config.AsadminTool)
+intf org.netbeans.modules.payara.tooling.data.ToolsConfig
+meth public org.netbeans.modules.payara.tooling.server.config.AsadminTool getAsadmin()
+supr java.lang.Object
+hfds asadmin
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds path
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.parser.ConfigReader
+cons public init()
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+supr java.lang.Object
+hfds filesetReader,pathReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderClasspath
+cons public init()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+supr org.netbeans.modules.payara.tooling.server.parser.ConfigReader
+
+CLSS public abstract org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJava
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds VERSION_ATTR,version
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJavaEE
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJava
+hfds NODE,checkReader,javaEE,moduleReader,profileReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJavaSE
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJava
+hfds NODE,javaSE,platformReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderJavadocs
+cons public init()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+supr org.netbeans.modules.payara.tooling.server.parser.ConfigReader
+hfds linkReader,lookupReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderServer
+cons public init()
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.config.LibraryNode> getLibraries()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaEESet getJavaEE()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaSESet getJavaSE()
+meth public org.netbeans.modules.payara.tooling.server.config.Tools getTools()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds actualLibID,classpathReader,configReaderTools,javaEEReader,javaSEReader,javadocsReader,libraries,sourcesReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderSources
+cons public init()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+supr org.netbeans.modules.payara.tooling.server.parser.ConfigReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ConfigReaderTools
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds LIB_ATTR,NODE,lib,tools,toolsAsadminReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.FilesetReader
+cons public init()
+meth public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFilesets()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readChildren(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds actualFileset,filesets
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.HttpData
+cons public init(java.lang.String,int,boolean)
+meth public boolean isSecure()
+meth public int getPort()
+meth public java.lang.String getId()
+meth public java.lang.String toString()
+supr java.lang.Object
+hfds id,port,secure
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.HttpListenerReader
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.String)
+fld protected static boolean readData
+fld public final static java.lang.String CONFIG_PATH = "/domain/configs/config"
+fld public final static java.lang.String DEFAULT_PATH = "/domain/configs/config/http-service/http-listener"
+fld public final static java.lang.String DEFAULT_TARGET = "server"
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public java.util.Map<java.lang.String,org.netbeans.modules.payara.tooling.server.parser.HttpData> getResult()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds LOGGER,path,result
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader
+innr public Module
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader$Module> getModules()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds CHECK_ATTR,NODE,TYPE_ATTR,modules
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader$Module
+ outer org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader
+meth public java.lang.String getCheck()
+meth public java.lang.String getType()
+supr java.lang.Object
+hfds check,type
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileCheckReader
+innr public Check
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds NAME_ATTR,NODE,checks,currentCheck,pathReader
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileCheckReader$Check
+ outer org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileCheckReader
+meth public java.lang.String getName()
+meth public java.util.List<java.lang.String> getFiles()
+supr java.lang.Object
+hfds files,name
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader
+innr public Profile
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader$Profile> getProfiles()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds CHECK_ATTR,NODE,TYPE_ATTR,VERSION_ATTR,profiles
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader$Profile
+ outer org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader
+meth public java.lang.String getCheck()
+meth public java.lang.String getType()
+meth public java.lang.String getVersion()
+supr java.lang.Object
+hfds check,type,version
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JavaSEPlatformReader
+meth public java.util.List<java.lang.String> getPlatforms()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds NODE,VERSION_ATTR,platforms
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JmxConnectorReader
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.String)
+fld protected static boolean readData
+fld public final static java.lang.String CONFIG_PATH = "/domain/configs/config"
+fld public final static java.lang.String DEFAULT_PATH = "/domain/configs/config/admin-service/jmx-connector"
+fld public final static java.lang.String DEFAULT_TARGET = "server"
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.lang.String getResult()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds LOGGER,path,result
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.JvmConfigReader
+cons public init(java.lang.String)
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public boolean isMonitoringEnabled()
+meth public java.util.List<JvmOption> getJvmOptions()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public java.util.Map<java.lang.String,java.lang.String> getPropMap()
+meth public org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener getConfigFinder()
+meth public org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener getMonitoringFinder()
+meth public org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener getServerFinder()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readCData(java.lang.String,char[],int,int) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds JVM_OPTIONS_TAG,b,isMonitoringEnabled,optList,propMap,readConfig,serverConfigName,serverName
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.LinkReader
+cons public init()
+meth public java.util.List<java.lang.String> getLinks()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds links
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.LookupReader
+cons public init()
+meth public java.util.List<java.lang.String> getLookups()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds lookups
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.NetworkListenerReader
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.String)
+fld protected static boolean readData
+fld public final static java.lang.String CONFIG_PATH = "/domain/configs/config"
+fld public final static java.lang.String DEFAULT_PATH = "/domain/configs/config/network-config/network-listeners/network-listener"
+fld public final static java.lang.String DEFAULT_TARGET = "server"
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public java.util.Map<java.lang.String,org.netbeans.modules.payara.tooling.server.parser.HttpData> getResult()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds LOGGER,path,result
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.PathReader
+meth public java.util.List<java.lang.String> getPaths()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void reset()
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds NODE,paths
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ResourcesReader
+cons public init(java.lang.String,java.lang.String)
+cons public init(org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType)
+innr public final static !enum ResourceType
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getResourceData()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readChildren(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds keyName,path,properties,resourceData
+
+CLSS public final static !enum org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType
+ outer org.netbeans.modules.payara.tooling.server.parser.ResourcesReader
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType ADMIN_OBJECT_RESOURCE
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType CONNECTOR_POOL
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType CONNECTOR_RESOURCE
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType JAVA_MAIL
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType JDBC_CONNECTION_POOL
+fld public final static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType JDBC_RESOURCE
+meth public java.lang.String getDefaultKeyName()
+meth public java.lang.String getDefaultPath()
+meth public static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType valueOf(java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType[] values()
+supr java.lang.Enum<org.netbeans.modules.payara.tooling.server.parser.ResourcesReader$ResourceType>
+hfds defaultKeyName,defaultPath
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.TargetConfigNameReader
+cons public init()
+cons public init(java.lang.String)
+fld public final static java.lang.String DEFAULT_TARGET = "server"
+fld public final static java.lang.String SERVER_PATH = "/domain/servers/server"
+intf org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public java.lang.String getTargetConfigName()
+meth public java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+hfds targetConfigName,targetName
+
+CLSS public org.netbeans.modules.payara.tooling.server.parser.ToolsAsadminReader
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.netbeans.modules.payara.tooling.server.parser.AbstractReader
+hfds JAR_ATTR,NODE,jar
+
+CLSS public final org.netbeans.modules.payara.tooling.server.parser.TreeParser
+innr public abstract static NodeListener
+innr public static Path
+meth public !varargs static boolean readXml(java.io.File,java.nio.charset.Charset,org.netbeans.modules.payara.tooling.server.parser.XMLReader[])
+meth public !varargs static boolean readXml(java.io.File,org.netbeans.modules.payara.tooling.server.parser.XMLReader[])
+meth public !varargs static boolean readXml(java.net.URL,org.netbeans.modules.payara.tooling.server.parser.XMLReader[])
+meth public org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+meth public void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public void endDocument() throws org.xml.sax.SAXException
+meth public void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void startDocument() throws org.xml.sax.SAXException
+meth public void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr org.xml.sax.helpers.DefaultHandler
+hfds DUMMY_RESOLVER,LOGGER,PATH_SEPARATOR,childNodeReader,depth,isFinerLoggable,isFinestLoggable,root,rover,skipping
+hcls Node
+
+CLSS public abstract static org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener
+ outer org.netbeans.modules.payara.tooling.server.parser.TreeParser
+cons public init()
+meth public void endNode(java.lang.String) throws org.xml.sax.SAXException
+meth public void readAttributes(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void readCData(java.lang.String,char[],int,int) throws org.xml.sax.SAXException
+meth public void readChildren(java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+supr java.lang.Object
+
+CLSS public static org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path
+ outer org.netbeans.modules.payara.tooling.server.parser.TreeParser
+cons public init(java.lang.String)
+cons public init(java.lang.String,org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener)
+meth public java.lang.String getPath()
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.tooling.server.parser.TreeParser$NodeListener getReader()
+supr java.lang.Object
+hfds path,reader
+
+CLSS public abstract interface org.netbeans.modules.payara.tooling.server.parser.XMLReader
+meth public abstract java.util.List<org.netbeans.modules.payara.tooling.server.parser.TreeParser$Path> getPathsToListen()
+
+CLSS public org.netbeans.modules.payara.tooling.utils.CyclicStringBuffer
+cons public init(int)
+meth public boolean append(char)
+meth public boolean equals(java.lang.String)
+meth public boolean prepend(char)
+meth public java.lang.String toString()
+meth public void resize(int)
+supr java.lang.Object
+hfds LOGGER,beg,buff,len,size
+
+CLSS public final org.netbeans.modules.payara.tooling.utils.EnumUtils
+cons public init()
+meth public final static boolean eq(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+meth public final static boolean ge(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+meth public final static boolean gt(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+meth public final static boolean le(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+meth public final static boolean lt(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+meth public final static boolean ne(java.lang.Enum<? extends java.lang.Enum>,java.lang.Enum<? extends java.lang.Enum>)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.utils.Jar
+cons public init(java.io.File)
+cons public init(java.lang.String)
+fld public final static java.lang.String MANIFEST_BUNDLE_VERSION = "Bundle-Version"
+meth public java.lang.String getBundleVersion()
+meth public java.util.jar.Manifest getManifest()
+meth public void close()
+supr java.lang.Object
+hfds jar
+
+CLSS public org.netbeans.modules.payara.tooling.utils.JarException
+cons public !varargs init(java.lang.String,java.lang.Object[])
+cons public init()
+cons public init(java.lang.String)
+cons public init(java.lang.String,java.lang.Throwable)
+supr org.netbeans.modules.payara.tooling.PayaraIdeException
+hfds CLOSE_ERROR,OPEN_ERROR
+
+CLSS public org.netbeans.modules.payara.tooling.utils.JavaUtils
+cons public init()
+fld public final static java.lang.String JAVA_HOME_ENV = "JAVA_HOME"
+fld public final static java.lang.String VM_CLASSPATH_OPTION = "-cp"
+fld public final static java.nio.charset.Charset UTF_8
+innr public static JavaVersion
+meth public static java.lang.String javaVmExecutableFullPath(java.lang.String)
+meth public static java.lang.String systemProperty(java.lang.String,java.lang.String)
+meth public static java.lang.String systemProperty(java.lang.StringBuilder,java.lang.String,java.lang.String)
+meth public static java.lang.String systemPropertyName(java.lang.String)
+meth public static java.lang.String systemPropertyName(java.lang.StringBuilder,java.lang.String)
+meth public static java.net.URL getPropertiesURL(java.lang.Class,java.lang.String)
+meth public static org.netbeans.modules.payara.tooling.utils.JavaUtils$JavaVersion javaVmVersion(java.io.File)
+supr java.lang.Object
+hfds JAVA_BIN_DIR,JAVA_VM_EXE,VM_MIN_VERSION_TOKENS,VM_SYS_PROP_ASSIGN,VM_SYS_PROP_OPT,VM_SYS_PROP_QUOTE,VM_VERSION_OPT,VM_VERSION_PATTERN
+
+CLSS public static org.netbeans.modules.payara.tooling.utils.JavaUtils$JavaVersion
+ outer org.netbeans.modules.payara.tooling.utils.JavaUtils
+cons public init(int,int,int,int)
+meth public int comapreTo(org.netbeans.modules.payara.tooling.utils.JavaUtils$JavaVersion)
+meth public java.lang.String toString()
+meth public org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform toPlatform()
+supr java.lang.Object
+hfds major,minor,patch,revision
+
+CLSS public org.netbeans.modules.payara.tooling.utils.LinkedList<%0 extends java.lang.Object>
+cons public init()
+innr public static Element
+meth public boolean first()
+meth public boolean isCurrent()
+meth public boolean isEmpty()
+meth public boolean isNext()
+meth public boolean isPrevious()
+meth public boolean last()
+meth public boolean next()
+meth public boolean previous()
+meth public int size()
+meth public java.lang.String toString()
+meth public void addFirst({org.netbeans.modules.payara.tooling.utils.LinkedList%0})
+meth public void addLast({org.netbeans.modules.payara.tooling.utils.LinkedList%0})
+meth public void addNext({org.netbeans.modules.payara.tooling.utils.LinkedList%0})
+meth public void addPrevious({org.netbeans.modules.payara.tooling.utils.LinkedList%0})
+meth public void clear()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} getCurrent()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} getFirst()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} getLast()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} getNext()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} getPrevious()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeAndNext()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeAndNextOrPrevious()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeAndPrevious()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeAndPreviousOrNext()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeFirst()
+meth public {org.netbeans.modules.payara.tooling.utils.LinkedList%0} removeLast()
+supr java.lang.Object
+hfds current,head,size,tail
+
+CLSS public static org.netbeans.modules.payara.tooling.utils.LinkedList$Element<%0 extends java.lang.Object>
+ outer org.netbeans.modules.payara.tooling.utils.LinkedList
+supr java.lang.Object
+hfds next,previous,value
+
+CLSS public org.netbeans.modules.payara.tooling.utils.NetUtils
+cons public init()
+fld public final static int PORT_CHECK_TIMEOUT = 2000
+innr public static InetAddressComparator
+meth public static boolean isPortListeningLocal(java.lang.String,int)
+meth public static boolean isPortListeningRemote(java.lang.String,int)
+meth public static boolean isPortListeningRemote(java.lang.String,int,int)
+meth public static boolean isSecurePort(java.lang.String,int) throws java.io.IOException
+meth public static java.util.Set<java.net.Inet4Address> getHostIP4s()
+meth public static java.util.Set<java.net.Inet6Address> getHostIP6s()
+meth public static java.util.Set<java.net.InetAddress> getHostIPs()
+supr java.lang.Object
+hfds INET_ADDRESS_COMPARATOR,LOGGER
+
+CLSS public static org.netbeans.modules.payara.tooling.utils.NetUtils$InetAddressComparator
+ outer org.netbeans.modules.payara.tooling.utils.NetUtils
+cons public init()
+intf java.util.Comparator<java.net.InetAddress>
+meth public int compare(java.net.InetAddress,java.net.InetAddress)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.utils.OsUtils
+cons public init()
+fld public final static int FILE_SEPARATOR_LENGTH
+fld public final static java.lang.String EXEC_SUFFIX
+fld public final static java.lang.String LINES_SEPARATOR
+fld public final static java.lang.String OS_NAME
+fld public final static java.lang.String OS_NAME_PROPERTY = "os.name"
+fld public final static java.lang.String OS_NAME_UPCASE
+meth public static boolean isWin()
+meth public static boolean rmDir(java.io.File)
+meth public static boolean rmDirContent(java.io.File)
+meth public static java.lang.String escapeParameters(java.lang.String[])
+meth public static java.lang.String escapeString(java.lang.String)
+meth public static java.lang.String joinPaths(java.lang.String,java.lang.String)
+meth public static java.lang.String[] parseParameters(java.lang.String,java.lang.String)
+meth public static void escapeString(java.lang.String,java.lang.StringBuffer)
+supr java.lang.Object
+hfds IS_WIN,OS_WIN_SUBSTR
+
+CLSS public org.netbeans.modules.payara.tooling.utils.ServerUtils
+cons public init()
+fld public final static java.lang.String AS_JAVA_ENV = "AS_JAVA"
+fld public final static java.lang.String BUNDLE_VERSION = "Bundle-Version"
+fld public final static java.lang.String GF_JAR_MATCHER = "glassfish(?:-[0-9bSNAPHOT]+(?:\u005c.[0-9]+(?:_[0-9]+|)|).*|).jar"
+fld public final static java.lang.String VERSION_MATCHER = "(?:-[0-9bSNAPHOT]+(?:\u005c.[0-9]+(?:_[0-9]+|)|).*|).jar"
+fld public final static java.lang.String PF_COMMON_UTIL_JAR = "common-util.jar"
+fld public final static java.lang.String PF_DERBY_DIR_NAME = "javadb"
+fld public final static java.lang.String PF_DERBY_ROOT_PROPERTY = "com.sun.aas.derbyRoot"
+fld public final static java.lang.String PF_DOMAINS_DIR_NAME = "domains"
+fld public final static java.lang.String PF_DOMAIN_CONFIG_DIR_NAME = "config"
+fld public final static java.lang.String PF_DOMAIN_CONFIG_FILE_NAME = "domain.xml"
+fld public final static java.lang.String PF_DOMAIN_ROOT_PROPERTY = "com.sun.aas.instanceRoot"
+fld public final static java.lang.String PF_EMBEDDED_DIR_NAME = "embedded"
+fld public final static java.lang.String PF_EMBEDDED_STATIC_SHELL_JAR = "payara-embedded-static-shell.jar"
+fld public final static java.lang.String PF_HOME_PROPERTY = "com.sun.aas.installRoot"
+fld public final static java.lang.String PF_JAVAHELP_JAR = "javahelp.jar"
+fld public final static java.lang.String PF_JAVA_ROOT_PROPERTY = "com.sun.aas.javaRoot"
+fld public final static java.lang.String PF_JERSEY_1_CORE_JAR = "jersey-core.jar"
+fld public final static java.lang.String PF_JERSEY_2_COMMON_JAR = "jersey-common.jar"
+fld public final static java.lang.String PF_LIB_DIR_NAME = "lib"
+fld public final static java.lang.String PF_MODULES_DIR_NAME = "modules"
+fld public final static java.lang.String PF_SERVICE_NOT_YET_READY_MSG = "V3 cannot process this command at this time, please wait"
+fld public final static java.lang.String PF_VERIFIER_JAR = "verifier.jar"
+fld public final static java.lang.String MANIFEST_COMPONENTS_SEPARATOR = ";"
+fld public final static java.lang.String MANIFEST_EOL = "%%%EOL%%%"
+fld public final static java.lang.String MANIFEST_RESOURCES_SEPARATOR = "[,;]"
+fld public final static org.netbeans.modules.payara.tooling.utils.ServerUtils$PayaraFilter PF_HOME_DIR_FILTER
+fld public static java.lang.String PF_DOMAIN_ARG
+fld public static java.lang.String PF_DOMAIN_DIR_ARG
+fld public static java.lang.String PF_LOG_DIR_NAME
+fld public static java.lang.String PF_LOG_FILE_NAME
+fld public static java.lang.String VERIFIER_MAIN_CLASS
+innr public static PayaraFilter
+meth public static boolean isAdminPortListening(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean isAdminPortListening(org.netbeans.modules.payara.tooling.data.PayaraServer,int)
+meth public static boolean isHttpPortListening(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static boolean isHttpPortListening(org.netbeans.modules.payara.tooling.data.PayaraServer,int)
+meth public static boolean notYetReadyMsg(java.lang.String)
+meth public static java.io.File getCommonUtilJarInModules(java.lang.String)
+meth public static java.io.File getFileFromPattern(java.lang.String,java.io.File)
+meth public static java.io.File getJarInModules(java.lang.String,java.lang.String)
+meth public static java.io.File getJarName(java.lang.String,java.lang.String)
+meth public static java.io.File getJarName(java.lang.String,java.lang.String,java.lang.String)
+meth public static java.io.File getJerseyCommonJarInModules(java.lang.String)
+meth public static java.io.File getServerLogFile(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static java.lang.String basicAuthCredentials(java.lang.String,java.lang.String)
+meth public static java.lang.String cmdLineArgument(java.lang.String,java.lang.String)
+meth public static java.lang.String getDerbyRoot(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static java.lang.String getDomainConfigFile(java.lang.String,java.lang.String)
+meth public static java.lang.String getDomainConfigPath(java.lang.String)
+meth public static java.lang.String getDomainPath(org.netbeans.modules.payara.tooling.data.PayaraServer)
+meth public static java.lang.String getEmbeddedStaticShellJar(java.lang.String)
+meth public static java.lang.String getJavaHelpJar(java.lang.String)
+meth public static java.lang.String getJerseyVersion(java.lang.String)
+meth public static java.lang.String getVerifierJar(java.lang.String)
+meth public static java.lang.String getVersionString(java.lang.String)
+meth public static java.lang.String javaRootProperty(java.lang.String)
+meth public static java.lang.String manifestDecode(java.lang.String)
+meth public static java.lang.String serverLogFileRelativePath()
+meth public static org.netbeans.modules.payara.tooling.data.PayaraVersion getServerVersion(java.lang.String)
+meth public static void addComponentToMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>>,java.lang.String)
+meth public static void addPathElement(java.lang.StringBuilder,java.lang.String)
+supr java.lang.Object
+hfds AUTH_BASIC_FIELD_SEPARATPR,FULL_VERSION_METHOD,FULL_VERSION_PATTERN,LOGGER,MANIFEST_COMPONENT_COMP_PATTERN,MANIFEST_COMPONENT_COMP_REGEX,MANIFEST_COMPONENT_FULL_PATTERN,MANIFEST_COMPONENT_FULL_REGEX,VERSION_CLASS
+hcls VersionFilter
+
+CLSS public static org.netbeans.modules.payara.tooling.utils.ServerUtils$PayaraFilter
+ outer org.netbeans.modules.payara.tooling.utils.ServerUtils
+cons public init()
+intf java.io.FileFilter
+meth public boolean accept(java.io.File)
+supr java.lang.Object
+
+CLSS public org.netbeans.modules.payara.tooling.utils.StringPrefixTree<%0 extends java.lang.Object>
+cons public init(boolean)
+meth public boolean add(java.lang.String,{org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0})
+meth public int size()
+meth public void clear()
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} match(java.lang.CharSequence)
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} match(java.lang.CharSequence,int)
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} matchCyclicBuffer(char[],int,int)
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} prefixMatch(java.lang.CharSequence)
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} prefixMatch(java.lang.CharSequence,int)
+meth public {org.netbeans.modules.payara.tooling.utils.StringPrefixTree%0} remove(java.lang.String)
+supr java.lang.Object
+hfds caseSensitive,root,size
+hcls Node,StackItem
+
+CLSS public org.netbeans.modules.payara.tooling.utils.Utils
+cons public init()
+meth public static java.lang.String concatenate(java.lang.String[])
+meth public static java.lang.String doSub(java.lang.String,java.util.Map<java.lang.String,java.lang.String>)
+meth public static java.lang.String escapePath(java.lang.String)
+meth public static java.lang.String lineSeparator()
+meth public static java.lang.String quote(java.lang.String)
+meth public static java.lang.String sanitizeName(java.lang.String)
+meth public static java.lang.String[] splitOptionsString(java.lang.String)
+meth public static java.util.List<java.io.File> classPathToFileList(java.lang.String,java.io.File)
+supr java.lang.Object
+hfds pattern
+
+CLSS public abstract interface org.xml.sax.ContentHandler
+meth public abstract void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public abstract void endDocument() throws org.xml.sax.SAXException
+meth public abstract void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void ignorableWhitespace(char[],int,int) throws org.xml.sax.SAXException
+meth public abstract void processingInstruction(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void setDocumentLocator(org.xml.sax.Locator)
+meth public abstract void skippedEntity(java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void startDocument() throws org.xml.sax.SAXException
+meth public abstract void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public abstract void startPrefixMapping(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.DTDHandler
+meth public abstract void notationDecl(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public abstract void unparsedEntityDecl(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.EntityResolver
+meth public abstract org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+
+CLSS public abstract interface org.xml.sax.ErrorHandler
+meth public abstract void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public abstract void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public abstract void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+
+CLSS public org.xml.sax.helpers.DefaultHandler
+cons public init()
+intf org.xml.sax.ContentHandler
+intf org.xml.sax.DTDHandler
+intf org.xml.sax.EntityResolver
+intf org.xml.sax.ErrorHandler
+meth public org.xml.sax.InputSource resolveEntity(java.lang.String,java.lang.String) throws java.io.IOException,org.xml.sax.SAXException
+meth public void characters(char[],int,int) throws org.xml.sax.SAXException
+meth public void endDocument() throws org.xml.sax.SAXException
+meth public void endElement(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void endPrefixMapping(java.lang.String) throws org.xml.sax.SAXException
+meth public void error(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public void fatalError(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+meth public void ignorableWhitespace(char[],int,int) throws org.xml.sax.SAXException
+meth public void notationDecl(java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void processingInstruction(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void setDocumentLocator(org.xml.sax.Locator)
+meth public void skippedEntity(java.lang.String) throws org.xml.sax.SAXException
+meth public void startDocument() throws org.xml.sax.SAXException
+meth public void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) throws org.xml.sax.SAXException
+meth public void startPrefixMapping(java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void unparsedEntityDecl(java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws org.xml.sax.SAXException
+meth public void warning(org.xml.sax.SAXParseException) throws org.xml.sax.SAXException
+supr java.lang.Object
\ No newline at end of file
diff --git a/enterprise/payara.tooling/nbproject/project.properties b/enterprise/payara.tooling/nbproject/project.properties
new file mode 100644
index 0000000..0f4ec98
--- /dev/null
+++ b/enterprise/payara.tooling/nbproject/project.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
diff --git a/enterprise/payara.tooling/nbproject/project.xml b/enterprise/payara.tooling/nbproject/project.xml
new file mode 100644
index 0000000..38c36c7
--- /dev/null
+++ b/enterprise/payara.tooling/nbproject/project.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.payara.tooling</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.27</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.json_simple</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>0.10</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.xml.jaxb.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.13</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.7</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.testng</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <friend-packages>
+ <friend>org.netbeans.modules.payara.cloud</friend>
+ <friend>org.netbeans.modules.payara.common</friend>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
+ <friend>org.netbeans.modules.payara.jakartaee</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv</friend>
+ <friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
+ <friend>org.netbeans.modules.j2ee.sun.ddui</friend>
+ <package>org.netbeans.modules.payara.tooling</package>
+ <package>org.netbeans.modules.payara.tooling.data</package>
+ <package>org.netbeans.modules.payara.tooling.data.cloud</package>
+ <package>org.netbeans.modules.payara.tooling.server</package>
+ <package>org.netbeans.modules.payara.tooling.server.config</package>
+ <package>org.netbeans.modules.payara.tooling.server.parser</package>
+ <package>org.netbeans.modules.payara.tooling.admin</package>
+ <package>org.netbeans.modules.payara.tooling.admin.cloud</package>
+ <package>org.netbeans.modules.payara.tooling.admin.response</package>
+ <package>org.netbeans.modules.payara.tooling.logging</package>
+ <package>org.netbeans.modules.payara.tooling.utils</package>
+ </friend-packages>
+ </data>
+ </configuration>
+</project>
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/Bundle.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/Bundle.properties
new file mode 100644
index 0000000..72d9e26
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/Bundle.properties
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+OpenIDE-Module-Name=Payara Tooling
+
+OpenIDE-Module-Display-Category=Libraries
+OpenIDE-Module-Long-Description=Common tooling for Payara support.
+
+OpenIDE-Module-Short-Description=Common tooling for Payara support.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/ExceptionMessages.properties
new file mode 100644
index 0000000..aca7859
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/ExceptionMessages.properties
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# PayaraIdeException class
+PayaraIdeException.init.empty=Caught PayaraIdeException.
+PayaraIdeException.init.msg=Caught PayaraIdeException
+PayaraIdeException.init.cause=PayaraIdeException was caused by
+
+# PayaraStatus class
+PayaraStatus.toString.invalidState=Invalid Payara server state
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/LogMessages.properties
new file mode 100644
index 0000000..d72745f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/LogMessages.properties
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+################################################################################
+# Log messages for tests #
+################################################################################
+
+# CommonTest class
+CommonTest.intProperty.undefined=Property {0} is not defined.
+CommonTest.intPayaraProperty.undefined=Property {0} is not defined.
+CommonTest.intPayaraProperty.cantSet=Cannot set {0} property.
+CommonTest.intPayaraProperty.numberFormat=Caught NumberFormatException \
+exception in intPayaraProperty() method:
+CommonTest.createPayaraServer.accessorFailed=Getting Payara property \
+accessor method failed:
+CommonTest.createPayaraServer.unknownVersion=Cannot set {0} property: \
+Version number was not recognized.
+CommonTest.createPayaraServer.unknownAdminInterface=Cannot set {0} \
+property: Admin interface was not recognized.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraIdeException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraIdeException.java
new file mode 100644
index 0000000..eb29d00
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraIdeException.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.text.MessageFormat;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Common Payara IDE SDK Exception.
+ * <p>
+ * Base exception for Payara IDE SDK Exception contains all common code.
+ * All exceptions are logging themselves on WARNING level when created.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class PayaraIdeException extends RuntimeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(PayaraIdeException.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create exception message from message pattern and arguments using
+ * {@link java.text.MessageFormat}.
+ * <p/>
+ * @param msg The detail message pattern.
+ * @param arguments Arguments to be inserted into message pattern.
+ */
+ private static String formatMessage(String msg, Object... arguments) {
+ if (arguments != null && arguments.length > 0) {
+ return MessageFormat.format(msg, arguments);
+ } else {
+ return msg;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>PayaraIdeException</code> without
+ * detail message.
+ */
+ public PayaraIdeException() {
+ super();
+ final String METHOD = "init";
+ // Log exception in WARNING level.
+ LOGGER.exception(Level.WARNING, LOGGER.excMsg(METHOD, "empty"));
+ }
+
+ /**
+ * Constructs an instance of <code>PayaraIdeException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public PayaraIdeException(String msg) {
+ super(msg);
+ final String METHOD = "init";
+ // Log exception in WARNING level.
+ if (LOGGER.isLoggable(Level.WARNING)) {
+ String hdr = LOGGER.excMsg(METHOD, "msg");
+ String sep = msg != null ? ": " : ".";
+ StringBuilder sb = new StringBuilder(hdr.length() + sep.length()
+ + (msg != null ? msg.length() : 0));
+ sb.append(hdr);
+ sb.append(sep);
+ if (msg != null) {
+ sb.append(msg);
+ }
+ LOGGER.exception(Level.WARNING, sb.toString());
+ }
+ }
+
+ /**
+ * Constructs an instance of <code>PayaraIdeException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public PayaraIdeException(String msg, Object... arguments) {
+ this(formatMessage(msg, arguments));
+ }
+
+ /**
+ * Constructs an instance of <code>PayaraIdeException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated int his runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public PayaraIdeException(String msg, Throwable cause) {
+ super(msg, cause);
+ final String METHOD = "init";
+ // Log exception in WARNING level.
+ if (LOGGER.isLoggable(Level.WARNING)) {
+ String hdr = LOGGER.excMsg(METHOD, "msg");
+ String sep = msg != null ? ": " : ".";
+ StringBuilder sb = new StringBuilder(hdr.length() + sep.length()
+ + (msg != null ? msg.length() : 0));
+ sb.append(hdr);
+ sb.append(sep);
+ if (msg != null) {
+ sb.append(msg);
+ }
+ LOGGER.exception(Level.WARNING, sb.toString());
+ // Log cause exception in WARNING level.
+ if (cause != null) {
+ String className = cause.getClass().getName();
+ msg = cause.getMessage();
+ sep = msg != null ? ": " : ".";
+ hdr = LOGGER.excMsg(METHOD, "cause");
+ sb = new StringBuilder(hdr.length() + className.length()
+ + sep.length() + (msg != null ? msg.length() : 0));
+ sb.append(hdr);
+ sb.append(className);
+ sb.append(sep);
+ if (msg != null) {
+ sb.append(msg);
+ }
+ LOGGER.exception(Level.WARNING, sb.toString());
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatus.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatus.java
new file mode 100644
index 0000000..a89a4fb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatus.java
@@ -0,0 +1,512 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import org.netbeans.modules.payara.tooling.data.DataException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.state.PayaraStatusEntity;
+import org.netbeans.modules.payara.tooling.server.state.StatusJob;
+import org.netbeans.modules.payara.tooling.server.state.StatusScheduler;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Payara server status.
+ * <p>Local server can be in 4 possible states:<p/>
+ * <ul><li><i>Offline:</i> Server is not running</li>
+ * <ul><li>no process</li>
+ * <li>no network listeners</li>
+ * <li>no administration interface responses</li></ul>
+ * <li><i>Startup/Restart:</i> Server start or restart was requested</li>
+ * <ul><li>active process (PID should change for restart)</li>
+ * <li>network listeners may or may not be active</li>
+ * <li>no administration interface responses</li></ul>
+ * <li><i>Online:</i> Server is running</li>
+ * <ul><li>active process</li>
+ * <li>active network listeners</li>
+ * <li>valid administration interface responses</li></ul>
+ * <li><i>Shutdown:</i> Server shutdown was requested but server is still running</li>
+ * <ul><li>active process</li>
+ * <li>network listeners may or may not be active</li>
+ * <li>administration interface may or may not be active</li></ul></ul>
+ * <p>Remote server can be in 4 possible states:</p>
+ * <ul><li><i>Offline:</i> Server is not running
+ * <ul><li>no network listeners
+ * <li>no administration interface responses</li></ul>
+ * <li><i>Restart:</i> Server restart was requested</li>
+ * <ul><li>network listeners may or may not be active</li>
+ * <li>no administration interface responses</li></ul>
+ * <li><i>Online:</i> Server is running</li>
+ * <ul><li>active network listeners</li>
+ * <li>valid administration interface responses</li></ul>
+ * <li><i>Shutdown:</i> Server shutdown was requested but server is still running</li>
+ * <ul><li>network listeners may or may not be active</li>
+ * <li>administration interface may or may not be active</li></ul></ul>
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum PayaraStatus {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Server status is unknown. */
+ UNKNOWN,
+
+ /** Server is offline (not running or not responding). */
+ OFFLINE,
+
+ /** Server start or restart was requested but server is still not
+ * fully responding. */
+ STARTUP,
+
+ /** Server is running an responding. */
+ ONLINE,
+
+ /** Server shutdown was requested but server is still running
+ * or responding. */
+ SHUTDOWN;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(PayaraStatus.class);
+
+ /** Payara version enumeration length. */
+ public static final int length = PayaraStatus.values().length;
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String UNKNOWN_STR = "UNKNOWN";
+
+ /** A <code>String</code> representation of OFFLINE value. */
+ private static final String OFFLINE_STR = "OFFLINE";
+
+ /** A <code>String</code> representation of STARTUP value. */
+ private static final String STARTUP_STR = "STARTUP";
+
+ /** A <code>String</code> representation of ONLINE value. */
+ private static final String ONLINE_STR = "ONLINE";
+
+ /** A <code>String</code> representation of SHUTDOWN value. */
+ private static final String SHUTDOWN_STR = "SHUTDOWN";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final Map<String, PayaraStatus> stringValuesMap
+ = new HashMap<>(values().length);
+ static {
+ for (PayaraStatus state : PayaraStatus.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>PayaraStatus</code> with a value represented by the
+ * specified <code>String</code>.
+ * <p/>
+ * The <code>PayaraStatus</code> returned represents existing value only
+ * if specified <code>String</code> matches any <code>String</code> returned
+ * by <code>toString</code> method. Otherwise <code>null</code> value
+ * is returned.
+ * <p>
+ * @param name Value containing <code>PayaraStatus</code>
+ * <code>toString</code> representation.
+ * @return <code>PayaraStatus</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static PayaraStatus toValue(final String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Initialize Payara server status task scheduler to use external
+ * executor.
+ * <p/>
+ * This method must be called before adding first GlassFisg server instance
+ * into scheduler.
+ * <p/>
+ * @param executor External executor to be used in scheduler.
+ */
+ public static void initScheduler(
+ final ScheduledThreadPoolExecutor executor) {
+ StatusScheduler.init(executor);
+ }
+
+ /**
+ * Register Payara server instance into scheduler and launch server
+ * status checking jobs.
+ * <p/>
+ * It is possible to call this method for the same GlassFisg server instance
+ * many times. Server instance will be added only if it is not already
+ * registered.
+ * <p/>
+ * @param srv Payara server instance to be registered.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean add(final PayaraServer srv) {
+ StatusScheduler scheduler = StatusScheduler.getInstance();
+ if (!scheduler.exists(srv)) {
+ PayaraStatusEntity status = new PayaraStatusEntity(srv);
+ return StatusScheduler.getInstance().add(status);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Register Payara server instance into scheduler, register server status
+ * listener and launch server status checking jobs.
+ * <p/>
+ * It is possible to call this method for the same GlassFisg server instance
+ * many times. Server instance and listener will be added only if it is not
+ * already registered.
+ * <p/>
+ * @param srv Payara server instance to be registered.
+ * @param listener Server status listener to be registered.
+ * @param currentState Notify about current server status after every check
+ * when <code>true</code>.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean add(final PayaraServer srv,
+ final PayaraStatusListener listener, final boolean currentState,
+ final PayaraStatus... newState) {
+ StatusScheduler scheduler = StatusScheduler.getInstance();
+ if (!scheduler.exists(srv)) {
+ PayaraStatusEntity status = new PayaraStatusEntity(srv);
+ return StatusScheduler.getInstance()
+ .add(status, listener, currentState, newState);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Get current Payara server instance status.
+ * <p/>
+ * When status checking is disabled, it will restart it and return current
+ * status which is probably <code>UNKNOWN</code>.
+ * <p/>
+ * @param srv Payara server instance to be searched.
+ * @return Payara server instance status. Returns <code>UNKNOWN</code>
+ * value for unregistered server instance.
+ */
+ public static PayaraStatus getStatus(final PayaraServer srv) {
+ PayaraServerStatus status
+ = StatusScheduler.getInstance().get(srv, null);
+ return status != null ? status.getStatus() : PayaraStatus.UNKNOWN;
+ }
+
+ /**
+ * Get current Payara server instance status.
+ * <p/>
+ * When status checking is disabled, it will restart it and return current
+ * status which is probably <code>UNKNOWN</code>. If listener is provided,
+ * it will be registered to receive any state change notification following
+ * status checking restart. This listener won't be unregistered
+ * automatically so caller should handle it properly.
+ * <p/>
+ * @param srv Payara server instance to be searched.
+ * @param listener Server status listener to be registered when status
+ * checking is being restarted.
+ * @return Payara server instance status. Returns <code>UNKNOWN</code>
+ * value for unregistered server instance.
+ */
+ public static PayaraStatus getStatus(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ PayaraServerStatus status
+ = StatusScheduler.getInstance().get(srv, listener);
+ return status != null ? status.getStatus() : PayaraStatus.UNKNOWN;
+ }
+
+ /**
+ * Get current Payara server instance {@link PayaraServerStatus}
+ * object.
+ * <p/>
+ * When status checking is disabled, it will restart it and return current
+ * status which is probably <code>UNKNOWN</code>.
+ * <p/>
+ * @param srv Payara server instance to be searched.
+ * @return Payara server status {@link PayaraServerStatus} object.
+ * Returns <code>null</code> value for unregistered server instance.
+ */
+ public static PayaraServerStatus get(final PayaraServer srv) {
+ return StatusScheduler.getInstance().get(srv, null);
+ }
+
+ /**
+ * Get current Payara server instance {@link PayaraServerStatus}
+ * object.
+ * <p/>
+ * When status checking is disabled, it will restart it and return current
+ * status which is probably <code>UNKNOWN</code>. If listener is provided,
+ * it will be registered to receive any state change notification following
+ * status checking restart. This listener won't be unregistered
+ * automatically so caller should handle it properly.
+ * <p/>
+ * @param srv Payara server instance to be searched.
+ * @param listener Server status listener to be registered when status
+ * checking is being restarted.
+ * @return Payara server status {@link PayaraServerStatus} object.
+ * Returns <code>null</code> value for unregistered server instance.
+ */
+ public static PayaraServerStatus get(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ return StatusScheduler.getInstance().get(srv, listener);
+ }
+
+ /**
+ * Trigger startup mode for Payara server instance.
+ * <p/>
+ * This will switch status monitoring into startup mode where server
+ * is being checked more often.
+ * <p/>
+ * @param srv Payara server instance to be switched
+ * into startup mode.
+ * @param force Force startup mode for Payara server instance
+ * from any state then <code>true</code>.
+ * @param listener Server status listener to be registered together with
+ * switching into startup mode.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean start(final PayaraServer srv, final boolean force,
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ return StatusScheduler.getInstance().start(
+ srv, force, listener, newState);
+ }
+
+ /**
+ * Trigger startup mode for Payara server instance.
+ * <p/>
+ * This will switch status monitoring into startup mode where server
+ * is being checked more often.
+ * <p/>
+ * @param srv Payara server instance to be switched into startup mode.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean start(final PayaraServer srv) {
+ return StatusScheduler.getInstance().start(srv, false, null);
+ }
+
+ /**
+ * Trigger shutdown mode for Payara server instance.
+ * <p/>
+ * This will switch status monitoring into shutdown mode where server
+ * is being checked more often.
+ * <p/>
+ * @param srv Payara server instance to be switched into shutdown mode.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public static boolean shutdown(final PayaraServer srv) {
+ return StatusScheduler.getInstance().shutdown(srv);
+ }
+
+ /**
+ * Remove Payara server instance from scheduler and stop server
+ * status checking jobs.
+ * <p/>
+ * It is possible to call this method for the same GlassFisg server instance
+ * many times. Server instance will be removed only if it is registered.
+ * <p/>
+ * @param srv Payara server instance to be removed.
+ * @return Value of <code>true</code> when server instance was successfully
+ * removed from scheduler and status checking job was stopped
+ * or <code>false</code> when server instance was not registered.
+ */
+ public static boolean remove(final PayaraServer srv) {
+ return StatusScheduler.getInstance().remove(srv);
+ }
+
+ /**
+ * Suspend server status monitoring for GlassFisg server instance.
+ * <p/>
+ * @param srv Payara server instance for which to suspend monitoring.
+ * @return Value of <code>true</code> when server instance monitoring
+ * was suspended or <code>false</code> when server instance
+ * is not registered.
+ */
+ public static boolean suspend(final PayaraServer srv) {
+ return StatusScheduler.getInstance().suspend(srv);
+ }
+
+ /**
+ * Register server status listener to be notified about current server
+ * status after every check.
+ * <p/>
+ * @param srv Payara server instance being monitored.
+ * @param listener Server status listener to be registered.
+ * @return Value of <code>true</code> when listener was added
+ * or <code>false</code> when this listener was already registered
+ * or Payara server instance was not registered.
+ */
+ public static boolean addCheckListener(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ final StatusJob job = StatusScheduler.getInstance().getJob(srv);
+ if (job != null) {
+ return job.addCurrStatusListener(listener);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Register server status listener to be notified about server status
+ * change.
+ * <p/>
+ * @param srv Payara server instance being monitored.
+ * @param listener Server status listener to be registered.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when listener was added in at least
+ * one list or <code>false</code> when this listener was already
+ * registered in all requested lists or Payara server instance
+ * was not registered.
+ */
+ public static boolean addChangeListener(final PayaraServer srv,
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ final StatusJob job = StatusScheduler.getInstance().getJob(srv);
+ if (job != null) {
+ return job.addNewStatusListener(listener, newState);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Register server status listener to be notified about server status
+ * change.
+ * <p/>
+ * @param srv Payara server instance being monitored.
+ * @param listener Server status listener to be registered.
+ * @return Value of <code>true</code> when listener was added in at least
+ * one list or <code>false</code> when this listener was already
+ * registered in all requested lists or Payara server instance
+ * was not registered.
+ */
+ public static boolean addErrorListener(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ final StatusJob job = StatusScheduler.getInstance().getJob(srv);
+ if (job != null) {
+ return job.addErrorListener(listener);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Register server status listener.
+ * <p/>
+ * @param srv Payara server instance being monitored.
+ * @param listener Server status listener to be registered.
+ * @param currentState Notify about current server status after every check
+ * when <code>true</code>.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when listener was added in at least
+ * one list or <code>false</code> when this listener was already
+ * registered in all requested lists or Payara server instance
+ * was not registered.
+ */
+ public static boolean addListener(final PayaraServer srv,
+ final PayaraStatusListener listener, final boolean currentState,
+ final PayaraStatus... newState) {
+ final StatusJob job = StatusScheduler.getInstance().getJob(srv);
+ if (job != null) {
+ return job.addStatusListener(listener, currentState, newState);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Unregister server status listener.
+ * <p/>
+ * @param srv Payara server instance being monitored.
+ * @param listener Server status listener to be unregistered.
+ * @return Value of <code>true</code> when listener was found and removed
+ * or <code>false</code> when listener was not found among
+ * registered listeners or Payara server instance was not
+ * registered.
+ */
+ public static boolean removeListener(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ final StatusJob job = StatusScheduler.getInstance().getJob(srv);
+ if (job != null) {
+ return job.removeStatusListener(listener);
+ } else {
+ return false;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraStatus</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ final String METHOD = "toString";
+ switch (this) {
+ case UNKNOWN: return UNKNOWN_STR;
+ case OFFLINE: return OFFLINE_STR;
+ case STARTUP: return STARTUP_STR;
+ case ONLINE: return ONLINE_STR;
+ case SHUTDOWN: return SHUTDOWN_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new DataException(
+ LOGGER.excMsg(METHOD, "invalidState"));
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatusListener.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatusListener.java
new file mode 100644
index 0000000..ad6f1ad
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraStatusListener.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+
+/**
+ * Payara server status listener.
+ * <p/>
+ * Receives notifications about every Payara server status check result
+ * or about Payara server status changes.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public interface PayaraStatusListener {
+
+ /**
+ * Callback to notify about current server status after every check
+ * when enabled.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ public void currentState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task);
+
+ /**
+ * Callback to notify about server status change when enabled.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param status Current server status.
+ * @param task Last Payara server status check task details.
+ */
+ public void newState(final PayaraServer server,
+ final PayaraStatus status, final PayaraStatusTask task);
+
+ /**
+ * Callback to notify about server status check failures.
+ * <p/>
+ * @param server Payara server instance being monitored.
+ * @param task Payara server status check task details.
+ */
+ public void error(final PayaraServer server,
+ final PayaraStatusTask task);
+
+ /**
+ * Callback to notify about status listener being registered.
+ * <p/>
+ * May be called multiple times for individual event sets during
+ * registration phase.
+ */
+ public void added();
+
+ /**
+ * Callback to notify about status listener being unregistered.
+ * <p/>
+ * Will be called once during listener removal phase when was found
+ * registered for at least one event set.
+ */
+ public void removed();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraToolsConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraToolsConfig.java
new file mode 100644
index 0000000..822388c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/PayaraToolsConfig.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * GlassFisg Tooling Library configuration.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraToolsConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(PayaraToolsConfig.class);
+
+ /** Proxy settings usage for loopback addresses. */
+ private static volatile boolean proxyForLoopback = true;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Do not use proxy settings for loopback addresses.
+ */
+ public static void noProxyForLoopback() {
+ proxyForLoopback = false;
+ }
+
+ /**
+ * Use proxy settings for loopback addresses.
+ * <p/>
+ * This is default behavior.
+ */
+ public static void useProxyForLoopback() {
+ proxyForLoopback = true;
+ }
+
+ /**
+ * Get proxy settings usage for loopback addresses configuration value.
+ * <p/>
+ * @return Proxy settings usage for loopback addresses configuration value.
+ */
+ public static boolean getProxyForLoopback() {
+ return proxyForLoopback;
+ }
+
+}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskEvent.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskEvent.java
new file mode 100644
index 0000000..f059742
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskEvent.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Events that caused state of Payara server administration command execution
+ * change.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum TaskEvent {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Task queued for execution. */
+ SUBMIT,
+ /** Start of task. */
+ START,
+ /** Exception in task. */
+ EXCEPTION,
+ /** Illegal task state. */
+ ILLEGAL_STATE,
+ /** Missing server process. */
+ PROCESS_NOT_EXISTS,
+ /** Process not running. */
+ PROCESS_NOT_RUNNING,
+ /** Server command running. */
+ CMD_RUNNING,
+ /** Server command exception. */
+ CMD_EXCEPTION,
+ /** Server command completed. */
+ CMD_COMPLETED,
+ /** Server command failed. */
+ CMD_FAILED,
+ /** Authorization failed on HTTP protocol level (401 or 403 response).
+ * This is usually handled by java.net.Authenticator. */
+ AUTH_FAILED_HTTP,
+ /** Authorization failed on asadmin response level (response
+ * in Manifest). Here java.net.Authenticator does nothing. */
+ AUTH_FAILED,
+ /** Empty message received. */
+ EMPTY_MESSAGE,
+ /** Java VM not found. */
+ NO_JAVA_VM,
+ /** Java VM version is wrong. */
+ WRONG_JAVA_VM,
+ /** Java VM execution failed. */
+ JAVA_VM_EXEC_FAILED,
+ /** Signals wrong proxy settings. */
+ BAD_GATEWAY;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** A <code>String</code> representation of SUBMIT value. */
+ private static final String SUBMIT_STR = "Submit";
+
+ /** A <code>String</code> representation of START value. */
+ private static final String START_STR = "Start";
+
+ /** A <code>String</code> representation of EXCEPTION value. */
+ private static final String EXCEPTION_STR = "Exception";
+
+ /** A <code>String</code> representation of ILLEGAL_STATE value. */
+ private static final String ILLEGAL_STATE_STR = "IllegalState";
+
+ /** A <code>String</code> representation of PROCESS_NOT_EXISTS value. */
+ private static final String PROCESS_NOT_EXISTS_STR = "ProcessNotExists";
+
+ /** A <code>String</code> representation of PROCESS_NOT_RUNNING value. */
+ private static final String PROCESS_NOT_RUNNING_STR = "ProcessNotRunning";
+
+ /** A <code>String</code> representation of CMD_RUNNING value. */
+ private static final String CMD_RUNNING_STR = "CmdRunning";
+
+ /** A <code>String</code> representation of CMD_EXCEPTION value. */
+ private static final String CMD_EXCEPTION_STR = "CmdException";
+
+ /** A <code>String</code> representation of CMD_COMPLETED value. */
+ private static final String CMD_COMPLETED_STR = "CmdCompleted";
+
+ /** A <code>String</code> representation of CMD_FAILED value. */
+ private static final String CMD_FAILED_STR = "CmdFailed";
+
+ /** A <code>String</code> representation of AUTH_FAILED_HTTP value. */
+ private static final String AUTH_FAILED_HTTP_STR = "AuthFailedHttp";
+
+ /** A <code>String</code> representation of AUTH_FAILED value. */
+ private static final String AUTH_FAILED_STR = "AuthFailed";
+
+ /** A <code>String</code> representation of EMPTY_MESSAGE value. */
+ private static final String EMPTY_MESSAGE_STR = "EmptyMessage";
+
+ /** A <code>String</code> representation of NO_JAVA_VM value. */
+ private static final String NO_JAVA_VM_STR = "NoJavaVm";
+
+ /** A <code>String</code> representation of NO_JAVA_VM value. */
+ private static final String WRONG_JAVA_VM_STR = "WrongJavaVm";
+
+ /** A <code>String</code> representation of JAVA_VM_EXEC_FAILED value. */
+ private static final String JAVA_VM_EXEC_FAILED_STR = "JavaVmExecFailed";
+
+ /** A <code>String</code> representation of BAD_GATEWAY value. */
+ private static final String BAD_GATEWAY_STR = "BadGateway";
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, TaskEvent> stringValuesMap
+ = new HashMap(values().length);
+
+ // Initialize backward String conversion <code>Map</code>.
+ static {
+ for (TaskEvent state : TaskEvent.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>TaskEvent</code> with a value represented by the
+ * specified <code>String</code>. The <code>TaskEvent</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param eventStr Value containing <code>TaskEvent</code>
+ * <code>toString</code> representation.
+ * @return <code>TaskEvent</code> value represented by <code>String</code>
+ * or <code>null</code> if value was not recognized.
+ */
+ public static TaskEvent toValue(String eventStr) {
+ if (eventStr != null) {
+ return (stringValuesMap.get(eventStr.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>TaskEvent</code> value to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case SUBMIT: return SUBMIT_STR;
+ case START: return START_STR;
+ case EXCEPTION: return EXCEPTION_STR;
+ case ILLEGAL_STATE: return ILLEGAL_STATE_STR;
+ case PROCESS_NOT_EXISTS: return PROCESS_NOT_EXISTS_STR;
+ case PROCESS_NOT_RUNNING: return PROCESS_NOT_RUNNING_STR;
+ case CMD_RUNNING: return CMD_RUNNING_STR;
+ case CMD_EXCEPTION: return CMD_EXCEPTION_STR;
+ case CMD_COMPLETED: return CMD_COMPLETED_STR;
+ case CMD_FAILED: return CMD_FAILED_STR;
+ case AUTH_FAILED_HTTP: return AUTH_FAILED_HTTP_STR;
+ case AUTH_FAILED: return AUTH_FAILED_STR;
+ case EMPTY_MESSAGE: return EMPTY_MESSAGE_STR;
+ case NO_JAVA_VM: return NO_JAVA_VM_STR;
+ case WRONG_JAVA_VM: return WRONG_JAVA_VM_STR;
+ case JAVA_VM_EXEC_FAILED: return JAVA_VM_EXEC_FAILED_STR;
+ case BAD_GATEWAY: return BAD_GATEWAY_STR;
+ // This is unrecheable. Returned null value means that some
+ // enum value is not handled correctly.
+ default: return null;
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskState.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskState.java
new file mode 100644
index 0000000..c61c32c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskState.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Current state of Payara server administration command execution
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum TaskState {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Value representing task waiting in executor queue. */
+ READY,
+
+ /** Value representing running task. */
+ RUNNING,
+
+ /** Value representing successfully completed task (with no errors). */
+ COMPLETED,
+
+ /** Value representing failed task. */
+ FAILED;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** A <code>String</code> representation of READY value. */
+ private static final String READY_STR = "READY";
+
+ /** A <code>String</code> representation of RUNNING value. */
+ private static final String RUNNING_STR = "RUNNING";
+
+ /** A <code>String</code> representation of COMPLETED value. */
+ private static final String COMPLETED_STR = "COMPLETED";
+
+ /** A <code>String</code> representation of FAILED value. */
+ private static final String FAILED_STR = "FAILED";
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, TaskState> stringValuesMap
+ = new HashMap(values().length);
+
+ // Initialize backward String conversion <code>Map</code>.
+ static {
+ for (TaskState state : TaskState.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>TaskState</code> with a value represented by the
+ * specified <code>String</code>. The <code>TaskState</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param stateStr Value containing <code>TaskState</code>
+ * <code>toString</code> representation.
+ * @return <code>TaskState</code> value represented by <code>String</code>
+ * or <code>null</code> if value was not recognized.
+ */
+ public static TaskState toValue(final String stateStr) {
+ if (stateStr != null) {
+ return (stringValuesMap.get(stateStr.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>TaskState</code> value to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case READY: return READY_STR;
+ case RUNNING: return RUNNING_STR;
+ case COMPLETED: return COMPLETED_STR;
+ case FAILED: return FAILED_STR;
+ // This is unrecheable. Returned null value means that some
+ // enum value is not handled correctly.
+ default: return null;
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskStateListener.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskStateListener.java
new file mode 100644
index 0000000..08b0855
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/TaskStateListener.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+/**
+ * Payara server administration command execution state report callback.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface TaskStateListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Interface Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Callback to notify about Payara server administration command
+ * execution state change.
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args Additional String arguments.
+ */
+ public void operationStateChanged(TaskState newState, TaskEvent event,
+ String... args);
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ActionReport.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ActionReport.java
new file mode 100644
index 0000000..b0d4b2b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ActionReport.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Represents response returned from server after command execution.
+ * <p>
+ * Inspired by ActionReport class from module GF Admin Rest Service.
+ * In our case the interface allows just read-only access.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface ActionReport {
+
+ public enum ExitCode { SUCCESS, WARNING, FAILURE };
+
+ public ExitCode getExitCode();
+
+ public String getMessage();
+
+ public String getCommand();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactory.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactory.java
new file mode 100644
index 0000000..7dce7d9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactory.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.data.PayaraAdminInterface;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Abstract Server Command Factory.
+ * <p/>
+ * Selects correct Payara server administration functionality depending
+ * on given Payara server entity object.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ * @author Gaurav Gupta
+ */
+public abstract class AdminFactory {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(AdminFactory.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates specific <code>AdminFactory</code> child class instance
+ * to build Payara server administration command runner and data objects
+ * based on provided Payara server version.
+ * <p>
+ * @param version Payara server version.
+ * @return Child factory class instance to work with given Payara server.
+ */
+ static AdminFactory getInstance(final PayaraVersion version)
+ throws CommandException {
+ switch (version) {
+ // Use HTTP interface for older than 3.
+
+ // Use REST interface for Payara 4.
+ case PF_4_1_144:
+ case PF_4_1_151:
+ case PF_4_1_153:
+ case PF_4_1_1_154:
+ case PF_4_1_1_161:
+ case PF_4_1_1_162:
+ case PF_4_1_1_163:
+ case PF_4_1_1_171:
+ case PF_4_1_2_172:
+ case PF_4_1_2_173:
+ case PF_4_1_2_174:
+ case PF_4_1_2_181:
+ case PF_5_181:
+ case PF_5_182:
+ case PF_5_183:
+ case PF_5_184:
+ case PF_5_191:
+ case PF_5_192:
+ return AdminFactoryRest.getInstance();
+ // Anything else is not unknown.
+ default:
+ throw new CommandException(CommandException.UNKNOWN_VERSION);
+ }
+ }
+
+ /**
+ * Creates specific <code>AdminFactory</code> child class instance
+ * to build Payara server administration command runner and data objects
+ * based on provided Payara server administration interface type.
+ * <p/>
+ * @param adminInterface Payara server administration interface type.
+ * @return Child factory class instance to work with given Payara server.
+ */
+ public static AdminFactory getInstance(
+ final PayaraAdminInterface adminInterface) throws CommandException {
+ switch (adminInterface) {
+ case REST: return AdminFactoryRest.getInstance();
+ case HTTP: return AdminFactoryHttp.getInstance();
+ // Anything else is unknown.
+ default:
+ throw new CommandException(
+ CommandException.UNKNOWN_ADMIN_INTERFACE);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build runner for command interface execution and connect it with
+ * provided <code>Command</code> instance.
+ * <p/>
+ * @param srv Target Payara server.
+ * @param cmd Payara server administration command entity.
+ * @return Payara server administration command execution object.
+ */
+ public abstract Runner getRunner(
+ final PayaraServer srv, final Command cmd);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of selected <code>Runner</code> child class.
+ * <p/>
+ * @param srv Target Payara server.
+ * @param cmd Payara server administration command entity.
+ * @param runnerClass Class of newly instantiated <code>runner</code>
+ * @return Payara server administration command execution object.
+ * @throws <code>CommandException</code> if construction of new instance
+ * fails.
+ */
+ Runner newRunner(final PayaraServer srv, final Command cmd,
+ final Class runnerClass) throws CommandException {
+ final String METHOD = "newRunner";
+ Constructor<Runner> con = null;
+ Runner runner = null;
+ try {
+ con = runnerClass.getConstructor(PayaraServer.class, Command.class);
+ } catch (NoSuchMethodException | SecurityException nsme) {
+ throw new CommandException(CommandException.RUNNER_INIT, nsme);
+ }
+ if (con == null) {
+ return runner;
+ }
+ try {
+ runner = con.newInstance(srv, cmd);
+ } catch (InstantiationException | IllegalAccessException ie) {
+ throw new CommandException(CommandException.RUNNER_INIT, ie);
+ } catch (InvocationTargetException ite) {
+ LOGGER.log(Level.WARNING, "exceptionMsg", ite.getMessage());
+ Throwable t = ite.getCause();
+ if (t != null) {
+ LOGGER.log(Level.WARNING, "cause", t.getMessage());
+ }
+ throw new CommandException(CommandException.RUNNER_INIT, ite);
+ }
+ return runner;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryHttp.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryHttp.java
new file mode 100644
index 0000000..b44eafe
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryHttp.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server HTTP Command Factory.
+ * <p>
+ * Selects correct Payara server administration functionality using HTTP
+ * command interface.
+ * <p>
+ * Factory is implemented as singleton.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class AdminFactoryHttp extends AdminFactory {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Singleton object instance. */
+ private static volatile AdminFactoryHttp instance;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Return existing singleton instance of this class or create a new one
+ * when no instance exists.
+ * <p>
+ * @return <code>AdminFactoryHttp</code> singleton instance.
+ */
+ static AdminFactoryHttp getInstance() {
+ if (instance != null) {
+ return instance;
+ }
+ synchronized (AdminFactoryHttp.class) {
+ if (instance == null) {
+ instance = new AdminFactoryHttp();
+ }
+ }
+ return instance;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build runner for HTTP command interface execution and connect it with
+ * provided <code>Command</code> instance.
+ * <p>
+ * @param srv Payara server entity object.
+ * @param cmd Payara server administration command entity.
+ * @return Payara server administration command execution object.
+ */
+ @Override
+ public Runner getRunner(final PayaraServer srv, final Command cmd) {
+ Runner runner;
+ Class cmcClass = cmd.getClass();
+ RunnerHttpClass rc = (RunnerHttpClass)cmcClass.getAnnotation(
+ RunnerHttpClass.class);
+ if (rc != null) {
+ Class runnerClass = rc.runner();
+ String command = rc.command();
+ runner = newRunner(srv, cmd, runnerClass);
+ if (command != null && command.length() > 0) {
+ cmd.command = command;
+ }
+ }
+ else {
+ runner = new RunnerHttp(srv, cmd);
+ }
+ return runner;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryRest.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryRest.java
new file mode 100644
index 0000000..34703f9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryRest.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server REST Command Factory.
+ * <p>
+ * Selects correct Payara server administration functionality using REST
+ * command interface.
+ * <p>
+ * Factory is implemented as singleton.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class AdminFactoryRest extends AdminFactory {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Singleton object instance. */
+ private static volatile AdminFactoryRest instance;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Return existing singleton instance of this class or create a new one
+ * when no instance exists.
+ * <p>
+ * @return <code>AdminFactoryRest</code> singleton instance.
+ */
+ static AdminFactoryRest getInstance() {
+ if (instance != null) {
+ return instance;
+ }
+ synchronized (AdminFactoryRest.class) {
+ if (instance == null) {
+ instance = new AdminFactoryRest();
+ }
+ }
+ return instance;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build runner for REST command interface execution and connect it with
+ * provided <code>Command</code> instance.
+ * <p>
+ * @param srv Payara server entity object.
+ * @param cmd Payara server administration command entity.
+ * @return Payara server administration command execution object.
+ */
+ @Override
+ public Runner getRunner(final PayaraServer srv, final Command cmd) {
+ Runner runner;
+ Class cmcClass = cmd.getClass();
+ RunnerRestClass rc = (RunnerRestClass)cmcClass.getAnnotation(
+ RunnerRestClass.class);
+ if (rc != null) {
+ Class runnerClass = rc.runner();
+ String command = rc.command();
+ runner = newRunner(srv, cmd, runnerClass);
+ if (command != null && command.length() > 0) {
+ cmd.command = command;
+ }
+ }
+ else {
+ runner = new RunnerRest(srv, cmd);
+ }
+ return runner;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Command.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Command.java
new file mode 100644
index 0000000..0e63b90
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Command.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara server administration command entity.
+ * <p/>
+ * Holds common data for administration command.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Server command represented by this object. */
+ protected String command;
+
+ /** Indicate whether we shall retry command execution. */
+ protected boolean retry = false;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server administration command entity
+ * with specified server command.
+ * <p/>
+ * @param command Server command represented by this object.
+ */
+ protected Command(final String command) {
+ this.command = command;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns server command represented by this object. Set in constructor.
+ * e.g. "deploy", "list-applications", etc.
+ * <p/>
+ * @return command string represented by this object.
+ */
+ public String getCommand() {
+ return command;
+ }
+
+ // This is also kind of getter.
+ /**
+ * Sometimes (e.g. during startup), the server does not accept commands. In
+ * such cases, it will block for 20 seconds and then return with the message
+ * "V3 cannot process this command at this time, please wait".
+ * <p/>
+ * In such cases, we set a flag and have the option to reissue the command.
+ * <p/>
+ * @return true if server responded with it's "please wait" message.
+ */
+ public boolean retry() {
+ return retry;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandAddResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandAddResources.java
new file mode 100644
index 0000000..9281214
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandAddResources.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+import java.util.concurrent.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command registers resources defined in provided xml file on specified target.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+@RunnerHttpClass(runner=RunnerHttpAddResources.class)
+@RunnerRestClass(runner=RunnerRestAddResources.class)
+public class CommandAddResources extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandAddResources.class);
+
+ /** Command string for create-cluster command. */
+ private static final String COMMAND = "add-resources";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add resource to target server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param xmlResourceFile File object pointing to XML file containing
+ * resources to be added.
+ * @param target Payara server target.
+ * @return Add resource task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString addResource(final PayaraServer server,
+ final File xmlResourceFile, final String target)
+ throws PayaraIdeException {
+ final String METHOD = "addResource";
+ Command command = new CommandAddResources(xmlResourceFile, target);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exception"), ie);
+ }
+ }
+
+ /**
+ * Add resource to target server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param xmlResourceFile File object pointing to XML file containing
+ * resources to be added.
+ * @param target Payara server target.
+ * @param timeout Administration command execution timeout [ms].
+ * @return Add resource task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString addResource(final PayaraServer server,
+ final File xmlResourceFile, final String target, final long timeout)
+ throws PayaraIdeException {
+ final String METHOD = "addResource";
+ Command command = new CommandAddResources(xmlResourceFile, target);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exception"), ie);
+ } catch (TimeoutException te) {
+ throw new PayaraIdeException(LOGGER.excMsg(METHOD,
+ "exceptionWithTimeout", Long.toString(timeout)), te);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** File object pointing to xml file that contains resources to be added. */
+ File xmlResFile;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server add-resources command entity.
+ * <p/>
+ * @param xmlResourceFile File object pointing to XML file containing
+ * resources to be added.
+ * @param target Payara server target.
+ */
+ public CommandAddResources(
+ final File xmlResourceFile, final String target) {
+ super(COMMAND, target);
+ xmlResFile = xmlResourceFile;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandChangeAdminPassword.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandChangeAdminPassword.java
new file mode 100644
index 0000000..17350a0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandChangeAdminPassword.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara server change administrator's password administration
+ * command entity.
+ * <p/>
+ * @author Tomas Kraus
+ */
+@RunnerHttpClass(runner=RunnerAsadminChangeAdminPassword.class)
+@RunnerRestClass(runner=RunnerAsadminChangeAdminPassword.class)
+public class CommandChangeAdminPassword extends CommandJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for change administrator's password command. */
+ private static final String COMMAND = "change-admin-password";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara administrator's new password to be set.
+ * Value of <code>null</code> or empty <code>String</code> means
+ * no password. */
+ final String password;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server administration command entity
+ * with specified server command, Java SE home and class path.
+ * <p/>
+ * @param javaHome Java SE home used to select JRE for Payara server.
+ * @param password Payara administrator's new password to be set.
+ */
+ public CommandChangeAdminPassword(final String javaHome,
+ final String password) {
+ super(COMMAND, javaHome);
+ this.password = password;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateAdminObject.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateAdminObject.java
new file mode 100644
index 0000000..75482f3
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateAdminObject.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Map;
+
+/**
+ * Command that creates administered object with the specified JNDI name and
+ * the interface definition for a resource adapter on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateAdminObject.class)
+public class CommandCreateAdminObject extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create administered object command. */
+ private static final String COMMAND = "create-admin-object";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** The JNDI name of this JDBC resource. */
+ final String jndiName;
+
+ /** Resource type. */
+ final String resType;
+
+ /** The name of the resource adapter associated with this administered
+ * object. */
+ final String raName;
+
+ /** Optional properties for configuring administered object. */
+ final Map<String, String> properties;
+
+ /** If this object is enabled. */
+ final boolean enabled;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create administered object
+ * command entity.
+ * <p/>
+ * @param jndiName The JNDI name of this JDBC resource.
+ * @param resType Resource type.
+ * @param raName The name of the resource adapter associated with
+ * this administered object.
+ * @param properties Optional properties for configuring the pool.
+ * @param enabled If this object is enabled.
+ */
+ public CommandCreateAdminObject(final String jndiName,
+ final String resType, final String raName,
+ final Map<String, String> properties, final boolean enabled) {
+ super(COMMAND);
+ this.resType = resType;
+ this.jndiName = jndiName;
+ this.raName = raName;
+ this.properties = properties;
+ this.enabled = enabled;
+ }
+
+ /**
+ * Constructs an instance of Payara server create administered object
+ * command entity.
+ * <p/>
+ * This object will be enabled on server by default.
+ * <p/>
+ * @param jndiName The JNDI name of this JDBC resource.
+ * @param resType Resource type.
+ * @param raName The name of the resource adapter associated with
+ * this administered object.
+ * @param properties Optional properties for configuring the pool.
+ */
+ public CommandCreateAdminObject(final String jndiName,
+ final String resType, final String raName,
+ final Map<String, String> properties) {
+ this(jndiName, resType, raName, properties, true);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateCluster.java
new file mode 100644
index 0000000..4520a8c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateCluster.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Cerate Cluster Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestCreateCluster.class)
+public class CommandCreateCluster extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create-cluster command. */
+ private static final String COMMAND = "create-cluster";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create-cluster command entity.
+ * <p/>
+ * @param clusterName Name of the created cluster.
+ */
+ public CommandCreateCluster(String clusterName) {
+ super(COMMAND, clusterName);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnector.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnector.java
new file mode 100644
index 0000000..15bb634
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnector.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Map;
+
+/**
+ * Command that creates connector resource with the specified JNDI name and
+ * the interface definition for a resource adapter on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateConnector.class)
+@RunnerRestClass(runner = RunnerRestCreateConnector.class)
+public class CommandCreateConnector extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create connector resource command. */
+ private static final String COMMAND = "create-connector-resource";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** The JNDI name of this connector resource. */
+ final String jndiName;
+
+ /** Connection pool unique name (and ID). */
+ final String poolName;
+
+ /** Optional properties for configuring the resource. */
+ final Map<String, String> properties;
+
+ /** If this object is enabled. */
+ final boolean enabled;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create connector resource
+ * command entity.
+ * <p/>
+ * @param jndiName The JNDI name of this connector resource.
+ * @param poolName Connection pool unique name (and ID).
+ * @param properties Optional properties for configuring the pool.
+ * @param enabled If this object is enabled.
+ * @param target Name of the cluster or instance where the resource
+ * will be created.
+ */
+ public CommandCreateConnector(final String jndiName, final String poolName,
+ final Map<String, String> properties, final boolean enabled, final
+ String target) {
+ super(COMMAND, target);
+ this.jndiName = jndiName;
+ this.poolName = poolName;
+ this.properties = properties;
+ this.enabled = enabled;
+ }
+
+ /**
+ * Constructs an instance of Payara server create connector resource
+ * command entity.
+ * <p/>
+ * @param jndiName The JNDI name of this connector resource.
+ * @param poolName Connection pool unique name (and ID).
+ * @param properties Optional properties for configuring the pool.
+ * @param enabled If this object is enabled.
+ */
+ public CommandCreateConnector(final String jndiName, final String poolName,
+ final Map<String, String> properties, final boolean enabled) {
+ this(jndiName, poolName, properties, enabled, null);
+ }
+
+
+
+ /**
+ * Constructs an instance of Payara server create connector resource
+ * command entity.
+ * <p/>
+ * This object will be enabled on server by default.
+ * <p/>
+ * @param jndiName The JNDI name of this connector resource.
+ * @param poolName Connection pool unique name (and ID).
+ * @param properties Optional properties for configuring the pool.
+ */
+ public CommandCreateConnector(final String jndiName, final String poolName,
+ final Map<String, String> properties) {
+ this(jndiName, poolName, properties, true);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnectorConnectionPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnectorConnectionPool.java
new file mode 100644
index 0000000..5ad6d72
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateConnectorConnectionPool.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Map;
+
+/**
+ * Command that creates a pool of connections to an enterprise information
+ * system (EIS).
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateConnectorConnectionPool.class)
+@RunnerRestClass(runner = RunnerRestCreateConnectorPool.class)
+public class CommandCreateConnectorConnectionPool extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create EIS connection pool command. */
+ private static final String COMMAND = "create-connector-connection-pool";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Connection pool unique name (and ID). */
+ final String poolName;
+
+ /** The name of the resource adapter. */
+ final String raName;
+
+ /** The name of the connection definition. */
+ final String connectionDefinition;
+
+ /** Optional properties for configuring the pool.
+ * <p/>
+ * <table>
+ * <tr><td><b>LazyConnectionEnlistment</b></td><td><i>Deprecated.</i> Use
+ * the equivalent option. Default value is false.</td></tr>
+ * <tr><td><b>LazyConnectionAssociation</b></td><td><i>Deprecated.</i> Use
+ * the equivalent option. Default value is false.</td></tr>
+ * <tr><td><b>AssociateWithThread</b></td><td><i>Deprecated.</i> Use
+ * the equivalent option. Default value is false.</td></tr>
+ * <tr><td><b>MatchConnections</b></td><td><i>Deprecated.</i> Use
+ * the equivalent option. Default value is false.</td></tr>
+ * </table> */
+ final Map<String, String> properties;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create EIS connection pool
+ * command entity.
+ * <p/>
+ * @param poolName Connection pool unique name (and ID).
+ * @param raName The name of the resource adapter.
+ * @param connectionDefinition The name of the connection definition.
+ * @param properties Optional properties for configuring the resource.
+ */
+ public CommandCreateConnectorConnectionPool(final String poolName,
+ final String raName, final String connectionDefinition,
+ final Map<String, String> properties) {
+ super(COMMAND);
+ this.poolName = poolName;
+ this.raName = raName;
+ this.connectionDefinition = connectionDefinition;
+ this.properties = properties;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateInstance.java
new file mode 100644
index 0000000..74f9021
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateInstance.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Create Instance Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateInstance.class)
+@RunnerRestClass(runner=RunnerRestCreateInstance.class)
+public class CommandCreateInstance extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create-instance command. */
+ private static final String COMMAND = "create-instance";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Target Payara node where instance will be created. */
+ final String node;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create-instance command entity.
+ * <p/>
+ * @param name Name of instance to create.
+ * @param target Target Payara cluster or <code>null</code> for
+ * standalone instance.
+ * @param node Target Payara node where instance will be created.
+ */
+ public CommandCreateInstance(String name, String target, String node) {
+ super(COMMAND, name, target);
+ this.node = node;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCConnectionPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCConnectionPool.java
new file mode 100644
index 0000000..5663642
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCConnectionPool.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Map;
+import java.util.concurrent.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that creates JDBC connection pool on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateJDBCConnectionPool.class)
+@RunnerRestClass(runner=RunnerRestCreateJDBCConnectionPool.class)
+public class CommandCreateJDBCConnectionPool extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create JDBC connection pool command. */
+ private static final String COMMAND = "create-jdbc-connection-pool";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE
+ = "Create JDBC connection pool failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * create JDBC connection pool.
+ * <p/>
+ * @param server Payara server entity.
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param dataSourceClassName The name of the vendor-supplied JDBC data
+ * source resource manager.
+ * @param resType Resource type.
+ * @param properties Optional properties for configuring the pool.
+ * @return Create JDBC connection pool task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString createJDBCConnectionPool(
+ final PayaraServer server, final String connectionPoolId,
+ final String dataSourceClassName, final String resType,
+ final Map<String, String> properties) throws PayaraIdeException {
+ Command command = new CommandCreateJDBCConnectionPool(connectionPoolId,
+ dataSourceClassName, resType, properties);
+ Future<ResultString> future = ServerAdmin
+ .<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ /**
+ * Create JDBC connection pool.
+ * <p/>
+ * @param server Payara server entity.
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param dataSourceClassName The name of the vendor-supplied JDBC data
+ * source resource manager.
+ * @param resType Resource type.
+ * @param properties Optional properties for configuring the pool.
+ * @param timeout Administration command execution timeout [ms].
+ * @return Create JDBC connection pool task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString createJDBCConnectionPool(
+ final PayaraServer server, final String connectionPoolId,
+ final String dataSourceClassName, final String resType,
+ final Map<String, String> properties, final long timeout)
+ throws PayaraIdeException {
+ Command command = new CommandCreateJDBCConnectionPool(connectionPoolId,
+ dataSourceClassName, resType, properties);
+ Future<ResultString> future = ServerAdmin
+ .<ResultString>exec(server, command);
+ try {
+ return future.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ } catch (TimeoutException te) {
+ throw new PayaraIdeException(
+ ERROR_MESSAGE + " in " + timeout + "ms", te);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Connection pool unique name (and ID). */
+ final String connectionPoolId;
+
+ /** The name of the vendor-supplied JDBC data source resource manager. */
+ final String dataSourceClassName;
+
+ /** Resource type. */
+ final String resType;
+
+ /** Optional properties for configuring the pool.
+ * <p/><table>
+ * <tr><td><b>user</b></td><td>Specifies the user name for connecting to
+ * the database.</td></tr>
+ * <tr><td><b>password</b></td><td>Specifies the password for connecting
+ * to the database.</td></tr>
+ * <tr><td><b>databaseName</b></td><td>Specifies the database for this
+ * connection pool.</td></tr>
+ * <tr><td><b>serverName</b></td><td>Specifies the database server for
+ * this connection pool.</td></tr>
+ * <tr><td><b>port</b></td><td>Specifies the port on which the database
+ * server listens for requests.</td></tr>
+ * <tr><td><b>networkProtocol</b></td><td>Specifies the communication
+ * protocol.</td></tr>
+ * <tr><td><b>roleName</b></td><td>Specifies the initial SQL role
+ * name.</td></tr>
+ * <tr><td><b>datasourceName</b></td><td>Specifies an underlying
+ * XADataSource, or a ConnectionPoolDataSource if connection pooling
+ * is done.</td></tr>
+ * <tr><td><b>description</b></td><td>Specifies a text
+ * description.</td></tr>
+ * <tr><td><b>url</b></td><td>Specifies the URL for this connection pool.
+ * Although this is not a standard property, it is commonly used.</td></tr>
+ * <tr><td><b>dynamic-reconfiguration-wait-timeout-in-seconds</b></td>
+ * <td>Used to enable dynamic reconfiguration of the connection pool
+ * transparently to the applications that are using the pool, so that
+ * applications need not be re-enabled for the attribute or property changes
+ * to the pool to take effect. Any in-flight transaction's connection
+ * requests will be allowed to complete with the old pool configuration
+ * as long as the connection requests are within the timeout period,
+ * so as to complete the transaction. New connection requests will wait
+ * for the pool reconfiguration to complete and connections will be acquired
+ * using the modified pool configuration.</td></tr>
+ * <tr><td><b>LazyConnectionEnlistment</b></td><td><i>Deprecated.</i>
+ * Use the equivalent attribute. The default value is false.</td></tr>
+ * <tr><td><b>LazyConnectionAssociation</b></td><td>Deprecated.</i> Use
+ * the equivalent attribute. The default value is false.</td></tr>
+ * <tr><td><b>AssociateWithThread</b></td><td><i>Deprecated.</i> Use
+ * the equivalent attribute. The default value is false.</td></tr>
+ * <tr><td><b>MatchConnections</b></td><td><i>Deprecated.</i> Use
+ * the equivalent attribute. The default value is true.</td></tr>
+ * <tr><td><b>Prefer-Validate-Over-Recreate</b></td><td>Specifies whether
+ * pool resizer should validate idle connections before destroying and
+ * recreating them. The default value is true.</td></tr>
+ * <tr><td><b>time-to-keep-queries-in-minutes</b></td><td>Specifies
+ * the number of minutes that will be cached for use in calculating
+ * frequently used queries. Takes effect when SQL tracing and monitoring
+ * are enabled for the JDBC connection pool. The default value is
+ * 5 minutes.</td></tr>
+ * <tr><td><b>number-of-top-queries-to-report</b></td><td>Specifies
+ * the number of queries to list when reporting the top and most frequently
+ * used queries. Takes effect when SQL tracing and monitoring are enabled
+ * for the JDBC connection pool. The default value is 10 queries.</td></tr>
+ * </table> */
+ final Map<String, String> properties;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create JDBC connection pool
+ * command entity.
+ * <p/>
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param dataSourceClassName The name of the vendor-supplied JDBC
+ * data source resource manager.
+ * @param resType Resource type.
+ * @param properties Optional properties for configuring the pool.
+ */
+ public CommandCreateJDBCConnectionPool(final String connectionPoolId,
+ final String dataSourceClassName, final String resType,
+ final Map<String, String> properties) {
+ super(COMMAND);
+ this.connectionPoolId = connectionPoolId;
+ this.dataSourceClassName = dataSourceClassName;
+ this.resType = resType;
+ this.properties = properties;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCResource.java
new file mode 100644
index 0000000..d2deeb5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandCreateJDBCResource.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Map;
+import java.util.concurrent.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that creates JDBC resource on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCreateJDBCResource.class)
+@RunnerRestClass(runner = RunnerRestCreateJDBCResource.class)
+public class CommandCreateJDBCResource extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create JDBC resource command. */
+ private static final String COMMAND = "create-jdbc-resource";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE
+ = "Create JDBC resource failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create JDBC resource.
+ * <p/>
+ * @param server Payara server entity.
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param jndiName The JNDI name of this JDBC resource.
+ * @param target Helps specify the target to which you
+ * are deploying.
+ * @param properties Optional properties for configuring the pool.
+ * @return Create JDBC connection pool task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString createJDBCResource(
+ final PayaraServer server, final String connectionPoolId,
+ final String jndiName, final String target,
+ final Map<String, String> properties) throws PayaraIdeException {
+ Command command = new CommandCreateJDBCResource(connectionPoolId,
+ jndiName, target, properties);
+ Future<ResultString> future = ServerAdmin
+ .<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ /**
+ * Create JDBC resource.
+ * <p/>
+ * @param server Payara server entity.
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param jndiName The JNDI name of this JDBC resource.
+ * @param target Helps specify the target to which you
+ * are deploying.
+ * @param properties Optional properties for configuring the pool.
+ * @param timeout Administration command execution timeout [ms].
+ * @return Create JDBC resource task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString createJDBCResource(
+ final PayaraServer server, final String connectionPoolId,
+ final String jndiName, final String target,
+ final Map<String, String> properties, final long timeout)
+ throws PayaraIdeException {
+ Command command = new CommandCreateJDBCResource(connectionPoolId,
+ jndiName, target, properties);
+ Future<ResultString> future = ServerAdmin
+ .<ResultString>exec(server, command);
+ try {
+ return future.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ } catch (TimeoutException te) {
+ throw new PayaraIdeException(
+ ERROR_MESSAGE + " in " + timeout + "ms", te);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Connection pool unique name (and ID). */
+ final String connectionPoolId;
+
+ /** The JNDI name of this JDBC resource. */
+ final String jndiName;
+
+ /** Helps specify the target to which you are deploying.
+ * <p/>
+ * Valid values are:<br/><table>
+ * <tr><td><b>server</b></td><td>Deploys the component to the default server
+ * instance. This is the default value.</td></tr>
+ * <tr><td><b>domain</b></td><td>Deploys the component to
+ * the domain.</td></tr>
+ * <tr><td><b>cluster_name</b></td><td>Deploys the component to every server
+ * instance in the cluster.</td></tr>
+ * <tr><td><b>instance_name</b></td><td>Deploys the component to
+ * a particular sever instance.</td></tr></table> */
+ final String target;
+
+ /** Optional properties for configuring the resource. */
+ final Map<String, String> properties;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server create JDBC resource
+ * command entity.
+ * <p/>
+ * @param connectionPoolId Connection pool unique name (and ID).
+ * @param jndiName The JNDI name of this JDBC resource.
+ * @param target Specify the target to which you are deploying.
+ * @param properties Optional properties for configuring the resource.
+ */
+ public CommandCreateJDBCResource(final String connectionPoolId,
+ final String jndiName, final String target,
+ final Map<String, String> properties) {
+ super(COMMAND);
+ this.connectionPoolId = connectionPoolId;
+ this.jndiName = jndiName;
+ this.target = target;
+ this.properties = properties;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteCluster.java
new file mode 100644
index 0000000..c5b1914
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteCluster.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Delete Cluster Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestDeleteCluster.class)
+public class CommandDeleteCluster extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for delete-cluster command. */
+ private static final String COMMAND = "delete-cluster";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server delete-cluster command entity.
+ * <p/>
+ * @param target Target Payara instance.
+ */
+ public CommandDeleteCluster(String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteInstance.java
new file mode 100644
index 0000000..97ebbb4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteInstance.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Delete Instance Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpDeleteInstance.class)
+@RunnerRestClass(runner=RunnerRestDeleteInstance.class)
+public class CommandDeleteInstance extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for delete-instance command. */
+ private static final String COMMAND = "delete-instance";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server delete-instance command entity.
+ * <p/>
+ * @param target Target Payara instance.
+ */
+ public CommandDeleteInstance(String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteResource.java
new file mode 100644
index 0000000..e691e82
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeleteResource.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Command that deletes resource from server.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+@RunnerHttpClass(runner=RunnerHttpDeleteResource.class)
+@RunnerRestClass(runner=RunnerRestDeleteResource.class)
+public class CommandDeleteResource extends CommandTarget {
+
+ private static final String COMMAND_PREFIX = "delete-";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Name of the resource. */
+ String name;
+
+ /** Key name that defines the deleted property. */
+ String cmdPropertyName;
+
+ /** Delete also dependent resources. */
+ boolean cascade;
+
+ /**
+ * Constructor for delete resource command entity.
+ * <p/>
+ * @param target Target Payara instance or cluster.
+ * @param name Name of resource to be deleted.
+ * @param resourceCmdSuffix Resource related command suffix. Command string
+ * is build by appending this value after
+ * <code>delete-</code>.
+ * @param cmdPropertyName Name of query property which contains
+ * resource name.
+ * @param cascade Delete also dependent resources.
+ */
+ public CommandDeleteResource(String target, String name,
+ String resourceCmdSuffix, String cmdPropertyName, boolean cascade) {
+ super(COMMAND_PREFIX + resourceCmdSuffix, target);
+ this.name = name;
+ this.cmdPropertyName = cmdPropertyName;
+ this.cascade = cascade;
+ }
+
+ /**
+ * Constructor for delete resource command entity.
+ * <p/>
+ * @param name Name of resource to be deleted.
+ * @param resourceCmdSuffix Resource related command suffix. Command string
+ * is build by appending this value after
+ * <code>delete-</code>.
+ * @param cmdPropertyName Name of query property which contains
+ * resource name.
+ * @param cascade Delete also dependent resources.
+ */
+ public CommandDeleteResource(String name,
+ String resourceCmdSuffix, String cmdPropertyName, boolean cascade) {
+ this(null, name, resourceCmdSuffix, cmdPropertyName, cascade);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeploy.java
new file mode 100644
index 0000000..55f3b04
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDeploy.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Deploy Command Entity.
+ * <p>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpDeploy.class)
+@RunnerRestClass(runner=RunnerRestDeploy.class)
+public class CommandDeploy extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for deploy command. */
+ private static final String COMMAND = "deploy";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE
+ = "Application deployment failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Deploy task that deploys application on server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param application File object representing archive or directory
+ * to be deployed.
+ * @param listener Command execution events listener.
+ * @return Deploy task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString deploy(PayaraServer server, File application,
+ TaskStateListener listener) throws PayaraIdeException {
+ Command command = new CommandDeploy(null, null, application,
+ null, null, null);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command, listener);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** File to deploy. */
+ final File path;
+
+ /** Deployed application context root. */
+ final String contextRoot;
+
+ /** Deployment properties. */
+ final Map<String, String> properties;
+
+ /** Deployment libraries. */
+ final File[] libraries;
+
+ /** Is this deployment of a directory? */
+ final boolean dirDeploy;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server deploy command entity.
+ * <p/>
+ * @param name Name of module/cluster/instance to modify.
+ * @param target Target Payara instance or cluster where
+ * <code>name</code> is stored.
+ * @param path File to deploy.
+ * @param contextRoot Deployed application context root.
+ * @param properties Deployment properties.
+ * @param libraries Not used in actual deploy command.
+ */
+ public CommandDeploy(final String name, final String target,
+ final File path, final String contextRoot,
+ final Map<String,String> properties, final File[] libraries) {
+ super(COMMAND, name, target);
+ this.path = path;
+ this.contextRoot = contextRoot;
+ this.properties = properties;
+ this.libraries = libraries;
+ this.dirDeploy = path.isDirectory();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDisable.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDisable.java
new file mode 100644
index 0000000..f68362d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandDisable.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Disable (a deployed application) Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpEnableDisable.class)
+@RunnerRestClass(runner=RunnerRestDisable.class)
+public class CommandDisable extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for disable command. */
+ private static final String COMMAND = "disable";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server disable command entity.
+ * <p/>
+ * @param name Name of module to disable.
+ * @param target Target Payara instance.
+ */
+ public CommandDisable(String name, String target) {
+ super(COMMAND, name, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandEnable.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandEnable.java
new file mode 100644
index 0000000..1f9e693
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandEnable.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Enable (a deployed application) Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpEnableDisable.class)
+@RunnerRestClass(runner=RunnerRestEnable.class)
+public class CommandEnable extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for enable command. */
+ private static final String COMMAND = "enable";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server enable command entity.
+ * <p/>
+ * @param name Name of module to enable.
+ * @param target Target Payara instance.
+ */
+ public CommandEnable(String name, String target) {
+ super(COMMAND, name, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandException.java
new file mode 100644
index 0000000..1e8e38a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandException.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Payara IDE SDK Exception related to server administration command package
+ * problems.
+ * <p>
+ * All exceptions are logging themselves on WARNING level when created.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Exception message for unsupported Payara version. */
+ static final String UNSUPPORTED_VERSION = "Unsupported Payara version";
+
+ /** Exception message for unknown Payara administration interface
+ * type. */
+ static final String UNKNOWN_ADMIN_INTERFACE =
+ "Unknown Payara administration interface type";
+
+ /** Exception message for unknown Payara version. */
+ static final String UNKNOWN_VERSION = "Unknown Payara version";
+
+ /** Exception message for unsupported operation. */
+ static final String UNSUPPORTED_OPERATION = "Operation is not supported";
+
+ /** Exception message for IOException when reading HTTP response. */
+ static final String HTTP_RESP_IO_EXCEPTION
+ = "Can not read HTTP response, caught IOException";
+ /**
+ * Exception message for exceptions when initializing <code>Runner</code>
+ * object.
+ */
+ static final String RUNNER_INIT = "Cannot initialize Runner class";
+
+ /**
+ * Exception message for exceptions when preparing headers for
+ * HTTP connection.
+ */
+ static final String RUNNER_HTTP_HEADERS
+ = "Cannos set headers for HTTP connection";
+
+ /** Exception message for exceptions when building command URL. */
+ static final String RUNNER_HTTP_URL = "Cannot build HTTP command URL";
+
+ /** Exception message for illegal <code>Command</code> instance provided. */
+ static final String ILLEGAL_COMAND_INSTANCE = "Illegal command instance provided";
+
+ /** Exception message for illegal <code>null</code> value provided. */
+ static final String ILLEGAL_NULL_VALUE
+ = "Value shall not be null";
+
+ /** Exception message for UnsupportedEncodingException when processing
+ * <code>Manifest</code> retrieved from server. */
+ static final String HTTP_RESP_UNS_ENC_EXCEPTION
+ = "Can not read HTTP response, caught UnsupportedEncodingException";
+
+ /** Exception message for invalid server component (application) item. */
+ public static final String MANIFEST_INVALID_COMPONENT_ITEM
+ = "Invalid component item";
+
+ /** Exception message for invalid constant representing <code>boolean</code>
+ * value. */
+ public static final String INVALID_BOOLEAN_CONSTANT
+ = "Invalid String representing boolean constant.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>CommandException</code> without
+ * detail message.
+ */
+ public CommandException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>CommandException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public CommandException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>CommandException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public CommandException(String msg, Object... arguments) {
+ super(msg, arguments);
+ }
+
+ /**
+ * Constructs an instance of <code>CommandException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public CommandException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandFetchLogData.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandFetchLogData.java
new file mode 100644
index 0000000..a1d1763
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandFetchLogData.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server View Log Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerRestFetchLogData.class)
+@RunnerRestClass(runner=RunnerRestFetchLogData.class)
+public class CommandFetchLogData extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for view log command. */
+ private static final String COMMAND = "view-log";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Query parameters to be used to read only log entries added in particular
+ * interval starting from previous call that returned this value of
+ * <code>paramsAppendNext</code> stored in returned <code>ValueLog</code>.
+ * <p/>
+ * Content of HTTP header <code>X-Text-Append-Next</code>.
+ */
+ final String paramsAppendNext;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server view log command entity.
+ * <p/>
+ * All existing log entries will be returned.
+ */
+ public CommandFetchLogData() {
+ super(COMMAND);
+ this.paramsAppendNext = null;
+ }
+
+ /**
+ * Constructs an instance of Payara server view log command entity.
+ * <p/>
+ * Only log entries added in particular interval starting from previous
+ * call that returned this value of <code>paramsAppendNext</code> will
+ * be returned.
+ * <p/>
+ * @param paramsAppendNext Interval query parameters from Last View Log
+ * command execution.
+ */
+ public CommandFetchLogData(String paramsAppendNext) {
+ super(COMMAND);
+ this.paramsAppendNext = paramsAppendNext;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandGetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandGetProperty.java
new file mode 100644
index 0000000..3711b00
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandGetProperty.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that retrieves property (properties) from server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpGetProperty.class)
+@RunnerRestClass(runner=RunnerRestGetProperty.class)
+public class CommandGetProperty extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandGetProperty.class);
+
+ /** Command string for create-cluster command. */
+ private static final String COMMAND = "get";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Pattern that defines properties to retrieve. */
+ String propertyPattern;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve properties from server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param propertyPattern Pattern that defines properties to retrieve.
+ * @return Payara command result containing map with key-value pairs
+ * returned by server.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultMap<String, String> getProperties(
+ final PayaraServer server, final String propertyPattern)
+ throws PayaraIdeException {
+ final String METHOD = "getProperties";
+ Future<ResultMap<String, String>> future =
+ ServerAdmin.<ResultMap<String, String>>exec(
+ server, new CommandGetProperty(propertyPattern));
+ try {
+ return future.get();
+ } catch (ExecutionException | InterruptedException
+ | CancellationException ee) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exception", propertyPattern), ee);
+ }
+ }
+
+ /**
+ * Retrieve properties from server with timeout.
+ * <p/>
+ * @param server Payara server entity.
+ * @param propertyPattern Pattern that defines properties to retrieve.
+ * @param timeout Administration command execution timeout [ms].
+ * @return Payara command result containing map with key-value pairs
+ * returned by server.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultMap<String, String> getProperties(
+ final PayaraServer server, final String propertyPattern,
+ final long timeout)
+ throws PayaraIdeException {
+ final String METHOD = "getProperties";
+ Future<ResultMap<String, String>> future =
+ ServerAdmin.<ResultMap<String, String>>exec(
+ server, new CommandGetProperty(propertyPattern));
+ try {
+ return future.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException | InterruptedException
+ | CancellationException ee) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exception", propertyPattern), ee);
+ } catch (TimeoutException te) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exceptionWithTimeout",
+ propertyPattern, Long.toString(timeout)), te);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server get property command entity.
+ * <p/>
+ * @param property Pattern that defines property tor retrieve.
+ */
+ public CommandGetProperty(final String property) {
+ super(COMMAND);
+ propertyPattern = property;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJava.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJava.java
new file mode 100644
index 0000000..584354a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJava.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara server administration command entity with local Java SE support.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class CommandJava extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java SE home used to select JRE for Payara server. */
+ final String javaHome;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server administration command entity
+ * with specified server command and Java SE home.
+ * <p/>
+ * @param command Server command represented by this object.
+ * @param javaHome Java SE home used to select JRE for Payara server.
+ */
+ public CommandJava(final String command, final String javaHome) {
+ super(command);
+ this.javaHome = javaHome;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Java SE home used to select JRE for Payara server.
+ * <p/>
+ * @return Java SE home used to select JRE for Payara server.
+ */
+ public String getJavaHome() {
+ return javaHome;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJavaClassPath.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJavaClassPath.java
new file mode 100644
index 0000000..d5439de
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandJavaClassPath.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara server administration command entity with local Java SE support
+ * and class path.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class CommandJavaClassPath extends CommandJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Class path to be passed to java executable formated as
+ <code>-cp <path1>:<path2>:...:<pathN></code>. */
+ final String classPath;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server administration command entity
+ * with specified server command, Java SE home and class path.
+ * <p/>
+ * @param command Server command represented by this object.
+ * @param javaHome Java SE home used to select JRE for Payara server.
+ * @param classPath Java SE class path.
+ */
+ public CommandJavaClassPath(final String command, final String javaHome,
+ final String classPath) {
+ super(command, javaHome);
+ this.classPath = classPath;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get class path to be passed to java executable.
+ * <p/>
+ * @return the classPath Class path to be passed to java executable.
+ */
+ public String getClassPath() {
+ return classPath;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListComponents.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListComponents.java
new file mode 100644
index 0000000..855cc1b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListComponents.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.List;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that retrieves list of components defined on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpListComponents.class)
+@RunnerRestClass(runner=RunnerRestListApplications.class, command="list-applications")
+public class CommandListComponents extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for list components command. */
+ private static final String COMMAND = "list-components";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "List components failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * List components.
+ * <p/>
+ * @param server Payara server entity.
+ * @param target Target server instance or cluster.
+ * @return List components task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultMap<String, List<String>> listComponents(
+ final PayaraServer server, final String target)
+ throws PayaraIdeException {
+ Command command = new CommandListComponents(target);
+ Future<ResultMap<String, List<String>>> future = ServerAdmin
+ .<ResultMap<String, List<String>>>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server list components
+ * command entity.
+ * <p/>
+ * @param target Target Payara instance or cluster.
+ */
+ public CommandListComponents(final String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListResources.java
new file mode 100644
index 0000000..cbc9c38
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListResources.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that retrieves list of JDBC resources defined on server.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpListResources.class)
+@RunnerRestClass(runner=RunnerRestListResources.class)
+public class CommandListResources extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandListResources.class);
+
+ /** Command string prefix used to construct list JDBC resources
+ * HTTP command. */
+ private static final String COMMAND_PREFIX = "list-";
+
+ /** Command string suffix used to construct list JDBC resources
+ * HTTP command. */
+ private static final String COMMAND_SUFFIX = "s";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add resource to target server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param cmdSuffix Resource command suffix. Value should not be null.
+ * @param target Payara server target.
+ * @return Add resource task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultList<String> listResources(final PayaraServer server,
+ final String cmdSuffix, final String target)
+ throws PayaraIdeException {
+ final String METHOD = "listResources";
+ Command command = new CommandListResources(command(cmdSuffix), target);
+ Future<ResultList<String>> future =
+ ServerAdmin.<ResultList<String>>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "exception"), ie);
+ }
+ }
+
+ /**
+ * Constructs command string for provided resource command suffix.
+ * <p/>
+ * @param resourceCmdSuffix Resource command suffix. Value should not
+ * be null.
+ */
+ public static String command(String resourceCmdSuffix) {
+ StringBuilder sb = new StringBuilder(COMMAND_PREFIX.length()
+ + COMMAND_SUFFIX.length() + resourceCmdSuffix.length());
+ sb.append(COMMAND_PREFIX);
+ sb.append(resourceCmdSuffix);
+ sb.append(COMMAND_SUFFIX);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server list JDBC resources
+ * command entity.
+ * <p/>
+ * Command string is supplied as an argument.
+ * <p/>
+ * @param command Server command represented by this object. Use
+ * <code>command</code> static method to build this string
+ * using resource command suffix.
+ * @param target Target Payara instance or cluster.
+ */
+ public CommandListResources(final String command, final String target) {
+ super(command, target);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListWebServices.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListWebServices.java
new file mode 100644
index 0000000..6d11eaa
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandListWebServices.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Command that retrieves list of web services defined on server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpListWebServices.class)
+@RunnerRestClass(runner=RunnerRestListWebServices.class)
+public class CommandListWebServices extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for list web services command. */
+ private static final String COMMAND = "__list-webservices";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server list web services
+ * command entity.
+ */
+ public CommandListWebServices() {
+ super(COMMAND);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandLocation.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandLocation.java
new file mode 100644
index 0000000..371d631
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandLocation.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+import java.net.URI;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Locations command used to determine locations (installation, domain etc.)
+ * where the DAS is running.
+ * <p/>
+ * Result of the command will be in the form of <code>Map<String, String></code>
+ * object. The keys to particular locations are as followed:
+ * Installation root - "Base-Root_value"
+ * Domain root - "Domain-Root_value"
+ * <p/>
+ * Minimal <code>__locations</code> command support exists since Payara
+ * 3.0.1 where both Base-Root and Domain-Root values are returned.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpLocation.class)
+@RunnerRestClass(runner=RunnerRestLocation.class)
+public class CommandLocation extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for location command. */
+ private static final String COMMAND = "__locations";
+
+ /** Result key to retrieve <code>Domain-Root</code> value. */
+ public static final String DOMAIN_ROOT_RESULT_KEY = "Domain-Root_value";
+
+ /** Result key to retrieve <code>Basic-Root</code> value. */
+ public static final String BASIC_ROOT_RESULT_KEY = "Base-Root_value";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Verifies if domain directory returned by location command result matches
+ * domain directory of provided Payara server entity.
+ * <p/>
+ * @param resultMap Locations command result.
+ * @param server Payara server entity.
+ * @return For local server value of <code>true</code> means that domain
+ * directory returned by location command result matches domain
+ * directory of provided Payara server entity and value
+ * of <code>false</code> that they differs. For remote serve this
+ * test makes no sense and value of <code>true</code> is always
+ * returned.
+ */
+ public static boolean verifyResult(
+ final ResultMap<String, String> resultMap,
+ final PayaraServer server) {
+ if (!server.isRemote()) {
+ boolean result = false;
+ String domainRootResult
+ = resultMap.getValue().get(DOMAIN_ROOT_RESULT_KEY);
+ String domainRootServer = ServerUtils.getDomainPath(server);
+ if (domainRootResult != null && domainRootServer != null) {
+ URI rootResult = new File(domainRootResult).toURI().normalize();
+ URI rootServer = new File(domainRootServer).toURI().normalize();
+ if (rootResult != null && rootServer != null) {
+ result = rootServer.equals(rootResult);
+ }
+ }
+ return result;
+ } else {
+ return true;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server location command entity.
+ */
+ public CommandLocation() {
+ super(COMMAND);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRedeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRedeploy.java
new file mode 100644
index 0000000..6d40e78
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRedeploy.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+import java.util.Map;
+
+/**
+ * Payara Server Redeploy Command Entity.
+ * <p>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpRedeploy.class)
+@RunnerRestClass(runner=RunnerRestDeploy.class)
+public class CommandRedeploy extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for deploy command. */
+ private static final String COMMAND = "redeploy";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Deployed application context root. */
+ final String contextRoot;
+
+ /** Deployment properties. */
+ final Map<String,String> properties;
+
+ /** Deployment libraries. */
+ final File[] libraries;
+
+ /** Keep state. */
+ final boolean keepState;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server deploy command entity.
+ * <p/>
+ * @param name Name of module/cluster/instance to modify.
+ * @param target Target Payara instance or cluster where
+ * <code>name</code> is stored.
+ * @param contextRoot Deployed application context root.
+ * @param properties Deployment properties.
+ * @param libraries Deployment libraries.
+ * @param keepState Keep state.
+ */
+ public CommandRedeploy(final String name, final String target,
+ final String contextRoot, final Map<String,String> properties,
+ final File[] libraries, final boolean keepState) {
+ super(COMMAND, name, target);
+ this.contextRoot = contextRoot;
+ this.properties = properties;
+ this.libraries = libraries;
+ this.keepState = keepState;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestartDAS.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestartDAS.java
new file mode 100644
index 0000000..5cb743b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestartDAS.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server restart DAS command entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpRestartDAS.class)
+@RunnerRestClass(command="restart")
+public class CommandRestartDAS extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for version command. */
+ private static final String COMMAND = "restart-domain";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "DAS restart failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Restarts running DAS server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param debug Specifies whether the domain is restarted with JPDA.
+ * @return Restart DAS task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString restartDAS(final PayaraServer server,
+ final boolean debug) throws PayaraIdeException {
+ Command command = new CommandRestartDAS(debug);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Specifies whether the domain is restarted with JPDA. */
+ final boolean debug;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server version command entity.
+ * <p/>
+ * @param debug Specifies whether the domain is restarted with JPDA.
+ */
+ public CommandRestartDAS(final boolean debug) {
+ super(COMMAND);
+ this.debug = debug;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestoreDomain.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestoreDomain.java
new file mode 100644
index 0000000..5a34925
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandRestoreDomain.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+
+/**
+ * Offline asadmin command used to restore domain in junit tests.
+ *
+ * @author Peter Benedikovic
+ */
+@RunnerHttpClass(runner = RunnerAsadminRestoreDomain.class)
+@RunnerRestClass(runner = RunnerAsadminRestoreDomain.class)
+public class CommandRestoreDomain extends CommandJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for change administrator's password command. */
+ private static final String COMMAND = "restore-domain";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Domain backup archive. */
+ final File domainBackup;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server administration command entity
+ * with specified server command, Java SE home and class path.
+ * <p/>
+ * @param javaHome Java SE home used to select JRE for Payara server.
+ * @param domainBackup archive that contains domain restore.
+ */
+ public CommandRestoreDomain(final String javaHome,
+ final File domainBackup) {
+ super(COMMAND, javaHome);
+ this.domainBackup = domainBackup;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandSetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandSetProperty.java
new file mode 100644
index 0000000..2b91558
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandSetProperty.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.*;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command that sets property (properties) on the server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpSetProperty.class)
+@RunnerRestClass(runner=RunnerRestSetProperty.class)
+public class CommandSetProperty extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for create-cluster command. */
+ private static final String COMMAND = "set";
+
+ /** Error message prefix for administration command execution exception .*/
+ private static final String ERROR_MESSAGE_PREFIX
+ = "Could not set value ";
+
+ /** Error message middle part for administration command execution
+ * exception .*/
+ private static final String ERROR_MESSAGE_MIDDLE
+ = " of property ";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build error message from command property name and it's value.
+ * <p/>
+ * @param command Command used to build error message.
+ * @return Error message for administration command execution exception.
+ */
+ private static String errorMessage(final CommandSetProperty command) {
+ int valueLen = command.value != null
+ ? command.value.length() : 0;
+ int propertyLen = command.property != null
+ ? command.property.length() : 0;
+ StringBuilder sb = new StringBuilder(ERROR_MESSAGE_PREFIX.length()
+ + ERROR_MESSAGE_MIDDLE.length() + valueLen + propertyLen);
+ sb.append(ERROR_MESSAGE_PREFIX);
+ sb.append(valueLen > 0 ? command.value : "");
+ sb.append(ERROR_MESSAGE_MIDDLE);
+ sb.append(propertyLen > 0 ? command.property : "");
+ return sb.toString();
+ }
+
+ /**
+ * Put property to server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param command Command to set property value.
+ * @return Payara command result containing <code>String</code> with
+ * result message.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString setProperty(
+ final PayaraServer server, final CommandSetProperty command)
+ throws PayaraIdeException {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (ExecutionException | InterruptedException
+ | CancellationException ee) {
+ throw new PayaraIdeException(errorMessage(command), ee);
+ }
+ }
+
+ /**
+ * Put property to server.
+ * <p/>
+ * @param server Payara server entity.
+ * @param command Command to set property value.
+ * @param timeout Administration command execution timeout [ms].
+ * @return Payara command result containing <code>String</code> with
+ * result message.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString setProperty(
+ final PayaraServer server, final CommandSetProperty command,
+ final long timeout) throws PayaraIdeException {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException | InterruptedException
+ | CancellationException ee) {
+ throw new PayaraIdeException(errorMessage(command), ee);
+ } catch (TimeoutException te) {
+ throw new PayaraIdeException(errorMessage(command)
+ + " in " + timeout + "ms", te);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Name of the property to set. */
+ final String property;
+
+ /** Value of the property to set. */
+ final String value;
+
+ /** Format for the query string. */
+ final String format;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server set property command entity.
+ * <p/>
+ * @param property Name of the property to set.
+ * @param value Value of the property to set.
+ * @param format Format for the query string.
+ */
+ public CommandSetProperty(final String property, final String value,
+ final String format) {
+ super(COMMAND);
+ this.property = property;
+ this.value = value;
+ this.format = format;
+ }
+
+ /**
+ * Constructs an instance of Payara server set property command entity.
+ * <p/>
+ * @param property Name of the property to set.
+ * @param value Value of the property to set.
+ */
+ public CommandSetProperty(final String property, final String value) {
+ super(COMMAND);
+ this.property = property;
+ this.value = value;
+ this.format = "DEFAULT={0}={1}";
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get name of the property to set.
+ * <p/>
+ * @return Name of the property to set.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Get value of the property to set.
+ * <p/>
+ * @return Value of the property to set.
+ */
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartCluster.java
new file mode 100644
index 0000000..62b121d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartCluster.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Start Cluster Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestStartCluster.class)
+public class CommandStartCluster extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for start-cluster command. */
+ private static final String COMMAND = "start-cluster";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "Cluster start failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Starts cluster.
+ * <p/>
+ * @param server Payara server entity.
+ * @param target Cluster name.
+ * @return Start cluster task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString startCluster(PayaraServer server,
+ String target) throws PayaraIdeException {
+ Command command = new CommandStartCluster(target);
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server start-cluster command entity.
+ * <p/>
+ * @param target Target Payara cluster.
+ */
+ public CommandStartCluster(String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartDAS.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartDAS.java
new file mode 100644
index 0000000..fda48f4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartDAS.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Start DAS Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerLocal.class)
+@RunnerRestClass(runner=RunnerLocal.class)
+public class CommandStartDAS extends CommandJavaClassPath {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** No command string is needed for Start DAS command but we may use it
+ * in logs. */
+ private static final String COMMAND = "start-das";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JVM options to be passed to java executable.
+ Typically options as as <code>-D<name>=<value></code>
+ or <code>-X<option></code>.
+ */
+ final String javaOpts;
+
+ /** Payara specific arguments to be passed to
+ * bootstrap main method, e.g. <code>--domain domain_name</code>. */
+ final String payaraArgs;
+
+ /** Payara server domain directory (full path). */
+ final String domainDir;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server start DAS command entity.
+ * @param javaHome Java SE home used to select JRE for Payara
+ * server.
+ * @param classPath Java SE class path.
+ * @param javaOptions JVM options to be passed to java executable.
+ * @param payaraArgs Payara specific arguments to be passed
+ * to bootstrap main method.
+ * @param domainDir Payara server domain directory (full path).
+ */
+ public CommandStartDAS(final String javaHome, final String classPath,
+ final String javaOptions, final String payaraArgs,
+ final String domainDir) {
+ super(COMMAND, javaHome, classPath);
+ this.javaOpts = javaOptions;
+ this.payaraArgs = payaraArgs;
+ this.domainDir = domainDir;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartInstance.java
new file mode 100644
index 0000000..f7b1485
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStartInstance.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Start Instance Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestStartInstance.class)
+public class CommandStartInstance extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for start-instance command. */
+ private static final String COMMAND = "start-instance";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "Instance start failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Starts server instance.
+ * <p/>
+ * @param server Payara server entity.
+ * @param target Instance name.
+ * @return Start instance task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString startInstance(final PayaraServer server,
+ final String target) throws PayaraIdeException {
+ Command command = new CommandStartInstance(target);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server start-instance command entity.
+ * <p/>
+ * @param target Target Payara instance.
+ */
+ public CommandStartInstance(final String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopCluster.java
new file mode 100644
index 0000000..04eea5b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopCluster.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Stop Cluster Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestStopCluster.class)
+public class CommandStopCluster extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for stop-cluster command. */
+ private static final String COMMAND = "stop-cluster";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "Cluster stop failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Stops cluster.
+ * <p/>
+ * @param server Payara server entity.
+ * @param target Cluster name.
+ * @return Stop cluster task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString stopCluster(PayaraServer server,
+ String target) throws PayaraIdeException {
+ Command command = new CommandStopCluster(target);
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server stop-cluster command entity.
+ * <p/>
+ * @param target Target Payara cluster.
+ */
+ public CommandStopCluster(String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopDAS.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopDAS.java
new file mode 100644
index 0000000..281f371
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopDAS.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server stop DAS command entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass
+@RunnerRestClass(runner = RunnerRestStopDAS.class)
+public class CommandStopDAS extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for version command. */
+ private static final String COMMAND = "stop-domain";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "DAS stop failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Stops running DAS server.
+ * <p/>
+ * @param server Payara server entity.
+ * @return Stop DAS task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString stopDAS(final PayaraServer server) throws
+ PayaraIdeException {
+ Command command = new CommandStopDAS();
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server version command entity.
+ */
+ public CommandStopDAS() {
+ super(COMMAND);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopInstance.java
new file mode 100644
index 0000000..f5259fa
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandStopInstance.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Stop Instance Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpTarget.class)
+@RunnerRestClass(runner=RunnerRestStopInstance.class)
+public class CommandStopInstance extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for stop-instance command. */
+ private static final String COMMAND = "stop-instance";
+
+ /** Error message for administration command execution exception .*/
+ private static final String ERROR_MESSAGE = "Instance stop failed.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Stops server instance.
+ * <p/>
+ * @param server Payara server entity.
+ * @param target Instance name.
+ * @return Stop instance task response.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString stopInstance(final PayaraServer server,
+ final String target) throws PayaraIdeException {
+ Command command = new CommandStopInstance(target);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException
+ | CancellationException ie) {
+ throw new PayaraIdeException(ERROR_MESSAGE, ie);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server stop-instance command entity.
+ * <p/>
+ * @param target Target Payara instance.
+ */
+ public CommandStopInstance(final String target) {
+ super(COMMAND, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTarget.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTarget.java
new file mode 100644
index 0000000..5167443
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTarget.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Abstract Payara Server Command Entity containing target.
+ * <p/>
+ * Contains common <code>target</code> attribute.
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommandTarget extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Target Payara instance or cluster. */
+ final String target;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server enable command entity.
+ * <p/>
+ * @param command Server command represented by this object.
+ * @param target Target Payara instance or cluster.
+ */
+ CommandTarget(String command, String target) {
+ super(command);
+ this.target = target;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTargetName.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTargetName.java
new file mode 100644
index 0000000..35c2f8a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandTargetName.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Abstract Payara Server Command Entity containing name and target.
+ * <p/>
+ * Contains common <code>name</code> and <code>target</code> attribute.
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommandTargetName extends CommandTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Name of module/cluster/instance to modify. */
+ final String name;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server enable command entity.
+ * <p/>
+ * @param command Server command represented by this object.
+ * @param name Name of module/cluster/instance to modify.
+ * @param target Target Payara instance or cluster where
+ * <code>name</code> is stored.
+ */
+ CommandTargetName(String command, String name, String target) {
+ super(command, target);
+ this.name = name;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandUndeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandUndeploy.java
new file mode 100644
index 0000000..f80a670
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandUndeploy.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Server Undeploy Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpUndeploy.class)
+@RunnerRestClass(runner=RunnerRestUndeploy.class)
+public class CommandUndeploy extends CommandTargetName {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for undeploy command. */
+ private static final String COMMAND = "undeploy";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server undeploy command entity.
+ * <p/>
+ * @param target Target Payara instance.
+ */
+ public CommandUndeploy(String name, String target) {
+ super(COMMAND, name, target);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandVersion.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandVersion.java
new file mode 100644
index 0000000..270c3f4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/CommandVersion.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server Version Command Entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass
+@RunnerRestClass
+public class CommandVersion extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandVersion.class);
+
+ /** Command string for version command. */
+ private static final String COMMAND = "version";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve version from server.
+ * <p/>
+ * @param server Payara server entity.
+ * @return Payara command result containing version string returned
+ * by server.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static ResultString getVersion(final PayaraServer server)
+ throws PayaraIdeException {
+ final String METHOD = "getVersion";
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, new CommandVersion());
+ try {
+ return future.get();
+ } catch (ExecutionException | InterruptedException
+ | CancellationException ee) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "exception"),
+ ee.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Retrieve version from server.
+ * <p/>
+ * @param server Payara server entity.
+ * @return Payara command result containing {@link PayaraVersion}
+ * object retrieved from server or <code>null</code> if no
+ * version was returned.
+ * @throws PayaraIdeException When error occurred during administration
+ * command execution.
+ */
+ public static PayaraVersion getPayaraVersion(
+ final PayaraServer server) {
+ ResultString result;
+ try {
+ result = getVersion(server);
+ } catch (CommandException ce) {
+ return null;
+ }
+ String value = result != null
+ ? ServerUtils.getVersionString(result.getValue()) : null;
+ if (value != null) {
+ return PayaraVersion.toValue(value);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Verifies if domain directory returned by version command result matches
+ * domain directory of provided Payara server entity.
+ * <p/>
+ * @param result Version command result.
+ * @param server Payara server entity.
+ * @return For local server value of <code>true</code> means that server
+ * major and minor version value matches values returned by version
+ * command and value of <code>false</code> that they differs.
+ */
+ public static boolean verifyResult(
+ final ResultString result, final PayaraServer server) {
+ boolean verifyResult = false;
+ String value = ServerUtils.getVersionString(result.getValue());
+ if (value != null) {
+ PayaraVersion valueVersion = PayaraVersion.toValue(value);
+ PayaraVersion serverVersion = server.getVersion();
+ if (valueVersion != null && serverVersion != null) {
+ verifyResult = serverVersion.equals(valueVersion);
+ }
+ }
+ return verifyResult;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server version command entity.
+ */
+ public CommandVersion() {
+ super(COMMAND);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ExceptionMessages.properties
new file mode 100644
index 0000000..970f72d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ExceptionMessages.properties
@@ -0,0 +1,77 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# CommandAddResources class
+CommandAddResources.addResource.exception=Add resource failed.
+CommandAddResources.addResource.exceptionWithTimeout=Add resource failed \
+in {0} ms.
+
+# CommandGetProperty class
+CommandGetProperty.getProperties.exception=Could not retrieve properties \
+for {0}.
+CommandGetProperty.getProperties.exceptionWithTimeout=Could not retrieve properties \
+for {0} in {1} ms.
+
+# CommandListResources class
+CommandListResources.listResources.exception=List resources failed.
+
+# CommandVersion class
+CommandVersion.getVersion.exception=Could not retrieve version from server: {0}
+
+# PasswordFile class
+PasswordFile.buildPasswordFilePath.nullValue=Domains folder and domain name \
+shall not be null.
+PasswordFile.write.noAdminPassword=No administrator password value is set.
+
+# ProcessIOParser class
+ProcessIOParser.getOutput.illegalState=Process output stream verification \
+was not called yet.
+
+# RunnerJava class
+RunnerJava.getServerConfig.noConfig=Cannot find Payara features configuration file \
+for Payara {0}
+RunnerJava.getJavaSEConfig.noJavaSEConfig=Cannot find Payara features \
+Java SE configuration
+RunnerJava.init.noCommandJava=Command argument is not an instance \
+of CommandJava class
+RunnerJava.init.noJavaVMExe=No suitable Java VM executable found in {0} \
+for {1}
+
+# RunnerAsadminChangeAdminPassword class
+RunnerAsadminChangeAdminPassword.init.illegalInstance=Illegal command \
+instance provided. Expected instance of CommandChangeAdminPassword class.
+RunnerAsadminChangeAdminPassword.query.nullValue=Value of domain name \
+or domains folder shall not be null.
+
+# RunnerHttpCreateInstance class
+RunnerHttpCreateInstance.query.nullValue=Value of name or node shall not \
+be null.
+RunnerHttpCreateInstance.query.illegalInstance=Illegal command instance \
+provided. Expected instance of CommandCreateInstance class.
+
+# RunnerAsadmin class
+RunnerAsadmin.buildProcessArgs.nullValue=Value of administrator user \
+name shall not be null.
+RunnerAsadmin.extractPath.noToolsConfig=Cannot find tools configuration \
+in Payara features configuration file for Payara {0}
+RunnerAsadmin.extractPath.noAsadminConfig=Cannot find asadmin configuration \
+in Payara features configuration file for Payara {0}
\ No newline at end of file
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/LogMessages.properties
new file mode 100644
index 0000000..661d17d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/LogMessages.properties
@@ -0,0 +1,143 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# AdminFactory class
+AdminFactory.newRunner.exception=Caught: {0}
+AdminFactory.newRunner.cause=Caused by: {0}
+
+# PasswordFile class
+PasswordFile.createFilePosix.exists=File {0} already exists
+PasswordFile.createFilePosix.ioException=IO exception caught when creating \
+new file:
+PasswordFile.createFilePosix.unsupported=Could not set file permissions. \
+File system is not POSIX compliant.
+PasswordFile.finishFilePosix.unsupported=Could not set file permissions. \
+File system is not POSIX compliant.
+PasswordFile.finishFilePosix.ioException=IO exception caught when updating \
+file permissions:
+PasswordFile.write.writeException=Caught IOException when writting {0}: {1}
+PasswordFile.write.closeException=Cannot close {0} Writer
+
+# Runner class
+Runner.prepareHttpConnection.setting=Setting HTTP connection attributes: \
+timeout = {0} user = {1} password = {2}
+Runner.prepareHttpConnection.using=Using "Basic" authorization with user \
+and password
+Runner.handleSecureConnection.issue=Trust manager issue when processing {0}
+Runner.handleSecureConnection.exception=Trust manager caught an exception:
+Runner.handleReceive.exception=Caught an exception when reading response:
+Runner.handleHTTPConnection.connect=Connecting to {0}:{1}
+Runner.handleHTTPResponse.response=Receiving response, code: {0}
+Runner.handleHTTPResponse.invalidRedirect=Invalid redirect for {0}
+Runner.handleHTTPResponse.locationMoved=Location moved to {0}
+Runner.call.thread=Runner call() method called on URL {0} thread {1}
+Runner.call.connect=Connecting to {0}:{1}
+Runner.call.response=Receiving response, code: {0}
+Runner.call.failure={0} failure, ContentType: {1}, ContentEncoding: {2}
+Runner.call.headerFields=Header Fields:
+Runner.call.headerField= * {0} = {1}
+Runner.call.unexpectedConnection=Unexpected connection type: {0}
+Runner.call.sleepInterrupted=Thread sleep interrupted in call() method:
+Runner.call.malformedURLException=Caught MalformedURLException in call() method:
+
+# RunnerAsadminChangeAdminPassword class
+
+# RunnerHttpCreateInstance class
+RunnerHttpCreateInstance.processResponse.illegalArgument=Caught \
+IllegalArgumentException when processing command execution response
+
+# RunnerHttpDeploy class
+RunnerHttpDeploy.handleSend.ioException=IO exception caught in handleSend() \
+method:
+RunnerHttpDeploy.handleSend.noData=HTTP POST request but no data stream provided
+RunnerHttpDeploy.getInputStream.fileNotFound=File not found exception caught \
+in getInputStream() method:
+
+# RunnerHttpGetProperty class
+RunnerHttpGetProperty.processResponse.manifestNull=info is null \
+for GetProperty command with {0}
+RunnerHttpGetProperty.processResponse.unsupportedEncoding=Caught \
+UnsupportedEncodingException exception in processResponse() method \
+while processing {0}
+RunnerHttpGetProperty.processResponse.exceptionDetails=\
+UnsupportedEncodingException details:
+RunnerHttpGetProperty.processResponse.illegalArgument=Caught \
+IllegalArgumentException in processResponse() method while processing {0}:{1}
+RunnerHttpGetProperty.processResponse.emptyString=Inserting empty string \
+as value for key {0}
+
+# RunnerRestGetProperty class
+RunnerRestGetProperty.processResponse.unsupportedEncoding=Caught \
+UnsupportedEncodingException exception in processResponse() method \
+while processing {0}
+RunnerRestGetProperty.processResponse.illegalArgument=Caught \
+IllegalArgumentException in processResponse() method while processing {0}:{1}
+RunnerRestGetProperty.processResponse.emptyString=Inserting empty string \
+as value for key {0}
+
+# RunnerJava class
+RunnerJava.getJavaVM.noJavaVMExe="Java VM {0} executable was not found"
+RunnerJava.verifyJavaVM.unknown=Java VM {0} executable version is unknown
+RunnerJava.verifyJavaVM.info=Java VM {0} executable version {1}
+RunnerJava.verifyJavaVM.unsupported=Java VM {0} executable version is \
+not supported by {1}
+RunnerJava.setProcessCurrentDir.dir=Setting {0} process current directory to {1}
+
+################################################################################
+# Log messages for tests #
+################################################################################
+
+# CommandAsadminTest class
+CommandAsadminTest.testCommandChangeAdminPasswordGFv3.output=StdOut: {0}
+CommandAsadminTest.testCommandChangeAdminPasswordGFv4.output=StdOut: {0}
+
+# CommandHttpTest class
+CommandHttpTest.startPayara.startFrame=+------------------------------------------+
+CommandHttpTest.startPayara.startText=| Starting Payara server for HTTP tests |
+CommandHttpTest.startPayara.stdout=STDOUT: {0}
+CommandHttpTest.startPayara.failed=Payara exited on error.
+CommandHttpTest.stopPayara.stopFrame=+------------------------------------------+
+CommandHttpTest.stopPayara.stopText=| Stopping Payara server for HTTP tests |
+
+# CommandRestTest class
+CommandRestTest.startPayara.startFrame=+------------------------------------------+
+CommandRestTest.startPayara.startText=| Starting Payara server for REST tests |
+CommandRestTest.startPayara.stdout=STDOUT: {0}
+CommandRestTest.startPayara.failed=Payara exited on error.
+CommandRestTest.stopPayara.stopFrame=+------------------------------------------+
+CommandRestTest.stopPayara.stopText=| Stopping Payara server for REST tests |
+
+# ProcessIOTest class
+ProcessIOTest.threadClose.in=Could not close standard input Reader: {0}
+ProcessIOTest.threadClose.out=Could not close standard output Writer: {0}
+ProcessIOTest.threadClose.err=Could not close standard error output Writer: {0}
+ProcessIOTest.run.io=Could not simulate process IO: {0}
+ProcessIOTest.testProcessIOSuccess.thread=Could not initialize process IO simulation \
+thread: {0}
+ProcessIOTest.testProcessIOSuccess.output=StdOut: {0}
+ProcessIOTest.testProcessIOFailure.thread=Could not initialize process IO simulation \
+thread: {0}
+ProcessIOTest.testProcessIOFailure.output=StdOut: {0}
+ProcessIOTest.close.in=Could not close standard input stream: {0}
+ProcessIOTest.close.out=Could not close standard output stream: {0}
+ProcessIOTest.close.err=Could not close standard error output stream: {0}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/MessagePart.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/MessagePart.java
new file mode 100644
index 0000000..2b3394f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/MessagePart.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class MessagePart {
+
+ Properties props = new Properties();
+ String message;
+
+ List<MessagePart> children = new ArrayList<MessagePart>();
+
+ public List<MessagePart> getChildren() {
+ return children;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Properties getProps() {
+ return props;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/PasswordFile.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/PasswordFile.java
new file mode 100644
index 0000000..76c78e9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/PasswordFile.java
@@ -0,0 +1,374 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.nio.file.attribute.PosixFilePermissions;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import static org.netbeans.modules.payara.tooling.utils.ServerUtils.PF_DOMAIN_CONFIG_DIR_NAME;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Support for <code>asadmin</code> <code>--passwordfile</code> file format.
+ * <p/>
+ * <code>asadmin</code> <code>--passwordfile</code> argument specifies the name,
+ * including the full path, of a file that contains password entries in
+ * a specific format.
+ * <p/>
+ * Note that any password file created to pass as an argument by using
+ * the <code>--passwordfile</code> option should be protected with file system
+ * permissions. Additionally, any password file being used for a
+ * transient purpose, such as setting up SSH among nodes, should be
+ * deleted after it has served its purpose.
+ * <p/>
+ * The entry for a password must have the AS_ADMIN_ prefix followed by
+ * the password name in uppercase letters, an equals sign, and the
+ * password.
+ * <p/>
+ * The entries in the file that are read by the asadmin utility are as
+ * follows:
+ * <ul><li><code>AS_ADMIN_PASSWORD=administration-password</code></li>
+ * <li><code>AS_ADMIN_MASTERPASSWORD=master-password</code></li>
+ * The entries in this file that are read by subcommands are as
+ * follows:
+ * <li><code>AS_ADMIN_NEWPASSWORD=new-administration-password</code> (read by
+ * the <code>start-domain</code> subcommand)</li>
+ * <li><code>AS_ADMIN_USERPASSWORD=user-password</code> (read by the
+ * <code>create-file-user</code> subcommand)</li>
+ * <li><code>AS_ADMIN_ALIASPASSWORD=alias-password</code> (read by the
+ * <code>create-password-alias</code> subcommand)</li>
+ * <li><code>AS_ADMIN_MAPPEDPASSWORD=mapped-password</code> (read by the
+ * <code>create-connector-security-map</code> subcommand)</li>
+ * <li><code>AS_ADMIN_WINDOWSPASSWORD=windows-password</code> (read by the
+ * <code>create-node-dcom</code>, <code>install-node-dcom</code>, and
+ * <code>update-node-dcom</code> subcommands)</li>
+ * <li><code>AS_ADMIN_SSHPASSWORD=sshd-password</code> (read by the
+ * <code>create-node-ssh</code>, <code>install-node</code>,
+ * <code>install-node-ssh</code>, and <code>update-node-ssh</code>
+ * subcommands)</li>
+ * <li><code>AS_ADMIN_SSHKEYPASSPHRASE=sshd-passphrase</code> (read by the
+ * <code>create-node-ssh</code>, <code>install-node</code>,
+ * <code>install-node-ssh</code>, and <code>update-node-ssh</code>
+ * subcommands)</li>
+ * <li><code>AS_ADMIN_JMSDBPASSWORD=jdbc-user-password</code> (read by the
+ * <code>configure-jms-cluster</code> subcommand)</li></ul>
+ * These password entries are stored in clear text in the password
+ * file. To provide additional security, the create-password-alias
+ * subcommand can be used to create aliases for passwords that are
+ * used by remote subcommands. The password for which the alias is
+ * created is stored in an encrypted form. If an alias exists for a
+ * password, the alias is specified in the entry for the password as
+ * follows:
+ * <p/>
+ * <code>AS_ADMIN_password-name=${ALIAS=password-alias-name}</code>
+ * For example:
+ * <ul><li><code>AS_ADMIN_SSHPASSWORD=${ALIAS=ssh-password-alias}</code></li>
+ * <li><code>AS_ADMIN_SSHKEYPASSPHRASE=${ALIAS=ssh-key-passphrase-alias}</code></li></ul>
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PasswordFile {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(PasswordFile.class);
+
+ /** Name of password file. */
+ public static final String PASSWORD_FILE_NAME = "password-file";
+
+ /** Password file permissions when file is being created before writing
+ * it's content. */
+ private static final Set<PosixFilePermission> CREATE_FILE_PERMISSIONS
+ = new HashSet<>();
+ static {
+ CREATE_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_READ);
+ CREATE_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_WRITE);
+ }
+
+ /** Password file permissions when file is finished. */
+ private static final Set<PosixFilePermission> FINAL_FILE_PERMISSIONS
+ = new HashSet<>();
+ static {
+ FINAL_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_READ);
+ }
+
+ /** Key to value assignment character. */
+ private static final char ASSIGN_VALUE = '=';
+
+ /** Administrator password key (mandatory). */
+ private static final String AS_ADMIN_PASSWORD = "AS_ADMIN_PASSWORD";
+
+ /** Master password key (optional). */
+ private static final String AS_ADMIN_MASTERPASSWORD = "AS_ADMIN_MASTERPASSWORD";
+
+ /** New administrator password to be set (optional). */
+ private static final String AS_ADMIN_NEWPASSWORD = "AS_ADMIN_NEWPASSWORD";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public static Path buildPasswordFilePath(final PayaraServer server) {
+ final String METHOD = "buildPasswordFilePath";
+ String domainsFolder = server.getDomainsFolder();
+ String domainName = server.getDomainName();
+ if (domainsFolder == null || domainName == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "nullValue"));
+ }
+ return Paths.get(domainsFolder, domainName,
+ PF_DOMAIN_CONFIG_DIR_NAME, PASSWORD_FILE_NAME);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Password file path. */
+ Path file;
+
+ /** Administrator password value (mandatory). */
+ private String adminPassword;
+
+ /** Master password value (optional). */
+ private String masterPassword;
+
+ /** New administrator password to be set (optional). */
+ private String adminNewPassword;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Support for <code>asadmin</code>
+ * <code>--passwordfile</code> file format.
+ * <p/>
+ * Content of password file is not read from file so at least administrator
+ * password from {@link PayaraServer} must be provided.
+ * <p/>
+ * @param server Payara server instance.
+ */
+ PasswordFile(final PayaraServer server) {
+ file = buildPasswordFilePath(server);
+ this.adminPassword = server.getAdminPassword();
+ masterPassword = null;
+ adminNewPassword = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get password file path as {@link String}.
+ */
+ public String getFilePath() {
+ return file.toString();
+ }
+
+ /**
+ * Get administrator password value (mandatory).
+ * <p/>
+ * @return Administrator password value (mandatory).
+ */
+ public String getAdminPassword() {
+ return adminPassword;
+ }
+
+ /**
+ * Get administrator password value (mandatory).
+ * <p/>
+ * @param adminPassword Administrator password value (mandatory).
+ */
+ public void setAdminPassword(String adminPassword) {
+ this.adminPassword = adminPassword;
+ }
+
+ /**
+ * Get master password value (optional).
+ * <p/>
+ * @return Master password value (optional).
+ */
+ public String getMasterPassword() {
+ return masterPassword;
+ }
+
+ /**
+ * Get master password value (optional).
+ * <p/>
+ * @param masterPassword Master password value (optional).
+ */
+ public void setMasterPassword(String masterPassword) {
+ this.masterPassword = masterPassword;
+ }
+
+ /**
+ * Get new administrator password to be set (optional).
+ * <p/>
+ * @return New administrator password to be set (optional).
+ */
+ public String getAdminNewPassword() {
+ return adminNewPassword;
+ }
+
+ /**
+ * Get new administrator password to be set (optional).
+ * <p/>
+ * @param adminNewPassword New administrator password to be set (optional).
+ */
+ public void setAdminNewPassword(String adminNewPassword) {
+ this.adminNewPassword = adminNewPassword;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build password file content to be written into file.
+ * <p/>
+ * @return Password file content.
+ */
+ private String dataToWrite() {
+ int len = AS_ADMIN_PASSWORD.length() + 1 + adminPassword.length();
+ if (masterPassword != null) {
+ len += AS_ADMIN_MASTERPASSWORD.length()
+ + 1 + masterPassword.length();
+ }
+ if (adminNewPassword != null) {
+ len += AS_ADMIN_NEWPASSWORD.length()
+ + 1 + adminNewPassword.length();
+ }
+ StringBuilder sb = new StringBuilder(len);
+ sb.append(AS_ADMIN_PASSWORD).append(ASSIGN_VALUE);
+ sb.append(adminPassword).append(OsUtils.LINES_SEPARATOR);
+ if (masterPassword != null) {
+ sb.append(AS_ADMIN_MASTERPASSWORD).append(ASSIGN_VALUE);
+ sb.append(masterPassword).append(OsUtils.LINES_SEPARATOR);
+ }
+ if (adminNewPassword != null) {
+ sb.append(AS_ADMIN_NEWPASSWORD).append(ASSIGN_VALUE);
+ sb.append(adminNewPassword).append(OsUtils.LINES_SEPARATOR);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Create password file to be written with access permissions to read
+ * and write by user only.
+ * <p/>
+ * @return Value of <code>true</code> if new file was created
+ * or <code>false</code> otherwise
+ */
+ private boolean createFilePosix() {
+ final String METHOD = "createFilePosix";
+ boolean success = false;
+ try {
+ if (Files.notExists(file, new LinkOption[0])) {
+ Files.createFile(file, PosixFilePermissions
+ .asFileAttribute(CREATE_FILE_PERMISSIONS));
+ success = true;
+ } else {
+ Files.setPosixFilePermissions(file, CREATE_FILE_PERMISSIONS);
+ LOGGER.log(Level.INFO, METHOD, "exists", file.toString());
+ }
+ } catch (UnsupportedOperationException uoe) {
+ LOGGER.log(Level.INFO, METHOD, "unsupported", file.toString());
+ } catch (FileAlreadyExistsException faee) {
+ LOGGER.log(Level.INFO, METHOD, "exists", file.toString());
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ioe);
+ }
+ return success;
+ }
+
+ /**
+ * Update password file permissions when finished.
+ * <p/>
+ * File should exist.
+ */
+ private boolean finishFilePosix() {
+ final String METHOD = "finishFilePosix";
+ boolean success = false;
+ try {
+ Files.setPosixFilePermissions(file, FINAL_FILE_PERMISSIONS);
+ success = true;
+ } catch (UnsupportedOperationException uoe) {
+ LOGGER.log(Level.INFO, METHOD, "unsupported", file.toString());
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ioe);
+ }
+ return success;
+ }
+
+ /**
+ * Write Payara password file using stored values.
+ * <p/>
+ * Attempts to set file access permissions to read by user only.
+ * <p/>
+ * @return Value of <code>true</code> when file was successfully written
+ * or <code>false</code> otherwise.
+ */
+ public boolean write() {
+ final String METHOD = "write";
+ if (adminPassword == null) {
+ //throw new CommandException("noAdminPassword");
+ adminPassword = "";
+ }
+ boolean success = true;
+ Writer out = null;
+ createFilePosix();
+ try {
+ out = new OutputStreamWriter(new FileOutputStream(file.toFile()), "UTF-8");
+ out.write(dataToWrite());
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO, METHOD, "writeException",
+ new Object[] {file.toString(), ioe.getMessage()});
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException ioe) {
+ success = false;
+ LOGGER.log(Level.INFO, METHOD,
+ "closeException", file.toString());
+ }
+ finishFilePosix();
+ }
+ }
+ return success;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOContent.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOContent.java
new file mode 100644
index 0000000..fc48aa4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOContent.java
@@ -0,0 +1,432 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.LinkedList;
+import org.netbeans.modules.payara.tooling.utils.StringPrefixTree;
+
+/**
+ * Content to verify on server administration command execution standard
+ * output and data to send on standard input.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ProcessIOContent {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Prefix tree final node content.
+ */
+ protected static class TreeNode {
+ /** Match array index. */
+ private final Short index;
+
+ /** Response result. */
+ private final ProcessIOResult result;
+
+ /**
+ * Creates an instance of prefix tree final node content.
+ * <p/>
+ * @param index Match array index.
+ * @param result Response result.
+ */
+ private TreeNode(final Short index, final ProcessIOResult result) {
+ this.index = index;
+ this.result = result;
+ }
+ }
+
+ /**
+ * Abstract input or output token.
+ */
+ protected abstract static class Token {
+
+ /** Array of match indicators for individual success input strings.
+ * This value shall not be null.*/
+ private final boolean matchSuccess[];
+
+ /** Array of match indicators for individual error input strings.
+ * This value shall not be null.*/
+ private final boolean matchError[];
+
+ /** Strings to be matched on standard output stored in prefix tree. */
+ private final StringPrefixTree<TreeNode> outputStrings;
+
+ /** Maximum length of all stored strings. */
+ private final int maxLen;
+
+ /**
+ * Create an instance of abstract token expecting set of strings
+ * on standard output.
+ * <p/>
+ * @param inputSuccess Array of input strings considered as successful
+ * response to be matched before prompt.
+ * @param inputError Array of input strings considered as error
+ * response to be matched before prompt.
+ */
+ protected Token(final String[] inputSuccess, final String[] inputError) {
+ int lenSuccess = inputSuccess != null ? inputSuccess.length : 0;
+ int lenError = inputError != null ? inputError.length : 0;
+ int maxLenLocal = 0;
+ matchSuccess = new boolean[lenSuccess];
+ matchError = new boolean[lenError];
+ outputStrings = new StringPrefixTree<>(false);
+ for (short i = 0; i < lenSuccess; i++) {
+ matchSuccess[i] = false;
+ outputStrings.add(inputSuccess[i],
+ new TreeNode(i, ProcessIOResult.SUCCESS));
+ if (inputSuccess[i].length() > maxLenLocal) {
+ maxLenLocal = inputSuccess[i].length();
+ }
+ }
+ for (short i = 0; i < lenError; i++) {
+ matchError[i] = false;
+ outputStrings.add(inputError[i],
+ new TreeNode(i, ProcessIOResult.ERROR));
+ if (inputError[i].length() > maxLenLocal) {
+ maxLenLocal = inputError[i].length();
+ }
+ }
+ maxLen = maxLenLocal;
+ }
+
+ /**
+ * Get process input prompt different from global input prompt.
+ * <p/>
+ * @return Always returns <code>null</code>.
+ */
+ protected String getPrompt() {
+ return null;
+ }
+
+ /**
+ * Returns status of success matching.
+ * <p/>
+ * @return Value of <code>true</code> when all successful input strings
+ * were matched or <coe>false</code> otherwise.
+ */
+ protected boolean isSuccess() {
+ boolean success = true;
+ for (int i = 0; i < matchSuccess.length; i++) {
+ success = success && matchSuccess[i];
+ }
+ return success;
+ }
+
+ /**
+ * Array of match indicators for individual error input strings.
+ * This value shall not be null.
+ * @return the matchError
+ */
+ protected boolean[] getMatchError() {
+ return matchError;
+ }
+
+ /**
+ * Get strings to be matched on standard output stored in prefix tree.
+ * <p/>
+ * @return Strings to be matched on standard output stored
+ * in prefix tree.
+ */
+ protected StringPrefixTree<TreeNode> getOutputStrings() {
+ return outputStrings;
+ }
+
+ /**
+ * Get maximum length of all stored strings.
+ * <p/>
+ * @return Maximum length of all stored strings.
+ */
+ protected int getMaxLen() {
+ return maxLen;
+ }
+
+ /**
+ * Search for tokens in provided string.
+ * <p/>
+ * @param str String to be compared with stored tokens.
+ * @param offset Beginning index for searching.
+ * @return Search result.
+ */
+ protected ProcessIOResult match(CharSequence str, int offset) {
+ TreeNode node = outputStrings.prefixMatch(str, offset);
+ if (node != null) {
+ switch (node.result) {
+ case SUCCESS:
+ matchSuccess[node.index] = true;
+ return isSuccess()
+ ? ProcessIOResult.SUCCESS
+ : ProcessIOResult.UNKNOWN;
+ case ERROR:
+ matchError[node.index] = true;
+ return ProcessIOResult.ERROR;
+ }
+ }
+ return ProcessIOResult.UNKNOWN;
+ }
+ }
+
+ /**
+ * Output token contains data to be send on prompt.
+ */
+ protected static class OutputToken extends Token {
+
+ /**
+ * Create an instance of output token expecting set of strings
+ * on standard output.
+ * <p/>
+ * @param inputSuccess Array of input strings considered as successful
+ * response to be matched before prompt.
+ * @param inputError Array of input strings considered as error
+ * response to be matched before prompt.
+ */
+ protected OutputToken(final String[] inputSuccess, final String[] inputError) {
+ super(inputSuccess, inputError);
+ }
+
+ }
+
+ /**
+ * Input token contains data to be send on prompt.
+ */
+ protected static class InputToken extends Token {
+
+ /** Process input prompt when differs from global input prompt. */
+ private final String prompt;
+
+ /**
+ * Create an instance of input token expecting custom input prompt
+ * and set of strings on standard output.
+ * <p/>
+ * @param prompt Process input prompt different from
+ * global input prompt.
+ * @param input Array of input strings to be matched before prompt.
+ * @param output Output to be sent after all input strings are matched
+ * and prompt is received.
+ */
+ protected InputToken(final String prompt, final String[] input,
+ final String output) {
+ super(input, null);
+ this.prompt = prompt;
+ }
+
+ /**
+ * Get process input prompt different from global input prompt.
+ * <p/>
+ * @return Process input prompt different from global input prompt
+ * or <code>null</code> when no such prompt is set.
+ */
+ @Override
+ protected String getPrompt() {
+ return prompt;
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ProcessIOContent.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Process input prompt. Data on standard input are expected after sending
+ * this string to standard output. */
+ private final String prompt;
+
+ /** List of tokens to be processed. */
+ private final LinkedList<Token> tokens;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of server administration command execution content.
+ * <p/>
+ * @param prompt Process input prompt.
+ */
+ public ProcessIOContent(final String prompt) {
+ this.prompt = prompt;
+ tokens = new LinkedList<>();
+ }
+
+ /**
+ * Creates an instance of server administration command execution content.
+ * <p/>
+ * No input prompt is set. This constructor may be used for commands which
+ * are expecting no input.
+ */
+ public ProcessIOContent() {
+ this(null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get global process input prompt.
+ * <p/>
+ * @return Global process input prompt.
+ */
+ public String getPrompt() {
+ return prompt;
+ }
+
+ /**
+ * Get current input prompt.
+ * <p/>
+ * @return Current input prompt.
+ */
+ public String getCurrentPrompt() {
+ Token token = tokens.getCurrent();
+ String tokenPrompt = token != null ? token.getPrompt() : null;
+ return tokenPrompt != null ? tokenPrompt : prompt;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add next expected process output to be matched.
+ * <p/>
+ * All strings in <code>inputSuccess</code> array must be matched
+ * for successful evaluation. Any matching string from
+ * <code>inputError</code> will cause evaluation as error.
+ * <p/>
+ * @param inputSuccess Array of input strings considered as successful
+ * response to be matched before prompt.
+ * @param inputError Array of input strings considered as error
+ * response to be matched before prompt.
+ */
+ public void addOutput(final String[] inputSuccess,
+ final String[] inputError) {
+ tokens.addLast(new OutputToken(inputSuccess, inputError));
+ }
+
+ /**
+ * Add next expected process output to be matched.
+ * <p/>
+ * All strings in <code>inputSuccess</code> array must be matched
+ * for successful evaluation.
+ * <p/>
+ * @param inputSuccess Array of input strings considered as successful
+ * response to be matched before prompt.
+ */
+ public void addOutput(final String[] inputSuccess) {
+ tokens.addLast(new OutputToken(inputSuccess, null));
+ }
+
+ /**
+ * Add next expected process input dependent on matched process output.
+ * <p/>
+ * All strings in <code>inputSuccess</code> array must be matched
+ * for successful evaluation. Any matching string from
+ * <code>inputError</code> will cause evaluation as error.
+ * <p/>
+ * @param prompt Process input prompt different from
+ * global input prompt.
+ * @param input Array of input strings to be matched before prompt.
+ * @param output Output to be sent after all input strings are matched
+ * and prompt is received.
+ */
+ public void addInput(final String prompt, final String[] input,
+ final String output) {
+ tokens.addLast(new InputToken(prompt, input, output));
+ }
+
+ /**
+ * Add next expected process input dependent on matched process output.
+ * <p/>
+ * <code>inputSuccess</code> string must be matched for successful
+ * evaluation. Any matching string from <code>inputError</code> will cause
+ * evaluation as error.
+ * <p/>
+ * @param prompt Process input prompt different from
+ * global input prompt.
+ * @param input Input string to be matched before prompt.
+ * @param output Output to be sent after all input strings are matched
+ * and prompt is received.
+ */
+ public void addInput(final String prompt, final String input,
+ final String output) {
+ tokens.addLast(new InputToken(prompt, new String[] {input}, output));
+ }
+
+ /**
+ * Add next expected process input dependent on matched process output.
+ * <p/>
+ * All strings in <code>inputSuccess</code> array must be matched
+ * for successful evaluation. Any matching string from
+ * <code>inputError</code> will cause evaluation as error.
+ * <p/>
+ * @param input Array of input strings to be matched before prompt.
+ * @param output Output to be sent after all input strings are matched
+ * and prompt is received.
+ */
+ public void addInput(final String[] input, final String output) {
+ tokens.addLast(new InputToken(prompt, input, output));
+ }
+
+ /**
+ * Add next expected process input dependent on matched process output.
+ * <p/>
+ * <code>inputSuccess</code> string must be matched for successful
+ * evaluation. Any matching string from <code>inputError</code> will cause
+ * evaluation as error.
+ * <p/>
+ * @param input Input string to be matched before prompt.
+ * @param output Output to be sent after all input strings are matched
+ * and prompt is received.
+ */
+ public void addInput(final String input, final String output) {
+ tokens.addLast(new InputToken(prompt, new String[] {input}, output));
+ }
+
+ /**
+ * Get first token to be processed from list.
+ * <p/>
+ * @return First token from list or <code>null</code> when list is empty.
+ */
+ public Token firstToken() {
+ tokens.first();
+ return tokens.getCurrent();
+ }
+
+ /**
+ * Get next token to be processed from list.
+ * <p/>
+ * Next token from list or <code>null</code> when there are no more tokens
+ * in the list.
+ */
+ public Token nextToken() {
+ return tokens.next() ? tokens.getCurrent() : null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOParser.java
new file mode 100644
index 0000000..007cbbd
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOParser.java
@@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.CyclicStringBuffer;
+import org.netbeans.modules.payara.tooling.utils.LinkedList;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+
+/**
+ * Parse process IO and verify it against content verification data.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ProcessIOParser {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Parse process output.
+ * <p/>
+ * Process output is being read as text lines separated by prompt string,
+ * CR or CRLF. Each finished line is searched for provided process
+ * IO content.
+ */
+ protected static class Parser {
+
+ /**
+ * State machine input classes.
+ */
+ protected enum Input {
+ /** Content of user, password hash or tool strings. */
+ STRING,
+ /** Separator character. */
+ PROMPT,
+ /** CR character, beginning of CRLF sequence. */
+ CR,
+ /** LF Character. */
+ LF;
+
+ /** Enumeration length. */
+ protected static final int length = Input.values().length;
+
+ /**
+ * Get input class value for provided character.
+ * <p/>
+ * @param c Character to check tor input class.
+ * @return Input class of provided character.
+ */
+ protected static Input value(final char c, final String prompt,
+ final CyclicStringBuffer promptBuff) {
+ if (prompt != null && promptBuff.equals(prompt)) {
+ return PROMPT;
+ }
+ switch (c) {
+ case '\r':
+ return CR;
+ case '\n':
+ return LF;
+ default:
+ return STRING;
+ }
+ }
+
+ }
+
+ /**
+ * State machine internal states.
+ */
+ protected enum State {
+ /** Initial state, expecting line 1st character. */
+ START,
+ /** Reading line characters until line separator or prompt. */
+ LINE,
+ /** Got '\r', expecting '\n' from EOL. */
+ CR,
+ /** Error state. */
+ ERROR;
+
+ /** Enumeration length. */
+ protected static final int length = State.values().length;
+
+ /** Transition table for [State, Input]. */
+ protected static final State transition[][] = {
+ // STRING PROMPT CR LF
+ { LINE, START, CR, START}, // START
+ { LINE, START, CR, START}, // LINE
+ { LINE, START, CR, START}, // CR
+ {ERROR, ERROR, ERROR, ERROR} // ERROR
+ };
+
+ /**
+ * State machine transition.
+ * <p/>
+ * @param s Current machine state.
+ * @param i current input class.
+ * @return Next machine state.
+ */
+ protected static State next(final State s, final Input i) {
+ return transition[s.ordinal()][i.ordinal()];
+ }
+
+ }
+
+ /** Content to verify on server administration command execution IO. */
+ private final ProcessIOContent content;
+
+ /** Content token to be verified. */
+ private ProcessIOContent.Token token;
+
+ /** Content verification result. */
+ private ProcessIOResult result;
+
+ /** Process input prompt length. Value of zero indicates no prompt. */
+ private int promptLen;
+
+ /** Current line being processed. */
+ private final StringBuilder line;
+
+ /** Cyclic buffer to compare input against prompt. */
+ CyclicStringBuffer promptBuff;
+
+ /** Machine internal state. */
+ private State state;
+
+ /** Process output log lines. */
+ private final LinkedList<String> output;
+
+ /**
+ * Creates an instance of process output parser.
+ * <p/>
+ * @param content Content to verify on server administration command
+ * execution IO.
+ */
+ protected Parser(ProcessIOContent content) {
+ this.content = content;
+ line = new StringBuilder(BUFF_SIZE);
+ state = State.START;
+ token = this.content.firstToken();
+ result = ProcessIOResult.UNKNOWN;
+ String prompt = content.getCurrentPrompt();
+ promptLen = prompt != null ? prompt.length() : 0;
+ promptBuff = new CyclicStringBuffer(promptLen);
+ output = new LinkedList();
+ }
+
+ /**
+ * Parses content of process output.
+ * <p/>
+ * @param buff Buffer with incoming process standard output data.
+ * @param len Data length in process standard output buffer.
+ */
+ protected void parse(final char[] buff, final short len) {
+ for (int pos = 0; pos < len; pos++) {
+ state = action(buff[pos]);
+ }
+ }
+
+ /**
+ * Finish parsing when end of file was reached.
+ */
+ protected void finish() {
+ endOfLine('\0');
+ }
+
+ /**
+ * Get content verification result.
+ * <p/>
+ * @return Content verification result.
+ */
+ protected ProcessIOResult result() {
+ return result;
+ }
+
+ /**
+ * Run parser action based on current state and character class.
+ * <p/>
+ * @param c Current character being processed from {@link Reader} buffer.
+ * @return Next state transition based on current state
+ * and character class.
+ */
+ protected State action(final char c) {
+ Input cl = Input.value(c, content.getCurrentPrompt(), promptBuff);
+ switch (state) {
+ case START: switch (cl) {
+ case STRING:
+ firstChar(c);
+ break;
+ case PROMPT:
+ firstChar(c);
+ case LF:
+ endOfLine(c);
+ } break;
+ case LINE: switch (cl) {
+ case STRING:
+ nextChar(c);
+ break;
+ case PROMPT:
+ nextChar(c);
+ case LF:
+ endOfLine(c);
+ } break;
+ case CR: switch (cl) {
+ case STRING:
+ nextCharWithCR(c);
+ break;
+ case PROMPT:
+ nextCharWithCR(c);
+ case LF:
+ endOfLine(c);
+ } break;
+ }
+ return State.next(state, cl);
+ }
+
+ /**
+ * Clear line content and append first character.
+ * <p/>
+ * @param c Current character from buffer.
+ */
+ protected void firstChar(final char c) {
+ line.setLength(0);
+ line.append(c);
+ }
+
+ /**
+ * Append next character.
+ * <p/>
+ * @param c Current character from buffer.
+ */
+ protected void nextChar(final char c) {
+ line.append(c);
+ }
+
+ /**
+ * Append next character after CR.
+ * <p/>
+ * @param c Current character from buffer.
+ */
+ protected void nextCharWithCR(final char c) {
+ line.append('\r');
+ line.append(c);
+ }
+
+ /**
+ * Handle end of line.
+ * <p/>
+ * @param c Current character from buffer (not used).
+ */
+ protected void endOfLine(final char c) {
+ if (line.length() > 0) {
+ output.addLast(line.toString());
+ }
+ if (token != null) {
+ ProcessIOResult matchResult
+ = ProcessIOResult.UNKNOWN;
+ for (int i = 0 ; i < line.length() ; i++) {
+ if ((matchResult = token.match(line, i))
+ != ProcessIOResult.UNKNOWN) {
+ token = content.nextToken();
+ String prompt = content.getCurrentPrompt();
+ promptLen = prompt != null ? prompt.length() : 0;
+ promptBuff.resize(promptLen);
+ break;
+ }
+ }
+ switch(matchResult) {
+ case SUCCESS:
+ if (result == ProcessIOResult.UNKNOWN) {
+ result = matchResult;
+ }
+ break;
+ case ERROR:
+ if (result != ProcessIOResult.ERROR) {
+ result = matchResult;
+ }
+ break;
+ }
+ }
+ line.setLength(0);
+ }
+
+ /**
+ * Build output string from stored process output lines.
+ * <p/>
+ * @return Process output string.
+ */
+ protected String getOutputString() {
+ int len = 0;
+ boolean isElement = output.first();
+ while(isElement) {
+ len += output.getCurrent().length();
+ isElement = output.next();
+ if (isElement) {
+ len += OsUtils.LINES_SEPARATOR.length();
+ }
+ }
+ StringBuilder sb = new StringBuilder(len);
+ isElement = output.first();
+ while(isElement) {
+ sb.append(output.getCurrent());
+ isElement = output.next();
+ if (isElement) {
+ sb.append(OsUtils.LINES_SEPARATOR);
+ }
+ }
+ return sb.toString();
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ProcessIOParser.class);
+
+ /** Internal IO buffer size. */
+ private static final short BUFF_SIZE = 128;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Process standard input. */
+ private final Writer stdIn;
+
+ /** Process standard output. */
+ private final Reader stdOut;
+
+ /** Process standard output parser. */
+ private final Parser outParser;
+
+ /** Buffer for incoming process standard output data. */
+ private final char[] outBuff;
+
+ /** Data length in process standard output buffer. */
+ private short outLen;
+
+ /** Vas process output verification already done? */
+ private boolean verifydone;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of process IO verification parser.
+ * <p/>
+ * @param stdIn Process standard input.
+ * @param stdOut Process standard output.
+ * @param ioContent Content to verify on server administration command
+ * execution IO.
+ */
+ public ProcessIOParser(final Writer stdIn, final Reader stdOut,
+ final ProcessIOContent ioContent) {
+ this.stdIn = stdIn;
+ this.stdOut = stdOut;
+ outParser = new Parser(ioContent);
+ outBuff = new char[BUFF_SIZE];
+ outLen = 0;
+ verifydone = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Verify process output streams against content verification data
+ * provided in constructor as <code>ioContent</code> argument.
+ * <p/>
+ * @return Process output streams verification result.
+ * @throws IOException When there is an issue with reading process
+ * output streams.
+ */
+ public ProcessIOResult verify() throws IOException {
+ while (outLen >= 0) {
+ outLen = (short)stdOut.read(outBuff);
+ outParser.parse(outBuff, outLen);
+ }
+ outParser.finish();
+ verifydone = true;
+ return outParser.result();
+ }
+
+ /**
+ * Return process output as {@link String}.
+ * <p/>
+ * @return Process output as {@link String}.
+ */
+ public String getOutput() {
+ final String METHOD = "getOutput";
+ if (!verifydone) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "illegalState"));
+ }
+ return outParser.getOutputString();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOResult.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOResult.java
new file mode 100644
index 0000000..fdac756
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ProcessIOResult.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Response result.
+ * <p/>
+ * Order of values defines values priority.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum ProcessIOResult {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Unknown response. */
+ UNKNOWN,
+
+ /** Successful response. */
+ SUCCESS,
+
+ /** Error response. */
+ ERROR
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Result.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Result.java
new file mode 100644
index 0000000..4eacd1f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Result.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+
+/**
+ * Payara administration command result.
+ * <p/>
+ * Stores administration command result values and command execution state.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class Result<T> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** State of Payara server administration command execution. */
+ TaskState state;
+
+ /** Authorization status.
+ * <p/>
+ * Value of <code>true</code> means that there was no authorization issue.
+ * Value of <code>false</code> means that authorization failed. */
+ boolean auth;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara administration command result.
+ */
+ Result() {
+ this.state = null;
+ this.auth = true;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get state of Payara server administration command execution.
+ * <p/>
+ * @return State of Payara server administration command execution.
+ */
+ public TaskState getState() {
+ return state;
+ }
+
+ /**
+ * Get value returned by administration command execution.
+ * <p/>
+ * @return Value returned by administration command execution.
+ */
+ public abstract T getValue();
+
+
+ /**
+ * Get administration command execution authorization status.
+ * <p/>
+ * @return Value of <code>true</code> means that there was no authorization
+ * issue. Value of <code>false</code> means that authorization
+ * failed.
+ */
+ public boolean isAuth() {
+ return auth;
+ }
+
+ /**
+ * Set administration command execution authorization status.
+ * <p/>
+ * Use only in administration command runners to set result value.
+ * <p/>
+ * @param auth Authorization status: Value of <code>true</code> means that
+ * there was no authorization issue. Value of <code>false</code>
+ * means that authorization failed.
+ */
+ public void setAuth(final boolean auth) {
+ this.auth = auth;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultList.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultList.java
new file mode 100644
index 0000000..f6536bc
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultList.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.List;
+
+/**
+ * Payara Administration Command Result.
+ * <p>
+ * Stores administration command result values and command execution state.
+ * Result value is <code>List</code>.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResultList<T> extends Result<List<T>> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Value returned by administration command execution. */
+ List<T> value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara administration command result for
+ * <code>List</code> result value.
+ */
+ ResultList() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get value returned by administration command execution.
+ * @return Value returned by administration command execution.
+ */
+ @Override
+ public List<T> getValue() {
+ return value;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultLog.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultLog.java
new file mode 100644
index 0000000..3ccd927
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultLog.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Administratio Command Result containing server log
+ * as <code>List<String></code> values.
+ * <p/>
+ * Stores administration command result values and command execution state.
+ * Result value is <code>List<String></code> with individual log lines</li>.
+ * <code>String</code> with <code>X-Text-Append-Next</code> response URL
+ * parameters is also stored.</li>
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResultLog extends Result<ValueLog> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Server log value returned by admin command execution. */
+ ValueLog value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara admin command result
+ * for <code>List<String></code> result value containing server log.
+ */
+ ResultLog() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get server log value returned by admin command execution.
+ * <p/>
+ * @return Server log value returned by admin command execution.
+ */
+ @Override
+ public ValueLog getValue() {
+ return value;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultMap.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultMap.java
new file mode 100644
index 0000000..cd867e8
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultMap.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Payara administration command result.
+ * <p>
+ * Stores administration command result values and command execution state.
+ * Result value is <code>Map</code>.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResultMap<K, V> extends Result<Map<K, V>> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Value returned by administration command execution. */
+ HashMap<K, V> value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara administration command result for
+ * <code>Map</code> result value.
+ */
+ ResultMap() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get value returned by administration command execution.
+ * @return Value returned by administration command execution.
+ */
+ @Override
+ public Map<K, V> getValue() {
+ return value;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultProcess.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultProcess.java
new file mode 100644
index 0000000..c859f3a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultProcess.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara Admin Command Result containing process execution result values.
+ * <p/>
+ * Stores admin command result values and command execution state.
+ * Result value is set of values describing process execution.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResultProcess extends Result<ValueProcess> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Value returned by admin command execution. */
+ ValueProcess value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara admin command result for
+ * <code>ValueProcess</code> result value.
+ */
+ ResultProcess() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get value returned by admin command execution.
+ * <p/>
+ * @return Value returned by admin command execution.
+ */
+ @Override
+ public ValueProcess getValue() {
+ return value;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultString.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultString.java
new file mode 100644
index 0000000..83352cb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ResultString.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara administration command result containing <code>String</code> value.
+ * <p/>
+ * Stores administration command result values and command execution state.
+ * Result value is <code>String</code>.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResultString extends Result<String> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Value returned by administration command execution. */
+ String value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara administration command result for
+ * <code>String</code> result value.
+ */
+ ResultString() {
+ super();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get value returned by administration command execution.
+ * <p/>
+ * @return Value returned by administration command execution.
+ */
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Runner.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Runner.java
new file mode 100644
index 0000000..2133322
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/Runner.java
@@ -0,0 +1,989 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.*;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import javax.net.ssl.*;
+import org.netbeans.modules.payara.tooling.PayaraToolsConfig;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Abstract Payara server administration command execution.
+ * <p/>
+ * Abstract class implements common Payara server administration
+ * functionality
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class Runner implements Callable<Result> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * State change request data.
+ */
+ protected static class StateChange {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Payara server administration command runner. */
+ private final Runner runner;
+
+ /** New task execution state. */
+ private final TaskState taskState;
+
+ /** Event related to execution state change. */
+ private final TaskEvent taskEvent;
+
+ /** Additional arguments. */
+ private final String[] args;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of state change request data.
+ * <p/>
+ * @param runner Payara server administration command runner.
+ * @param taskState New task execution state.
+ * @param taskEvent Event related to execution state change.
+ * @param args Additional state change request arguments.
+ */
+ protected StateChange(final Runner runner, final TaskState taskState,
+ final TaskEvent taskEvent, final String... args) {
+ this.runner = runner;
+ this.taskState = taskState;
+ this.taskEvent = taskEvent;
+ this.args = args;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Update task state value in <code>Result</code> object and notify
+ * all registered command execution state listeners about command
+ * execution state change.
+ * <p/>
+ * @return Payara administration command receiveResult with updated
+ * task execution state.
+ */
+ protected Result handleStateChange() {
+ return runner.handleStateChange(taskState, taskEvent, args);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(Runner.class);
+
+ /** Socket connection timeout (in miliseconds). */
+ public static final int HTTP_CONNECTION_TIMEOUT = 3000;
+
+ /** Delay before administration command execution will be retried. */
+ public static final int HTTP_RETRY_DELAY = 3000;
+
+ /** Character used to separate query string from list of parameters. */
+ static final char QUERY_SEPARATOR = '?';
+
+ /** Character used to separate individual parameters. */
+ static final char PARAM_SEPARATOR = '&';
+
+ /** Character used to separate individual items in parameters. */
+ static final char ITEM_SEPARATOR = ':';
+
+ /** Character used to assign value to parameter. */
+ static final char PARAM_ASSIGN_VALUE = '=';
+
+ /** <code>String</code> value for <code>true</code>. */
+ static final String TRUE_VALUE = "true";
+
+ /** <code>String</code> value for <code>false</code>. */
+ static final String FALSE_VALUE = "false";
+
+ /** Executor used to serialize administration commands passed to Payara
+ * server. */
+ private static volatile ExecutorService executor;
+
+ /* Global password authenticator for Payara servers. */
+ private static volatile Authenticator authenticator;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns shared <code>Executor</code> instance to serialize administration
+ * commands passed to Payara server.
+ * <p/>
+ * <code>Executor</code> instance is handled internally.
+ * <p/>
+ * @return Shared <code>Executor</code> instance.
+ */
+ static ExecutorService serializedExecutor() {
+ if (executor != null) {
+ return executor;
+ }
+ synchronized (Runner.class) {
+ if (executor == null) {
+ executor = Executors.newFixedThreadPool(1);
+ }
+ }
+ return executor;
+ }
+
+ /**
+ * Allows to initialize this class to use external
+ * <code>Authenticator</code>.
+ * <p/>
+ * This method must be called before first usage of <code>call()</code>
+ * method.
+ * <p/>
+ * @param authenticator External authenticator for Payara servers
+ * to be supplied.
+ */
+ public static void init(final Authenticator authenticator) {
+ synchronized (Runner.class) {
+ if (Runner.authenticator == null) {
+ Runner.authenticator = authenticator;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ /**
+ * Get external <code>Authenticator</code> if set.
+ * @return External <code>Authenticator</code> for Payara servers
+ * or <code>null</code> if no external <code>Authenticator</code>
+ * was set.
+ */
+ private static Authenticator getAuthenticator() {
+ return authenticator;
+ }
+
+ /**
+ * Returns individual <code>Executor</code> instance to run administration
+ * commands passed to Payara server in parallel.
+ * <p/>
+ * @param size Thread pool size.
+ * @return Individual <code>Executor</code> instance.
+ */
+ static ExecutorService parallelExecutor(final int size) {
+ return Executors.newFixedThreadPool(size);
+ }
+
+ /**
+ * Convert <code>boolean</code> value to <code>String</code> constant.
+ * <p/>
+ * @param value <code>boolean</code> value to be converted.
+ * @return <code>String</code> constant.
+ */
+ static String toString(final boolean value) {
+ return value ? TRUE_VALUE : FALSE_VALUE;
+ }
+
+ /**
+ * Convert <code>String</code> constant representing <code>boolean</code>
+ * value to it's original <code>boolean</code> value.
+ * <p/>
+ * @param constant Constant representing <code>boolean</code> value.
+ * @return Original <code>boolean</code> value.
+ * @throws CommandException when constant representing <code>boolean</code>
+ * value is not recognized.
+ */
+ static boolean toBoolean(final String constant) throws CommandException {
+ if (constant == null || constant.length() < 1)
+ throw new CommandException(
+ CommandException.INVALID_BOOLEAN_CONSTANT);
+ switch(constant.charAt(0)) {
+ case 'T': case 't':
+ if (constant.regionMatches(true, 1, "rue", 1, 3))
+ return true;
+ else
+ throw new CommandException(
+ CommandException.INVALID_BOOLEAN_CONSTANT);
+ case 'F': case 'f':
+ if (constant.regionMatches(true, 1, "alse", 1, 4))
+ return false;
+ else
+ throw new CommandException(
+ CommandException.INVALID_BOOLEAN_CONSTANT);
+ default:
+ throw new CommandException(
+ CommandException.INVALID_BOOLEAN_CONSTANT);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Allow commands to fail without a big message. */
+ protected boolean silentFailureAllowed = false;
+
+ /** Server command path (e.g. "/__asadmin/").*/
+ protected String path;
+
+ /**
+ * Sometimes (e.g. during startup), the server does not accept commands. In
+ * such cases, it will block for 20 seconds and then return with the message
+ * "V3 cannot process this command at this time, please wait".
+ * <p/>
+ * In such cases, we set a flag and have the option to reissue the command.
+ */
+ boolean retry = false;
+
+ /** Authentication success or failure. */
+ boolean auth = true;
+
+ /** Holding Payara server for command execution. */
+ protected PayaraServer server;
+
+ /** Holding data for command execution. */
+ final Command command;
+
+ /**
+ * Payara administration command execution result.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ Result result;
+
+ /** Query string for this command. */
+ final String query;
+
+ /** Listeners that want to know about command state. */
+ protected TaskStateListener[] stateListeners;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>Result</code> object corresponding to command execution
+ * value to be returned.
+ */
+ protected abstract Result createResult();
+
+ /**
+ * Send information to the server via HTTP POST.
+ * <p/>
+ * @return <code>true</code> if using HTTP POST to send to server
+ * or <code>false</code> otherwise
+ */
+ public abstract boolean getDoOutput();
+
+ /**
+ * Inform whether this runner implementation accepts gzip format.
+ * <p/>
+ * @return <code>true</code> when gzip format is accepted,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean acceptsGzip();
+
+ /**
+ * Template method to allow descendants to implement creation of command
+ * url.
+ * <p/>
+ * @return url to connect to
+ */
+ protected abstract String constructCommandUrl() throws CommandException;
+
+ /**
+ * Override to change the type of HTTP method used for this command. Default
+ * is GET.
+ * <p/>
+ * @return HTTP method (GET, POST, etc.)
+ */
+ protected abstract String getRequestMethod();
+
+ /**
+ * Override this method to handle sending data to server.
+ * <p/>
+ * In some cases command has to send data to server. To do that, override
+ * this method.
+ * <p/>
+ * @param hconn
+ * @throws IOException
+ */
+ protected abstract void handleSend(final HttpURLConnection hconn)
+ throws IOException;
+
+ /**
+ * Override this method to read response from provided input stream.
+ * <p/>
+ * Override to read the response data sent by the server. Do not close the
+ * stream parameter when finished. Caller will take care of that.
+ * <p/>
+ * @param in Stream to read data from.
+ * @return true if response was read correctly.
+ * @throws java.io.IOException in case of stream error.
+ */
+ protected abstract boolean readResponse(final InputStream in,
+ final HttpURLConnection hconn);
+
+ /**
+ * Override to parse, validate, and/or format any data read from the server
+ * in readResponse() / readManifest().
+ * <p/>
+ * @return true if data was processed correctly.
+ */
+ protected abstract boolean processResponse();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara Server HTTP Administration Command Entity.
+ * @param path Server command path.
+ */
+ Runner(final PayaraServer server, final Command command,
+ final String path) {
+ this(server, command, path, null);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using HTTP
+ * interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara Server HTTP Administration Command Entity.
+ * @param path Server command path.
+ * @param query Query string for this command.
+ */
+ Runner(final PayaraServer server, final Command command,
+ final String path, final String query) {
+ this.server = server;
+ this.command = command;
+ this.path = path;
+ this.query = query;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the query string for this command. Value is set in constructor.
+ * <p/>
+ * @return query string for this command.
+ */
+ String getQuery() {
+ return query;
+ }
+
+ /**
+ * Get Payara server administration command entity.
+ * <p/>
+ * @return Payara server administration command entity.
+ */
+ Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Get command execution result after task is finished.
+ * <p/>
+ * @return Payara administration command execution result.
+ */
+ public Result getResult() {
+ return result;
+ }
+
+ /**
+ * Do we allow commands to fail without a big message?
+ * <p/>
+ * SDK Exception functional test.
+ * <p/>
+ * @return The silentFailureAllowed.
+ */
+ protected boolean isSilentFailureAllowed() {
+ return silentFailureAllowed;
+ }
+
+ /**
+ * Set whether we allow commands to fail without a big message.
+ * <p/>
+ * @param silentFailureAllowed The silentFailureAllowed to set.
+ */
+ public void setSilentFailureAllowed(final boolean silentFailureAllowed) {
+ this.silentFailureAllowed = silentFailureAllowed;
+ }
+
+ /**
+ * Set listeners to notify about task state changes.
+ * <p/>
+ * Listeners must be set before task is executed.
+ * <p/>
+ * @param listeners Listeners to notify about task state changes.
+ */
+ public void setStateListeners(final TaskStateListener[] listeners) {
+ this.stateListeners = listeners;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Override to set the content-type of information sent to the server.
+ * Default is null (not set).
+ * <p/>
+ * @return content-type of data sent to server via HTTP POST
+ */
+ public String getContentType() {
+ return null;
+ }
+
+ /**
+ * Construct string containing <code>Command</code> string with
+ * <code>query</code> parameters appended.
+ * <p/>
+ * @return <code>Command</code> string with <code>query</code>
+ * parameters appended.
+ */
+ String getCommandWithQuery() {
+ String commandString = command.getCommand();
+ if (query == null) {
+ return commandString;
+ } else {
+ StringBuilder sb = new StringBuilder(commandString.length()
+ + 1 + query.length());
+ sb.append(commandString);
+ sb.append(QUERY_SEPARATOR);
+ sb.append(query);
+ return sb.toString();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build arguments for operationStateChanged method listening for state
+ * changes.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener:<ul>
+ * <li><code>args[0]</code> server name</li>
+ * <li><code>args[1]</code> administration command</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <li><code>args[3]</code> display message in GUI</li></ul>
+ * <p/>
+ * @param exMessage Exception message.
+ * @param display Display this event in GUI (Transformed
+ * to <code>String</code> value containing
+ * <code>"true"</code> value when user should be notified
+ * or <code>"true"</code> or <code>null</code> otherwise.
+ * @return Arguments for operationStateChanged method listening for state
+ * changes.
+ */
+ String[] stateChangeArgs(final String exMessage, final boolean display) {
+ return new String[] {
+ server.getName(), command.getCommand(),
+ exMessage, Boolean.toString(display)
+ };
+ }
+
+ /**
+ * Build arguments for operationStateChanged method listening for state
+ * changes.
+ * <p/>
+ * Send <code>false</code> display argument to operationStateChanged method
+ * to not display GUI message about this event.
+ * <p/>
+ * @param exMessage Exception message.
+ * @return Arguments for operationStateChanged method listening for state
+ * changes.
+ */
+ String[] stateChangeArgs(final String exMessage) {
+ return new String[] {
+ server.getName(), command.getCommand(),
+ exMessage, Boolean.toString(false)
+ };
+ }
+
+ /**
+ * Update task state value in <code>Result</code> object and notify
+ * all registered command execution state listeners about command execution
+ * state change.
+ * <p/>
+ * This method is not responsible for setting receiveResult value returned
+ * by Payara. This method is used after task is submitted into
+ * <code>ExecutorService</code>'s queue and Result object is initialized.
+ * <p/>
+ * @param newTaskState New task execution state.
+ * @param taskEvent Event related to execution state change.
+ * @param args Additional arguments.
+ * @return Payara administration command receiveResult with updated task
+ * execution state.
+ */
+ Result handleStateChange(final TaskState newTaskState,
+ final TaskEvent taskEvent, final String... args) {
+ result.state = newTaskState;
+ if (stateListeners != null) {
+ for (int i = 0; i < stateListeners.length; i++) {
+ if (stateListeners[i] != null) {
+ stateListeners[i].operationStateChanged(newTaskState,
+ taskEvent, args);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Used with external execution code to prepare initial task state before
+ * task is passed to executor.
+ */
+ public void setReadyState() {
+ result = createResult();
+ handleStateChange(TaskState.READY, TaskEvent.SUBMIT,
+ stateChangeArgs(null));
+ }
+
+ /**
+ * Execute an arbitrary server command.
+ * <p/>
+ * @return <code>Future</code> object to retrieve receiveResult of
+ * asynchronous execution.
+ */
+ Future<? extends Result> execute() {
+ setReadyState();
+ return serializedExecutor().submit(this);
+ }
+
+ /**
+ * Execute an arbitrary server command using provided executor.
+ * <p/>
+ * @param executor {@link ExecutorService} instance used to run this task.
+ * @return <code>Future</code> object to retrieve receiveResult of
+ * asynchronous execution.
+ */
+ Future<? extends Result> execute(final ExecutorService executor) {
+ setReadyState();
+ return executor.submit(this);
+ }
+
+ /**
+ * Prepare headers for HTTP connection. This handles all common headers for
+ * all implemented command interfaces (REST, HTTP, ...).
+ * <p/>
+ * @param conn Target HTTP connection.
+ * @throws <code>CommandException</code> if there is a problem with setting
+ * the headers.
+ */
+ protected void prepareHttpConnection(final HttpURLConnection conn)
+ throws CommandException {
+ final String METHOD = "prepareHttpConnection";
+ // Set up standard connection characteristics
+ conn.setAllowUserInteraction(false);
+ conn.setDoInput(true);
+ conn.setUseCaches(false);
+ conn.setConnectTimeout(HTTP_CONNECTION_TIMEOUT);
+ String adminUser = server.getAdminUser();
+ String adminPassword = server.getAdminPassword();
+ LOGGER.log(Level.FINEST, METHOD, "setting", new Object[] {
+ new Integer(HTTP_CONNECTION_TIMEOUT), adminUser,
+ adminPassword});
+ try {
+ conn.setRequestMethod(getRequestMethod());
+ } catch (ProtocolException pe) {
+ throw new CommandException(CommandException.RUNNER_HTTP_HEADERS,
+ pe);
+ }
+ conn.setDoOutput(getDoOutput());
+ String contentType = getContentType();
+ if (contentType != null && contentType.length() > 0) {
+ conn.setRequestProperty("Content-Type", contentType);
+ conn.setChunkedStreamingMode(0);
+ }
+ if (adminPassword != null && adminPassword.length() > 0) {
+ String authString = ServerUtils.basicAuthCredentials(
+ adminUser, adminPassword);
+ LOGGER.log(Level.FINEST, METHOD, "using");
+ conn.setRequestProperty("Authorization", "Basic " + authString);
+ }
+ if (acceptsGzip()) {
+ conn.setRequestProperty("Accept-Encoding", "gzip");
+ }
+ }
+
+ protected void handleSecureConnection(final HttpsURLConnection conn) {
+ final String METHOD = "handleSecureConnection";
+ // let's just trust any server that we connect to...
+ // we aren't send them money or secrets...
+ TrustManager[] tm = new TrustManager[]{
+ new X509TrustManager() {
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] arg0,
+ String arg1) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] arg0,
+ String arg1) throws CertificateException {
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ }
+ };
+
+ SSLContext context;
+ try {
+ context = SSLContext.getInstance("SSL");
+ context.init(null, tm, null);
+ conn.setSSLSocketFactory(context.getSocketFactory());
+ conn.setHostnameVerifier(new HostnameVerifier() {
+
+ @Override
+ public boolean verify(String string, SSLSession ssls) {
+ return true;
+ }
+ });
+ } catch (NoSuchAlgorithmException | KeyManagementException ex) {
+ // if there is an issue here... there will be another exception
+ // later which will take care of the user interaction...
+ LOGGER.log(Level.INFO, METHOD, "issue", conn.getURL());
+ LOGGER.log(Level.INFO, METHOD, "exception", ex);
+ }
+ }
+
+ protected boolean handleReceive(final HttpURLConnection hconn)
+ throws IOException {
+ final String METHOD = "handleReceive";
+ boolean receiveResult = false;
+ InputStream httpInputStream = hconn.getInputStream();
+ try {
+ receiveResult = readResponse(httpInputStream, hconn);
+ } finally {
+ try {
+ httpInputStream.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.WARNING, METHOD, "exception", ioe);
+ }
+ }
+ return receiveResult;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method attributes
+ // Do not use those attributes outside call() method execution context! //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server administration interface URL. */
+ private URL urlToConnectTo;
+
+ /** Payara server administration interface URL connection. */
+ private URLConnection conn;
+
+ /** Payara server administration interface HTTP URL connection. */
+ private HttpURLConnection hconn;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method helpers //
+ // Do not use those methods outside call() method execution context! //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize class instance attributes for <code>call()</code> method.
+ */
+ private void initCallAttributes() {
+ urlToConnectTo = null;
+ conn = null;
+ hconn = null;
+ }
+
+ /**
+ * Creates {@link URLConnection} instance that represents a connection
+ * to Payara server administration interface.
+ * <p/>
+ * Depending on GlassFisg Tooling Library configuration proxy usage for
+ * loopback addresses may be suppressed.
+ * <p/>
+ * @param urlToConnectTo Payara server administration interface URL.
+ * @return lassFish server administration interface URL connection.
+ * @throws IOException IOException if an I/O error occurs while opening the
+ * connection.
+ */
+ private static URLConnection openURLConnection(
+ final URL urlToConnectTo) throws IOException {
+ if (!PayaraToolsConfig.getProxyForLoopback()) {
+ InetAddress addr;
+ try {
+ addr = InetAddress.getByName(urlToConnectTo.getHost());
+ } catch (UnknownHostException ex) {
+ addr = null;
+ }
+ if (addr != null && addr.isLoopbackAddress()) {
+ return urlToConnectTo.openConnection(Proxy.NO_PROXY);
+ }
+ }
+ return urlToConnectTo.openConnection();
+ }
+
+ /**
+ * Handle HTTP connections to server.
+ * <p/>
+ * @return State change request when <code>call()</code> method should exit.
+ */
+ private StateChange handleHTTPConnection() throws IOException {
+ final String METHOD = "handleHTTPConnection";
+ URL oldUrlToConnectTo;
+ do { // deal with possible redirects from 3.1
+ oldUrlToConnectTo = urlToConnectTo;
+ hconn = (HttpURLConnection)conn;
+ if (conn instanceof HttpsURLConnection) {
+ handleSecureConnection((HttpsURLConnection)conn);
+ }
+ prepareHttpConnection(hconn);
+ LOGGER.log(Level.FINEST, METHOD, "connect",
+ new Object[] {server.getHost(),
+ Integer.toString(server.getAdminPort())});
+ // Use external Authenticator if supplied
+ Authenticator extAuth = Runner.getAuthenticator();
+ if (extAuth != null) {
+ Authenticator.setDefault(extAuth);
+ }
+ // Connect to server.
+ hconn.connect();
+ // Send data to server if necessary.
+ handleSend(hconn);
+ int respCode = hconn.getResponseCode();
+ StateChange change = handleHTTPResponse(respCode);
+ if (change != null) {
+ return change;
+ }
+ } while (urlToConnectTo != oldUrlToConnectTo);
+ return null;
+ }
+
+ /**
+ * Handle HTTP response from server.
+ * <p/>
+ * @param responseCode HTTP Response code.
+ * @return State change request when <code>call()</code> method should exit.
+ */
+ private StateChange handleHTTPResponse(
+ final int responseCode) throws IOException {
+ final String METHOD = "handleHTTPResponse";
+ LOGGER.log(Level.FINE, METHOD, "response", responseCode);
+ if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED
+ || responseCode == HttpURLConnection.HTTP_FORBIDDEN) {
+ result.auth = auth = false;
+ return new StateChange(this, TaskState.FAILED,
+ TaskEvent.AUTH_FAILED_HTTP, stateChangeArgs(null, true));
+ } else if (responseCode == HttpURLConnection.HTTP_BAD_GATEWAY) {
+ // signals proxy configuration problem
+ return new StateChange(this, TaskState.FAILED,
+ TaskEvent.BAD_GATEWAY, stateChangeArgs(null, true));
+ } else if (responseCode == HttpURLConnection.HTTP_MOVED_TEMP
+ || responseCode == HttpURLConnection.HTTP_MOVED_PERM) {
+ String newUrl = hconn.getHeaderField("Location");
+ if (null == newUrl || "".equals(newUrl.trim())) {
+ LOGGER.log(Level.SEVERE, METHOD,
+ "invalidRedirect", urlToConnectTo.toString());
+ } else {
+ LOGGER.log(Level.FINE, METHOD, "locationMoved", newUrl);
+ urlToConnectTo = new URL(newUrl);
+ conn = openURLConnection(urlToConnectTo);
+ hconn.disconnect();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Log administration command failure.
+ * <p/>
+ * @param method Method component of log message key.
+ */
+ private void logCommandFailure(final String method) {
+ LOGGER.log(Level.FINE, method, "failure", new Object[] {
+ hconn.toString(), hconn.getContentType(),
+ hconn.getContentEncoding()});
+ Map<String, List<String>> ms2ls = hconn.getHeaderFields();
+ LOGGER.log(Level.FINE, method, "headerFields");
+ for (Map.Entry<String, List<String>> e : ms2ls.entrySet()) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ boolean first = true;
+ for (String v : e.getValue()) {
+ if (first) {
+ first = false;
+ } else {
+ sb.append(", ");
+ }
+ sb.append(v);
+ }
+ sb.append("]");
+ LOGGER.log(Level.FINE, method, "headerField", new String[] {
+ e.getKey(), sb.toString()});
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara server administration command execution call.
+ * This is an entry point from <code>executor<code>'s serialization queue.
+ * <p/>
+ * @return Task execution state.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public Result call() {
+ final String METHOD = "call";
+ boolean httpSucceeded = false;
+ boolean commandSucceeded = false;
+ String commandUrl;
+ initCallAttributes();
+
+ handleStateChange(TaskState.RUNNING, TaskEvent.CMD_RUNNING,
+ stateChangeArgs(null));
+ try {
+ commandUrl = constructCommandUrl();
+ } catch (CommandException ce) {
+ return handleStateChange(TaskState.FAILED, TaskEvent.CMD_EXCEPTION,
+ stateChangeArgs(ce.getLocalizedMessage()));
+ }
+ // disable ("version".equals(cmd) || "__locations".equals(cmd)) ? 1 : 3;
+ int retries = 1;
+ LOGGER.log(Level.FINEST, METHOD, "thread", new Object[] {
+ commandUrl, Thread.currentThread().getName()});
+ try {
+ urlToConnectTo = new URL(commandUrl);
+ while (!httpSucceeded && retries-- > 0) {
+ try {
+ conn = openURLConnection(urlToConnectTo);
+ if (conn instanceof HttpURLConnection) {
+ StateChange change = handleHTTPConnection();
+ if (change != null) {
+ return change.handleStateChange();
+ }
+ // Process the response message.
+ // In Payara v4 HTTP interface authentication failure
+ // can only be found in readResponse() method where
+ // response message contains
+ // "javax.security.auth.login.LoginException".
+ boolean receiveResult = handleReceive(hconn);
+ boolean processResult = processResponse();
+ commandSucceeded = receiveResult && processResult;
+ if (!auth) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.AUTH_FAILED,
+ stateChangeArgs(null, true));
+ } else if (!commandSucceeded
+ && !isSilentFailureAllowed()
+ && LOGGER.isLoggable(Level.FINE)) {
+ logCommandFailure(METHOD);
+ }
+ httpSucceeded = true;
+ } else {
+ LOGGER.log(Level.INFO, METHOD,
+ "unexpectedConnection", urlToConnectTo);
+ }
+ } catch (ProtocolException ex) {
+ handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION,
+ stateChangeArgs(ex.getLocalizedMessage(), true));
+ retries = 0;
+ } catch (ConnectException ce) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.EXCEPTION,
+ stateChangeArgs(ce.getLocalizedMessage()));
+ } catch (IOException ex) {
+ if (retries <= 0) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.EXCEPTION, stateChangeArgs(
+ ex.getLocalizedMessage()));
+ }
+ } catch (RuntimeException ex) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.EXCEPTION, stateChangeArgs(
+ ex.getLocalizedMessage()));
+ } finally {
+ if (null != hconn) {
+ hconn.disconnect();
+ }
+ }
+
+ if (!httpSucceeded && retries > 0) {
+ try {
+ Thread.sleep(HTTP_RETRY_DELAY);
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, METHOD, "sleepInterrupted", ie);
+ }
+ }
+ } // while
+ } catch (MalformedURLException ex) {
+ LOGGER.log(Level.WARNING, METHOD, "malformedURLException", ex);
+ }
+
+ if (commandSucceeded) {
+ return handleStateChange(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED, stateChangeArgs(null));
+ } else {
+ return handleStateChange(TaskState.FAILED, TaskEvent.CMD_FAILED,
+ stateChangeArgs(null));
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadmin.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadmin.java
new file mode 100644
index 0000000..584116e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadmin.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import static org.netbeans.modules.payara.tooling.admin.RunnerJava.getServerConfig;
+import static org.netbeans.modules.payara.tooling.admin.RunnerJava.setJavaEnvironment;
+import org.netbeans.modules.payara.tooling.data.ToolConfig;
+import org.netbeans.modules.payara.tooling.data.ToolsConfig;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server administration command execution using local
+ * asadmin interface.
+ * <p/>
+ * Class implements Payara server administration functionality command line
+ * asadmin interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class RunnerAsadmin extends RunnerJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(RunnerAsadmin.class);
+
+ /** Specifies the administrator username. */
+ private static final String USER_PARAM = "--user";
+
+ /** Specifies the name, including the full path, of a file that contains
+ * password entries. */
+ private static final String PASSWORD_FILE_PARAM = "--passwordfile";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Extracts asadmin JAR path from Payara server entity object.
+ * <p/>
+ * @param server Payara server entity object.
+ * @return Asadmin JAR path to execute.
+ */
+ private static String extractPath(final PayaraServer server) {
+ final String METHOD = "extractPath";
+ ToolsConfig toolsConfig = getServerConfig(server).getTools();
+ if (toolsConfig == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noToolsConfig"),
+ server.getVersion());
+ }
+ ToolConfig asadmin = toolsConfig.getAsadmin();
+ if (asadmin == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noAsadminConfig"),
+ server.getVersion());
+ }
+ String serverHome = server.getServerHome();
+ String asadminJar = asadmin.getJar();
+ StringBuilder sb = new StringBuilder(serverHome.length()
+ + OsUtils.FILE_SEPARATOR_LENGTH + asadminJar.length());
+ sb.append(serverHome);
+ ServerUtils.addPathElement(sb, asadminJar);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara administration command result.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. Method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ protected ResultString result;
+
+ /** Asadmin JAR path (relative under Payara home). */
+ private final String asadminJar;
+
+ /** Process standard input. */
+ protected Writer stdIn;
+
+ /** Process standard output. */
+ protected Reader stdOut;
+
+ /** Process standard error output. */
+ protected Reader stdErr;
+
+ /** Process IO processing. */
+ protected ProcessIOContent processIO;
+
+ /** Support for <code>asadmin</code> <code>--passwordfile</code>
+ * file format. */
+ protected PasswordFile passwordFile;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create internal <code>ProcessIOContent</code> object corresponding
+ * to command execution IO.
+ */
+ protected abstract ProcessIOContent createProcessIOContent();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * command line asadmin interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ public RunnerAsadmin(final PayaraServer server, final Command command,
+ final String query) {
+ super(server, command, query);
+ asadminJar = extractPath(server);
+ stdIn = null;
+ stdOut = null;
+ stdErr = null;
+ passwordFile = new PasswordFile(server);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultString</code> object corresponding
+ * to <code>String</code>command execution value to be returned.
+ * <p/>
+ * @return <code>String</code>command execution value to be returned.
+ */
+ @Override
+ protected Result createResult() {
+ return result = new ResultString();
+ }
+
+ /**
+ * Reads response from server and stores internally.
+ * <p/>
+ * @param in Stream to read data from.
+ * @return Always returns <code>false</code>.
+ * @throws CommandException in case of stream error.
+ */
+ @Override
+ protected boolean readResponse(final InputStream in,
+ final HttpURLConnection hconn) {
+ return false;
+ }
+
+ /**
+ * Extracts result value from internal storage.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ protected boolean processResponse() {
+ return false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method helpers //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build process execution arguments.
+ * <p/>
+ * @return Process execution arguments.
+ */
+ String buildProcessArgs() {
+ final String METHOD = "buildProcessArgs";
+ String user = server.getAdminUser();
+ String passwordFilePath = passwordFile.getFilePath();
+ StringBuilder sb = new StringBuilder(JAR_PARAM.length() + 1
+ + asadminJar.length() + 1 + USER_PARAM.length() + 1
+ + user.length() + 1 + PASSWORD_FILE_PARAM.length() + 1
+ + passwordFilePath.length() + 1
+ + command.command.length() + 1
+ + query.length());
+ sb.append(JAR_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(asadminJar);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(USER_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(user);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(PASSWORD_FILE_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(passwordFilePath);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(command.command);
+ sb.append(QUERY_SEPARATOR);
+ sb.append(query);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Execute an arbitrary server command.
+ * <p/>
+ * @return <code>Future</code> object to retrieve receiveResult of
+ * asynchronous execution.
+ */
+ @Override
+ Future<? extends Result> execute() {
+ processIO = createProcessIOContent();
+ return super.execute();
+ }
+
+ /**
+ * Execute an arbitrary server command using provided executor.
+ * <p/>
+ * @return <code>Future</code> object to retrieve receiveResult of
+ * asynchronous execution.
+ */
+ @Override
+ Future<? extends Result> execute(final ExecutorService executor) {
+ processIO = createProcessIOContent();
+ return super.execute(executor);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara server administration command execution call.
+ * This is an entry point from <code>executor<code>'s serialization queue.
+ * <p/>
+ * Attempts to start local GalssFish DAS directly using <code>java</code>
+ * executable.
+ * <p/>
+ * @return Task execution state.
+ */
+ @Override
+ public Result call() {
+ if (!verifyJavaVM()) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.NO_JAVA_VM, command.getCommand(),
+ server.getName());
+ }
+ passwordFile.write();
+ Process process;
+ String[] args = OsUtils.parseParameters(javaVMExe, buildProcessArgs());
+ ProcessBuilder pb = new ProcessBuilder(args);
+ pb.redirectErrorStream(true);
+ setProcessCurrentDir(pb);
+ setJavaEnvironment(pb.environment(), command);
+ try {
+ process = pb.start();
+ } catch (IOException ex) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.JAVA_VM_EXEC_FAILED, command.getCommand(),
+ server.getName());
+ }
+ ProcessIOParser parser = new ProcessIOParser(
+ new OutputStreamWriter(process.getOutputStream()),
+ new InputStreamReader(process.getInputStream()),
+ processIO);
+ ProcessIOResult verifyResult;
+ try {
+ verifyResult = parser.verify();
+ result.value = parser.getOutput();
+ } catch (IOException ex) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.EXCEPTION, command.getCommand(),
+ server.getName());
+ }
+ switch (verifyResult) {
+ case SUCCESS:
+ return handleStateChange(TaskState.COMPLETED,
+ TaskEvent.CMD_COMPLETED, command.getCommand(),
+ server.getName());
+ default:
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.CMD_FAILED, command.getCommand(),
+ server.getName());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminChangeAdminPassword.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminChangeAdminPassword.java
new file mode 100644
index 0000000..f7462fe
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminChangeAdminPassword.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Change administrator password command execution using local
+ * asadmin interface.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class RunnerAsadminChangeAdminPassword extends RunnerAsadmin {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerAsadminChangeAdminPassword.class);
+
+ /** Specifies the domain of the administrator user. */
+ private static final String DOMAIN_NAME_PARAM = "--domain_name";
+
+ /** Specifies the parent directory of the domain specified
+ * in the --domain_name option. */
+ private static final String DOMAINDIR_PARAM = "--domaindir";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds <code>change-admin-password</code> command query string.
+ */
+ private static String query(final PayaraServer server,
+ final Command command) {
+ final String METHOD = "query";
+ String domainsFolder = OsUtils.escapeString(server.getDomainsFolder());
+ String domainName = OsUtils.escapeString(server.getDomainName());
+ if (domainName == null || domainsFolder == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "nullValue"));
+ }
+ StringBuilder sb = new StringBuilder(
+ DOMAIN_NAME_PARAM.length() + 1 + domainName.length() + 1
+ + DOMAINDIR_PARAM.length() + 1 + domainsFolder.length());
+ sb.append(DOMAINDIR_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(domainsFolder);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(DOMAIN_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(domainName);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandChangeAdminPassword command;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * command line asadmin interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerAsadminChangeAdminPassword(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(server, command));
+ final String METHOD = "init";
+ if (command instanceof CommandChangeAdminPassword) {
+ this.command = (CommandChangeAdminPassword)command;
+ } else {
+ throw new CommandException(
+ LOGGER.excMsg(METHOD, "illegalInstance"));
+ }
+ passwordFile.setAdminNewPassword(this.command.password);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create internal <code>ProcessIOContent</code> object corresponding
+ * to command execution IO.
+ */
+ @Override
+ protected ProcessIOContent createProcessIOContent() {
+ ProcessIOContent processIOContent = new ProcessIOContent();
+ processIOContent.addOutput(
+ new String[] {"Command", "executed successfully"},
+ new String[] {"Command change-admin-password failed"});
+ return processIOContent;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminRestoreDomain.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminRestoreDomain.java
new file mode 100644
index 0000000..d389178
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerAsadminRestoreDomain.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import static org.netbeans.modules.payara.tooling.admin.RunnerJava.PARAM_ASSIGN_VALUE;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Peter Benedikovic
+ */
+public class RunnerAsadminRestoreDomain extends RunnerAsadmin {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerAsadminRestoreDomain.class);
+
+ /** Specifies the domain dir. */
+ private static final String DOMAIN_DIR_PARAM = "--domaindir";
+
+ /** Specifies the directory where the backup archive is stored. */
+ private static final String BACKUP_DIR_PARAM = "--backupdir";
+
+ /** Specifies the name of the backup archive. */
+ private static final String BACKUP_FILE_PARAM = "--filename";
+
+ /** Specifies the force param needed to restore from non-standard location. */
+ private static final String FORCE_PARAM = "--force";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds <code>change-admin-password</code> command query string.
+ */
+ private static String query(final PayaraServer server,
+ final Command command) {
+ final String METHOD = "query";
+ CommandRestoreDomain restoreCommand;
+ String domainsFolder = OsUtils.escapeString(server.getDomainsFolder());
+ String domainName = OsUtils.escapeString(server.getDomainName());
+ if (domainName == null || domainsFolder == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "nullValue"));
+ }
+ if (command instanceof CommandRestoreDomain) {
+ restoreCommand = (CommandRestoreDomain)command;
+ } else {
+ throw new CommandException(
+ LOGGER.excMsg(METHOD, "illegalInstance"));
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append(DOMAIN_DIR_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(domainsFolder);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(FORCE_PARAM);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(BACKUP_FILE_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(restoreCommand.domainBackup.getAbsolutePath());
+ sb.append(PARAM_SEPARATOR);
+ sb.append(domainName);
+ System.out.println("Restore command params: " + sb.toString());
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandRestoreDomain command;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * command line asadmin interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerAsadminRestoreDomain(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(server, command));
+ final String METHOD = "init";
+ if (command instanceof CommandRestoreDomain) {
+ this.command = (CommandRestoreDomain)command;
+ } else {
+ throw new CommandException(
+ LOGGER.excMsg(METHOD, "illegalInstance"));
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create internal <code>ProcessIOContent</code> object corresponding
+ * to command execution IO.
+ */
+ @Override
+ protected ProcessIOContent createProcessIOContent() {
+ ProcessIOContent processIOContent = new ProcessIOContent();
+ processIOContent.addOutput(
+ new String[] {"Command", "executed successfully"},
+ new String[] {"Command restore-domain failed"});
+ return processIOContent;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttp.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttp.java
new file mode 100644
index 0000000..ca8bf5d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttp.java
@@ -0,0 +1,541 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.*;
+import java.net.*;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.Manifest;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.NetUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server administration command execution using HTTP interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttp extends Runner {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Character used to separate individual items in libraries query
+ * parameter. */
+ static final char LIBRARY_SEPARATOR = ',';
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Calculate properties length based on properties map.
+ * <p/>
+ * @param properties Properties to be added into query string.
+ * @param paramName Properties parameter name in query string.
+ * @return Size of properties query string to be added.
+ */
+ static int queryPropertiesLength(final Map<String,String> properties,
+ final String paramName) {
+ int propertyLength = 0;
+ if (null != properties && properties.size() > 0) {
+ Set<Map.Entry<String,String>> entrySet = properties.entrySet();
+ boolean first = true;
+ propertyLength += paramName.length() + 2;
+ for (Map.Entry<String,String> entry : entrySet) {
+ String key = entry.getKey();
+ String val = entry.getValue();
+ if (key == null)
+ throw new CommandException(
+ CommandException.ILLEGAL_NULL_VALUE);
+ if (first) {
+ first = false;
+ }
+ else {
+ propertyLength++;
+ }
+ propertyLength += key.length() + 1 +
+ (val != null ? val.length() : 0);
+ }
+ }
+ return propertyLength;
+ }
+
+ /**
+ * Calculate libraries length based on libraries array.
+ * <p/>
+ * @param libraries Libraries to be added into query string.
+ * @param paramName Libraries parameter name in query string.
+ * @return Size of libraries query string to be added.
+ */
+ static int queryLibrariesLength(final File[] libraries,
+ final String paramName) {
+ int propertyLength = 0;
+ if (null != libraries && libraries.length > 0) {
+ boolean first = true;
+ propertyLength += paramName.length() + 2;
+ for (File library : libraries) {
+ if (first) {
+ first = false;
+ }
+ else {
+ propertyLength++;
+ }
+ propertyLength += library.getPath().length();
+ }
+ }
+ return propertyLength;
+ }
+
+ /**
+ * Append properties to existing query string stored in given
+ * <code>StringBuilder</code>.
+ * <p/>
+ * @param sb Target <code>StringBuilder</code> where to append
+ * properties.
+ * @param properties Properties to be added into query string.
+ * @param paramName Properties parameter name in query string.
+ * @param separator Prepend parameter separator if <code>true</code>
+ * @return Target <code>StringBuilder</code> with properties appended.
+ */
+ static StringBuilder queryPropertiesAppend(StringBuilder sb,
+ final Map<String,String> properties, final String paramName,
+ final boolean separator) {
+ if (null != properties && properties.size() > 0) {
+ Set<Map.Entry<String,String>> entrySet = properties.entrySet();
+ boolean first = true;
+ if (separator) {
+ sb.append(PARAM_SEPARATOR);
+ }
+ sb.append(paramName).append(PARAM_ASSIGN_VALUE);
+ for (Map.Entry<String,String> entry : entrySet) {
+ String key = entry.getKey();
+ String val = entry.getValue();
+ if (first) {
+ first = false;
+ }
+ else {
+ sb.append(ITEM_SEPARATOR);
+ }
+ sb.append(key);
+ sb.append(PARAM_ASSIGN_VALUE);
+ if (val != null) {
+ sb.append(val);
+ }
+ }
+ }
+ return sb;
+ }
+
+ /**
+ * Append libraries to existing query string stored in given
+ * <code>StringBuilder</code>.
+ * <p/>
+ * @param sb Target <code>StringBuilder</code> where to append
+ * properties.
+ * @param libraries Libraries to be added into query string.
+ * @param paramName Libraries parameter name in query string.
+ * @param separator Prepend parameter separator if <code>true</code>
+ * @return Target <code>StringBuilder</code> with libraries appended.
+ */
+ static StringBuilder queryLibrariesAppend(StringBuilder sb,
+ final File[] libraries, final String paramName,
+ final boolean separator) {
+ if (null != libraries && libraries.length > 0) {
+ boolean first = true;
+ if (separator) {
+ sb.append(PARAM_SEPARATOR);
+ }
+ sb.append(paramName).append(PARAM_ASSIGN_VALUE);
+ for (File library : libraries) {
+ if (first) {
+ first = false;
+ }
+ else {
+ sb.append(LIBRARY_SEPARATOR);
+ }
+ sb.append(library.getPath());
+ }
+ }
+ return sb;
+ }
+
+ /**
+ * Check <code>Manifest</code> <i>exit-code<i> attribute for result.
+ * Missing value or any value differed to< code>"FAILED"</code>
+ * is considered as success.
+ * <p/>
+ * Response processing helper method. Manifest must contain valid data.
+ * <p/>
+ * @param manifest Manifest from server response.
+ * @return <code>true</code> for success and <code>false</code> for failure.
+ */
+ private static boolean successExitCode(Manifest manifest) {
+ String exitCode = manifest.getMainAttributes().getValue("exit-code");
+ return exitCode == null
+ || !"FAILURE".equals(exitCode.toUpperCase(Locale.ENGLISH));
+ }
+
+ private static String getHttpListenerProtocol(String hostname, int port,
+ String url) {
+ String retVal = "http"; // NOI18N
+ try {
+ if (NetUtils.isSecurePort(hostname, port)) {
+ retVal = "https"; // NOI18N
+ }
+ } catch (ConnectException ex) {
+ Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex);
+ } catch (SocketException ex) {
+ Logger.log(Level.FINE, hostname + ":" + port + "::" + url, ex);
+ } catch (SocketTimeoutException ex) {
+ Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex);
+ } catch (IOException ex) {
+ Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex);
+ }
+ return retVal;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Manifest from server response.
+ * <p/>
+ * <code>Manifest</code> instance is internal server response holder.
+ * <code>Manifest</code> instance life cycle is started
+ * in <code>readResponse</code> method where manifest returned from server
+ * is read and stored internally.
+ */
+ Manifest manifest;
+
+ /**
+ * Payara administration command result.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultString result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttp(final PayaraServer server, final Command command) {
+ this(server, command, (String)null);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * This constructor allows child classes to set their own path.
+ * <p/>
+ * <b>For use in child classes only.</b>
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ RunnerHttp(final PayaraServer server, final Command command,
+ final String query) {
+ this(server, command, "/__asadmin/", query);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * This constructor allows child classes to set their own path.
+ * <p/>
+ * <b>For use in child classes only.</b>
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param path Server command path.
+ * @param query Query string for this command.
+ */
+ protected RunnerHttp(final PayaraServer server, final Command command,
+ final String path, final String query) {
+ super(server, command, path, query);
+ silentFailureAllowed = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultString</code> object corresponding
+ * to <code>String</code>command execution value to be returned.
+ * <p/>
+ * @return <code>String</code>command execution value to be returned.
+ */
+ @Override
+ protected Result createResult() {
+ return result = new ResultString();
+ }
+
+ /**
+ * Do not send information to the server via HTTP POST by default.
+ * <p/>
+ * @return <code>true</code> if using HTTP POST to send to server
+ * or <code>false</code> otherwise
+ */
+ @Override
+ public boolean getDoOutput() {
+ return false;
+ }
+
+ /**
+ * Inform whether this runner implementation accepts gzip format.
+ * <p/>
+ * @return <code>true</code> when gzip format is accepted,
+ * <code>false</code> otherwise.
+ */
+ @Override
+ public boolean acceptsGzip() {
+ return false;
+ }
+
+ /**
+ * Build Payara HTTP command URL.
+ * <o>
+ * @return <code>String</code> value containing command URL.
+ * @throws <code>CommandException</code> if there is a problem with building
+ * command URL.
+ */
+ @Override
+ protected String constructCommandUrl() throws CommandException {
+ String host = server.getHost();
+ boolean useAdminPort = !"false"
+ .equals(System.getProperty("payara.useadminport"));
+ int port = useAdminPort ? server.getAdminPort() : server.getPort();
+ String protocol = "http";
+ String url = server.getUrl();
+ String domainsDir = server.getDomainsFolder();
+ if (null == url) {
+ protocol = getHttpListenerProtocol(host, port, ":::"
+ + command.getCommand() + "?" + query);
+ } else if (!(url.contains("ee6wc"))) {
+ protocol = getHttpListenerProtocol(host, port, url + ":::"
+ + command.getCommand() + "?" + query);
+ } else if (url.contains("ee6wc") && (null == domainsDir
+ || "".equals(domainsDir))) {
+ protocol = "https";
+ }
+ URI uri;
+ try {
+ uri = new URI(protocol, null, host, port,
+ path + command.getCommand(), query, null);
+ } catch (URISyntaxException use) {
+ throw new CommandException(CommandException.RUNNER_HTTP_URL, use);
+ }
+ // These characters don't get handled by GF correctly. Best I can tell.
+ return uri.toASCIIString().replace("+", "%2b");
+ }
+
+ /**
+ * Override to change the type of HTTP method used for this command.
+ * Default is GET.
+ *
+ * @return HTTP method (GET, POST, etc.)
+ */
+ @Override
+ protected String getRequestMethod() {
+ return "GET";
+ }
+
+ /**
+ * Handle sending data to server using HTTP command interface.
+ * <p/>
+ * Does nothing by default.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ }
+
+ /**
+ * Reads response from server and stores it into internal
+ * <code>Manifest</code> object. Value of <i>exit-code<i> attribute
+ * is verified to detect if command completed successfully. If not,
+ * <i>message</i> value is checked for "please wait" <code>String</code>
+ * to eventually set <code>retry</code> value to <code>true</code>.
+ * <p/>
+ * Override to read the response data sent by the server. Do not close
+ * the stream parameter when finished. Caller will take care of that.
+ * <p/>
+ * @param in Stream to read data from.
+ * @return true if response was read correctly.
+ * @throws CommandException in case of stream error.
+ */
+ @Override
+ protected boolean readResponse(InputStream in, HttpURLConnection hconn) {
+ boolean readResult;
+ manifest = new Manifest();
+ try {
+ Logger.log(Level.FINEST, "Reading response from {0}:{1}",
+ new Object[] {server.getHost(),
+ Integer.toString(server.getAdminPort())});
+ manifest.read(in);
+ } catch (IOException ioe) {
+ throw new CommandException(CommandException.HTTP_RESP_IO_EXCEPTION,
+ ioe);
+ }
+ if (successExitCode(manifest)) {
+ readResult = true;
+ }
+ else {
+ readResult = false;
+ String message = getMessage(manifest);
+ if (message != null) {
+ if (message.contains("please wait")) {
+ retry = true;
+ } else if (message.contains(
+ "javax.security.auth.login.LoginException")) {
+ auth = false;
+ }
+ }
+ }
+ return readResult;
+ }
+
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ result.value = getMessage(manifest);
+ result.auth = auth;
+ Logger.log(Level.FINEST, "Manifest message: {0}",
+ new Object[] {result.value});
+ return result.value != null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Override to provide the lastModified date for data source whose
+ * inputstream is returned by getInputStream. Must not return null if
+ * getInputStream() does not return null;
+ *
+ * @return String format of long integer from lastModified date of source.
+ */
+ public String getLastModified() {
+ return null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve <i>message<i> from <code>Manifest</code> object.
+ * <p/>
+ * Response processing helper method. Manifest must contain valid data.
+ * <code>Manifest</code> instance is always created in
+ * <code>readResponse</code> method so no <code>null</code> check is
+ * required here.
+ * <p/>
+ * @param manifest Manifest from server response.
+ * @return Value of <i>message<i> attribute or <code>null</code> if
+ * no such attribute exists.
+ */
+ private String getMessage(Manifest manifest) {
+ String message = null;
+ String tmp = manifest.getMainAttributes().getValue("message");
+ if (null != tmp) {
+ try {
+ message = URLDecoder.decode(
+ ServerUtils.manifestDecode(tmp), "UTF-8");
+ } catch (UnsupportedEncodingException uee) {
+ Logger.log(Level.WARNING, "Could not URL decode with UTF-8", uee);
+ } catch (IllegalArgumentException iae) {
+ Logger.log(Level.FINE, "Caught IllegalArgumentException", iae);
+ message = tmp;
+ }
+ }
+ return message;
+ }
+
+ /**
+ * Get extra properties for ZIP entries.
+ * <p/>
+ * @return Extra properties for ZIP entries.
+ */
+ byte[] getExtraProperties() {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Properties props = new Properties();
+ props.setProperty("data-request-type", "file-xfer");
+ props.setProperty("last-modified", getLastModified());
+ props.put("data-request-name", "DEFAULT");
+ props.put("data-request-is-recursive", "true");
+ props.put("Content-Type", "application/octet-stream");
+ props.list(new java.io.PrintStream(baos));
+ return baos.toByteArray();
+ }
+
+ /**
+ * Prepare headers for HTTP connection.
+ * <p/>
+ * @param conn Target HTTP connection.
+ * @throws <code>CommandException</code> if there is a problem with setting
+ * the headers.
+ */
+ @Override
+ protected void prepareHttpConnection(HttpURLConnection conn) throws CommandException {
+ super.prepareHttpConnection(conn);
+ String contentType = getContentType();
+ if (contentType == null || contentType.length() <= 0) {
+ // work around that helps prevent tickling the
+ // GF issue that is the root cause of 195384.
+ //
+ // GF doesn't expect to get image content, so it doesn't
+ // try to handle the content... which prevents the
+ // exception, according to Tim Quinn.
+ conn.setRequestProperty("Content-Type", "image/png");
+ }
+ conn.setRequestProperty("User-Agent", "hk2-agent");
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpAddResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpAddResources.java
new file mode 100644
index 0000000..ffc7b58
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpAddResources.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner executes add-resources command via HTTP interface.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerHttpAddResources extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds add-resources query string for given command.
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandAddResources</code> instance is expected.
+ * @return Add-resources query string for given command.
+ */
+ private static String query(Command command) {
+ CommandAddResources cmd = (CommandAddResources) command;
+ StringBuilder sb = new StringBuilder();
+ sb.append("xml_file_name=");
+ sb.append(cmd.xmlResFile.getAbsolutePath());
+ if (cmd.target != null) {
+ sb.append("&target=");
+ sb.append(cmd.target);
+ }
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpAddResources(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpClass.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpClass.java
new file mode 100644
index 0000000..aebfd7e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpClass.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to select Payara server admin command runner for command entity.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface RunnerHttpClass {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara command runner class as named value. */
+ Class runner() default RunnerHttp.class;
+
+ /** Payara command string if differs from default one. */
+ String command() default "";
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateAdminObject.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateAdminObject.java
new file mode 100644
index 0000000..a06a359
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateAdminObject.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server create administered object administration command execution
+ * using HTTP interface.
+ * <p/>
+ * Contains code for create administered object command.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateAdminObject extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Create JDBC connection pool command <code>restype</code>
+ * parameter name. */
+ private static final String RESOURCE_TYPE_PARAM = "restype";
+
+ /** Create JDBC connection pool command <code>jndi_name</code>
+ * parameter name. */
+ private static final String JNDI_NAME_PARAM = "jndi_name";
+
+ /** Create JDBC connection pool command <code>raName</code>
+ * parameter name. */
+ private static final String RA_NAME_PARAM = "raname";
+
+ /** Create JDBC connection pool command <code>property</code>
+ * parameter name. */
+ private static final String PROPERTY_PARAM = "property";
+
+ /** Create JDBC connection pool command <code>enabled</code>
+ * parameter name. */
+ private static final String ENABLED_PARAM = "enabled";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds create JDBC connection pool query string for given command.
+ * <p/>
+ * <code>QUERY :: "jndi_name" '=' <jndiName><br/>
+ * ['&' "restype" '=' <restype> ]<br/>
+ * ['&' "raname" '=' <raName> ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * ['&' "enabled" '=' true|false ]<br/>
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandCreateAdminObject</code> instance
+ * is expected.
+ * @return Create JDBC connection pool query string for given command.
+ */
+ private static String query(final Command command) {
+ String jndiName;
+ String resType;
+ String raName;
+ boolean enabled;
+ if (command instanceof CommandCreateAdminObject) {
+ jndiName = ((CommandCreateAdminObject)command).jndiName;
+ resType = ((CommandCreateAdminObject)command).resType;
+ raName = ((CommandCreateAdminObject)command).raName;
+ enabled = ((CommandCreateAdminObject)command).enabled;
+ } else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ boolean isResType = resType != null && resType.length() > 0;
+ boolean isRaname = raName != null && raName.length() > 0;
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ JNDI_NAME_PARAM.length() + 1 + jndiName.length()
+ + ENABLED_PARAM.length() + 1 + toString(enabled).length()
+ + ( isResType
+ ? RESOURCE_TYPE_PARAM.length() + 1 + resType.length()
+ : 0)
+ + ( isRaname
+ ? RA_NAME_PARAM.length() + 1 + raName.length()
+ : 0)
+ + queryPropertiesLength(
+ ((CommandCreateAdminObject)command).properties,
+ PROPERTY_PARAM));
+ // Build query string
+ sb.append(JNDI_NAME_PARAM).append(PARAM_ASSIGN_VALUE);
+ sb.append(jndiName);
+ sb.append(PARAM_SEPARATOR).append(ENABLED_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(toString(enabled));
+ if (isResType) {
+ sb.append(PARAM_SEPARATOR).append(RESOURCE_TYPE_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(resType);
+ }
+ if (isRaname) {
+ sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(raName);
+ }
+ queryPropertiesAppend(sb,
+ ((CommandCreateAdminObject)command).properties,
+ PROPERTY_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateAdminObject(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnector.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnector.java
new file mode 100644
index 0000000..2ae0853
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnector.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server create connector resource administration command execution
+ * using HTTP interface.
+ * <p/>
+ * Contains code for create connector resource command.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateConnector extends RunnerHttp {
+
+
+ /** Create connector resource command <code>jndi_name</code>
+ * parameter name. */
+ private static final String JNDI_NAME_PARAM = "jndi_name";
+
+ /** Create connector resource command <code>poolname</code>
+ * parameter name. */
+ private static final String POOL_NAME_PARAM = "poolname";
+
+ /** Create connector resource command <code>property</code>
+ * parameter name. */
+ private static final String PROPERTY_PARAM = "property";
+
+ /** Create connector resource command <code>enabled</code>
+ * parameter name. */
+ private static final String ENABLED_PARAM = "enabled";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds create connector resource query string for given command.
+ * <p/>
+ * <code>QUERY :: "jndi_name" '=' <jndiName><br/>
+ * ['&' "poolname" '=' <poolName> ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * ['&' "enabled" '=' true|false ]<br/>
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandCreateConnector</code> instance
+ * is expected.
+ * @return Create connector resource query string for given command.
+ */
+ private static String query(final Command command) {
+ String jndiName;
+ String poolName;
+ boolean enabled;
+ if (command instanceof CommandCreateConnector) {
+ jndiName = ((CommandCreateConnector)command).jndiName;
+ poolName = ((CommandCreateConnector)command).poolName;
+ enabled = ((CommandCreateConnector)command).enabled;
+ } else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ boolean isPoolName = poolName != null && poolName.length() > 0;
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ JNDI_NAME_PARAM.length() + 1 + jndiName.length()
+ + ENABLED_PARAM.length() + 1 + toString(enabled).length()
+ + ( isPoolName
+ ? POOL_NAME_PARAM.length() + 1 + poolName.length()
+ : 0)
+ + queryPropertiesLength(
+ ((CommandCreateConnector)command).properties,
+ PROPERTY_PARAM));
+ // Build query string
+ sb.append(JNDI_NAME_PARAM).append(PARAM_ASSIGN_VALUE);
+ sb.append(jndiName);
+ sb.append(PARAM_SEPARATOR).append(ENABLED_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(toString(enabled));
+ if (isPoolName) {
+ sb.append(PARAM_SEPARATOR).append(POOL_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(poolName);
+ }
+ queryPropertiesAppend(sb,
+ ((CommandCreateConnector)command).properties,
+ PROPERTY_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateConnector(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnectorConnectionPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnectorConnectionPool.java
new file mode 100644
index 0000000..4d674d5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateConnectorConnectionPool.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server create EIS connection pool administration command execution
+ * using HTTP interface.
+ * <p/>
+ * Contains code for create EIS connection pool command.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateConnectorConnectionPool extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Create JDBC connection pool command <code>poolname</code>
+ * parameter name. */
+ private static final String POOL_NAME_PARAM = "poolname";
+
+ /** Create JDBC connection pool command <code>raname</code>
+ * parameter name. */
+ private static final String RA_NAME_PARAM = "raname";
+
+ /** Create JDBC connection pool command <code>connectiondefinition</code>
+ * parameter name. */
+ private static final String CONNECTION_DEFINITION_PARAM
+ = "connectiondefinition";
+
+ /** Create JDBC connection pool command <code>property</code>
+ * parameter name. */
+ private static final String PROPERTY_PARAM = "property";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds create JDBC connection pool query string for given command.
+ * <p/>
+ * <code>QUERY :: "poolname" '=' <poolname><br/>
+ * ['&' "restype" '=' <restype> ]<br/>
+ * ['&' "raname" '=' <raName> ]<br/>
+ * ['&' "connectiondefinition" '=' <connectionDefinition> ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandCreateAdminObject</code> instance
+ * is expected.
+ * @return Create JDBC connection pool query string for given command.
+ */
+ private static String query(final Command command) {
+ String poolName;
+ String raName;
+ String connectionDefinition;
+ if (command instanceof CommandCreateConnectorConnectionPool) {
+ poolName = ((CommandCreateConnectorConnectionPool)command).poolName;
+ raName = ((CommandCreateConnectorConnectionPool)command).raName;
+ connectionDefinition
+ = ((CommandCreateConnectorConnectionPool)command)
+ .connectionDefinition;
+ } else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ boolean isRaname = raName != null && raName.length() > 0;
+ boolean isConnectionDefinition = connectionDefinition != null
+ && connectionDefinition.length() > 0;
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ POOL_NAME_PARAM.length() + 1 + poolName.length()
+ + ( isRaname
+ ? RA_NAME_PARAM.length() + 1 + raName.length()
+ : 0)
+ + ( isConnectionDefinition
+ ? CONNECTION_DEFINITION_PARAM.length()
+ + 1 + connectionDefinition.length()
+ : 0)
+ + queryPropertiesLength(
+ ((CommandCreateConnectorConnectionPool)command)
+ .properties, PROPERTY_PARAM));
+ if (isRaname) {
+ sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(raName);
+ }
+ if (isConnectionDefinition) {
+ sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(connectionDefinition);
+ }
+ queryPropertiesAppend(sb,
+ ((CommandCreateConnectorConnectionPool)command).properties,
+ PROPERTY_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateConnectorConnectionPool(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateInstance.java
new file mode 100644
index 0000000..202a0a1
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateInstance.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara instance and cluster administration command with
+ * <code>DEFAULT=<target></code> query execution using HTTP interface.
+ * <p/>
+ * Contains common code for commands that are called with
+ * <code>DEFAULT=<target></code> query string. Individual child classes
+ * are not needed at this stage.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateInstance extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerHttpCreateInstance.class);
+
+ /** Start/Stop command <code>DEFAULT</code> param name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ /** Start/Stop command <code>node</code> param name. */
+ private static final String NODE_PARAM = "node";
+
+ /** Start/Stop command <code>cluster</code> param name. */
+ private static final String CLUSTER_PARAM = "cluster";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds enable/disable query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <name> '&' "node" '=' <node>
+ * ['&' "cluster" '=' <cluster> ]</code>
+ * <p/>
+ * @param command Payara Server Admin Command Entity.
+ * <code>CommandDisable</code> instance is expected.
+ * @return Enable/Disable query string for given command.
+ */
+ private static String query(Command command) {
+ final String METHOD = "query";
+ String name;
+ String cluster;
+ String node;
+ if (command instanceof CommandCreateInstance) {
+ cluster = Utils.sanitizeName(
+ ((CommandCreateInstance)command).target);
+ if (((CommandTargetName)command).name == null
+ || ((CommandCreateInstance)command).node == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "nullValue"));
+ }
+ name = Utils.sanitizeName(((CommandCreateInstance)command).name);
+ node = Utils.sanitizeName(((CommandCreateInstance)command).node);
+ }
+ else {
+ throw new CommandException(
+ LOGGER.excMsg(METHOD, "illegalInstance"));
+ }
+ StringBuilder sb = new StringBuilder(
+ DEFAULT_PARAM.length() + 1 + name.length()
+ + 1 + NODE_PARAM.length() + 1 + node.length() + (
+ cluster != null
+ ? 1 + CLUSTER_PARAM.length() + 1 + cluster.length()
+ : 0
+ ) );
+ sb.append(DEFAULT_PARAM).append(PARAM_ASSIGN_VALUE).append(name);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(NODE_PARAM).append(PARAM_ASSIGN_VALUE).append(node);
+ if (cluster != null) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(CLUSTER_PARAM).append(PARAM_ASSIGN_VALUE).append(cluster);
+ }
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ final String METHOD = "processResponse";
+ try {
+ result.value = manifest.getMainAttributes().getValue("message");
+ result.value = result.value.replace("%%%EOL%%%", "\n");
+ } catch (IllegalArgumentException iae) {
+ LOGGER.log(Level.WARNING, METHOD, "illegalArgument", iae);
+ }
+ return result.value != null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCConnectionPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCConnectionPool.java
new file mode 100644
index 0000000..41fc9f6
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCConnectionPool.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server create JDBC connection pool administration command execution
+ * using HTTP interface.
+ * <p/>
+ * Contains code for create JDBC connection pool command.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateJDBCConnectionPool extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Create JDBC connection pool command <code>connectionpoolid</code>
+ * parameter name. */
+ private static final String CONN_POOL_ID_PARAM = "jdbc_connection_pool_id";
+
+ /** Create JDBC connection pool command <code>datasourceclassname</code>
+ * parameter name. */
+ private static final String DS_CLASS_NAME_PARAM = "datasourceclassname";
+
+ /** Create JDBC connection pool command <code>restype</code>
+ * parameter name. */
+ private static final String RESOURCE_TYPE_PARAM = "restype";
+
+ /** Create JDBC connection pool command <code>property</code>
+ * parameter name. */
+ private static final String PROPERTY_PARAM = "property";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds create JDBC connection pool query string for given command.
+ * <p/>
+ * <code>QUERY :: "jdbc_connection_pool_id" '=' <connectionPoolId><br/>
+ * ['&' "datasourceclassname" '=' <datasourceclassname> ]<br/>
+ * ['&' "restype" '=' <restype> ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandCreateJDBCConnectionPool</code> instance
+ * is expected.
+ * @return Create JDBC connection pool query string for given command.
+ */
+ private static String query(final Command command) {
+ String connectionPoolId;
+ String dataSourceClassName;
+ String resType;
+ if (command instanceof CommandCreateJDBCConnectionPool) {
+ connectionPoolId = ((CommandCreateJDBCConnectionPool)command)
+ .connectionPoolId;
+ dataSourceClassName = ((CommandCreateJDBCConnectionPool)command)
+ .dataSourceClassName;
+ resType = ((CommandCreateJDBCConnectionPool)command).resType;
+ } else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ boolean isDataSourceClassName = dataSourceClassName != null
+ && dataSourceClassName.length() > 0;
+ boolean isResType = resType != null && resType.length() > 0;
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ CONN_POOL_ID_PARAM.length() + 1 + connectionPoolId.length()
+ + ( isDataSourceClassName
+ ? DS_CLASS_NAME_PARAM.length()
+ + 1 + dataSourceClassName.length()
+ : 0 )
+ + ( isResType
+ ? RESOURCE_TYPE_PARAM.length() + 1 + resType.length()
+ : 0)
+ + queryPropertiesLength(
+ ((CommandCreateJDBCConnectionPool)command).properties,
+ PROPERTY_PARAM));
+ // Build query string
+ sb.append(CONN_POOL_ID_PARAM).append(PARAM_ASSIGN_VALUE);
+ sb.append(connectionPoolId);
+ if (isDataSourceClassName) {
+ sb.append(PARAM_SEPARATOR).append(DS_CLASS_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(dataSourceClassName);
+ }
+ if (isResType) {
+ sb.append(PARAM_SEPARATOR).append(RESOURCE_TYPE_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(resType);
+ }
+ queryPropertiesAppend(sb,
+ ((CommandCreateJDBCConnectionPool)command).properties,
+ PROPERTY_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateJDBCConnectionPool(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCResource.java
new file mode 100644
index 0000000..8330690
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpCreateJDBCResource.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server create JDBC resource administration command execution
+ * using HTTP interface.
+ * <p/>
+ * Contains code for create JDBC resource command.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCreateJDBCResource extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Create JDBC connection pool command <code>connectionpoolid</code>
+ * parameter name. */
+ private static final String CONN_POOL_ID_PARAM = "connectionpoolid";
+
+ /** Create JDBC connection pool command <code>jndi_name</code>
+ * parameter name. */
+ private static final String JNDI_NAME_PARAM="jndi_name";
+
+ /** Create JDBC connection pool command <code>target</code>
+ * parameter name. */
+ private static final String TARGET_PARAM="target";
+
+ /** Create JDBC connection pool command <code>property</code>
+ * parameter name. */
+ private static final String PROPERTY_PARAM = "property";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds create JDBC resource query string for given command.
+ * <p/>
+ * <code>QUERY :: "connectionpoolid" '=' <connectionPoolId><br/>
+ * ['&' "jndi_name" '=' <jndiName> ]<br/>
+ * ['&' "target" '=' <target> ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * <p/>
+ * @param command Payara server administration command entity.
+ * <code>CommandCreateJDBCResource</code> instance
+ * is expected.
+ * @return Create JDBC connection pool query string for given command.
+ */
+ private static String query(final Command command) {
+ String connectionPoolId;
+ String jndiName;
+ String target;
+ if (command instanceof CommandCreateJDBCResource) {
+ connectionPoolId = ((CommandCreateJDBCResource)command)
+ .connectionPoolId;
+ jndiName = ((CommandCreateJDBCResource)command).jndiName;
+ target = ((CommandCreateJDBCResource)command).target;
+ } else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ boolean isJndiName = jndiName != null && jndiName.length() > 0;
+ boolean isTarget = target != null && target.length() > 0;
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ CONN_POOL_ID_PARAM.length() + 1 + connectionPoolId.length()
+ + ( isJndiName
+ ? JNDI_NAME_PARAM.length()
+ + 1 + jndiName.length()
+ : 0 )
+ + ( isTarget
+ ? TARGET_PARAM.length() + 1 + target.length()
+ : 0)
+ + queryPropertiesLength(
+ ((CommandCreateJDBCResource)command).properties,
+ PROPERTY_PARAM));
+ // Build query string
+ sb.append(CONN_POOL_ID_PARAM).append(PARAM_ASSIGN_VALUE);
+ sb.append(connectionPoolId);
+ if (isJndiName) {
+ sb.append(PARAM_SEPARATOR).append(JNDI_NAME_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(jndiName);
+ }
+ if (isTarget) {
+ sb.append(PARAM_SEPARATOR).append(TARGET_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(target);
+ }
+ queryPropertiesAppend(sb,
+ ((CommandCreateJDBCResource)command).properties,
+ PROPERTY_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCreateJDBCResource(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteInstance.java
new file mode 100644
index 0000000..2bd5afc
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteInstance.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara instance and cluster admin command with
+ * <code>DEFAULT=<target></code> query execution using HTTP interface.
+ * <p/>
+ * Contains common code for commands that are called with
+ * <code>DEFAULT=<target></code> query string. Individual child classes
+ * are not needed at this stage.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpDeleteInstance extends RunnerHttpTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpDeleteInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ try {
+ result.value = manifest.getMainAttributes().getValue("message");
+ result.value = result.value.replace("%%%EOL%%%", "\n");
+ } catch (IllegalArgumentException iae) {
+ Logger.log(Level.WARNING, "Caught IllegalArgumentException", iae);
+ }
+ return result.value != null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteResource.java
new file mode 100644
index 0000000..d23a470
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeleteResource.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerHttpDeleteResource extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerHttpDeleteResource.class);
+
+ /** Deploy command <code>DEFAULT</code> parameter name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ /**
+ * Creates query string from command object properties.
+ * <p/>
+ * @param command Payara server administration command entity.
+ * @return Query string from command object properties.
+ */
+ private static String query(CommandDeleteResource command) {
+ StringBuilder query = new StringBuilder(128);
+ query.append(DEFAULT_PARAM);
+ query.append('=');
+ query.append(command.name);
+ if (null != command.target) {
+ query.append(PARAM_SEPARATOR);
+ query.append("target=");
+ query.append(command.target);
+ }
+ return query.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpDeleteResource(final PayaraServer server,
+ final Command command) {
+ super(server, command, query((CommandDeleteResource)command));
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeploy.java
new file mode 100644
index 0000000..e9756e0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpDeploy.java
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.util.logging.Level;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server <code>deploy</code> Administration Command Execution
+ * using HTTP interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpDeploy extends RunnerHttp {
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(RunnerHttpDeploy.class);
+
+ /** Deploy command <code>DEFAULT</code> parameter name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ /** Deploy command <code>target</code> parameter name. */
+ private static final String TARGET_PARAM = "target";
+
+ /** Deploy command <code>name</code> parameter name. */
+ private static final String NAME_PARAM = "name";
+
+ /** Deploy command <code>contextroot</code> parameter name. */
+ private static final String CTXROOT_PARAM = "contextroot";
+
+ /** Deploy command <code>force</code> parameter name. */
+ private static final String FORCE_PARAM = "force";
+
+ /** Deploy command <code>properties</code> parameter name. */
+ private static final String PROPERTIES_PARAM = "properties";
+
+ /** Deploy command <code>libraries</code> parameter name. */
+ private static final String LIBRARIES_PARAM = "libraries";
+
+ /** Deploy command <code>force</code> parameter value. */
+ private static final boolean FORCE_VALUE = true;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds deploy query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <path> <br/>
+ * '&' "force" '=' true | false <br/>
+ * ['&' "name" '=' <name> ] <br/>
+ * ['&' "target" '=' <target> ] <br/>
+ * ['&' "contextroot" '=' <contextRoot> ] <br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * ['&' "libraries" '=' <lname> '=' <lvalue>
+ * { ':' <lname> '=' <lvalue>} ]</code>
+ * <p/>
+ * @param command Payara server administration deploy command entity.
+ * @return Deploy query string for given command.
+ */
+ private static String query(final Command command) {
+ // Prepare values
+ String name;
+ String path;
+ String target;
+ String ctxRoot;
+ String force = Boolean.toString(FORCE_VALUE);
+ if (command instanceof CommandDeploy) {
+ if (((CommandDeploy)command).path == null) {
+ throw new CommandException(CommandException.ILLEGAL_NULL_VALUE);
+ }
+ name = Utils.sanitizeName(((CommandDeploy)command).name);
+ path = ((CommandDeploy)command).path.getAbsolutePath();
+ target =((CommandDeploy)command).target;
+ ctxRoot = ((CommandDeploy)command).contextRoot;
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ // Calculate StringBuilder initial length to avoid resizing
+ StringBuilder sb = new StringBuilder(
+ DEFAULT_PARAM.length() + 1 + path.length() +
+ 1 + FORCE_PARAM.length() + 1 + force.length()
+ + queryPropertiesLength(
+ ((CommandDeploy)command).properties, PROPERTIES_PARAM)
+ + queryLibrariesLength(
+ ((CommandDeploy)command).libraries, LIBRARIES_PARAM)
+ + ( name != null && name.length() > 0
+ ? 1 + NAME_PARAM.length() + 1 + name.length()
+ : 0
+ ) + ( target != null
+ ? 1 + TARGET_PARAM.length() + 1 + target.length()
+ : 0
+ ) + ( ctxRoot != null && ctxRoot.length() > 0
+ ? 1 + CTXROOT_PARAM.length() + 1 + ctxRoot.length()
+ : 0
+ ));
+ // Build query string
+ sb.append(DEFAULT_PARAM).append(PARAM_ASSIGN_VALUE).append(path);
+ sb.append(PARAM_SEPARATOR);
+ sb.append(FORCE_PARAM).append(PARAM_ASSIGN_VALUE).append(force);
+ if (name != null && name.length() > 0) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(NAME_PARAM).append(PARAM_ASSIGN_VALUE).append(name);
+ }
+ if (target != null) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(TARGET_PARAM).append(PARAM_ASSIGN_VALUE).append(target);
+ }
+ if (ctxRoot != null && ctxRoot.length() > 0) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(CTXROOT_PARAM).append(PARAM_ASSIGN_VALUE).append(ctxRoot);
+ }
+ // Add properties into query string.
+ queryPropertiesAppend(sb, ((CommandDeploy)command).properties,
+ PROPERTIES_PARAM, true);
+ queryLibrariesAppend(sb, ((CommandDeploy)command).libraries,
+ LIBRARIES_PARAM, true);
+
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandDeploy command;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpDeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ this.command = (CommandDeploy)command;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Send deployed file to the server via HTTP POST when it's not
+ * a directory deployment.
+ * <p/>
+ * @return <code>true</code> if using HTTP POST to send to server
+ * or <code>false</code> otherwise
+ */
+ @Override
+ public boolean getDoOutput() {
+ return !command.dirDeploy;
+ }
+
+ /**
+ * HTTP request method used for this command is <code>POST</code> for
+ * file deployment and <code>GET</code> for directory deployment.
+ *
+ * @return HTTP request method used for this command.
+ */
+ @Override
+ public String getRequestMethod() {
+ return command.dirDeploy ? super.getRequestMethod() : "POST";
+ }
+
+ /**
+ * Handle sending data to server using HTTP command interface.
+ * <p/>
+ * This is based on reading the code of <code>CLIRemoteCommand.java</code>
+ * from the server's code repository. Since some asadmin commands
+ * need to send multiple files, the server assumes the input is a ZIP
+ * stream.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ final String METHOD = "handleSend";
+ InputStream istream = getInputStream();
+ if(istream != null) {
+ ZipOutputStream ostream = null;
+ try {
+ ostream = new ZipOutputStream(new BufferedOutputStream(
+ hconn.getOutputStream(), 1024*1024));
+ ZipEntry e = new ZipEntry(command.path.getName());
+ e.setExtra(getExtraProperties());
+ ostream.putNextEntry(e);
+ byte buffer[] = new byte[1024*1024];
+ while (true) {
+ int n = istream.read(buffer);
+ if (n < 0) {
+ break;
+ }
+ ostream.write(buffer, 0, n);
+ }
+ ostream.closeEntry();
+ ostream.flush();
+ } finally {
+ try {
+ istream.close();
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ex);
+ }
+ if(ostream != null) {
+ try {
+ ostream.close();
+ } catch(IOException ex) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ex);
+ }
+ }
+ }
+ } else if("POST".equalsIgnoreCase(getRequestMethod())) {
+ LOGGER.log(Level.INFO, METHOD, "noData");
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set the content-type of information sent to the server.
+ * Returns <code>application/zip</code> for file deployment
+ * and <code>null</code> (not set) for directory deployment.
+ *
+ * @return content-type of data sent to server via HTTP POST
+ */
+ @Override
+ public String getContentType() {
+ return command.dirDeploy ? null : "application/zip";
+ }
+
+ /**
+ * Provide the lastModified date for data source whose
+ * <code>InputStream</code> is returned by getInputStream.
+ * <p/>
+ * @return String format of long integer from lastModified date of source.
+ */
+ @Override
+ public String getLastModified() {
+ return Long.toString(command.path.lastModified());
+ }
+
+ /**
+ * Get <code>InputStream</code> object for deployed file.
+ * <p/>
+ * @return <code>InputStream</code> object for deployed file
+ * or <code>null</code> for directory deployment.
+ */
+ public InputStream getInputStream() {
+ final String METHOD = "getInputStream";
+ if (command.dirDeploy) {
+ return null;
+ } else {
+ try {
+ return new FileInputStream(command.path);
+ } catch (FileNotFoundException fnfe) {
+ LOGGER.log(Level.INFO, METHOD, "fileNotFound", fnfe);
+ return null;
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpEnableDisable.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpEnableDisable.java
new file mode 100644
index 0000000..23faaba
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpEnableDisable.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server <code>enable</code> and <code>disable</code>
+ * administration command execution using HTTP interface.
+ * <p/>
+ * Contains common code for enable and disable commands. Individual child
+ * classes are not needed at this stage.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpEnableDisable extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Enable/Disable command <code>DEFAULT</code> param name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ /** Enable/Disable command <code>target</code> param name. */
+ private static final String TARGET_PARAM = "target";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds enable/disable query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <name>
+ * ['&' "target" '=' <target> ]</code>
+ * <p/>
+ * @param command Payara Server Admin Command Entity.
+ * <code>CommandDisable</code> instance is expected.
+ * @return Enable/Disable query string for given command.
+ */
+ private static String query(final Command command) {
+ String target;
+ String name;
+ if (command instanceof CommandTargetName) {
+ target = Utils.sanitizeName(((CommandTargetName)command).target);
+ if (((CommandTargetName)command).name == null) {
+ throw new CommandException(CommandException.ILLEGAL_NULL_VALUE);
+ }
+ name = Utils.sanitizeName(((CommandTargetName)command).name);
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ StringBuilder sb = new StringBuilder(
+ DEFAULT_PARAM.length() + 1 + name.length() + (
+ target != null
+ ? 1 + TARGET_PARAM.length() + 1 + target.length()
+ : 0
+ ));
+ sb.append(DEFAULT_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(name);
+ if (target != null) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(TARGET_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(target);
+ }
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of admin command executor using HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara Server Admin Command Entity.
+ */
+ public RunnerHttpEnableDisable(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpGetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpGetProperty.java
new file mode 100644
index 0000000..3828377
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpGetProperty.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerHttpGetProperty extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerHttpGetProperty.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Returned value is map where key-value pairs returned by server
+ * are stored. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpGetProperty(final PayaraServer server,
+ final Command command) {
+ super(server, command,
+ "pattern=" + ((CommandGetProperty)command).propertyPattern);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultMap</code> object corresponding
+ * to server get property command execution value to be returned.
+ */
+ @Override
+ protected ResultMap<String, String> createResult() {
+ return result = new ResultMap<String, String>();
+ }
+
+ @Override
+ protected boolean processResponse() {
+ final String METHOD = "processResponse";
+ if (manifest == null) {
+ LOGGER.log(Level.WARNING, METHOD, "manifestNull", query);
+ return false;
+ }
+ result.value = new HashMap<String, String>();
+ for (String encodedkey : manifest.getEntries().keySet()) {
+ String key = "";
+ try {
+ if (null != encodedkey) {
+ key = encodedkey;
+ key = URLDecoder.decode(encodedkey, "UTF-8");
+ }
+ } catch (UnsupportedEncodingException uee) {
+ LOGGER.log(Level.INFO, METHOD,
+ "unsupportedEncoding", encodedkey);
+ LOGGER.log(Level.INFO, METHOD, "exceptionDetails", uee);
+ } catch (IllegalArgumentException iae) {
+ // Ignore this for now
+ }
+ int equalsIndex = key.indexOf('=');
+ if (equalsIndex >= 0) {
+ String keyPart = key.substring(0, equalsIndex);
+ String valuePart = key.substring(equalsIndex + 1);
+ try {
+ // Around Sept. 2008... 3.x servers were double encoding their
+ // responces. It appears that has stopped
+ // (See http://netbeans.org/bugzilla/show_bug.cgi?id=195015)
+ // The open question is, "When did 3.x stop doing the double
+ // encode?" since we don't know... this strategy will work
+ // for us
+ // Belt and suspenders, like
+ result.value.put(keyPart, valuePart); // raw form
+ result.value.put(keyPart, URLDecoder.decode(valuePart,
+ "UTF-8")); // single decode
+ result.value.put(keyPart, URLDecoder.decode(result.value.
+ get(keyPart), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ LOGGER.log(Level.INFO, METHOD,
+ "unsupportedEncoding", result.value.get(keyPart));
+ } catch (IllegalArgumentException iae) {
+ LOGGER.log(Level.INFO, METHOD, "illegalArgument",
+ new Object[] {valuePart, result.value.get(keyPart)});
+ }
+ } else {
+ LOGGER.log(Level.WARNING, METHOD, "emptyString", key);
+ result.value.put(key, "");
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListComponents.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListComponents.java
new file mode 100644
index 0000000..dd34dfe
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListComponents.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for retrieving list of components from server.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpListComponents extends RunnerHttpTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara administration command result containing server components.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultMap<String, List<String>> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpListComponents(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultList</code> object corresponding
+ * to server log command execution value to be returned.
+ */
+ @Override
+ protected ResultMap<String, List<String>> createResult() {
+ return result = new ResultMap<String, List<String>>();
+ }
+
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ String resourcesAttr = manifest.getMainAttributes()
+ .getValue("children");
+ String[] components = resourcesAttr != null
+ ? resourcesAttr.split(ServerUtils.MANIFEST_COMPONENTS_SEPARATOR)
+ : null;
+ result.value = new HashMap<String, List<String>>();
+ if (components != null) {
+ for (String component : components) {
+ String decodedComponent;
+ try {
+ decodedComponent = URLDecoder.decode(
+ component, JavaUtils.UTF_8.name());
+ } catch (UnsupportedEncodingException ex) {
+ decodedComponent = component;
+ }
+ ServerUtils.addComponentToMap(result.value, decodedComponent);
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListResources.java
new file mode 100644
index 0000000..0f16d11
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListResources.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.jar.Attributes;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for retrieving resources from server.
+ * <p>
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpListResources extends RunnerHttpTarget {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara administration command result containing server resources.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method
+ * <code>call()</code>
+ * is responsible for correct
+ * <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultList<String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpListResources(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultList</code> object corresponding
+ * to server log command execution value to be returned.
+ */
+ @Override
+ protected ResultList<String> createResult() {
+ return result = new ResultList<String>();
+ }
+
+ /**
+ * Extracts result value from internal
+ * <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in
+ * <code>Manifest</code> object is
+ * stored as <i>value</i> into
+ * <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ String resourcesAttr = manifest.getMainAttributes()
+ .getValue("children");
+ String[] resources = resourcesAttr != null
+ ? resourcesAttr.split(ServerUtils.MANIFEST_RESOURCES_SEPARATOR)
+ : null;
+ int resoucesCount = resources != null ? resources.length : 0;
+ result.value = new ArrayList<String>(resoucesCount);
+ if (resources != null) {
+ for (String resource : resources) {
+ Attributes resourceAttr = manifest.getAttributes(resource);
+ String resourceMsg = resourceAttr.getValue("message");
+ String name;
+ try {
+ if (resourceMsg != null) {
+ name = URLDecoder.decode(resourceMsg, "UTF-8");
+ } else {
+ name = null;
+ }
+ if (name == null || name.length() <= 0) {
+ name = URLDecoder.decode(resource.trim(), "UTF-8");
+ }
+ } catch (UnsupportedEncodingException uee) {
+ throw new CommandException(
+ CommandException.HTTP_RESP_UNS_ENC_EXCEPTION, uee);
+ }
+ result.value.add(name);
+ }
+ }
+ return true;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListWebServices.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListWebServices.java
new file mode 100644
index 0000000..92d74ac
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpListWebServices.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for retrieving list of web services from server.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpListWebServices extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara administration command result containing server resources.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultList<String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpListWebServices(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultList</code> object corresponding
+ * to server log command execution value to be returned.
+ */
+ @Override
+ protected ResultList<String> createResult() {
+ return result = new ResultList<String>();
+ }
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ if(manifest == null) {
+ return false;
+ }
+ result.value = new ArrayList<String>();
+ Map <String, String> filter = new HashMap<String, String>();
+ Iterator<String> keyIterator = manifest.getEntries().keySet().iterator();
+ while (keyIterator.hasNext()) {
+ String k = keyIterator.next();
+ if (!k.contains("address:/")) // NOI18N
+ continue;
+ if (k.contains("address:/wsat-wsat")) // NOI18N
+ continue;
+ if (k.contains("address:/__wstx-services")) // NOI18N
+ continue;
+ String a = k.replaceFirst(".* address:/", "").replaceFirst("\\. .*", ""); // NOI18N
+ if (filter.containsKey(a))
+ continue;
+ filter.put(a,a);
+ result.value.add(a);
+ }
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpLocation.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpLocation.java
new file mode 100644
index 0000000..322094f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpLocation.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.HashMap;
+import java.util.jar.Attributes;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpLocation extends RunnerHttp {
+
+ /** Returned value is map where locations are stored under keys specified in
+ * CommandLocation class.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpLocation(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected Result createResult() {
+ return result = new ResultMap<String, String>();
+ }
+
+ @Override
+ protected boolean processResponse() {
+ if (manifest == null)
+ return false;
+
+ result.value = new HashMap<String, String>();
+ Attributes mainAttrs = manifest.getMainAttributes();
+ if(mainAttrs != null) {
+ result.value.put("Base-Root_value", mainAttrs.getValue("Base-Root_value"));
+ result.value.put("Domain-Root_value", mainAttrs.getValue("Domain-Root_value"));
+ result.value.put("message", mainAttrs.getValue("message"));
+ }
+
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRedeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRedeploy.java
new file mode 100644
index 0000000..92ce45d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRedeploy.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server <code>redeploy</code> Admin Command Execution
+ * using HTTP interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpRedeploy extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Deploy command <code>target</code> parameter name. */
+ private static final String TARGET_PARAM = "target";
+
+ /** Deploy command <code>name</code> parameter name. */
+ private static final String NAME_PARAM = "name";
+
+ /** Deploy command <code>contextroot</code> parameter name. */
+ private static final String CTXROOT_PARAM = "contextroot";
+
+ /** Deploy command <code>properties</code> parameter name. */
+ private static final String PROPERTIES_PARAM = "properties";
+
+ /** Deploy command <code>libraries</code> parameter name. */
+ private static final String LIBRARIES_PARAM = "libraries";
+
+ /** Deploy command <code>keepState</code> parameter name. */
+ private static final String KEEP_STATE_PARAM = "keepState";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds redeploy query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <path> <br/>
+ * ['&' "name" '=' <name> ] <br/>
+ * ['&' "target" '=' <target> ] <br/>
+ * ['&' "contextroot" '=' <contextRoot> ] <br/>
+ * ['&' "keepState" '=' true | false ]<br/>
+ * ['&' "properties" '=' <pname> '=' <pvalue>
+ * { ':' <pname> '=' <pvalue>} ]</code>
+ * ['&' "libraries" '=' <lname> '=' <lvalue>
+ * { ':' <lname> '=' <lvalue>} ]</code>
+ * <p/>
+ * @param command Payara server administration deploy command entity.
+ * @return Redeploy query string for given command.
+ */
+ private static String query(final Command command) {
+ String name;
+ String target;
+ String ctxRoot;
+ String keepState;
+ if (command instanceof CommandRedeploy) {
+ name = Utils.sanitizeName(((CommandRedeploy)command).name);
+ target = ((CommandRedeploy)command).target;
+ ctxRoot = ((CommandRedeploy)command).contextRoot;
+ keepState = Boolean.toString(((CommandRedeploy)command).keepState);
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ // Calculate StringBuilder initial length to avoid resizing
+ boolean first = true;
+ StringBuilder sb = new StringBuilder(
+ queryPropertiesLength(
+ ((CommandRedeploy)command).properties, PROPERTIES_PARAM)
+ + queryLibrariesLength(
+ ((CommandRedeploy)command).libraries, LIBRARIES_PARAM)
+ + ( NAME_PARAM.length() + 1 + name.length() )
+ + ( target != null
+ ? 1 + TARGET_PARAM.length() + 1 + target.length() : 0 )
+ + ( ctxRoot != null && ctxRoot.length() > 0
+ ? 1 + CTXROOT_PARAM.length() + 1 + ctxRoot.length()
+ : 0 )
+ + ( ((CommandRedeploy)command).keepState
+ ? KEEP_STATE_PARAM.length() + 1 + keepState.length()
+ : 0 )
+ );
+ sb.append(NAME_PARAM).append(PARAM_ASSIGN_VALUE).append(name);
+ if (target != null) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(TARGET_PARAM).append(PARAM_ASSIGN_VALUE).append(target);
+ }
+ if (ctxRoot != null && ctxRoot.length() > 0) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(CTXROOT_PARAM).append(PARAM_ASSIGN_VALUE).append(ctxRoot);
+ }
+ if (((CommandRedeploy)command).keepState) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(KEEP_STATE_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE).append(keepState);
+ }
+ // Add properties into query string.
+ queryPropertiesAppend(sb, ((CommandRedeploy)command).properties,
+ PROPERTIES_PARAM, true);
+ queryLibrariesAppend(sb, ((CommandRedeploy)command).libraries,
+ LIBRARIES_PARAM, true);
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandRedeploy command;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpRedeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ this.command = (CommandRedeploy)command;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRestartDAS.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRestartDAS.java
new file mode 100644
index 0000000..5931a22
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpRestartDAS.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara restart DAS administration command with
+ * <code></code> query execution using HTTP interface.
+ * <p/>
+ * Contains code for command that is called with
+ * <code>debug=true|false&force=true|false&kill=true|false</code> query string.
+ * <p/>
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpRestartDAS extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Restart DAS command <code>debug</code> parameter's name. */
+ private static final String DEBUG_PARAM = "debug";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds restart DAS query string for given command.
+ * <p/>
+ * <code>debug=true|false&force=true|false&kill=true|false</code>
+ * <p/>
+ * @param command Payara Server Administration Command Entity.
+ * <code>CommandRestartDAS</code> instance is expected.
+ * @return Restart DAS query string for given command.
+ */
+ static String query(final Command command) {
+ if (command instanceof CommandRestartDAS) {
+ boolean debug = ((CommandRestartDAS)command).debug;
+ int boolValSize = FALSE_VALUE.length() > TRUE_VALUE.length()
+ ? FALSE_VALUE.length() : TRUE_VALUE.length();
+ StringBuilder sb = new StringBuilder(DEBUG_PARAM.length()
+ + boolValSize + 1);
+ sb.append(DEBUG_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(debug ? TRUE_VALUE : FALSE_VALUE);
+ return sb.toString();
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpRestartDAS(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpSetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpSetProperty.java
new file mode 100644
index 0000000..5728c8e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpSetProperty.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.text.MessageFormat;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerHttpSetProperty extends RunnerHttp {
+
+ /**
+ * Creates query string from command object properties.
+ * <p/>
+ * @param command Payara server administration command entity.
+ * @return Query string from command object properties.
+ */
+ private static String query(CommandSetProperty command) {
+ return MessageFormat.format(
+ command.format, command.property, command.value);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpSetProperty(final PayaraServer server,
+ final Command command) {
+ super(server, command, query((CommandSetProperty)command));
+ }
+
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpTarget.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpTarget.java
new file mode 100644
index 0000000..7c042ad
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpTarget.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara instance and cluster administration command with
+ * <code>DEFAULT=<target></code> query execution using HTTP interface.
+ * <p/>
+ * Contains common code for commands that are called with
+ * <code>DEFAULT=<target></code> query string. Individual child classes
+ * are not needed at this stage.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpTarget extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Start/Stop command <code>DEFAULT</code> parameter's name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds enable/disable query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <target></code>
+ * <p/>
+ * @param command Payara Server Administration Command Entity.
+ * <code>CommandDisable</code> instance is expected.
+ * @return Enable/Disable query string for given command.
+ */
+ static String query(Command command) {
+ String target;
+ if (command instanceof CommandTarget) {
+ target = Utils.sanitizeName(((CommandTarget)command).target);
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ if (target == null) {
+ return null;
+ } else {
+ StringBuilder sb = new StringBuilder(
+ DEFAULT_PARAM.length() + 1 + target.length());
+ sb.append(DEFAULT_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(target);
+ return sb.toString();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpTarget(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpUndeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpUndeploy.java
new file mode 100644
index 0000000..8bbe4f9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerHttpUndeploy.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server <code>undeploy</code> Admin Command Execution
+ * using HTTP interface.
+ * <p/>
+ * Contains common code for commands that are called with
+ * <code>DEFAULT=<target></code> query string. Individual child classes
+ * are not needed at this stage.
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpUndeploy extends RunnerHttp {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Enable/Disable command <code>DEFAULT</code> param name. */
+ private static final String DEFAULT_PARAM = "DEFAULT";
+
+ /** Enable/Disable command <code>target</code> param name. */
+ private static final String TARGET_PARAM = "target";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds enable/disable query string for given command.
+ * <p/>
+ * <code>QUERY :: "DEFAULT" '=' <name>
+ * ['&' "target" '=' <target> ]</code>
+ * <p/>
+ * @param command Payara Server Admin Command Entity.
+ * <code>CommandDisable</code> instance is expected.
+ * @return Enable/Disable query string for given command.
+ */
+ private static String query(Command command) {
+ String target;
+ String name;
+ if (command instanceof CommandTargetName) {
+ target = Utils.sanitizeName(((CommandTargetName)command).target);
+ if (((CommandTargetName)command).name == null) {
+ throw new CommandException(CommandException.ILLEGAL_NULL_VALUE);
+ }
+ name = Utils.sanitizeName(((CommandTargetName)command).name);
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+ StringBuilder sb = new StringBuilder(
+ DEFAULT_PARAM.length() + 1 + name.length() + (
+ target != null
+ ? 1 + TARGET_PARAM.length() + 1 + target.length()
+ : 0
+ ));
+ sb.append(DEFAULT_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(name);
+ if (target != null) {
+ sb.append(PARAM_SEPARATOR);
+ sb.append(TARGET_PARAM);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(target);
+ }
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpUndeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command, query(command));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerJava.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerJava.java
new file mode 100644
index 0000000..3c579d2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerJava.java
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.config.ConfigBuilderProvider;
+import org.netbeans.modules.payara.tooling.server.config.PayaraConfigManager;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server administration command execution using local Java VM.
+ * <p/>
+ * @author Tomas Kraus
+ */
+abstract class RunnerJava extends Runner {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(RunnerJava.class);
+
+ /** Specifies program encapsulated in a JAR file to execute. */
+ static final String JAR_PARAM = "-jar";
+
+ /** Character used to separate query string from list of parameters. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ static final char QUERY_SEPARATOR = ' ';
+
+ /** Character used to separate individual parameters. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ static final char PARAM_SEPARATOR = ' ';
+
+ /** Character used to assign value to parameter. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ static final char PARAM_ASSIGN_VALUE = ' ';
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get {@link PayaraConfig} instance for provided Payara server which
+ * shall not be <code>null</code>.
+ * <p/>
+ * {@link CommandException} is thrown when configuration object value
+ * is <code>null</code>.
+ * <p/>
+ * @param server Payara server entity object.
+ * @return Payara server features configuration which
+ * is not <code>null</code>.
+ */
+ static PayaraConfig getServerConfig(final PayaraServer server) {
+ final String METHOD = "getServerConfig";
+ PayaraConfig config = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(
+ server.getVersion()));
+ if (config == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noConfig"),
+ server.getVersion());
+ }
+ return config;
+ }
+
+ /**
+ * Get {@link JavaSESet} instance for provided Payara server
+ * features configuration.
+ * <p/>
+ * @param config Payara server features configuration.
+ * @return Payara JavaSE configuration which is not <code>null</code>.
+ */
+ static JavaSESet getJavaSEConfig(final PayaraConfig config) {
+ final String METHOD = "getJavaSEConfig";
+ JavaSESet javaSEConfig = config.getJavaSE();
+ if (javaSEConfig == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noJavaSEConfig"));
+ }
+ return javaSEConfig;
+ }
+
+ /**
+ * Constructs path to Java VM executable and verifies if it exists.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command lassFish server administration command with local Java VM.
+ * @return Path to Java VM executable
+ */
+ private static String getJavaVM(final PayaraServer server,
+ final CommandJava command) {
+ final String METHOD = "getJavaVM";
+ String javaVmExe = JavaUtils.javaVmExecutableFullPath(command.javaHome);
+ File javaVmFile = new File(javaVmExe);
+ // Java VM executable should exist and should be executable.
+ if (!javaVmFile.canExecute()) {
+ LOGGER.log(Level.INFO, METHOD, "noJavaVMExe", javaVmExe);
+ return null;
+ }
+ return javaVmExe;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandJava command;
+
+ /** Java VM executable. */
+ final String javaVMExe;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * command line asadmin interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ public RunnerJava(final PayaraServer server, final Command command,
+ final String query) {
+ super(server, command, null, query);
+ final String METHOD = "init";
+ if (command instanceof CommandJava) {
+ this.command = (CommandJava)command;
+ } else {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noCommandJava"));
+ }
+ javaVMExe = getJavaVM(server, this.command);
+ if (javaVMExe == null) {
+ throw new CommandException(LOGGER.excMsg(METHOD, "noJavaVMExe"),
+ new Object[] {this.command.javaHome, server.getName()});
+ }
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * command line asadmin interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerJava(final PayaraServer server, final Command command) {
+ this(server, command, null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Do not send information to the server via HTTP POST by default.
+ * <p/>
+ * @return <code>true</code> if using HTTP POST to send to server
+ * or <code>false</code> otherwise
+ */
+ /**
+ * Do not send information to the server via HTTP POST by default.
+ * <p/>
+ * This method makes no sense for this runner.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ public boolean getDoOutput() {
+ return false;
+ }
+
+ /**
+ * Inform whether this runner implementation accepts gzip format.
+ * <p/>
+ * This method makes no sense for this runner.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ public boolean acceptsGzip() {
+ return false;
+ }
+
+ /**
+ * Build Payara administration interface command URL.
+ * <p/>
+ * This method makes no sense for this runner.
+ * <p/>
+ * @return Always returns <code>null</code>.
+ * @throws <code>CommandException</code> if there is a problem with building
+ * command URL.
+ */
+ @Override
+ protected String constructCommandUrl() throws CommandException {
+ return null;
+ }
+
+ /**
+ * The type of HTTP method used to access administration interface command.
+ * <p/>
+ * This method makes no sense for this runner.
+ * <p/>
+ * @return Always returns <code>null</code>.
+ */
+ @Override
+ protected String getRequestMethod() {
+ return null;
+ }
+
+ /**
+ * Handle sending data to server using HTTP administration command interface.
+ * <p/>
+ * Does nothing. This method makes no sense for this runner.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method helpers //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Verifies if Java VM version is supported by provided Payara server.
+ * <p/>
+ * @return Value of <code>true</code> when Java VM executable version
+ * is known and supported by provided Payara server
+ * or <code>false</code> otherwise.
+ */
+ boolean verifyJavaVM() {
+ final String METHOD = "verifyJavaVM";
+ // Java VM executable version must be known.
+ JavaUtils.JavaVersion javaVersion
+ = JavaUtils.javaVmVersion(new File(javaVMExe));
+ if (javaVersion == null) {
+ LOGGER.log(Level.INFO, METHOD, "unknown", javaVMExe);
+ return false;
+ } else {
+ LOGGER.log(Level.FINEST, METHOD, "info",
+ new Object[] {javaVMExe, javaVersion.toString()});
+ }
+ // Java VM executable version must be supported by provided server.
+ Set<JavaSEPlatform> platforms =
+ getJavaSEConfig(getServerConfig(server)).platforms();
+ if (!platforms.contains(javaVersion.toPlatform())) {
+ LOGGER.log(Level.INFO, METHOD, "unsupported",
+ new Object[] {javaVMExe, server.getName()});
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Prepare Java VM environment for Payara server execution.
+ * <p/>
+ * @param env Process builder environment <code>Map</code>.
+ * @param command Payara Server Administration Command Entity.
+ */
+ static void setJavaEnvironment(Map<String,String> env,
+ CommandJava command) {
+ // Java VM home stored in AS environment variables JAVA_HOME and AS_JAVA
+ env.put(JavaUtils.JAVA_HOME_ENV, command.javaHome);
+ env.put(ServerUtils.AS_JAVA_ENV, command.javaHome);
+ }
+
+ /**
+ * Set server process current directory to domain directory if exists.
+ * <p/>
+ * No current directory will be set when domain directory does not exist.
+ * <p/>
+ * @param pb Process builder object where to set current directory.
+ */
+ void setProcessCurrentDir(ProcessBuilder pb) {
+ final String METHOD = "setProcessCurrentDir";
+ String domainsFolder = server.getDomainsFolder();
+ if (domainsFolder != null && domainsFolder.length() > 0) {
+ File currentDir = new File(
+ ServerUtils.getDomainConfigPath(domainsFolder));
+ if (currentDir.exists()) {
+ LOGGER.log(Level.FINEST, METHOD, "dir",
+ new Object[] {server.getName(), currentDir});
+ pb.directory(currentDir);
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerLocal.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerLocal.java
new file mode 100644
index 0000000..dd425f7
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerLocal.java
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server administration command execution using local file
+ * access interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough local
+ * file access interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerLocal extends RunnerJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara main class to be started when using classpath. */
+ private static final String MAIN_CLASS
+ = "com.sun.enterprise.glassfish.bootstrap.ASMain";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandStartDAS command;
+
+ /** Argument format. */
+ private String arguments;
+
+ /**
+ * Payara admin command result containing process information.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultProcess result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using local
+ * file access interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara Server Administration Command Entity.
+ */
+ public RunnerLocal(PayaraServer server, Command command) {
+ super(server, command);
+ this.command = (CommandStartDAS)command;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultString</code> object corresponding
+ * to <code>String</code>command execution value to be returned.
+ */
+ @Override
+ protected Result createResult() {
+ return result = new ResultProcess();
+ }
+
+ /**
+ * Reads response from server and stores internally.
+ * <p/>
+ * @param in Stream to read data from.
+ * @return Always returns <code>false</code>.
+ * @throws CommandException in case of stream error.
+ */
+ @Override
+ protected boolean readResponse(InputStream in, HttpURLConnection hconn) {
+ return false;
+ }
+
+ /**
+ * Extracts result value from internal storage.
+ * <p/>
+ * @return Always returns <code>false</code>.
+ */
+ @Override
+ protected boolean processResponse() {
+ return false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method helpers //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Prepare Java VM options for Payara server execution.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara Server Administration Command Entity.
+ * @return Java VM options for Payara server execution
+ * as <cpde>String</code>.
+ */
+ private static String buildJavaOptions(PayaraServer server,
+ CommandStartDAS command) {
+ // Java VM options
+ StringBuilder sb = new StringBuilder();
+ boolean isClasspath = command.classPath != null &&
+ command.classPath.length() > 0;
+ boolean isOptions = command.javaOpts != null &&
+ command.javaOpts.length() > 0;
+ sb.append(JavaUtils.VM_CLASSPATH_OPTION).append(' ');
+ // Add classpath if exists.
+ if (isClasspath) {
+ sb.append(command.classPath);
+ } else {
+ File bootstrapJar = ServerUtils.getJarName(server.getServerHome(),
+ ServerUtils.GF_JAR_MATCHER);
+ sb.append(Utils.quote(bootstrapJar.getAbsolutePath()));
+ }
+ sb.append(' ');
+ // Add Java VM options.
+ if (isOptions) {
+ sb.append(command.javaOpts);
+ sb.append(' ');
+ }
+ // Add startup main class or jar.
+ sb.append(MAIN_CLASS);
+ sb.append(' ');
+ // Add Payara specific options.
+ if (command.payaraArgs != null
+ && command.payaraArgs.length() > 0) {
+ sb.append(command.payaraArgs);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Set server process current directory to domain directory if exists.
+ * <p/>
+ * No current directory will be set when domain directory does not exist.
+ * <p/>
+ * @param pb Process builder object where to set current directory.
+ */
+ @Override
+ void setProcessCurrentDir(ProcessBuilder pb) {
+ if (command.domainDir != null && command.domainDir.length() > 0) {
+ File currentDir = new File(
+ ServerUtils.getDomainConfigPath(command.domainDir));
+ if (currentDir.exists()) {
+ Logger.log(Level.FINEST,
+ "Setting {0} process current directory to {1}",
+ new Object[]{server.getName(), command.domainDir});
+ pb.directory(currentDir);
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // ExecutorService call() method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara server administration command execution call.
+ * This is an entry point from <code>executor<code>'s serialization queue.
+ * <p/>
+ * Attempts to start local GalssFish DAS directly using <code>java</code>
+ * executable.
+ * <p/>
+ * @return Task execution state.
+ */
+ @Override
+ public Result call() {
+ String javaVmExe = JavaUtils.javaVmExecutableFullPath(command.javaHome);
+ File javaVmFile = new File(javaVmExe);
+ // Java VM executable should exist.
+ if (!javaVmFile.exists()) {
+ Logger.log(Level.INFO,
+ "Java VM {0} executable for {1} was not found",
+ new Object[] {javaVmFile.getAbsolutePath(),
+ server.getName()});
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.NO_JAVA_VM, command.getCommand(),
+ server.getName());
+ }
+ // Java VM should be 1.6.0_0 or greater.
+ JavaUtils.JavaVersion javaVersion = JavaUtils.javaVmVersion(javaVmFile);
+ Logger.log(Level.FINEST, "Java VM {0} executable version {1}",
+ new Object[] {javaVmFile.getAbsolutePath(),
+ javaVersion != null ? javaVersion.toString() : "null"});
+ if (javaVersion == null || javaVersion.comapreTo(
+ new JavaUtils.JavaVersion(1, 6, 0, 0)) == -1) {
+ // Display warning message but try to run server anyway.
+ Logger.log(Level.INFO,
+ "Java VM {0} executable version {1} can't be used with {2} "
+ + "but trying to start server anyway.",
+ new Object[] {javaVmFile.getAbsolutePath(),
+ javaVersion != null ? javaVersion.toString() : "null",
+ server.getName()});
+ }
+ String allArgs = buildJavaOptions(server, command);
+ String[] args = OsUtils.parseParameters(javaVmExe, allArgs);
+ Logger.log(Level.FINEST,
+ "Starting {0} using Java VM {1} and arguments {2}",
+ new Object[]{server.getName(), javaVmExe, allArgs});
+ ProcessBuilder pb = new ProcessBuilder(args);
+ pb.redirectErrorStream(true);
+ Process process;
+ setProcessCurrentDir(pb);
+ setJavaEnvironment(pb.environment(), command);
+ try {
+ process = pb.start();
+ } catch (IOException ex) {
+ return handleStateChange(TaskState.FAILED,
+ TaskEvent.JAVA_VM_EXEC_FAILED, command.getCommand(),
+ server.getName());
+ }
+ result.value = new ValueProcess(
+ javaVmFile.getAbsolutePath(), allArgs, process);
+ return handleStateChange(TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ command.getCommand(), server.getName());
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRest.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRest.java
new file mode 100644
index 0000000..38c1688
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRest.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.Set;
+import static org.netbeans.modules.payara.tooling.admin.Runner.PARAM_SEPARATOR;
+import org.netbeans.modules.payara.tooling.admin.response.ResponseContentType;
+import org.netbeans.modules.payara.tooling.admin.response.ResponseParserFactory;
+import org.netbeans.modules.payara.tooling.admin.response.RestActionReport;
+import org.netbeans.modules.payara.tooling.admin.response.RestResponseParser;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara server administration command execution using REST interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough REST
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRest extends Runner {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Parser for returned response. Default response is XML. */
+ RestResponseParser parser = ResponseParserFactory.getRestParser(getResponseType());
+
+ /** Object representation of returned response.*/
+ RestActionReport report;
+
+ /**
+ * Payara administration command result.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ protected ResultString result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRest(final PayaraServer server, final Command command) {
+ this(server, command, null);
+ }
+
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ public RunnerRest(final PayaraServer server, final Command command,
+ final String query) {
+ this(server, command, "/command/", query);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param path path which builds URL we speak to.
+ * @param query Query string for this command.
+ */
+ public RunnerRest(final PayaraServer server, final Command command,
+ final String path, final String query) {
+ super(server, command, path, query);
+ silentFailureAllowed = false;
+ }
+
+ /**
+ * Helper methods that appends java.util.Properties into
+ * POST request body.
+ * @param sb
+ * @param properties
+ * @param paramName
+ * @param separator
+ */
+ protected void appendProperties(StringBuilder sb,
+ final Map<String,String> properties, final String paramName,
+ final boolean separator) {
+ if (null != properties && properties.size() > 0) {
+ Set<Map.Entry<String,String>> entrySet = properties.entrySet();
+ boolean first = true;
+ if (separator) {
+ sb.append(PARAM_SEPARATOR);
+ }
+ sb.append(paramName).append(PARAM_ASSIGN_VALUE);
+ for (Map.Entry<String,String> entry : entrySet) {
+ String key = entry.getKey();
+ String val = entry.getValue();
+ if (first) {
+ first = false;
+ }
+ else {
+ sb.append(ITEM_SEPARATOR);
+ }
+ sb.append(key);
+ sb.append(PARAM_ASSIGN_VALUE);
+ if (val != null) {
+ sb.append(val);
+ }
+ }
+ }
+ }
+
+ protected void appendIfNotEmpty(StringBuilder sb, String paramName, String paramValue) {
+ if ((paramValue != null) && (!paramValue.isEmpty())) {
+ sb.append(paramName);
+ sb.append(PARAM_ASSIGN_VALUE);
+ sb.append(paramValue);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultString</code> object corresponding
+ * to <code>String</code>command execution value to be returned.
+ * <p/>
+ * @return <code>String</code>command execution value to be returned.
+ */
+ @Override
+ protected Result createResult() {
+ return result = new ResultString();
+ }
+
+
+ /**
+ * Do not send information to the server via HTTP POST by default.
+ * <p/>
+ * @return <code>true</code> if using HTTP POST to send to server
+ * or <code>false</code> otherwise
+ */
+ @Override
+ public boolean getDoOutput() {
+ return true;
+ }
+
+ /**
+ * Inform whether this runner implementation accepts gzip format.
+ * <p/>
+ * @return <code>true</code> when gzip format is accepted,
+ * <code>false</code> otherwise.
+ */
+ @Override
+ public boolean acceptsGzip() {
+ return false;
+ }
+
+ /**
+ * Build Payara REST command URL.
+ * <p/>
+ * @return <code>String</code> value containing command URL.
+ * @throws <code>CommandException</code> if there is a problem with building
+ * command URL.
+ */
+ @Override
+ protected String constructCommandUrl() throws CommandException {
+ String protocol = "http";
+ URI uri;
+ try {
+ uri = new URI(protocol, null, server.getHost(),
+ server.getAdminPort(), path + command.getCommand(),
+ query, null);
+ } catch (URISyntaxException use) {
+ throw new CommandException(CommandException.RUNNER_HTTP_URL, use);
+ }
+ return uri.toASCIIString();
+ }
+
+ /**
+ * Override to change the type of HTTP method used for this command.
+ * Default is GET.
+ * <p/>
+ * @return HTTP method (GET, POST, etc.)
+ */
+ @Override
+ protected String getRequestMethod() {
+ return "POST"; // NOI18N
+ }
+
+ /*
+ * Handle sending data to server using REST command interface.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ // Do nothing.
+ }
+
+ /**
+ * Override this method to read response from provided input stream. <p/>
+ * Override to read the response data sent by the server. Do not close the
+ * stream parameter when finished. Caller will take care of that. <p/>
+ * <p/>
+ * @param in Stream to read data from.
+ * @return <code>true</code> if response was read correctly.
+ * @throws java.io.IOException in case of stream error.
+ */
+ @Override
+ protected boolean readResponse(InputStream in, HttpURLConnection hconn) {
+ report = parser.parse(in);
+ return isSuccess();
+ }
+
+ /**
+ * Override to parse, validate, and/or format any data read from the server
+ * in readResponse() / readManifest().
+ * <p/>
+ * @return <code>true</code> if data was processed correctly.
+ */
+ @Override
+ protected boolean processResponse() {
+ result.value = report.getMessage();
+ return isSuccess();
+ }
+
+ /**
+ * Added to give descendants possibility to decide what report state has
+ * successful meaning.
+ * <p/>
+ * Default is to delegate decision to report itself.
+ * <p/>
+ * @return Does report state have successful meaning?
+ */
+ protected boolean isSuccess() {
+ return report.isSuccess();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Prepare headers for HTTP connection.
+ * <p/>
+ * @param conn Target HTTP connection.
+ * @throws <code>CommandException</code> if there is a problem with setting
+ * the headers.
+ */
+ @Override
+ protected void prepareHttpConnection(HttpURLConnection conn)
+ throws CommandException {
+ super.prepareHttpConnection(conn);
+ // from gf4 every command has to be authenticated
+ String adminUser = server.getAdminUser();
+ String adminPassword = server.getAdminPassword();
+ if (adminUser != null && adminUser.length() > 0) {
+ adminPassword = (adminPassword != null
+ && adminPassword.length() > 0) ? adminPassword : "";
+ String authCredentials = ServerUtils.basicAuthCredentials(
+ adminUser, adminPassword);
+ conn.setRequestProperty(
+ "Authorization", "Basic " + authCredentials);
+ }
+ conn.setRequestProperty("Accept", getResponseType().toString());
+ conn.addRequestProperty("X-Requested-By",
+ "Payara REST HTML interface");
+ }
+
+ /**
+ * Method returns content type in which the server is asked to return
+ * the response.
+ * <p/>
+ * @return <code>ContentType</code> that runner wants to get from server.
+ */
+ protected ResponseContentType getResponseType() {
+ return ResponseContentType.APPLICATION_JSON;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestAddResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestAddResources.java
new file mode 100644
index 0000000..be6b80a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestAddResources.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner executes add-resources commnad via REST interface.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestAddResources extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestAddResources(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandAddResources cmd = (CommandAddResources)command;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("xml_file_name=").append(cmd.xmlResFile.getAbsolutePath());
+ if (cmd.target != null) {
+ data.append("&target=").append(cmd.target);
+ }
+
+ wr.write(data.toString());
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestClass.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestClass.java
new file mode 100644
index 0000000..7fb7e81
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestClass.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to select Payara server admin command runner for command entity.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface RunnerRestClass {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara command runner class as named value. */
+ Class runner() default RunnerRest.class;
+
+ /** Override Payara command string if differs from default one. */
+ String command() default "";
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateCluster.java
new file mode 100644
index 0000000..aa8b300
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateCluster.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for creating a cluster.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestCreateCluster extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateCluster(final PayaraServer server,
+ final Command command) {
+ super(server, command, "/management/domain/clusters/cluster/", null);
+ }
+
+ @Override
+ protected String constructCommandUrl() throws CommandException {
+ String protocol = "http";
+ URI uri;
+ try {
+ uri = new URI(protocol, null, server.getHost(), server.getAdminPort(), path, query, null);
+ } catch (URISyntaxException use) {
+ throw new CommandException(CommandException.RUNNER_HTTP_URL, use);
+ }
+ return uri.toASCIIString();
+ }
+
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ wr.write("name=" + ((CommandTarget)command).target);
+ wr.flush();
+ wr.close();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnector.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnector.java
new file mode 100644
index 0000000..df5821a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnector.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.admin.response.ActionReport.ExitCode;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner for create connector command via REST interface.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestCreateConnector extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateConnector(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandCreateConnector cmd = (CommandCreateConnector)command;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("jndi_name=").append(cmd.jndiName);
+ data.append("&enabled=").append(cmd.enabled);
+ appendIfNotEmpty(data, "&target", cmd.target);
+ appendIfNotEmpty(data, "&poolname", cmd.poolName);
+ appendProperties(data, cmd.properties, "property", true);
+ wr.write(data.toString());
+ wr.close();
+ }
+
+ /**
+ * Overridden because server returns WARNING even when it creates the resource.
+ */
+ @Override
+ protected boolean isSuccess() {
+ return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnectorPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnectorPool.java
new file mode 100644
index 0000000..e5b54a5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateConnectorPool.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.admin.response.ActionReport.ExitCode;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner for create connector pool command via REST interface.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestCreateConnectorPool extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateConnectorPool(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandCreateConnectorConnectionPool cmd = (CommandCreateConnectorConnectionPool)command;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("poolname=").append(cmd.poolName);
+ data.append("&raname=").append(cmd.raName);
+ data.append("&connectiondefinition=").append(cmd.connectionDefinition);
+ appendProperties(data, cmd.properties, "property", true);
+ wr.write(data.toString());
+ wr.close();
+ }
+
+ /**
+ * Overridden because server returns WARNING even when it creates the resource.
+ */
+ @Override
+ protected boolean isSuccess() {
+ return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateInstance.java
new file mode 100644
index 0000000..6be868b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateInstance.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for creating an instance.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestCreateInstance extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandCreateInstance createCommand = (CommandCreateInstance) command;
+ StringBuilder data = new StringBuilder();
+ data.append("instance_name=").append(createCommand.name);
+ data.append("&node=").append(createCommand.node);
+ if (createCommand.target != null) {
+ data.append("&cluster=").append(createCommand.target);
+ }
+
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCConnectionPool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCConnectionPool.java
new file mode 100644
index 0000000..1048348
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCConnectionPool.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.admin.response.ActionReport.ExitCode;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner for create JDBC connection pool command via REST interface.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestCreateJDBCConnectionPool extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateJDBCConnectionPool(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandCreateJDBCConnectionPool cmd = (CommandCreateJDBCConnectionPool)command;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("jdbc_connection_pool_id=").append(cmd.connectionPoolId);
+ data.append("&datasourceClassname=").append(cmd.dataSourceClassName);
+ data.append("&resType=").append(cmd.resType);
+ appendProperties(data, cmd.properties, "property", true);
+ wr.write(data.toString());
+ wr.close();
+ }
+
+ /**
+ * Overridden because server returns WARNING even when it creates the resource.
+ */
+ @Override
+ protected boolean isSuccess() {
+ return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCResource.java
new file mode 100644
index 0000000..b22e2c7
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestCreateJDBCResource.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.admin.response.ActionReport.ExitCode;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner for create JDBC resource command via REST interface.
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestCreateJDBCResource extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCreateJDBCResource(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandCreateJDBCResource cmd = (CommandCreateJDBCResource)command;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("jndi_name=").append(cmd.jndiName);
+ data.append("&connectionpoolid=").append(cmd.connectionPoolId);
+ appendIfNotEmpty(data, "&target", cmd.target);
+ appendProperties(data, cmd.properties, "property", true);
+ wr.write(data.toString());
+ wr.close();
+ }
+
+ /**
+ * Overridden because server returns WARNING even when it creates the resource.
+ */
+ @Override
+ protected boolean isSuccess() {
+ return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteCluster.java
new file mode 100644
index 0000000..5fa8fe0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteCluster.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for command that deletes the cluster.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestDeleteCluster extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestDeleteCluster(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ wr.write("name=" + ((CommandTarget)command).target);
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteInstance.java
new file mode 100644
index 0000000..2eb874e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteInstance.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner executes delete instance command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestDeleteInstance extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestDeleteInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandDeleteInstance deleteCommand = (CommandDeleteInstance) command;
+ StringBuilder data = new StringBuilder();
+ data.append("instance_name=").append(deleteCommand.target);
+
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteResource.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteResource.java
new file mode 100644
index 0000000..a0145ed
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeleteResource.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for command that deletes the resource.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestDeleteResource extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestDeleteResource(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandDeleteResource cmd = (CommandDeleteResource) command;
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ wr.write(cmd.cmdPropertyName + "=" + cmd.name);
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeploy.java
new file mode 100644
index 0000000..a21f8bc
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDeploy.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for deploying directory or file.
+ * <p>
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestDeploy extends RunnerRest {
+
+ private static final String NEWLINE = "\r\n";
+
+ private String multipartBoundary = Long.toHexString(System.
+ currentTimeMillis());
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandDeploy command;
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestDeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ this.command = (CommandDeploy)command;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ protected void prepareHttpConnection(HttpURLConnection conn) throws CommandException {
+ super.prepareHttpConnection(conn);
+ if (!command.dirDeploy) {
+ conn.setRequestProperty("Content-Type",
+ "multipart/form-data; boundary=" + multipartBoundary);
+ }
+ }
+
+ /**
+ * Handle sending data to server using HTTP command interface.
+ * <p/>
+ * This is based on reading the code of
+ * <code>CLIRemoteCommand.java</code>
+ * from the server's code repository. Since some asadmin commands
+ * need to send multiple files, the server assumes the input is a ZIP
+ * stream.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ //InputStream istream = getInputStream();
+ if (command.path == null) {
+ throw new PayaraIdeException("The path attribute of deploy command"
+ + " has to be non-empty!");
+ }
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ if (!command.dirDeploy) {
+ writeParam(wr, "path", command.path.getAbsolutePath());
+ if (command.name != null) {
+ writeParam(wr, "name", command.name);
+ }
+ if (command.contextRoot != null) {
+ writeParam(wr, "contextroot", command.contextRoot);
+ }
+ if (command.target != null) {
+ writeParam(wr, "target", command.target);
+ }
+
+ writeBinaryFile(wr, hconn.getOutputStream(), command.path);
+ wr.append("--" + multipartBoundary + "--").append(NEWLINE);
+ } else {
+ wr.write("path=" + command.path.toString());
+ if (command.name != null) {
+ wr.write("&");
+ wr.write("name=" + command.name);
+ }
+ if (command.contextRoot != null) {
+ wr.write("&");
+ wr.write("contextroot=" + command.name);
+ }
+ if (command.target != null) {
+ wr.write("&");
+ wr.write("target=" + command.target);
+ }
+ }
+
+ wr.close();
+ }
+
+ private void writeParam(OutputStreamWriter writer, String paramName,
+ String paramValue) throws IOException {
+ writer.append("--" + multipartBoundary).append(NEWLINE);
+ writer.append("Content-Disposition: form-data; name=\"").append(
+ paramName).append("\"").append(NEWLINE);
+ writer.append("Content-Type: text/plain;").append(NEWLINE);
+ writer.append(NEWLINE);
+ writer.append(paramValue).append(NEWLINE).flush();
+ }
+
+ private void writeBinaryFile(OutputStreamWriter writer, OutputStream output, File file) throws IOException {
+ writer.append("--" + multipartBoundary).append(NEWLINE);
+// writer.append("Content-Disposition: form-data; name=\"warFile\"; filename=\""
+// + file.getAbsolutePath() + "\"").append(NEWLINE);
+ writer.append("Content-Type: application/octet-stream").append(NEWLINE);
+ writer.append("Content-Transfer-Encoding: binary").append(NEWLINE);
+ writer.append(NEWLINE).flush();
+
+ InputStream input = null;
+ try {
+ input = new FileInputStream(file);
+ byte[] buffer = new byte[1024*1024];
+ for (int length ; (length = input.read(buffer)) > 0 ;) {
+ output.write(buffer, 0, length);
+ }
+ output.flush(); // Important! Output cannot be closed. Close of writer will close output as well.
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+ writer.append(NEWLINE).flush();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ // Fake Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set the content-type of information sent to the server.
+ * Returns
+ * <code>application/zip</code> for file deployment
+ * and
+ * <code>null</code> (not set) for directory deployment.
+ *
+ * @return content-type of data sent to server via HTTP POST
+ */
+ @Override
+ public String getContentType() {
+ return command.dirDeploy ? null : "application/zip";
+ }
+
+// /**
+// * Provide the lastModified date for data source whose
+// * <code>InputStream</code> is returned by getInputStream.
+// * <p/>
+// * @return String format of long integer from lastModified date of source.
+// */
+// @Override
+// public String getLastModified() {
+// return Long.toString(command.path.lastModified());
+// }
+ /**
+ * Get
+ * <code>InputStream</code> object for deployed file.
+ * <p/>
+ * @return <code>InputStream</code> object for deployed file
+ * or <code>null</code> for directory deployment.
+ */
+ public InputStream getInputStream() {
+ if (command.dirDeploy) {
+ return null;
+ } else {
+ try {
+ return new FileInputStream(command.path);
+ } catch (FileNotFoundException fnfe) {
+ Logger.log(Level.INFO, command.path.getPath(), fnfe);
+ return null;
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDisable.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDisable.java
new file mode 100644
index 0000000..4f75a50
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestDisable.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for disabling the application.
+ * <p>
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestDisable extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestDisable(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandTargetName commandApp = (CommandTargetName)command;
+ String target = commandApp.target;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("name=").append(commandApp.name);
+ if (target != null) {
+ data.append("&target=").append(commandApp.target);
+ }
+
+ wr.write(data.toString());
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestEnable.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestEnable.java
new file mode 100644
index 0000000..f9f4182
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestEnable.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for enabling a disabling the application.
+ * <p>
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestEnable extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestEnable(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ CommandTargetName commandApp = (CommandTargetName)command;
+ String target = commandApp.target;
+ OutputStreamWriter wr =
+ new OutputStreamWriter(hconn.getOutputStream());
+ StringBuilder data = new StringBuilder();
+ data.append("component=").append(commandApp.name);
+ if (target != null) {
+ data.append("&target=").append(commandApp.target);
+ }
+
+ wr.write(data.toString());
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestFetchLogData.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestFetchLogData.java
new file mode 100644
index 0000000..97205ff
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestFetchLogData.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.zip.GZIPInputStream;
+import org.netbeans.modules.payara.tooling.admin.response.ResponseContentType;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Server <code>view-log</code> Administration Command Execution
+ * using HTTP interface.
+ * <p/>
+ * Class implements Payara server administration functionality trough HTTP
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestFetchLogData extends RunnerRest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Extracts query string from passed View Log command entity.
+ * <p.>
+ * @param command View Log command entity.
+ * @return Query string for given command.
+ */
+ private static String query(Command command) {
+ if (command instanceof CommandFetchLogData) {
+ return ((CommandFetchLogData)command).paramsAppendNext;
+ }
+ else {
+ throw new CommandException(
+ CommandException.ILLEGAL_COMAND_INSTANCE);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara log lines.
+ * <p/>
+ * <code>List<String> lines</code> instance is internal server response
+ * holder. Instance life cycle is started in <code>readResponse</code>
+ * method where log returned from server is read and stored internally.
+ */
+ private List<String> lines;
+
+ /**
+ * Content of HTTP header <code>X-Text-Append-Next</code>.
+ * <p/>
+ * This header contains the entire URL to pass to the GET method to return
+ * the changes since the last call. You can use this header in client
+ * applications to get all log entries that were added in particular
+ * interval.
+ */
+ private URL headerAppendNext;
+
+ /**
+ * Payara administration command result containing server log.
+ * <p/>
+ * Result instance life cycle is started with submitting task into
+ * <code>ExecutorService</code>'s queue. method <code>call()</code>
+ * is responsible for correct <code>TaskState</code> and receiveResult value
+ * handling.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultLog result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // TODO: Make this "/management/domain/" command v3 only after
+ // NetBeans 7.3 release.
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestFetchLogData(final PayaraServer server,
+ final Command command) {
+ super(server, command, "/management/domain/", query(command));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultLog</code> object corresponding
+ * to server log command execution value to be returned.
+ */
+ @Override
+ protected Result createResult() {
+ return result = new ResultLog();
+ }
+
+ @Override
+ public boolean getDoOutput() {
+ return false;
+ }
+
+ @Override
+ protected String getRequestMethod() {
+ return "GET";
+ }
+
+
+ /**
+ * Inform whether this runner implementation accepts gzip format.
+ * <p/>
+ * @return <code>true</code> when gzip format is accepted,
+ * <code>false</code> otherwise.
+ */
+ @Override
+ public boolean acceptsGzip() {
+ return false;
+ }
+
+ /**
+ * Reads response from server and stores it into internal objects.
+ * <p/>
+ * Retrieved lines of server log are stored in internal <code>lines</code>
+ * <code>List</code>. Content of HTTP header <code>X-Text-Append-Next</code>
+ * is stored in internal <code>headerAppendNext</code> variable.
+ * <p/>
+ * It's not necessary close the stream parameter when finished. Caller
+ * will take care of that. But this method uses additional stream handlers
+ * for <code>gzip</code> compression and buffered reading so it should
+ * close them.
+ * <p/>
+ * @param in Stream to read data from.
+ * @return <code>true</code> if response <code>X-Text-Append-Next</code> HTTP header
+ * contains some parameters (e.g. ?start=<number>) or
+ * <code>false</code> otherwise.
+ * @throws CommandException in case of stream error.
+ */
+ @Override
+ public boolean readResponse(InputStream in, HttpURLConnection hconn) {
+ lines = new LinkedList<String>();
+ String ce = hconn.getContentEncoding();
+ BufferedReader br = null;
+ String line = null;
+ try {
+ InputStream cooked = null != ce && ce.contains("gzip")
+ ? new GZIPInputStream(in) : in;
+ br = new BufferedReader(new java.io.InputStreamReader(cooked));
+ while ((line = br.readLine()) != null) {
+ if (line != null)
+ lines.add(line);
+ }
+ } catch (IOException ioe) {
+ throw new CommandException(CommandException.HTTP_RESP_IO_EXCEPTION,
+ ioe);
+ } finally {
+ try {
+ if (br != null) {
+ br.close();
+ }
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING, ioe.getLocalizedMessage(), ioe);
+ }
+ }
+
+ try {
+ headerAppendNext
+ = new URL(hconn.getHeaderField("X-Text-Append-Next"));
+ } catch (MalformedURLException mue) {
+ Logger.log(Level.WARNING, mue.getLocalizedMessage(), mue);
+ headerAppendNext = null;
+ return false;
+ }
+ String queryAppendNext = headerAppendNext.getQuery();
+ return queryAppendNext != null;
+ }
+
+ /**
+ * Extracts result value from internal <code>Manifest</code> object.
+ * Value of <i>message</i> attribute in <code>Manifest</code> object is
+ * stored as <i>value</i> into <code>ResultString</code> result object.
+ * <p/>
+ * @return true if result was extracted correctly. <code>null</code>
+ * <i>message</i>value is considered as failure.
+ */
+ @Override
+ protected boolean processResponse() {
+ // Make ArrayList copy of stored lines. ArrayList allows better access
+ // to log values.
+ List logLines = new ArrayList(lines.size());
+ for (String line : lines) {
+ logLines.add(line);
+ }
+ result.value = new ValueLog(logLines, headerAppendNext.getQuery());
+ return true;
+ }
+
+ @Override
+ protected ResponseContentType getResponseType() {
+ return ResponseContentType.TEXT_PLAIN;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestGetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestGetProperty.java
new file mode 100644
index 0000000..c80ebb8
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestGetProperty.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.admin.response.MessagePart;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner that executes get property command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestGetProperty extends RunnerRest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(RunnerRestGetProperty.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Result object - contains list of JDBC resources names.*/
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestGetProperty(final PayaraServer server,
+ final Command command) {
+ super(server, command, "/command/", null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultMap</code> object corresponding
+ * to server get property command execution value to be returned.
+ */
+ @Override
+ protected ResultMap<String, String> createResult() {
+ return result = new ResultMap<String, String>();
+ }
+
+ @Override
+ protected boolean processResponse() {
+ final String METHOD = "processResponse";
+ List<MessagePart> childMessages = report.getTopMessagePart().getChildren();
+ if ((childMessages == null) || childMessages.isEmpty()) {
+ return false;
+ }
+ result.value = new HashMap<String, String>(childMessages.size());
+
+ for (MessagePart msg : childMessages) {
+ String message = msg.getMessage();
+ int equalsIndex = message.indexOf('=');
+ if (equalsIndex >= 0) {
+ String keyPart = message.substring(0, equalsIndex);
+ String valuePart = message.substring(equalsIndex + 1);
+ try {
+ // Around Sept. 2008... 3.x servers were double encoding their
+ // responces. It appears that has stopped
+ // (See http://netbeans.org/bugzilla/show_bug.cgi?id=195015)
+ // The open question is, "When did 3.x stop doing the double
+ // encode?" since we don't know... this strategy will work
+ // for us
+ // Belt and suspenders, like
+ result.value.put(keyPart, valuePart); // raw form
+ result.value.put(keyPart, URLDecoder.decode(valuePart,
+ "UTF-8")); // single decode
+ result.value.put(keyPart, URLDecoder.decode(result.value.
+ get(keyPart), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ LOGGER.log(Level.INFO, METHOD,
+ "unsupportedEncoding", result.value.get(keyPart));
+ } catch (IllegalArgumentException iae) {
+ LOGGER.log(Level.INFO, METHOD, "illegalArgument",
+ new Object[] {valuePart, result.value.get(keyPart)});
+ }
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "emptyString", message);
+ result.value.put(message, "");
+ }
+ }
+ return true;
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandGetProperty gpCommand = (CommandGetProperty) command;
+ StringBuilder data = new StringBuilder();
+ data.append("pattern=").append(gpCommand.propertyPattern);
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestList.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestList.java
new file mode 100644
index 0000000..bede3ad
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestList.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.admin.response.MessagePart;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for commands that retrieve some kind of list.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestList extends RunnerRest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Result object - contains list of JDBC resources names.*/
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultList<String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestList(final PayaraServer server, final Command command) {
+ super(server, command);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create <code>ResultList</code> object corresponding
+ * to server log command execution value to be returned.
+ */
+ @Override
+ protected ResultList<String> createResult() {
+ return result = new ResultList<>();
+ }
+
+ @Override
+ protected boolean processResponse() {
+ List<MessagePart> childMessages = report.getTopMessagePart().getChildren();
+ if ((childMessages != null) && !childMessages.isEmpty()) {
+ result.value = new ArrayList<>(childMessages.size());
+ for (MessagePart msg : childMessages) {
+ result.getValue().add(msg.getMessage());
+ }
+ }
+ return true;
+ }
+
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListApplications.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListApplications.java
new file mode 100644
index 0000000..4d78267
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListApplications.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for commands that retrieve list of applications
+ * deployed on server.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestListApplications extends RunnerRestList {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestListApplications(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListResources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListResources.java
new file mode 100644
index 0000000..72e9c10
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListResources.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for commands that retrieve list of resources
+ * of certain kind.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestListResources extends RunnerRestList {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestListResources(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListWebServices.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListWebServices.java
new file mode 100644
index 0000000..5fcae4e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestListWebServices.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner for commands that retrieve list of web services
+ * deployed on server.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestListWebServices extends RunnerRestList {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestListWebServices(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestLocation.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestLocation.java
new file mode 100644
index 0000000..6007f08
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestLocation.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.HashMap;
+import java.util.Properties;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestLocation extends RunnerRest {
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandLocation command;
+
+ /** Returned value is map where locations are stored under keys specified in
+ * CommandLocation class.
+ */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestLocation(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ this.command = (CommandLocation)command;
+ }
+
+ @Override
+ protected Result createResult() {
+ return result = new ResultMap<String, String>();
+ }
+
+ @Override
+ protected boolean processResponse() {
+ if (report == null) {
+ return false;
+ }
+ Properties props = report.getTopMessagePart().getProperties();
+ result.value = new HashMap<String, String>(props.size());
+ for (String key : props.stringPropertyNames()) {
+ result.value.put(key, props.getProperty(key));
+ }
+ return true;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestSetProperty.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestSetProperty.java
new file mode 100644
index 0000000..2850c89
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestSetProperty.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Runner executes set property command via REST interface.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class RunnerRestSetProperty extends RunnerRest {
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestSetProperty(final PayaraServer server,
+ final Command command) {
+ super(server, command, "/command/", null);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandSetProperty spCommand = (CommandSetProperty) command;
+ StringBuilder data = new StringBuilder();
+ data.append("values=");
+ data.append(spCommand.property);
+ data.append("=\"");
+ data.append(spCommand.value);
+ data.append("\"");
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartCluster.java
new file mode 100644
index 0000000..b6d702f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartCluster.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner executes start cluster command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestStartCluster extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestStartCluster(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ wr.write("clusterName=" + ((CommandTarget)command).target);
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartInstance.java
new file mode 100644
index 0000000..bd7b9ce
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStartInstance.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner executes start instance command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestStartInstance extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestStartInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandTarget cmd = (CommandTarget) command;
+ StringBuilder data = new StringBuilder();
+ data.append("instance_name=").append(cmd.target);
+
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopCluster.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopCluster.java
new file mode 100644
index 0000000..0a69172
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopCluster.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner executes stop cluster command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestStopCluster extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestStopCluster(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ wr.write("clusterName=" + ((CommandTarget)command).target);
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopDAS.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopDAS.java
new file mode 100644
index 0000000..28d2d52
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopDAS.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestStopDAS extends RunnerRest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestStopDAS(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+// @Override
+// protected String constructCommandUrl() throws CommandException {
+// String protocol = "http";
+// URI uri;
+// try {
+// uri = new URI(protocol, null, server.getHost(), server.getAdminPort(), path + "stop", query, null);
+// } catch (URISyntaxException use) {
+// throw new CommandException(CommandException.RUNNER_HTTP_URL, use);
+// }
+// return uri.toASCIIString();
+// }
+//
+// @Override
+// protected String getRequestMethod() {
+// return "POST";
+// }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopInstance.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopInstance.java
new file mode 100644
index 0000000..fb736e2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestStopInstance.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Command runner executes stop instance command.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestStopInstance extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestStopInstance(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandTarget cmd = (CommandTarget) command;
+ StringBuilder data = new StringBuilder();
+ data.append("instanceName=").append(cmd.target);
+
+ wr.write(data.toString());
+ wr.flush();
+ wr.close();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestUndeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestUndeploy.java
new file mode 100644
index 0000000..e465f5f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/RunnerRestUndeploy.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestUndeploy extends RunnerRest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestUndeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ }
+
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ CommandUndeploy cmd = (CommandUndeploy) command;
+ wr.write("name=" + cmd.name);
+ if (cmd.target != null) {
+ wr.write("&target=" + cmd.target);
+ }
+ wr.flush();
+ wr.close();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ServerAdmin.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ServerAdmin.java
new file mode 100644
index 0000000..4ebf62a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ServerAdmin.java
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import java.net.Authenticator;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.data.IdeContext;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Administration Command API.
+ * <p>
+ * Payara command facade allows remote and local server handling.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ServerAdmin {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set global password authenticator for Payara servers.
+ * <p/>
+ * This method must be called before first usage
+ * of <code>Runner.call()</code> method.
+ * <p/>
+ * @param authenticator External authenticator for Payara servers
+ * to be supplied.
+ */
+ public static void init(final Authenticator authenticator) {
+ Runner.init(authenticator);
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * Execution of administration command is serialized using internal
+ * executor.
+ * <p>
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param ide IDE Context object (not used).
+ * @deprecated {@link IdeContext} class will be removed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final PayaraServer srv, final Command cmd,
+ final IdeContext ide) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ return (Future<E>) runner.execute();
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * Execution of administration command is serialized using internal
+ * executor.
+ * <p>
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param ide IDE Context object (not used).
+ * @param listeners Listeners that are called when command execution status changes.
+ * @deprecated {@link IdeContext} class will be removed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final PayaraServer srv, final Command cmd, final IdeContext ide,
+ final TaskStateListener... listeners) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ runner.stateListeners = listeners;
+ return (Future<E>) runner.execute();
+ }
+
+ /**
+ * Get individual executor pool for remote administration command
+ * execution.
+ * <p/>
+ * This allows to execute tasks in parallel using provided executor.
+ * <p/>
+ * @param size Thread pool size (how many tasks to execute in parallel)..
+ * @return Individual <code>Executor</code> instance.
+ */
+ public static ExecutorService executor(final int size) {
+ return Runner.parallelExecutor(size);
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * This allows to execute tasks in parallel using provided executor.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param ide IDE Context object (not used).
+ * @deprecated {@link IdeContext} class will be removed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final ExecutorService executor, final PayaraServer srv,
+ final Command cmd, final IdeContext ide) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ return (Future<E>) runner.execute(executor);
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * @param executor Executor service used to start task.
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param ide IDE Context object (not used).
+ * @param listeners Listeners that are called when command execution status changes.
+ * @deprecated {@link IdeContext} class will be removed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final ExecutorService executor, final PayaraServer srv,
+ final Command cmd, final IdeContext ide,
+ final TaskStateListener... listeners) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ runner.stateListeners = listeners;
+ return (Future<E>) runner.execute(executor);
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * Execution of administration command is serialized using internal
+ * executor.
+ * <p>
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final PayaraServer srv, final Command cmd) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ return (Future<E>) runner.execute();
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * Execution of administration command is serialized using internal
+ * executor.
+ * <p>
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param listeners Listeners that are called when command execution status changes.
+ */
+ public static <E extends Result> Future<E> exec(
+ final PayaraServer srv, final Command cmd,
+ final TaskStateListener... listeners) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ runner.stateListeners = listeners;
+ return (Future<E>) runner.execute();
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * This allows to execute tasks in parallel using provided executor.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ */
+ public static <E extends Result> Future<E> exec(
+ final ExecutorService executor, final PayaraServer srv,
+ final Command cmd) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ return (Future<E>) runner.execute(executor);
+ }
+
+ /**
+ * Execute remote administration command on Payara server.
+ * <p>
+ * @param executor Executor service used to start task.
+ * @param srv Target Payara server.
+ * @param cmd Server administration command to me executed.
+ * @param listeners Listeners that are called when command execution status changes.
+ */
+ public static <E extends Result> Future<E> exec(
+ final ExecutorService executor, final PayaraServer srv,
+ final Command cmd, final TaskStateListener... listeners) {
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ Runner runner = af.getRunner(srv, cmd);
+ runner.stateListeners = listeners;
+ return (Future<E>) runner.execute(executor);
+ }
+
+}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueLog.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueLog.java
new file mode 100644
index 0000000..2731f37
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueLog.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.List;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+
+/**
+ * Payara server log.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ValueLog {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server log lines. */
+ final List<String> lines;
+
+ /**
+ * URL parameters from HTTP header <code>X-Text-Append-Next</code>.
+ * <p/>
+ * <code>X-Text-Append-Next</code> header contains the entire URL to pass
+ * to the GET method to return the changes since the last call.
+ * You can use those URL parameters to construct URL to get all log entries
+ * that were added in particular interval starting from call that returned
+ * this result.
+ */
+ final String paramsAppendNext;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server log entity.
+ * <p/>
+ * Entity is initialized with values stored in
+ * <code>Runner</code> internal attributes in <code>processResponse</code>
+ * method.
+ * <p/>
+ * @param lines Payara server log lines.
+ * @param paramsAppendNext URL parameters from HTTP header
+ * <code>X-Text-Append-Next</code>
+ */
+ ValueLog(List<String> lines, String paramsAppendNext) {
+ this.lines = lines;
+ this.paramsAppendNext = paramsAppendNext;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara server log lines.
+ * <p/>
+ * @return Payara server log lines.
+ */
+ public List<String> getLines() {
+ return lines;
+ }
+
+ /**
+ * Get URL parameters from HTTP header <code>X-Text-Append-Next</code>.
+ * <p/>
+ * @return URL parameters from HTTP header <code>X-Text-Append-Next</code>.
+ */
+ public String getParamsAppendNext() {
+ return paramsAppendNext;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert stored server log lines to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ String lineSeparator = Utils.lineSeparator();
+ int lineSeparatorLength = lineSeparator.length();
+ if (lines != null) {
+ // Calculate total log length to avoid StringBuffer resizing.
+ int length = 0;
+ for (String line : lines) {
+ length += line != null
+ ? line.length() + lineSeparatorLength
+ : lineSeparatorLength;
+ }
+ StringBuilder sb = new StringBuilder(length);
+ for (String line : lines) {
+ if (line != null) {
+ sb.append(line);
+ }
+ sb.append(lineSeparator);
+ }
+ return sb.toString();
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueProcess.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueProcess.java
new file mode 100644
index 0000000..29b85d0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/ValueProcess.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+/**
+ * Payara server process.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ValueProcess {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** The name of the executable to run. */
+ private String processName;
+
+ /** Arguments passed to the executable. */
+ private String arguments;
+
+ /** Process information. */
+ private Process process;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara server process entity.
+ * <p/>
+ * Entity is initialized in <code>RunnerLocal</code> method
+ * <code>call</code>.
+ * method.
+ * <p/>
+ * @param processName The name of the executable to run..
+ * @param arguments Arguments passed to the executable.
+ */
+ ValueProcess(String processName, String arguments, Process process) {
+ this.processName = processName;
+ this.arguments = arguments;
+ this.process = process;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get name of the executable to run.
+ * <p/>
+ * @return Name of the executable to run.
+ */
+ public String getProcessName() {
+ return processName;
+ }
+
+ /**
+ * Get arguments passed to the executable.
+ * <p/>
+ * @return Arguments passed to the executable.
+ */
+ public String getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Get process information.
+ * <p/>
+ * @return Process information.
+ */
+ public Process getProcess() {
+ return process;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert stored process information to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ int length = (processName != null ? processName.length() : 0) +
+ (arguments != null ? arguments.length() : 0) + 1;
+ StringBuilder sb = new StringBuilder(length);
+ if (processName != null) {
+ sb.append(processName);
+ }
+ sb.append(' ');
+ if (arguments != null) {
+ sb.append(arguments);
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CloudTasks.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CloudTasks.java
new file mode 100644
index 0000000..bc90c4d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CloudTasks.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import java.io.File;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * This class provides convenience methods for working with cloud (CPAS server).
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CloudTasks {
+
+ /**
+ * Deploy task that deploys application on server.
+ *
+ * @param server - server to deploy on
+ * @param account - which account the application is deployed under
+ * @param application - File object representing archive or directory where
+ * the application is
+ * @param listener - listener, that listens to command execution events
+ * @return result object with task status and message
+ */
+ public static ResultString deploy(final PayaraServer server,
+ final String account, final File application,
+ final TaskStateListener listener) {
+ Command command = new CommandCloudDeploy(account, application);
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command, listener);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new PayaraIdeException(
+ "Instance or cluster stop failed.", e);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloud.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloud.java
new file mode 100644
index 0000000..42b0f2b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloud.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import org.netbeans.modules.payara.tooling.admin.Command;
+
+/**
+ * Payara cloud administration command entity.
+ * <p/>
+ * Holds common data for cloud administration command.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandCloud extends Command {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Cloud account identifier. */
+ final String account;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara cloud administration command entity
+ * with specified cloud account and command.
+ * <p/>
+ * @param command Cloud command represented by this object.
+ * @param account Cloud account identifier.
+ */
+ CommandCloud(final String command, final String account) {
+ super(command);
+ this.account = account;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns cloud account identifier of this command.
+ * <p/>
+ * @return Cloud account identifier.
+ */
+ public String getAccount() {
+ return account;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeploy.java
new file mode 100644
index 0000000..ef75acd
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeploy.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import java.io.File;
+import org.netbeans.modules.payara.tooling.admin.RunnerHttpClass;
+import org.netbeans.modules.payara.tooling.admin.RunnerRestClass;
+
+/**
+ * Payara cloud deploy command entity.
+ * <p/>
+ * Holds data for command. Objects of this class are created by API user.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@RunnerHttpClass(runner=RunnerHttpCloud.class)
+@RunnerRestClass(runner=RunnerRestCloudDeploy.class)
+public class CommandCloudDeploy extends CommandCloud {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command string for deploy command. */
+ private static final String COMMAND = "deploy";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** File to deploy. */
+ final File path;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server deploy command entity.
+ * <p/>
+ * @param account Cloud account identifier.
+ * @param path File to deploy.
+ */
+ public CommandCloudDeploy(final String account, final File path) {
+ super(COMMAND, account);
+ this.path = path;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerHttpCloud.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerHttpCloud.java
new file mode 100644
index 0000000..0608ca4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerHttpCloud.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.RunnerHttp;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara cloud administration command execution using HTTP interface.
+ * <p/>
+ * HTTP interface is not supported with cloud commands.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerHttpCloud extends RunnerHttp {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * This constructor prototype is called from factory class and should
+ * remain public in all child classes.
+ * <p/>
+ * @param server Payara cloud entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerHttpCloud(final PayaraServer server,
+ final CommandCloud command) {
+ super(server, command, "/command/cloud/", null);
+ throw new UnsupportedOperationException(
+ "HTTP interface does not support cloud commands.");
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ RunnerHttpCloud(final PayaraServer server, final Command command,
+ final String query) {
+ super(server, command, "/command/cloud/", query);
+ throw new UnsupportedOperationException(
+ "HTTP interface does not support cloud commands.");
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * HTTP interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param path Path which builds URL we speak to.
+ * @param query Query string for this command.
+ */
+ RunnerHttpCloud(final PayaraServer server, final Command command,
+ final String path, final String query) {
+ super(server, command, path, query);
+ throw new UnsupportedOperationException(
+ "HTTP interface does not support cloud commands.");
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloud.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloud.java
new file mode 100644
index 0000000..5347a03
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloud.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.RunnerRest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara cloud administration command execution using REST interface.
+ * <p/>
+ * Class implements Payara cloud administration functionality trough REST
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+class RunnerRestCloud extends RunnerRest {
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * This constructor prototype is called from factory class and should
+ * remain public in all child classes.
+ * <p/>
+ * @param server Payara cloud entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCloud(final PayaraServer server,
+ final Command command) {
+ super(server, command, "/command/cloud/", null);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param query Query string for this command.
+ */
+ RunnerRestCloud(final PayaraServer server, final Command command,
+ final String query) {
+ super(server, command, "/command/cloud/", query);
+ }
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ * @param path Path which builds URL we speak to.
+ * @param query Query string for this command.
+ */
+ RunnerRestCloud(final PayaraServer server, final Command command,
+ final String path, final String query) {
+ super(server, command, path, query);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloudDeploy.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloudDeploy.java
new file mode 100644
index 0000000..592e967
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/cloud/RunnerRestCloudDeploy.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara cloud administration command execution using REST interface.
+ * <p/>
+ * Class implements Payara cloud administration functionality trough REST
+ * interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RunnerRestCloudDeploy extends RunnerRestCloud {
+
+ private static final String NEWLINE = "\r\n";
+
+ private String multipartBoundary = Long.toHexString(System.
+ currentTimeMillis());
+
+ /** Holding data for command execution. */
+ @SuppressWarnings("FieldNameHidesFieldInSuperclass")
+ final CommandCloudDeploy command;
+
+ /**
+ * Constructs an instance of administration command executor using
+ * REST interface for deploy command.
+ * <p/>
+ * @param server Payara server entity object.
+ * @param command Payara server administration command entity.
+ */
+ public RunnerRestCloudDeploy(final PayaraServer server,
+ final Command command) {
+ super(server, command);
+ this.command = (CommandCloudDeploy)command;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Handle sending data to server using HTTP command interface.
+ * <p/>
+ * This is based on reading the code of
+ * <code>CLIRemoteCommand.java</code>
+ * from the server's code repository. Since some asadmin commands
+ * need to send multiple files, the server assumes the input is a ZIP
+ * stream.
+ */
+ @Override
+ protected void handleSend(HttpURLConnection hconn) throws IOException {
+ //InputStream istream = getInputStream();
+ if (command.path == null) {
+ throw new PayaraIdeException("The path attribute of deploy command"
+ + " has to be non-empty!");
+ }
+ OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream());
+ writeParam(wr, "file", command.path.getAbsolutePath());
+ if (command.account != null) {
+ writeParam(wr, "account", command.account);
+ }
+ writeBinaryFile(wr, hconn.getOutputStream(), command.path);
+ wr.append("--" + multipartBoundary + "--").append(NEWLINE);
+ wr.close();
+ }
+
+ private void writeParam(OutputStreamWriter writer, String paramName,
+ String paramValue) throws IOException {
+ writer.append("--" + multipartBoundary).append(NEWLINE);
+ writer.append("Content-Disposition: form-data; name=\"").append(
+ paramName).append("\"").append(NEWLINE);
+ writer.append("Content-Type: text/plain;").append(NEWLINE);
+ writer.append(NEWLINE);
+ writer.append(paramValue).append(NEWLINE).flush();
+ }
+
+ private void writeBinaryFile(OutputStreamWriter writer, OutputStream output,
+ File file) throws IOException {
+ writer.append("--" + multipartBoundary).append(NEWLINE);
+ writer.
+ append("Content-Disposition: form-data; name=\"warFile\"; filename=\""
+ + file.getAbsolutePath() + "\"").append(NEWLINE);
+ writer.append("Content-Type: application/octet-stream").append(NEWLINE);
+ writer.append("Content-Transfer-Encoding: binary").append(NEWLINE);
+ writer.append(NEWLINE).flush();
+
+ InputStream input = null;
+ try {
+ input = new FileInputStream(file);
+ byte[] buffer = new byte[1024 * 1024];
+ for (int length = 0 ; (length = input.read(buffer)) > 0 ;) {
+ output.write(buffer, 0, length);
+ }
+ output.flush(); // Important! Output cannot be closed. Close of writer will close output as well.
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+ writer.append(NEWLINE).flush();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ActionReport.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ActionReport.java
new file mode 100644
index 0000000..d17ad75
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ActionReport.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+/**
+ * Represents response returned from server after command execution.
+ * <p>
+ * Inspired by ActionReport class from module GF Admin Rest Service.
+ * In our case the interface allows just read-only access.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface ActionReport {
+
+ /** Possible exit codes that are sent by server. */
+ public enum ExitCode { SUCCESS, WARNING, FAILURE, NA };
+
+ /**
+ * Get command execution exit code.
+ * <p>
+ * @return exit code of the called operation
+ */
+ public ExitCode getExitCode();
+
+ /**
+ * Getter for message included in server response.
+ * <p>
+ * @return message
+ */
+ public String getMessage();
+
+ /**
+ * Getter for command name (description).
+ * <p>
+ * @return command name
+ */
+ public String getCommand();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/MessagePart.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/MessagePart.java
new file mode 100644
index 0000000..f9d7d95
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/MessagePart.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Class represents one part of REST server message.
+ * <p>
+ * This part can be repeated in server response.
+ * It includes string message and can have other properties.
+ * It can be nesting also other message parts.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class MessagePart {
+
+ /** Message properties.*/
+ Properties props;
+
+ /** Message.*/
+ String message;
+
+ /** Nested messages.*/
+ List<MessagePart> children;
+
+ public List<MessagePart> getChildren() {
+ return children;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Properties getProperties() {
+ return props;
+ }
+
+ public void setProperties(Properties props) {
+ this.props = props;
+ }
+
+ void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseContentType.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseContentType.java
new file mode 100644
index 0000000..4034c22
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseContentType.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+/**
+ * Enum that represents possible content types that runners accept responses
+ * in.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum ResponseContentType {
+
+ APPLICATION_XML("application/xml"),
+ APPLICATION_JSON("application/json"),
+ TEXT_PLAIN("text/plain");
+
+ private String type;
+
+ ResponseContentType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParser.java
new file mode 100644
index 0000000..314233e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParser.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.io.InputStream;
+
+/**
+ * Interface for various implementations of parsing response functionality.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface ResponseParser {
+
+ /**
+ * Method parses the response and returns it's object representation -
+ * <code>ActionReport</code>.
+ * <p>
+ * @param in - input stream object
+ * @return <i>ActionReport</i> object that represents the response.
+ */
+ public ActionReport parse(InputStream in);
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserFactory.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserFactory.java
new file mode 100644
index 0000000..078464c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+
+
+/**
+ * Factory that returns appropriate response parser implementation
+ * based on content type of the response.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ResponseParserFactory {
+
+ private static RestXMLResponseParser xmlParser;
+
+ private static RestJSONResponseParser jsonParser;
+
+ public static synchronized RestResponseParser getRestParser(ResponseContentType contentType) {
+ switch (contentType) {
+ case APPLICATION_XML:
+ if (xmlParser == null) {
+ xmlParser = new RestXMLResponseParser();
+ }
+ return xmlParser;
+ case APPLICATION_JSON:
+ if (jsonParser == null) {
+ jsonParser = new RestJSONResponseParser();
+ }
+ return jsonParser;
+ case TEXT_PLAIN:
+ return null;
+ default: throw new PayaraIdeException("Not supported content type. Cannot create response parser!");
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestActionReport.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestActionReport.java
new file mode 100644
index 0000000..80af220
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestActionReport.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Object representation of the response returned by REST administration service.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RestActionReport implements ActionReport {
+
+ /** Top part of the message, can be the only one.*/
+ MessagePart topMessagePart = new MessagePart();
+ /** Nested reports.*/
+ List<? extends ActionReport> subActions = new ArrayList<>();
+ /** Exit code returned by server.*/
+ ExitCode exitCode = ActionReport.ExitCode.NA;
+ /** Description of command which is the report related to.*/
+ String actionDescription;
+
+ public List<? extends ActionReport> getSubActionsReport() {
+ return subActions;
+ }
+
+ @Override
+ public ExitCode getExitCode() {
+ return exitCode;
+ }
+
+ @Override
+ public String getMessage() {
+ return topMessagePart.getMessage();
+ }
+
+ @Override
+ public String getCommand() {
+ return actionDescription;
+ }
+
+ void setActionDescription(String actionDescription) {
+ this.actionDescription = actionDescription;
+ }
+
+ void setExitCode(ExitCode exitCode) {
+ this.exitCode = exitCode;
+ }
+
+ void setMessage(String message) {
+ topMessagePart.setMessage(message);
+ }
+
+ public boolean isSuccess() {
+ return getExitCode().equals(ExitCode.SUCCESS);
+ }
+
+ public MessagePart getTopMessagePart() {
+ return topMessagePart;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestJSONResponseParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestJSONResponseParser.java
new file mode 100644
index 0000000..f0f48a1
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestJSONResponseParser.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.ArrayList;
+import java.util.Properties;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.json.simple.parser.ParseException;
+
+/**
+ * Response parser implementation that can parse JSON responses
+ * returned by REST administration interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RestJSONResponseParser extends RestResponseParser {
+
+ /**
+ * Parse JSON response.
+ * <p/>
+ * @param in {@link InputStream} to read.
+ * @return Response returned by REST administration service.
+ */
+ @Override
+ public RestActionReport parse(InputStream in) {
+ RestActionReport report = new RestActionReport();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ copy(in, out);
+ String respMsg = out.toString("UTF-8");
+ JSONObject json = (JSONObject)JSONValue.parseWithException(respMsg);
+ parseReport(report, json);
+ } catch (IOException ex) {
+ throw new PayaraIdeException("Unable to copy JSON response.", ex);
+ } catch (ParseException e) {
+ throw new PayaraIdeException("Unable to parse JSON response.", e);
+ }
+ return report;
+ }
+
+ /**
+ * Parse JSON response.
+ * <p/>
+ * @param report Parsed content of JSON response.
+ * @param json JSON response.
+ */
+ private void parseReport(RestActionReport report, JSONObject json) {
+ report.setExitCode(ActionReport.ExitCode.valueOf((String)json.get(
+ "exit_code")));
+ report.setActionDescription((String)json.get("command"));
+ report.topMessagePart = parseMessagePart(json);
+ }
+
+ /**
+ * Parse one part of REST server message from JSON response.
+ * @param json JSON response.
+ * @return One part of REST server message from JSON response.
+ */
+ private MessagePart parseMessagePart(JSONObject json) {
+ MessagePart mp = new MessagePart();
+ mp.setMessage((String)json.get("message"));
+ mp.setProperties(parseProperties(json));
+ JSONArray children = (JSONArray)json.get("children");
+ if (children != null) {
+ mp.children = new ArrayList<>(children.size());
+ for (int i = 0 ; i < children.size() ; i++) {
+ JSONObject child = (JSONObject)children.get(i);
+ mp.children.add(parseMessagePart(child));
+ }
+ }
+ return mp;
+ }
+
+ /**
+ * Retrieve properties from JSON response.
+ * <p/>
+ * @param json JSON response.
+ * @return Properties from JSON response.
+ */
+ private Properties parseProperties(JSONObject json) {
+ Properties result = new Properties();
+ JSONObject properties = (JSONObject)json.get("properties");
+ if (properties != null) {
+ for (Object key : properties.keySet()) {
+ String value = (String) properties.get(key);
+ result.setProperty((String)key, value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Copy all data from <code>in</code> {@link InputStream}
+ * into <code>out</code> {@link OutputStream}.
+ * <p/>
+ * @param in Source {@link InputStream} to read all data.
+ * @param out Target {@link OutputStream} to write all data.
+ * @throws IOException when there is a problem with copying data.
+ */
+ public static void copy(InputStream in, OutputStream out) throws IOException {
+ try {
+ ReadableByteChannel inChannel = Channels.newChannel(in);
+ WritableByteChannel outChannel = Channels.newChannel(out);
+ ByteBuffer byteBuffer = ByteBuffer.allocate(10240);
+ int read;
+ do {
+ read = inChannel.read(byteBuffer);
+ if (read > 0) {
+ byteBuffer.limit(byteBuffer.position());
+ byteBuffer.rewind();
+ outChannel.write(byteBuffer);
+ byteBuffer.clear();
+ }
+ } while (read != -1);
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestResponseParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestResponseParser.java
new file mode 100644
index 0000000..10b4541
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestResponseParser.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.io.InputStream;
+
+/**
+ * Base implementation for REST parsers.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+abstract public class RestResponseParser implements ResponseParser {
+
+ @Override
+ public abstract RestActionReport parse(InputStream in);
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestXMLResponseParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestXMLResponseParser.java
new file mode 100644
index 0000000..9d7cd91
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/admin/response/RestXMLResponseParser.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.io.InputStream;
+import java.util.*;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Response parser implementation that can parse XML responses
+ * returned by REST admin interface.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class RestXMLResponseParser extends RestResponseParser {
+
+ private static final String ENTRY = "entry";
+ private static final String MAP = "map";
+
+ private static final XMLInputFactory factory = XMLInputFactory.newInstance();
+ private static final RestXMLResponseFilter filter = new RestXMLResponseFilter();
+
+ public RestXMLResponseParser() {
+
+ }
+
+ /**
+ * Parse implementation for XML REST response.
+ * <p>
+ * This implementation is based on Stax parser. Currently REST admin service
+ * does not use any schema for XML responses so this implementation is based
+ * on the code that generates the response on server side.
+ * <p>
+ * @param in {@link InputStream} with XML REST response.
+ * @return Response returned by REST administration service.
+ */
+ @Override
+ public RestActionReport parse(InputStream in) {
+ //System.out.println("FACTORY: " + factory);
+ try {
+ XMLEventReader reader = factory.createFilteredReader(factory.createXMLEventReader(in), filter);
+ if (reader.hasNext() && MAP.equals(reader.nextEvent().asStartElement().getName().getLocalPart())) {
+ return parseReport(reader);
+ } else {
+ return null;
+ }
+ } catch (XMLStreamException ex) {
+ throw new PayaraIdeException("Unable to parse XML Rest response.", ex);
+ }
+ }
+
+ private RestActionReport parseReport(XMLEventReader reader) throws XMLStreamException {
+ int level = 0;
+ RestActionReport report = new RestActionReport();
+ while (reader.hasNext() && (level > -1)) {
+ XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+
+ if (level++ == 0) {
+ StartElement element = event.asStartElement();
+ String elementName = element.getName().getLocalPart();
+ if (ENTRY.equals(elementName)) {
+ Map<String, String> m = getMapEntry(element);
+ String key = m.get("key");
+ String value = m.get("value");
+ switch (key) {
+ case "message":
+ report.setMessage(value);
+ break;
+ case "exit_code":
+ report.setExitCode(ActionReport.ExitCode.valueOf(value));
+ break;
+ case "command":
+ report.setActionDescription(value);
+ break;
+ case "children":
+ report.topMessagePart.children = parseChildrenMessages(reader);
+ level--;
+ break;
+ case "subReports":
+ report.subActions = parseSubReports(reader);
+ break;
+ }
+ }
+ }
+
+ }
+
+ if (event.isEndElement()) {
+ level--;
+ }
+ }
+ return report;
+ }
+
+ private HashMap<String, String> getMapEntry(StartElement entry) {
+ HashMap<String, String> entryMap = new HashMap<>();
+ Iterator iter = entry.getAttributes();
+ while (iter.hasNext()) {
+ Attribute att = (Attribute) iter.next();
+ entryMap.put(att.getName().getLocalPart(), att.getValue());
+ }
+ return entryMap;
+ }
+
+ private List<MessagePart> parseChildrenMessages(XMLEventReader reader) throws XMLStreamException {
+ ArrayList<MessagePart> messages = new ArrayList<>();
+ int level = 0;
+ while (reader.hasNext() && (level > -1)) {
+ XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ if (level++ == 1) {
+ StartElement element = event.asStartElement();
+ String elementName = element.getName().getLocalPart();
+ if (MAP.equals(elementName)) {
+ messages.add(parseChildMessage(reader));
+ level--;
+ }
+ }
+ } else {
+ level--;
+ }
+
+ }
+ return messages;
+ }
+
+ private MessagePart parseChildMessage(XMLEventReader reader) throws XMLStreamException {
+ MessagePart msg = new MessagePart();
+ int level = 0;
+ while (reader.hasNext() && (level > -1)) {
+ XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ if (level++ == 0) {
+ StartElement element = event.asStartElement();
+ String elementName = element.getName().getLocalPart();
+ if (ENTRY.equals(elementName)) {
+ Map<String, String> m = getMapEntry(element);
+ String key = m.get("key");
+ String value = m.get("value");
+ switch (key) {
+ case "message":
+ msg.setMessage(value);
+ break;
+ case "properties":
+ msg.props = parseProperties(reader);
+ break;
+ case "children":
+ msg.children = parseChildrenMessages(reader);
+ break;
+ }
+ }
+ }
+ } else {
+ level--;
+ }
+ }
+ return msg;
+ }
+
+ private Properties parseProperties(XMLEventReader reader) {
+ Properties props = new Properties();
+ // TODO parsing of properties
+ return props;
+ }
+
+ private List<? extends ActionReport> parseSubReports(XMLEventReader reader) {
+ ArrayList<RestActionReport> subReports = new ArrayList<>();
+ return subReports;
+ }
+
+
+ static private class RestXMLResponseFilter implements EventFilter {
+
+ @Override
+ public boolean accept(XMLEvent event) {
+ if (event.isStartElement() || event.isEndElement()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/DataException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/DataException.java
new file mode 100644
index 0000000..809c8de
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/DataException.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Payara IDE SDK Exception related to server administration command package
+ * problems.
+ * <p>
+ * All exceptions are logging themselves on WARNING level when created.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class DataException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Exception message for invalid Payara administration interface
+ * type. */
+ static final String INVALID_ADMIN_INTERFACE =
+ "Invalid Payara administration interface type";
+
+ /** Exception message for invalid Payara version. */
+ static final String INVALID_CONTAINER = "Invalid Payara container";
+
+ /** Exception message for invalid Payara URL.
+ * Used in IDE URL entity class. */
+ public static final String INVALID_URL = "Invalid Payara URL";
+
+ /** Exception for Payara installation root directory null value. */
+ static final String SERVER_ROOT_NULL
+ = "Payara installation root directory is null";
+
+ /** Exception for Payara home directory null value. */
+ static final String SERVER_HOME_NULL
+ = "Payara home directory is null";
+
+ /** Exception for non existent Payara installation root directory.
+ Requires 1 directory argument.*/
+ static final String SERVER_ROOT_NONEXISTENT
+ = "Payara installation root directory {0} does not exist";
+
+ /** Exception for non existent Payara home directory.
+ Requires 1 directory argument.*/
+ static final String SERVER_HOME_NONEXISTENT
+ = "Payara home directory {0} does not exist";
+
+ /** Exception for unknown Payara version in Payara home directory.
+ */
+ static final String SERVER_HOME_NO_VERSION
+ = "Unknown Payara version in home directory {0}";
+
+ /** Exception for Payara URL null value. */
+ static final String SERVER_URL_NULL = "Payara URL is null";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>DataException</code> without
+ * detail message.
+ */
+ public DataException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>DataException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public DataException(final String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>DataException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public DataException(final String msg, final Object... arguments) {
+ super(msg, arguments);
+ }
+
+ /**
+ * Constructs an instance of <code>DataException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public DataException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ExceptionMessages.properties
new file mode 100644
index 0000000..c2fb63f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ExceptionMessages.properties
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# PayaraStatusCheck class
+PayaraStatusCheck.toString.invalidStatusCheck=Invalid Payara server \
+status check type
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/IdeContext.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/IdeContext.java
new file mode 100644
index 0000000..2382e18
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/IdeContext.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+/**
+ * IDE context containing interfaces to access IDE objects.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ * @deprecated IDE context support was removed. DO NOT USE!
+ */
+public class IdeContext {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs IDE context object and sets IDE accessors.
+ * <p/>
+ * @deprecated IDE context support was removed. DO NOT USE!
+ */
+ public IdeContext() {
+ }
+
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/JDKVersion.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/JDKVersion.java
new file mode 100644
index 0000000..ad0ed7a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/JDKVersion.java
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.Optional;
+
+public final class JDKVersion {
+
+ /**
+ * Major version number.
+ */
+ private final short major;
+
+ /**
+ * Minor version number.
+ */
+ private final Optional<Short> minor;
+
+ /**
+ * Sub-minor version number.
+ */
+ private final Optional<Short> subminor;
+
+ /**
+ * Update version number.
+ */
+ private final Optional<Short> update;
+
+ public static JDKVersion IDE_JDK_VERSION;
+
+ private static final String VERSION_MATCHER = "([0-9]+[\\._u\\-]+)*[0-9]+";
+
+ // split java version into it's constituent parts, i.e.
+ // 1.2.3.4 -> [ 1, 2, 3, 4]
+ // 1.2.3u4 -> [ 1, 2, 3, 4]
+ // 1.2.3_4 -> [ 1, 2, 3, 4]
+ private static final String VERSION_SPLITTER = "[\\._u\\-]+";
+
+ private static final Short DEFAULT_VALUE = 0;
+
+ private JDKVersion(String string) {
+ String[] split = string.split(VERSION_SPLITTER);
+ major = split.length > 0 ? Short.parseShort(split[0]) : 0;
+ minor = split.length > 1 ? Optional.of(Short.parseShort(split[1])) : Optional.empty();
+ subminor = split.length > 2 ? Optional.of(Short.parseShort(split[2])) : Optional.empty();
+ update = split.length > 3 ? Optional.of(Short.parseShort(split[3])) : Optional.empty();
+ }
+
+ private JDKVersion(Short major, Short minor, Short subminor, Short update) {
+ this.major = major;
+ this.minor = Optional.of(minor);
+ this.subminor = Optional.of(subminor);
+ this.update = Optional.of(update);
+ }
+
+ /**
+ * Get major version number.
+ *
+ * @return Major version number.
+ */
+ public short getMajor() {
+ return major;
+ }
+
+ /**
+ * Get minor version number.
+ *
+ * @return Minor version number.
+ */
+ public Optional<Short> getMinor() {
+ return minor;
+ }
+
+ /**
+ * Get sub-minor version number.
+ *
+ * @return Sub-Minor version number.
+ */
+ public Optional<Short> getSubMinor() {
+ return subminor;
+ }
+
+ /**
+ * Get update version number.
+ *
+ * @return Update version number.
+ */
+ public Optional<Short> getUpdate() {
+ return update;
+ }
+
+ public boolean gt(JDKVersion version) {
+ if (major > version.getMajor()) {
+ return true;
+ } else if (major == version.getMajor()) {
+ if (JDKVersion.this.gt(minor, version.getMinor())) {
+ return true;
+ } else if (eq(minor, version.getMinor())) {
+ if (JDKVersion.this.gt(subminor, version.getSubMinor())) {
+ return true;
+ } else if (eq(subminor, version.getSubMinor())) {
+ if (JDKVersion.this.gt(update, version.getUpdate())) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean lt(JDKVersion version) {
+ if (major < version.getMajor()) {
+ return true;
+ } else if (major == version.getMajor()) {
+ if (lt(minor, version.getMinor())) {
+ return true;
+ } else if (eq(minor, version.getMinor())) {
+ if (JDKVersion.this.lt(subminor, version.getSubMinor())) {
+ return true;
+ } else if (eq(subminor, version.getSubMinor())) {
+ if (JDKVersion.this.lt(update, version.getUpdate())) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public boolean ge(JDKVersion version) {
+ return gt(version) || equals(version);
+ }
+
+ public boolean le(JDKVersion version) {
+ return lt(version) || equals(version);
+ }
+
+ private boolean gt(Optional<Short> v1, Optional<Short> v2) {
+ return v1.orElse(DEFAULT_VALUE) > v2.orElse(DEFAULT_VALUE);
+ }
+
+ private boolean lt(Optional<Short> v1, Optional<Short> v2) {
+ return v1.orElse(DEFAULT_VALUE) < v2.orElse(DEFAULT_VALUE);
+ }
+
+ /**
+ * if either v1 or v2 is empty, it is equals
+ *
+ * @param v1
+ * @param v2
+ * @return true if equals, otherwise false
+ */
+ private boolean eq(Optional<Short> v1, Optional<Short> v2) {
+ if (!v1.isPresent() || !v2.isPresent()) {
+ return true;
+ }
+ return v1.orElse(DEFAULT_VALUE).equals(v2.orElse(DEFAULT_VALUE));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final JDKVersion other = (JDKVersion) obj;
+ if (this.major != other.getMajor()) {
+ return false;
+ }
+ if (!eq(this.minor, other.getMinor())) {
+ return false;
+ }
+ if (!eq(this.subminor, other.getSubMinor())) {
+ return false;
+ }
+ return eq(this.update, other.getUpdate());
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 89 * hash + this.major;
+ hash = 89 * hash + this.minor.orElse(DEFAULT_VALUE);
+ hash = 89 * hash + this.subminor.orElse(DEFAULT_VALUE);
+ hash = 89 * hash + this.update.orElse(DEFAULT_VALUE);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder value = new StringBuilder(major);
+ if (minor.isPresent()) {
+ value.append('.').append(minor.get());
+ }
+ if (subminor.isPresent()) {
+ value.append('.').append(subminor.get());
+ }
+ if (update.isPresent()) {
+ value.append('.').append(update.get());
+ }
+ return value.toString();
+ }
+
+ public static JDKVersion toValue(String version) {
+ if (version != null && version.matches(VERSION_MATCHER)) {
+ return new JDKVersion(version);
+ } else {
+ return null;
+ }
+ }
+
+ public static JDKVersion getDefaultPlatformVersion() {
+ return IDE_JDK_VERSION;
+ }
+
+ public static boolean isCorrectJDK(JDKVersion jdkVersion, Optional<JDKVersion> minVersion, Optional<JDKVersion> maxVersion) {
+ boolean correctJDK = true;
+ if (minVersion.isPresent()) {
+ correctJDK = jdkVersion.ge(minVersion.get());
+ }
+ if (correctJDK && maxVersion.isPresent()) {
+ correctJDK = jdkVersion.le(maxVersion.get());
+ }
+ return correctJDK;
+ }
+
+ public static boolean isCorrectJDK(Optional<JDKVersion> minVersion, Optional<JDKVersion> maxVersion) {
+ return isCorrectJDK(IDE_JDK_VERSION, minVersion, maxVersion);
+ }
+
+ static {
+ initialize();
+ }
+
+ private static void initialize() {
+ short major = 1;
+ short minor = 0;
+ short subminor = 0;
+ short update = 0;
+ try {
+ /*
+ In JEP 223 java.specification.version will be a single number versioning , not a dotted versioning .
+ For JDK 8:
+ java.specification.version 1.8
+ java.version 1.8.0_212
+ For JDK 9:
+ java.specification.version 9
+ java.version 9.0.4
+ For JDK 11:
+ java.specification.version 11
+ java.version 11.0.3
+ */
+ String javaSpecVersion = System.getProperty("java.specification.version");
+ String javaVersion = System.getProperty("java.version");
+ String[] javaSpecVersionSplit = javaSpecVersion.split("\\.");
+ if (javaSpecVersionSplit.length == 1) {
+ // Handle Early Access build. e.g: 13-ea
+ String[] javaVersionSplit = javaVersion.split("-");
+ String javaVersionCategory = javaVersionSplit[0];
+ String[] split = javaVersionCategory.split("[\\.]+");
+
+ if (split.length > 0) {
+ if (split.length > 0) {
+ major = Short.parseShort(split[0]);
+ }
+ if (split.length > 1) {
+ minor = Short.parseShort(split[1]);
+ }
+ if (split.length > 2) {
+ subminor = Short.parseShort(split[2]);
+ }
+ if (split.length > 3) {
+ update = Short.parseShort(split[3]);
+ }
+ }
+ } else {
+ if (javaVersion == null || javaVersion.length() <= 0) {
+ return;
+ }
+
+ String[] javaVersionSplit = javaVersion.split("\\.");
+ if (javaVersionSplit.length < 3 || !javaVersionSplit[0].equals("1")) {
+ return;
+ }
+
+ major = Short.parseShort(javaVersionSplit[0]);
+ minor = Short.parseShort(javaVersionSplit[1]);
+ javaVersionSplit = javaVersionSplit[2].split("_");
+
+ if (javaVersionSplit.length < 1) {
+ return;
+ }
+
+ subminor = Short.parseShort(javaVersionSplit[0]);
+
+ if (javaVersionSplit.length > 1) {
+ update = Short.parseShort(javaVersionSplit[1]);
+ }
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+
+ IDE_JDK_VERSION = new JDKVersion(major, minor, subminor, update);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/LogMessages.properties
new file mode 100644
index 0000000..606d140
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/LogMessages.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# PayaraVersion class
+PayaraVersion.matchMajorMinor.nfe=Strings are not version numbers: {0}, {1}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraAdminInterface.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraAdminInterface.java
new file mode 100644
index 0000000..a04a18c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraAdminInterface.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Payara Server Administration Interface.
+ * <p>
+ * Local Payara server administration interface type used to mark proper
+ * administration interface for individual Payara servers.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum PayaraAdminInterface {
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+ /** Payara server administration interface is REST. */
+ REST,
+ /** Payara server administration interface is HTTP. */
+ HTTP;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** A <code>String</code> representation of REST value. */
+ static final String REST_STR = "REST";
+
+ /** A <code>String</code> representation of HTTP value. */
+ static final String HTTP_STR = "HTTP";
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, PayaraAdminInterface> stringValuesMap
+ = new HashMap(values().length);
+
+ // Initialize backward String conversion <code>Map</code>.
+ static {
+ for (PayaraAdminInterface adminInterface
+ : PayaraAdminInterface.values()) {
+ stringValuesMap.put(
+ adminInterface.toString().toUpperCase(), adminInterface);
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>PayaraAdminInterface</code> with a value represented
+ * by the specified <code>String</code>. The
+ * <code>PayaraAdminInterface</code> returned represents existing value
+ * only if specified <code>String</code> matches any <code>String</code>
+ * returned by <code>toString</code> method. Otherwise <code>null</code>
+ * value is returned.
+ * <p>
+ * @param name Value containing <code>PayaraAdminInterface</code>
+ * <code>toString</code> representation.
+ * @return <code>PayaraAdminInterface</code> value represented
+ * by <code>String</code> or <code>null</code> if value was
+ * not recognized.
+ */
+ public static PayaraAdminInterface toValue(String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraAdminInterface</code> value to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case REST: return REST_STR;
+ case HTTP: return HTTP_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new DataException(
+ DataException.INVALID_ADMIN_INTERFACE);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraConfig.java
new file mode 100644
index 0000000..1448bf9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraConfig.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.JavaEESet;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+import org.netbeans.modules.payara.tooling.server.config.LibraryNode;
+
+/**
+ * Payara configuration reader API interface.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public interface PayaraConfig {
+
+ /**
+ * Get Payara libraries configuration.
+ * <p/>
+ * @return Payara libraries configuration.
+ */
+ public List<LibraryNode> getLibrary();
+
+ /**
+ * Get Payara Java EE configuration.
+ * <p/>
+ * @return Payara JavaEE configuration.
+ */
+ public JavaEESet getJavaEE();
+
+ /**
+ * Get Payara Java SE configuration.
+ * <p/>
+ * @return Payara JavaSE configuration.
+ */
+ public JavaSESet getJavaSE();
+
+ /**
+ * Get Payara tools configuration.
+ * <p/>
+ * @return Payara tools configuration.
+ */
+ public ToolsConfig getTools();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraContainer.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraContainer.java
new file mode 100644
index 0000000..755e9f6
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraContainer.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Payara Server Containers.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum PayaraContainer implements Comparator<PayaraContainer> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** EAR application. */
+ EAR,
+ /** jRuby application. */
+ JRUBY,
+ /** Web application. */
+ WEB,
+ /** EJB application. */
+ EJB,
+ /** Application client. */
+ APPCLIENT,
+ /** Connector. */
+ CONNECTOR,
+ /** Unknown application. */
+ UNKNOWN;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** A <code>String</code> representation of EAR value. */
+ static final String EAR_STR = "ear";
+
+ /** A <code>String</code> representation of JRUBY value. */
+ static final String JRUBY_STR = "jruby";
+
+ /** A <code>String</code> representation of WEB value. */
+ static final String WEB_STR = "web";
+
+ /** A <code>String</code> representation of EJB value. */
+ static final String EJB_STR = "ejb";
+
+ /** A <code>String</code> representation of APPCLIENT value. */
+ static final String APPCLIENT_STR = "appclient";
+
+ /** A <code>String</code> representation of CONNECTOR value. */
+ static final String CONNECTOR_STR = "connector";
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ static final String UNKNOWN_STR = "unknown";
+
+ /** Version elements separator character. */
+ public static final char SEPARATOR = ',';
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, PayaraContainer> stringValuesMap
+ = new HashMap(2 * values().length);
+
+ // Initialize backward String conversion Map.
+ static {
+ for (PayaraContainer container : PayaraContainer.values()) {
+ stringValuesMap.put(container.toString().toUpperCase(), container);
+ }
+ }
+
+ /**
+ * Returns a <code>PayaraContainer</code> with a value represented by
+ * the specified <code>String</code>. The <code>PayaraContainer</code>
+ * returned represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param containerStr Value containing container <code>String</code>
+ * representation.
+ * @return <code>PayaraContainer</code> value represented
+ * by <code>String</code> or <code>null</code> if value was
+ * not recognized.
+ */
+ public static PayaraContainer toValue(String containerStr) {
+ if (containerStr != null) {
+ return (stringValuesMap.get(containerStr.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraContainer</code> value to <code>String</code>.
+ * <p>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case EAR: return EAR_STR;
+ case JRUBY: return JRUBY_STR;
+ case WEB: return WEB_STR;
+ case EJB: return EJB_STR;
+ case APPCLIENT: return APPCLIENT_STR;
+ case CONNECTOR: return CONNECTOR_STR;
+ case UNKNOWN: return UNKNOWN_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new DataException(
+ DataException.INVALID_CONTAINER);
+ }
+ }
+
+ /**
+ * Compares its two arguments for order.
+ * <p/>
+ * Returns a negative integer, zero,
+ * or a positive integer as the first argument is less than, equal to,
+ * or greater than the second.
+ * <p/>
+ * @param container1 The first object to be compared.
+ * @param container2 The second object to be compared.
+ * @return A negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ */
+ @Override
+ public int compare(PayaraContainer container1,
+ PayaraContainer container2) {
+ return container1 != null && container2 != null
+ ? container1.ordinal() - container2.ordinal()
+ : container1 != null
+ ? container2.ordinal()
+ : container2 != null
+ ? -container1.ordinal()
+ : 0;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaEEConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaEEConfig.java
new file mode 100644
index 0000000..0a4a535
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaEEConfig.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.io.File;
+import java.util.Set;
+import org.netbeans.modules.payara.tooling.server.config.JavaEEProfile;
+import org.netbeans.modules.payara.tooling.server.config.JavaEESet;
+import org.netbeans.modules.payara.tooling.server.config.ModuleType;
+
+/**
+ * Payara JavaEE configuration entity.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraJavaEEConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Supported module types. */
+ private final Set<ModuleType> modules;
+
+ /** Supported JavaEE profiles. */
+ private final Set<JavaEEProfile> profiles;
+
+ /** Highest JavaEE specification version implemented. */
+ private final String version;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of avaEE configuration entity using JavaEE set
+ * for Payara features configuration as source of instance content.
+ * <p/>
+ * @param javaEEconfig Container of Payara JavaEE
+ * features configuration.
+ * @param classpathHome Classpath search prefix.
+ */
+ public PayaraJavaEEConfig(
+ final JavaEESet javaEEconfig, final File classpathHome) {
+ modules = javaEEconfig.moduleTypes(classpathHome);
+ profiles = javaEEconfig.profiles(classpathHome);
+ version = javaEEconfig.getVersion();
+ javaEEconfig.reset();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get highest JavaEE specification version implemented.
+ * <p/>
+ * @return Highest JavaEE specification version implemented.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Get supported JavaEE profiles.
+ * <p/>
+ * @return Supported JavaEE profiles.
+ */
+ public Set<JavaEEProfile> getProfiles() {
+ return profiles;
+ }
+
+ /**
+ * Get supported module types.
+ * <p/>
+ * @return Supported module types.
+ */
+ public Set<ModuleType> getModuleTypes() {
+ return modules;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaSEConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaSEConfig.java
new file mode 100644
index 0000000..508c58d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraJavaSEConfig.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.Set;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+
+/**
+ * Container of Payara JavaSE features configuration.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraJavaSEConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Platforms retrieved from XML elements. */
+ private final Set<JavaSEPlatform> platforms;
+
+ /** Highest JavaEE specification version implemented. */
+ private final String version;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of avaEE configuration entity using JavaEE set
+ * for Payara features configuration as source of instance content.
+ * <p/>
+ * @param javaSEconfig Container of Payara JavaEE features configuration.
+ */
+ public PayaraJavaSEConfig(final JavaSESet javaSEconfig) {
+ platforms = javaSEconfig.platforms();
+ version = javaSEconfig.getVersion();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get highest JavaSE specification version implemented.
+ * <p/>
+ * @return Highest JavaSE specification version implemented.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Get supported JavaSE platforms.
+ * <p/>
+ * @return Supported JavaSE platforms.
+ */
+ public Set<JavaSEPlatform> getPlatforms() {
+ return platforms;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraLibrary.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraLibrary.java
new file mode 100644
index 0000000..6548c0b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraLibrary.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.net.URL;
+import java.util.List;
+
+/**
+ * Payara library entity.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraLibrary {
+
+ /**
+ * Maven related information for JARs.
+ */
+ public static class Maven {
+
+ /** Maven Group ID. */
+ private final String groupId;
+
+ /** Maven Artifact ID. */
+ private final String artifactId;
+
+ /** Maven Version. */
+ private final String version;
+
+ /**
+ * Creates an instance of Maven related information.
+ * <p/>
+ * @param groupId Maven Group ID.
+ * @param artifactId Maven Artifact ID.
+ * @param version Maven Version.
+ */
+ public Maven(final String groupId,
+ final String artifactId, final String version) {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+ }
+
+ /** Library name (unique identifier). */
+ private final String libraryID;
+
+ /** Library class path containing all JARs to be addedx to project. */
+ private final List<URL> classpath;
+
+ /** Library java doc. */
+ private final List<URL> javadocs;
+
+ /** Library java doc. */
+ private final List<String> javadocLookups;
+
+ /** Library sources. */
+ private final List<URL> sources;
+
+ /** Maven artifact information. */
+ private final List<Maven> maven;
+
+ /**
+ * Creates an instance of Payara library entity.
+ * <p/>
+ * @param libraryID Library name (unique identifier).
+ * @param classpath Library class path.
+ * @param javadocs Library java doc.
+ * @param sources Library sources.
+ */
+ public PayaraLibrary(final String libraryID,
+ final List<URL> classpath, final List<URL> javadocs,
+ List<String> javadocLookups,
+ final List<URL> sources, final List<Maven> maven) {
+ this.libraryID = libraryID;
+ this.classpath = classpath;
+ this.javadocs = javadocs;
+ this.javadocLookups = javadocLookups;
+ this.sources = sources;
+ this.maven = maven;
+ }
+
+ /**
+ * Get library name (unique identifier).
+ * <p/>
+ * @return Library name (unique identifier).
+ */
+ public String getLibraryID() {
+ return libraryID;
+ }
+
+ /**
+ * Get library class path.
+ * <p/>
+ * @return Library class path.
+ */
+ public List<URL> getClasspath() {
+ return classpath;
+ }
+
+ /**
+ * Get library java doc.
+ * <p/>
+ * @return Library java doc.
+ */
+ public List<URL> getJavadocs() {
+ return javadocs;
+ }
+
+ /**
+ * Get library java doc lookups.
+ * <p/>
+ * @return Library java doc lookups.
+ */
+ public List<String> getJavadocLookups() {
+ return javadocLookups;
+ }
+
+ /**
+ * get library sources.
+ * <p/>
+ * @return Library sources.
+ */
+ public List<URL> getSources() {
+ return sources;
+ }
+
+ /**
+ * Get Maven dependencies as
+ * <code><groupId> ':' <artifactId> ':' <version> ':jar'
+ * { ' ' <groupId> ':' <artifactId> ':' <version> ':jar'
+ * }</ code> {@link String}.
+ * <p/>
+ * @return Maven dependencies <code>String</code>.
+ */
+ public String getMavenDeps() {
+ StringBuilder sb = new StringBuilder();
+ boolean first = true;
+ for (Maven mvn : maven) {
+ if (first) {
+ first = false;
+ } else {
+ sb.append(' ');
+ }
+ sb.append(mvn.groupId);
+ sb.append(':');
+ sb.append(mvn.artifactId);
+ sb.append(':');
+ sb.append(mvn.version);
+ sb.append(":jar");
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServer.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServer.java
new file mode 100644
index 0000000..f1e4ba1
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServer.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+/**
+ * Payara server entity interface.
+ * <p/>
+ * Payara Server entity interface allows to use foreign entity classes.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface PayaraServer {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Interface Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara server name.
+ * <p/>
+ * @return The name.
+ */
+ public String getName();
+
+ /**
+ * Get Payara server host.
+ * <p/>
+ * @return The host.
+ */
+ public String getHost();
+
+ /**
+ * Get Payara server port.
+ * <p/>
+ * @return The port.
+ */
+ public int getPort();
+
+ /**
+ * Get Payara server administration port.
+ * <p/>
+ * @return The administration port.
+ */
+ public int getAdminPort();
+
+ /**
+ * Get Payara server administration user name.
+ * <p/>
+ * @return The adminUser.
+ */
+ public String getAdminUser();
+
+ /**
+ * Get Payara server administration user password.
+ * <p/>
+ * @return The adminPassword.
+ */
+ public String getAdminPassword();
+
+ /**
+ * Get Payara server domains folder.
+ * <p/>
+ * @return Domains folder.
+ */
+ public String getDomainsFolder();
+
+ /**
+ * Get Payara server domain name.
+ * <p/>
+ * @return Server domain name.
+ */
+ public String getDomainName();
+
+ /**
+ * Get Payara server URL.
+ * <p/>
+ * @return Server URL.
+ */
+ public String getUrl();
+
+ /**
+ * Get Payara server home which is <code>payara</code> subdirectory
+ * under installation root.
+ * <p/>
+ * @return Server installation root.
+ */
+ public String getServerHome();
+
+ /**
+ * Get Payara server installation directory.
+ * <p/>
+ * @return Server server installation directory.
+ */
+ public String getServerRoot();
+
+ /** Get Payara server version.
+ * <p/>
+ * @return The version
+ */
+ public PayaraVersion getVersion();
+
+ /**
+ * Get Payara server administration interface type.
+ * <p/>
+ * @return Payara server administration interface type.
+ */
+ public PayaraAdminInterface getAdminInterface();
+
+ /**
+ * Get information if this Payara server instance is local or remote.
+ * <p/>
+ * Local Payara server instance has domains folder attribute set while
+ * remote does not.
+ * <p/>
+ * @return Value of <code>true</code> when this Payara server instance
+ * is remote or <code>false</code> otherwise.
+ */
+ public boolean isRemote();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerEntity.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerEntity.java
new file mode 100644
index 0000000..13b9443
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerEntity.java
@@ -0,0 +1,410 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.io.File;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+
+/**
+ * Payara server entity.
+ * <p/>
+ * Local Payara Server entity instance which is used when not defined in IDE.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class PayaraServerEntity implements PayaraServer {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server name in IDE. Used as key attribute. */
+ private String name;
+
+ /** Payara server URL.
+ * Used as key attribute. (PayaraModule.URL_ATTR) */
+ private String url;
+
+ /** Payara server host. (PayaraModule.HOSTNAME_ATTR) */
+ private String host;
+
+ /** Payara server port. (PayaraModule.HTTPPORT_ATTR) */
+ private int port;
+
+ /** Payara server administration port.
+ * (PayaraModule.ADMINPORT_ATTR) */
+ private int adminPort;
+
+ /** Payara server administration user name
+ * (PayaraModule.USERNAME_ATTR). */
+ private String adminUser;
+
+ /** Payara server administration user password
+ * (PayaraModule.PASSWORD_ATTR). */
+ private String adminPassword;
+
+ /** Payara server domains folder. (PayaraModule.DOMAINS_FOLDER_ATTR) */
+ private String domainsFolder;
+
+ /** Payara server domain name. (PayaraModule.DOMAIN_NAME_ATTR) */
+ private String domainName;
+
+ /** Payara server home (usually glassfish subdirectory under server root
+ * directory (PayaraModule.PAYARA_FOLDER_ATTR). */
+ private String serverHome;
+
+ /** Payara server installation root
+ * (PayaraModule.INSTALL_FOLDER_ATTR). */
+ private String serverRoot;
+
+ /** Payara server version. */
+ private PayaraVersion version;
+
+ /** Payara server administration interface type. */
+ private PayaraAdminInterface adminInterface;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs empty class instance. No default values are set.
+ */
+ public PayaraServerEntity() {
+ }
+
+ /**
+ * Constructs class instance using server location directory.
+ * <p/>
+ * @param serverRoot Server installation directory.
+ * @param serverHome Server home directory.
+ * @param serverUrl Server URL assigned by IDE.
+ * @throws DataException When server location does not contain Payara
+ * server.
+ */
+ public PayaraServerEntity(
+ final String serverName, final String serverRoot,
+ final String serverHome, final String serverUrl) {
+ if (serverRoot == null) {
+ throw new DataException(DataException.SERVER_ROOT_NULL);
+ }
+ if (serverHome == null) {
+ throw new DataException(DataException.SERVER_HOME_NULL);
+ }
+ if (serverUrl == null) {
+ throw new DataException(DataException.SERVER_URL_NULL);
+ }
+ File root = new File(serverHome);
+ if (!root.isDirectory()) {
+ throw new DataException(DataException.SERVER_ROOT_NONEXISTENT,
+ serverHome);
+ }
+ File home = new File(serverHome);
+ if (!home.isDirectory()) {
+ throw new DataException(DataException.SERVER_HOME_NONEXISTENT,
+ serverHome);
+ }
+ this.version = ServerUtils.getServerVersion(serverHome);
+ if (this.version == null) {
+ throw new DataException(DataException.SERVER_HOME_NO_VERSION,
+ serverHome);
+ }
+ this.name = serverName;
+ this.url = serverUrl;
+ this.serverRoot = serverRoot;
+ this.serverHome = serverHome;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara server name.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @return The name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set Payara server name.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @param name The name to set.
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get Payara server URL.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @return Server URL.
+ */
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * Set Payara server URL.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @param url Server URL to set.
+ */
+ public void setUrl(final String url) {
+ this.url = url;
+ }
+
+ /**
+ * Get Payara server host.
+ * <p/>
+ * @return The host.
+ */
+ @Override
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * Set Payara server host.
+ * <p/>
+ * @param host The host to set.
+ */
+ public void setHost(final String host) {
+ this.host = host;
+ }
+
+ /**
+ * Get Payara server port.
+ * <p/>
+ * @return The port.
+ */
+ @Override
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * Set Payara server port.
+ * <p/>
+ * @param port The port to set.
+ */
+ public void setPort(final int port) {
+ this.port = port;
+ }
+
+ /**
+ * Get Payara server administration port.
+ * <p/>
+ * @return The administration port.
+ */
+ @Override
+ public int getAdminPort() {
+ return adminPort;
+ }
+
+ /**
+ * Set Payara server administration port.
+ * <p/>
+ * @param adminPort The administration port to set.
+ */
+ public void setAdminPort(final int adminPort) {
+ this.adminPort = adminPort;
+ }
+
+ /**
+ * Get Payara server administration user name.
+ * <p/>
+ * @return The adminUser.
+ */
+ @Override
+ public String getAdminUser() {
+ return adminUser;
+ }
+
+ /**
+ * Set Payara server administration user name.
+ * <p/>
+ * @param adminUser The adminUser to set.
+ */
+ public void setAdminUser(final String adminUser) {
+ this.adminUser = adminUser;
+ }
+
+ /**
+ * Get Payara server administration user password.
+ * <p/>
+ * @return The adminPassword.
+ */
+ @Override
+ public String getAdminPassword() {
+ return adminPassword;
+ }
+
+ /**
+ * Set Payara server administration user password.
+ * <p/>
+ * @param adminPassword The adminPassword to set.
+ */
+ public void setAdminPassword(final String adminPassword) {
+ this.adminPassword = adminPassword;
+ }
+
+ /**
+ * Get Payara server domains folder.
+ * <p/>
+ * @return Domains folder.
+ */
+ @Override
+ public String getDomainsFolder() {
+ return domainsFolder;
+ }
+
+ /**
+ * Set Payara server domains folder.
+ * <p/>
+ * @param domainsFolder Domains folder to set.
+ */
+ public void setDomainsFolder(final String domainsFolder) {
+ this.domainsFolder = domainsFolder;
+ }
+
+ /**
+ * Get Payara server domain name.
+ * <p/>
+ * @return Server domain name.
+ */
+ @Override
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ * Set Payara server domain name.
+ * <p/>
+ * @param domainName Server domain name to set.
+ */
+ public void setDomainName(final String domainName) {
+ this.domainName = domainName;
+ }
+
+ /**
+ * Get Payara server home which is <code>glassfish</code> subdirectory
+ * under installation root.
+ * <p/>
+ * @return Server installation root.
+ */
+ @Override
+ public String getServerHome() {
+ return serverHome;
+ }
+
+ /**
+ * Set Payara server home which is <code>glassfish</code> subdirectory
+ * under installation root.
+ * <p/>
+ * @param serverHome Server server home directory to set.
+ */
+ public void setServerHome(final String serverHome) {
+ this.serverHome = serverHome;
+ }
+
+ /**
+ * Get Payara server installation directory.
+ * <p/>
+ * @return Server server installation directory.
+ */
+ @Override
+ public String getServerRoot() {
+ return serverRoot;
+ }
+
+ /**
+ * Set Payara server server installation directory.
+ * <p/>
+ * @param serverRoot Server server installation directory to set.
+ */
+ public void setServerRoot(final String serverRoot) {
+ this.serverRoot = serverRoot;
+ }
+
+ /**
+ * Get Payara server version.
+ * <p/>
+ * @return The version.
+ */
+ @Override
+ public PayaraVersion getVersion() {
+ return version;
+ }
+
+ /**
+ * Set Payara server version.
+ * <p/>
+ * @param version The version to set.
+ */
+ public void setVersion(final PayaraVersion version) {
+ this.version = version;
+ }
+
+ /**
+ * Get Payara server administration interface type.
+ * <p/>
+ * @return Payara server administration interface type.
+ */
+ @Override
+ public PayaraAdminInterface getAdminInterface() {
+ return adminInterface;
+ }
+
+ /**
+ * Set Payara server administration interface type.
+ * <p/>
+ * @param adminInterface Payara server administration interface type.
+ */
+ public void setAdminInterface(
+ final PayaraAdminInterface adminInterface) {
+ this.adminInterface = adminInterface;
+ }
+
+ /**
+ * Get information if this Payara server instance is local or remote.
+ * <p/>
+ * Local Payara server instance has domains folder attribute set while
+ * remote does not.
+ * <p/>
+ * @return Value of <code>true</code> when this Payara server instance
+ * is remote or <code>false</code> otherwise.
+ */
+ @Override
+ public boolean isRemote() {
+ return domainsFolder == null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerStatus.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerStatus.java
new file mode 100644
index 0000000..3a03bcf
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraServerStatus.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+
+/**
+ * Payara server status interface.
+ * <p/>
+ * Payara Server entity interface allows to use foreign entity classes.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface PayaraServerStatus {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Interface Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara server entity.
+ * <p/>
+ * @return Payara server entity.
+ */
+ public PayaraServer getServer();
+
+ /**
+ * Get current Payara server status.
+ * <p/>
+ * @return Current Payara server status.
+ */
+ public PayaraStatus getStatus();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheck.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheck.java
new file mode 100644
index 0000000..84146b2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheck.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Server status check type.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum PayaraStatusCheck {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Administration port check. */
+ PORT,
+
+ /** Version command check. */
+ VERSION,
+
+ /** Locations command check. */
+ LOCATIONS;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(PayaraStatusCheck.class);
+
+ /** Payara version enumeration length. */
+ public static final int length = PayaraStatusCheck.values().length;
+
+ /** A <code>String</code> representation of PORT value. */
+ private static final String PORT_STR = "PORT";
+
+ /** A <code>String</code> representation of VERSION value. */
+ private static final String VERSION_STR = "VERSION";
+
+ /** A <code>String</code> representation of LOCATIONS value. */
+ private static final String LOCATIONS_STR = "LOCATIONS";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final Map<String, PayaraStatusCheck> stringValuesMap
+ = new HashMap(values().length);
+ static {
+ for (PayaraStatusCheck state : PayaraStatusCheck.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>PayaraStatusCheck</code> with a value represented
+ * by the specified <code>String</code>.
+ * <p/>
+ * The <code>PayaraStatusCheck</code> returned represents existing value
+ * only if specified <code>String</code> matches any <code>String</code>
+ * returned by <code>toString</code> method. Otherwise <code>null</code>
+ * value is returned.
+ * <p>
+ * @param name Value containing <code>PayaraStatusCheck</code>
+ * <code>toString</code> representation.
+ * @return <code>PayaraStatusCheck</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static PayaraStatusCheck toValue(final String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraStatusCheck</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ final String METHOD = "toString";
+ switch (this) {
+ case PORT: return PORT_STR;
+ case VERSION: return VERSION_STR;
+ case LOCATIONS: return LOCATIONS_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new DataException(
+ LOGGER.excMsg(METHOD, "invalidStatusCheck"));
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheckResult.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheckResult.java
new file mode 100644
index 0000000..27f1825
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusCheckResult.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+/**
+ * Individual server check status returned.
+ * <p/>
+ * There is also minimal algebra defined to support <code>AND</code>
+ * and <code>OR</code>.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum PayaraStatusCheckResult {
+
+ /** Server status check passed. */
+ SUCCESS,
+
+ /** Server status check failed with <code>FAILED</code> result. */
+ FAILED;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Full <code>AND</code> operator state space. */
+ private static final PayaraStatusCheckResult[][] and = {
+ // SUCCESS FAILED
+ {SUCCESS, FAILED}, // SUCCESS
+ { FAILED, FAILED} // FAILED
+ };
+
+ /** Full <code>OR</code> operator state space. */
+ private static final PayaraStatusCheckResult[][] or = {
+ // SUCCESS FAILED
+ {SUCCESS, SUCCESS}, // SUCCESS
+ {SUCCESS, FAILED} // FAILED
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Compute logical <code>AND</code> of two status values.
+ * <p/>
+ * @param s1 First operand.
+ * @param s2 Second operand.
+ */
+ public static PayaraStatusCheckResult and(
+ final PayaraStatusCheckResult s1,
+ final PayaraStatusCheckResult s2) {
+ return and[s1.ordinal()][s2.ordinal()];
+ }
+
+ /**
+ * Compute logical <code>OR</code> of two status values.
+ * <p/>
+ * @param s1 First operand.
+ * @param s2 Second operand.
+ */
+ public static PayaraStatusCheckResult or(
+ final PayaraStatusCheckResult s1,
+ final PayaraStatusCheckResult s2) {
+ return or[s1.ordinal()][s2.ordinal()];
+ }
+
+ /**
+ * Compute logical <code>AND</code> of three status values.
+ * <p/>
+ * @param s1 First operand.
+ * @param s2 Second operand.
+ * @param s3 Third operand.
+ */
+ public static PayaraStatusCheckResult and(
+ final PayaraStatusCheckResult s1,
+ final PayaraStatusCheckResult s2,
+ final PayaraStatusCheckResult s3) {
+ return and[s1.ordinal()][and[s2.ordinal()][s3.ordinal()].ordinal()];
+ }
+
+ /**
+ * Compute logical <code>OR</code> of three status values.
+ * <p/>
+ * @param s1 First operand.
+ * @param s2 Second operand.
+ * @param s3 Third operand.
+ */
+ public static PayaraStatusCheckResult or(
+ final PayaraStatusCheckResult s1,
+ final PayaraStatusCheckResult s2,
+ final PayaraStatusCheckResult s3) {
+ return or[s1.ordinal()][or[s2.ordinal()][s3.ordinal()].ordinal()];
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>PayaraStatusCheckResult</code> value
+ * to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch(this) {
+ case SUCCESS: return "SUCCESS";
+ case FAILED: return "FAILED";
+ default:
+ throw new IllegalStateException("Unknown Status value");
+ }
+ }
+
+}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusTask.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusTask.java
new file mode 100644
index 0000000..ed7b1bb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraStatusTask.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import org.netbeans.modules.payara.tooling.TaskEvent;
+
+/**
+ * Payara server status check task details.
+ * <p/>
+ * Provides access to server status check task details in status listener
+ * callback methods.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public interface PayaraStatusTask {
+
+ /**
+ * Get server status check type.
+ * <p/>
+ * @return Server status check type.
+ */
+ public PayaraStatusCheck getType();
+
+ /**
+ * Get last command task execution status.
+ * <p/>
+ * @return Last command task execution status.
+ */
+ public PayaraStatusCheckResult getStatus();
+
+ /**
+ * Get last command task execution status.
+ * <p/>
+ * @return Last command task execution status.
+ */
+ public TaskEvent getEvent();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraVersion.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraVersion.java
new file mode 100644
index 0000000..d775dcc
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/PayaraVersion.java
@@ -0,0 +1,474 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.payara.tooling.utils.EnumUtils;
+import org.openide.util.Parameters;
+
+/**
+ * Payara server version.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ * @author Gaurav Gupta
+ */
+public enum PayaraVersion {
+
+ //add new version
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+ /** Payara 4.1.144 */
+ PF_4_1_144 ((short) 4, (short) 1, (short) 0, (short) 0, (short) 14, (short) 4, (short) 0, PayaraVersion.PF_4_1_144_STR),
+ /** Payara 4.1.151 */
+ PF_4_1_151 ((short) 4, (short) 1, (short) 0, (short) 0, (short) 15, (short) 1, (short) 0, PayaraVersion.PF_4_1_151_STR),
+ /** Payara 4.1.152 */
+ PF_4_1_152 ((short) 4, (short) 1, (short) 0, (short) 0, (short) 15, (short) 2, (short) 0, PayaraVersion.PF_4_1_152_STR),
+ /** Payara 4.1.153 */
+ PF_4_1_153 ((short) 4, (short) 1, (short) 0, (short) 0, (short) 15, (short) 3, (short) 0, PayaraVersion.PF_4_1_153_STR),
+ /** Payara 4.1.1.154 */
+ PF_4_1_1_154 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 15, (short) 4, (short) 0, PayaraVersion.PF_4_1_1_154_STR),
+ /** Payara 4.1.1.161 */
+ PF_4_1_1_161 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 16, (short) 1, (short) 0, PayaraVersion.PF_4_1_1_161_STR),
+ /** Payara 4.1.1.162 */
+ PF_4_1_1_162 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 16, (short) 2, (short) 0, PayaraVersion.PF_4_1_1_162_STR),
+ /** Payara 4.1.1.163 */
+ PF_4_1_1_163 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 16, (short) 3, (short) 0, PayaraVersion.PF_4_1_1_163_STR),
+ /** Payara 4.1.1.164 */
+ PF_4_1_1_164 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 16, (short) 4, (short) 0, PayaraVersion.PF_4_1_1_164_STR),
+ /** Payara 4.1.1.171 */
+ PF_4_1_1_171 ((short) 4, (short) 1, (short) 1, (short) 0, (short) 17, (short) 1, (short) 0, PayaraVersion.PF_4_1_1_171_STR),
+ /** Payara 4.1.2.172 */
+ PF_4_1_2_172 ((short) 4, (short) 1, (short) 2, (short) 0, (short) 17, (short) 2, (short) 0, PayaraVersion.PF_4_1_2_172_STR),
+ /** Payara 4.1.2.173 */
+ PF_4_1_2_173 ((short) 4, (short) 1, (short) 2, (short) 0, (short) 17, (short) 3, (short) 0, PayaraVersion.PF_4_1_2_173_STR),
+ /** Payara 4.1.2.174 */
+ PF_4_1_2_174 ((short) 4, (short) 1, (short) 2, (short) 0, (short) 17, (short) 4, (short) 0, PayaraVersion.PF_4_1_2_174_STR),
+ /** Payara 4.1.2.181 */
+ PF_4_1_2_181 ((short) 4, (short) 1, (short) 2, (short) 0, (short) 18, (short) 1, (short) 0, PayaraVersion.PF_4_1_2_181_STR),
+ /** Payara 5.181 */
+ PF_5_181 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 18, (short) 1, (short) 0, PayaraVersion.PF_5_181_STR),
+ /** Payara 5.182 */
+ PF_5_182 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 18, (short) 2, (short) 0, PayaraVersion.PF_5_182_STR),
+ /** Payara 5.183 */
+ PF_5_183 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 18, (short) 3, (short) 0, PayaraVersion.PF_5_183_STR),
+ /** Payara 5.184 */
+ PF_5_184 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 18, (short) 4, (short) 0, PayaraVersion.PF_5_184_STR),
+ /** Payara 5.191 */
+ PF_5_191 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 19, (short) 1, (short) 0, PayaraVersion.PF_5_191_STR),
+ /** Payara 5.192 */
+ PF_5_192 ((short) 5, (short) 0, (short) 0, (short) 0, (short) 19, (short) 2, (short) 0, PayaraVersion.PF_5_192_STR);
+
+ //add new version
+ /** A <code>String</code> representation of PF_4_1_144 value. */
+ static final String PF_4_1_144_STR = "4.1.144";
+ /** Additional <code>String</code> representations of 4.1.144 value. */
+ static final String PF_4_1_144_STR_NEXT[] = {"4.1.144.0"};
+ /** A <code>String</code> representation of PF_4_1_151 value. */
+ static final String PF_4_1_151_STR = "4.1.151";
+ /** Additional <code>String</code> representations of 4.1.151 value. */
+ static final String PF_4_1_151_STR_NEXT[] = {"4.1.151.0"};
+ /** A <code>String</code> representation of PF_4_1_152 value. */
+ static final String PF_4_1_152_STR = "4.1.152";
+ /** Additional <code>String</code> representations of 4.1.152 value. */
+ static final String PF_4_1_152_STR_NEXT[] = {"4.1.152.0"};
+ /** A <code>String</code> representation of PF_4_1_153 value. */
+ static final String PF_4_1_153_STR = "4.1.153";
+ /** Additional <code>String</code> representations of 4.1.153 value. */
+ static final String PF_4_1_153_STR_NEXT[] = {"4.1.153.0"};
+ /** A <code>String</code> representation of PF_4_1_1_154 value. */
+ static final String PF_4_1_1_154_STR = "4.1.1.154";
+ /** Additional <code>String</code> representations of 4.1.1.154 value. */
+ static final String PF_4_1_1_154_STR_NEXT[] = {"4.1.1.154.0"};
+ /** A <code>String</code> representation of PF_4_1_1_161 value. */
+ static final String PF_4_1_1_161_STR = "4.1.1.161";
+ /** Additional <code>String</code> representations of 4.1.1.161 value. */
+ static final String PF_4_1_1_161_STR_NEXT[] = {"4.1.1.161.0"};
+ /** A <code>String</code> representation of PF_4_1_1_162 value. */
+ static final String PF_4_1_1_162_STR = "4.1.1.162";
+ /** Additional <code>String</code> representations of 4.1.1.162 value. */
+ static final String PF_4_1_1_162_STR_NEXT[] = {"4.1.1.162.0"};
+ /** A <code>String</code> representation of PF_4_1_1_163 value. */
+ static final String PF_4_1_1_163_STR = "4.1.1.163";
+ /** Additional <code>String</code> representations of 4.1.1.163 value. */
+ static final String PF_4_1_1_163_STR_NEXT[] = {"4.1.1.163.0"};
+ /** A <code>String</code> representation of PF_4_1_1_164 value. */
+ static final String PF_4_1_1_164_STR = "4.1.1.164";
+ /** Additional <code>String</code> representations of 4.1.1.164 value. */
+ static final String PF_4_1_1_164_STR_NEXT[] = {"4.1.1.164.0"};
+ /** A <code>String</code> representation of PF_4_1_1_171 value. */
+ static final String PF_4_1_1_171_STR = "4.1.1.171";
+ /** Additional <code>String</code> representations of 4.1.1.171 value. */
+ static final String PF_4_1_1_171_STR_NEXT[] = {"4.1.1.171.0"};
+ /** A <code>String</code> representation of PF_4_1_2_172 value. */
+ static final String PF_4_1_2_172_STR = "4.1.2.172";
+ /** Additional <code>String</code> representations of 4.1.2.172 value. */
+ static final String PF_4_1_2_172_STR_NEXT[] = {"4.1.2.172.0"};
+ /** A <code>String</code> representation of PF_4_1_2_173 value. */
+ static final String PF_4_1_2_173_STR = "4.1.2.173";
+ /** Additional <code>String</code> representations of 4.1.2.173 value. */
+ static final String PF_4_1_2_173_STR_NEXT[] = {"4.1.2.173.0"};
+ /** A <code>String</code> representation of PF_4_1_2_174 value. */
+ static final String PF_4_1_2_174_STR = "4.1.2.174";
+ /** Additional <code>String</code> representations of 4.1.2.174 value. */
+ static final String PF_4_1_2_174_STR_NEXT[] = {"4.1.2.174.0"};
+ /** A <code>String</code> representation of PF_4_1_2_181 value. */
+ static final String PF_4_1_2_181_STR = "4.1.2.181";
+ /** Additional <code>String</code> representations of 4.1.2.181 value. */
+ static final String PF_4_1_2_181_STR_NEXT[] = {"4.1.2.181.0"};
+ /** A <code>String</code> representation of PF_5_181 value. */
+ static final String PF_5_181_STR = "5.181";
+ /** Additional <code>String</code> representations of 5.181 value. */
+ static final String PF_5_181_STR_NEXT[] = {"5.181.0"};
+ /** A <code>String</code> representation of PF_5_182 value. */
+ static final String PF_5_182_STR = "5.182";
+ /** Additional <code>String</code> representations of 5.182 value. */
+ static final String PF_5_182_STR_NEXT[] = {"5.182.0"};
+ /** A <code>String</code> representation of PF_5_183 value. */
+ static final String PF_5_183_STR = "5.183";
+ /** Additional <code>String</code> representations of 5.183 value. */
+ static final String PF_5_183_STR_NEXT[] = {"5.183.0"};
+ /** A <code>String</code> representation of PF_5_184 value. */
+ static final String PF_5_184_STR = "5.184";
+ /** Additional <code>String</code> representations of 5.184 value. */
+ static final String PF_5_184_STR_NEXT[] = {"5.184.0"};
+ /** A <code>String</code> representation of PF_5_191 value. */
+ static final String PF_5_191_STR = "5.191";
+ /** Additional <code>String</code> representations of 5.191 value. */
+ static final String PF_5_191_STR_NEXT[] = {"5.191.0"};
+ /** A <code>String</code> representation of PF_5_192 value. */
+ static final String PF_5_192_STR = "5.192";
+ /** Additional <code>String</code> representations of 5.192 value. */
+ static final String PF_5_192_STR_NEXT[] = {"5.192.0"};
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara version enumeration length. */
+ public static final int length = PayaraVersion.values().length;
+
+ /** Version elements separator character. */
+ public static final char SEPARATOR = '.';
+
+ /** Version elements separator REGEX pattern. */
+ public static final String SEPARATOR_PATTERN = "\\.";
+
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, PayaraVersion> stringValuesMap
+ = new HashMap(2 * values().length);
+
+ // Initialize backward String conversion Map.
+ static {
+ for (PayaraVersion state : PayaraVersion.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ //add new version
+ initStringValuesMapFromArray(PF_4_1_144, PF_4_1_144_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_151, PF_4_1_151_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_152, PF_4_1_152_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_153, PF_4_1_153_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_154, PF_4_1_1_154_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_161, PF_4_1_1_161_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_162, PF_4_1_1_162_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_163, PF_4_1_1_163_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_164, PF_4_1_1_164_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_1_171, PF_4_1_1_171_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_2_172, PF_4_1_2_172_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_2_173, PF_4_1_2_173_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_2_174, PF_4_1_2_174_STR_NEXT);
+ initStringValuesMapFromArray(PF_4_1_2_181, PF_4_1_2_181_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_181, PF_5_181_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_182, PF_5_182_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_183, PF_5_183_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_184, PF_5_184_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_191, PF_5_191_STR_NEXT);
+ initStringValuesMapFromArray(PF_5_192, PF_5_192_STR_NEXT);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Helper method to initialize backward String conversion <code>Map</code> with
+ * additional values using additional string values arrays.
+ * <p/>
+ * @param version Target version for additional values.
+ * @param values Array containing source <code>String</code> values.
+ */
+ private static void initStringValuesMapFromArray(
+ final PayaraVersion version, final String[] values) {
+ for (String value : values) {
+ stringValuesMap.put(value, version);
+ }
+ }
+
+ /**
+ * Returns a <code>PayaraVersion</code> with a value represented by the
+ * specified <code>String</code>. The <code>PayaraVersion</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p/>
+ * @param versionStr Value containing version <code>String</code>
+ * representation.
+ * @return <code>PayaraVersion</code> value represented by
+ * <code>String</code> or <code>null</code> if value was
+ * not recognized.
+ */
+ @CheckForNull
+ public static PayaraVersion toValue(@NonNull final String versionStr) {
+ Parameters.notNull("versionStr", versionStr);
+
+ PayaraVersion version
+ = stringValuesMap.get(versionStr.toUpperCase(Locale.ENGLISH));
+ if (version == null) {
+ String[] versionNumbers = versionStr.split("\\"+SEPARATOR);
+ for (int i = versionNumbers.length - 1;
+ version == null && i > 0; i--) {
+ int versionStrLen = i - 1;
+ for (int j = 0; j < i; j++) {
+ versionStrLen += versionNumbers[j].length();
+ }
+ StringBuilder sb = new StringBuilder(versionStrLen);
+ for (int j = 0; j < i; j++) {
+ if (j > 0) {
+ sb.append(SEPARATOR);
+ }
+ try {
+ Integer.parseInt(versionNumbers[j]);
+ sb.append(versionNumbers[j]);
+ } catch (NumberFormatException ex) {
+ break;
+ }
+ }
+ version = stringValuesMap.get(sb.toString().toUpperCase(Locale.ENGLISH));
+ }
+ if (version == null) {
+ // fallback attempt
+ int dot = versionStr.indexOf('.');
+ if (dot > 0) {
+ try {
+ int major = Integer.parseInt(versionStr.substring(0, dot));
+ // this needs enum to be properly ordered latest versions last
+ for (PayaraVersion v : values()) {
+ if (v.major <= major) {
+ version = v;
+ } else if (v.major > major) {
+ break;
+ }
+ }
+ } catch (NumberFormatException ex) {
+ // noop
+ }
+ }
+ }
+ }
+ return version;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Major version number. */
+ private final short major;
+
+ /** Minor version number. */
+ private final short minor;
+
+ /** Update version number. */
+ private final short update;
+
+ /** Build version number. */
+ private final short build;
+
+ private final String value;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server version.
+ * <p/>
+ * @param major Major version number.
+ * @param minor Minor version number.
+ * @param update Update version number.
+ * @param build Build version number.
+ */
+ private PayaraVersion(final short major, final short minor,
+ final short update, final short build,
+ final short year, final short quarter,
+ final short month, final String value) {
+ this.major = major;
+ this.minor = minor;
+ this.update = update;
+ this.build = build;
+ this.value = value;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get major version number.
+ *
+ * @return Major version number.
+ */
+ public short getMajor() {
+ return major;
+ }
+
+ /**
+ * Get minor version number.
+ * <p/>
+ * @return Minor version number.
+ */
+ public short getMinor() {
+ return minor;
+ }
+
+ /**
+ * Get update version number.
+ * <p/>
+ * @return Update version number.
+ */
+ public short getUpdate() {
+ return update;
+ }
+
+ /**
+ * Get build version number.
+ * <p/>
+ * @return Build version number.
+ */
+ public short getBuild() {
+ return build;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Compare major and minor parts of version number <code>String</code>s.
+ * <p/>
+ * @param version Payara server version to compare with this object.
+ * @return Value of <code>true</code> when major and minor parts
+ * of version numbers are the same or <code>false</code> otherwise.
+ */
+ public boolean equalsMajorMinor(final PayaraVersion version) {
+ if (version == null) {
+ return false;
+ } else {
+ return this.major == version.major && this.minor == version.minor;
+ }
+ }
+
+ /**
+ * Compare all parts of version number <code>String</code>s.
+ * <p/>
+ * @param version Payara server version to compare with this object.
+ * @return Value of <code>true</code> when all parts of version numbers are
+ * the same or <code>false</code> otherwise.
+ */
+ @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject")
+ public boolean equals(final PayaraVersion version) {
+ if (version == null) {
+ return false;
+ } else {
+ return this.major == version.major
+ && this.minor == version.minor
+ && this.update == version.update
+ && this.build == version.build;
+ }
+ }
+
+ /** {@inheritDoc} */
+ public static boolean eq(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.eq(v1, v2);
+ }
+
+ /** {@inheritDoc} */
+ public static boolean ne(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.ne(v1, v2);
+ }
+
+ /** {@inheritDoc} */
+ public static boolean lt(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.lt(v1, v2);
+ }
+
+ /** {@inheritDoc} */
+ public static boolean le(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.le(v1, v2);
+ }
+
+ /** {@inheritDoc} */
+ public static boolean gt(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.gt(v1, v2);
+ }
+
+ /** {@inheritDoc} */
+ public static boolean ge(Enum<PayaraVersion> v1, Enum<PayaraVersion> v2) {
+ return EnumUtils.ge(v1, v2);
+ }
+
+ /**
+ * Convert <code>PayaraVersion</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ return value;
+ }
+
+ /**
+ * Convert <code>PayaraVersion</code> value to <code>String</code>
+ * containing all version numbers.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object
+ * containing all version numbers.
+ */
+ public String toFullString() {
+ StringBuilder sb = new StringBuilder(8);
+ sb.append(Integer.toString(major));
+ sb.append(SEPARATOR);
+ sb.append(Integer.toString(minor));
+ sb.append(SEPARATOR);
+ sb.append(Integer.toString(update));
+ sb.append(SEPARATOR);
+ sb.append(Integer.toString(build));
+ return sb.toString();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgs.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgs.java
new file mode 100644
index 0000000..8620b66
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgs.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.util.List;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.data.JDKVersion;
+
+/**
+ * This interface provides IDE and user specific arguments for starting the server.
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface StartupArgs {
+
+ public List<String> getPayaraArgs();
+
+ public List<String> getJavaArgs();
+
+ public Map<String, String> getEnvironmentVars();
+
+ public String getJavaHome();
+
+ public JDKVersion getJavaVersion();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java
new file mode 100644
index 0000000..45b9b30
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.data.JDKVersion;
+import org.openide.util.Exceptions;
+
+/**
+ * Payara Server Entity.
+ * <p/>
+ * Local Payara Server entity instance which is used when not defined in IDE.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class StartupArgsEntity implements StartupArgs {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Command line arguments passed to bootstrap jar. */
+ private List<String>payaraArgs;
+
+ /** Command line arguments passed to JVM. */
+ private List<String> javaArgs;
+
+ /** Environment variables set before JVM execution. */
+ private Map<String, String> environmentVars;
+
+ /** Installation home of Java SDK used to run Payara. */
+ private String javaHome;
+
+ /** Version of Java SDK used to run Payara. */
+ private JDKVersion javaVersion;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs empty class instance. No default values are set.
+ */
+ public StartupArgsEntity() {
+ }
+
+ /**
+ * Constructs class instance with all values supplied.
+ * <p/>
+ * @param payaraArgs Command line arguments passed to bootstrap jar.
+ * @param javaArgs Command line arguments passed to JVM.
+ * @param environmentVars Environment variables set before JVM execution.
+ * @param javaHome Installation home of Java SDK used to
+ * run Payara.
+ */
+ public StartupArgsEntity(List<String>payaraArgs, List<String> javaArgs,
+ Map<String, String> environmentVars, String javaHome) {
+ this.payaraArgs = payaraArgs;
+ this.javaArgs = javaArgs;
+ this.environmentVars = environmentVars;
+ this.javaHome = javaHome;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get command line arguments passed to bootstrap jar.
+ * <p/>
+ * @return Command line arguments passed to bootstrap jar.
+ */
+ @Override
+ public List<String> getPayaraArgs() {
+ return payaraArgs;
+ }
+
+ /**
+ * Set command line arguments passed to bootstrap jar.
+ * <p/>
+ * @param payaraArgs Command line arguments passed to bootstrap jar.
+ */
+ public void setPayaraArgs(List<String> payaraArgs) {
+ this.payaraArgs = payaraArgs;
+ }
+
+ /**
+ * Get command line arguments passed to JVM.
+ * <p/>
+ * @return Command line arguments passed to JVM.
+ */
+ @Override
+ public List<String> getJavaArgs() {
+ return javaArgs;
+ }
+
+ /**
+ * Set command line arguments passed to JVM.
+ * <p/>
+ * @param javaArgs Command line arguments passed to JVM.
+ */
+ public void getJavaArgs(List<String> javaArgs) {
+ this.javaArgs = javaArgs;
+ }
+
+ /**
+ * Get environment variables set before JVM execution.
+ * <p/>
+ * @return Environment variables set before JVM execution.
+ */
+ @Override
+ public Map<String, String> getEnvironmentVars() {
+ return environmentVars;
+ }
+
+ /**
+ * Set environment variables set before JVM execution.
+ * <p/>
+ * @param environmentVars Environment variables set before JVM execution.
+ */
+ public void setEnvironmentVars(Map<String, String> environmentVars) {
+ this.environmentVars = environmentVars;
+ }
+
+ /**
+ * Get installation home of Java SDK used to run Payara.
+ * <p/>
+ * @return Installation home of Java SDK used to run Payara.
+ */
+ @Override
+ public String getJavaHome() {
+ return javaHome;
+ }
+
+ /**
+ * Set installation home of Java SDK used to run Payara.
+ * <p/>
+ * @param javaHome Installation home of Java SDK used to run Payara.
+ */
+ public void getJavaHome(String javaHome) {
+ this.javaHome = javaHome;
+ }
+
+ /**
+ * Get version of Java SDK used to run Payara.
+ * <p/>
+ * @return version of Java SDK used to run Payara.
+ */
+ @Override
+ public JDKVersion getJavaVersion() {
+ if(javaVersion == null && javaHome != null) {
+ try (BufferedReader bufferedReader
+ = new BufferedReader(new FileReader(new File(javaHome, "release")));) {
+ String line;
+ while ((line = bufferedReader.readLine()) != null) {
+ if (line.startsWith("JAVA_VERSION")) {
+ javaVersion = JDKVersion.toValue(line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\"")));
+ break;
+ }
+ }
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ return javaVersion;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolConfig.java
new file mode 100644
index 0000000..7870898
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolConfig.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+/**
+ * Payara tool.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public interface ToolConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get tool JAR path (relative under Payara home).
+ * <p/>
+ * @return ToolConfig JAR path (relative under Payara home)
+ */
+ public String getJar();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolsConfig.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolsConfig.java
new file mode 100644
index 0000000..dc65e15
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/ToolsConfig.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+/**
+ * Payara tools.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public interface ToolsConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get asadmin tool.
+ * <p/>
+ * @return Asadmin tool.
+ */
+ public ToolConfig getAsadmin();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccount.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccount.java
new file mode 100644
index 0000000..c543f55
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccount.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data.cloud;
+
+/**
+ * Payara Cloud User Account Entity.
+ * <p/>
+ * Payara Cloud User Account entity interface allows to use foreign
+ * entity classes.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface PayaraAccount {
+
+ /**
+ * Get Payara cloud user account name.
+ * <p/>
+ * This is display name given to the cluster.
+ * <p/>
+ * @return Payara cluster name.
+ */
+ public String getName();
+
+ /**
+ * Get Payara cloud account name.
+ * <p/>
+ * @return Payara cloud account name.
+ */
+ public String getAcount();
+
+ /**
+ * Get Payara cloud user name under account.
+ * <p/>
+ * @return Payara cloud user name under account.
+ */
+ public String getUserName();
+
+ /**
+ * Get Payara cloud URL.
+ * <p/>
+ * @return Cloud URL.
+ */
+ public String getUrl();
+
+ /**
+ * Get Payara cloud user password under account.
+ * <p/>
+ * @return Payara cloud user password under account.
+ */
+ public String getUserPassword();
+
+ /**
+ * Get Payara cloud entity reference.
+ * <p/>
+ * @return Payara cloud entity reference.
+ */
+ public PayaraCloud getCloudEntity();
+
+ }
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccountEntity.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccountEntity.java
new file mode 100644
index 0000000..8ad7d4f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraAccountEntity.java
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data.cloud;
+
+/**
+ * Payara Cloud User Account Entity Interface.
+ * <p/>
+ * Payara Cloud User Account entity instance which is used when not defined
+ * externally in IDE.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class PayaraAccountEntity implements PayaraAccount {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara cloud user account name (display name in IDE).
+ * Used as key attribute. */
+ protected String name;
+
+ /** Payara cloud server URL. Used as key attribute. */
+ private String url;
+
+ /** Payara cloud account name. */
+ protected String account;
+
+ /** Payara cloud account user name. */
+ protected String userName;
+
+ /** Payara cloud account user password. */
+ protected String userPassword;
+
+ /** Payara cloud entity reference. */
+ protected PayaraCloud cloudEntity;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs empty class instance. No default values are set.
+ */
+ public PayaraAccountEntity() {
+ }
+
+ /**
+ * Constructs class instance with ALL values set.
+ * <p/>
+ * @param name Payara cloud account name to set.
+ * @param url Payara cloud server URL.
+ * @param account Payara cloud host to set.
+ * @param userName Payara cloud account user name to set.
+ * @param userPassword Payara cloud account user password to set.
+ * @param cloudEntity Payara cloud entity reference to set.
+ */
+ public PayaraAccountEntity(String name, String account, String userName,
+ String userPassword, String url, PayaraCloud cloudEntity) {
+ this.name = name;
+ this.url = url;
+ this.account = account;
+ this.userName = userName;
+ this.userPassword = userPassword;
+ this.cloudEntity = cloudEntity;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara cloud user account display name.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * This is display name given to the cloud user account.
+ * <p/>
+ * @return Payara cloud user account display name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set Payara cloud user account display name.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * This is display name given to the cloud user account.
+ * <p/>
+ * @param name Payara cloud user account display name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get Payara cloud URL.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @return Cloud URL.
+ */
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * Set Payara cloud URL.
+ * <p/>
+ * Key attribute.
+ * <p/>
+ * @param url Cloud URL to set.
+ */
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ /**
+ * Get Payara cloud account name.
+ * <p/>
+ * @return Payara cloud account name.
+ */
+ @Override
+ public String getAcount() {
+ return account;
+ }
+
+ /**
+ * Set Payara cloud account name.
+ * <p/>
+ * @param account Payara cloud account name to set.
+ */
+ public void setAcount(String account) {
+ this.account = account;
+ }
+
+ /**
+ * Get Payara cloud user name under account.
+ * <p/>
+ * @return Payara cloud user name under account.
+ */
+ @Override
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * Set Payara cloud user name under account.
+ * <p/>
+ * @param userName Payara cloud user name under account to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * Get Payara cloud user password under account.
+ * <p/>
+ * @return Payara cloud user password under account.
+ */
+ @Override
+ public String getUserPassword() {
+ return userPassword;
+ }
+
+
+ /**
+ * Set Payara cloud user password under account.
+ * <p/>
+ * @param userPassword Payara cloud user password under account to set.
+ */
+ public void setUserPassword(String userPassword) {
+ this.userPassword = userPassword;
+ }
+
+ /**
+ * Get Payara cloud entity reference.
+ * <p/>
+ * @return Payara cloud entity reference.
+ */
+ @Override
+ public PayaraCloud getCloudEntity() {
+ return cloudEntity;
+ }
+
+ /**
+ * Set Payara cloud entity reference.
+ * <p/>
+ * @param cloudEntity Payara cloud entity reference to set.
+ */
+ public void setCloudEntity(PayaraCloud cloudEntity) {
+ this.cloudEntity = cloudEntity;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * String representation of this Payara cloud entity.
+ * <p/>
+ * @return String representation of this Payara cloud entity.
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloud.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloud.java
new file mode 100644
index 0000000..e8db19f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloud.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data.cloud;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Cloud Entity Interface.
+ * <p/>
+ * Payara Cloud entity interface allows to use foreign entity classes.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public interface PayaraCloud {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Interface Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara cloud name.
+ * <p/>
+ * This is display name given to the cloud.
+ * <p/>
+ * @return Payara cloud name.
+ */
+ public String getName();
+
+ /**
+ * Get Payara cloud (CPAS) host.
+ * <p/>
+ * @return Payara cloud (CPAS) host.
+ */
+ public String getHost();
+
+ /**
+ * Get Payara cloud port.
+ * <p/>
+ * @return Payara cloud port.
+ */
+ public int getPort();
+
+ /**
+ * Get Payara cloud local server.
+ * <p/>
+ * @return Payara cloud local server.
+ */
+ public PayaraServer getLocalServer();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloudEntity.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloudEntity.java
new file mode 100644
index 0000000..7855b47
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/cloud/PayaraCloudEntity.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data.cloud;
+
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Payara Cloud Entity.
+ * <p/>
+ * Payara cloud entity instance which is used when not defined externally
+ * in IDE.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class PayaraCloudEntity implements PayaraCloud {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara cloud name (display name in IDE). */
+ protected String name;
+
+ /** Payara cloud host. */
+ protected String host;
+
+ /** Payara cloud port. */
+ protected int port;
+
+ /** Payara cloud local server. */
+ protected PayaraServer localServer;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs empty class instance. No default values are set.
+ */
+ public PayaraCloudEntity() {
+ }
+
+ /**
+ * Constructs class instance with ALL values set.
+ * <p/>
+ * @param name Payara cloud name to set.
+ * @param host Payara cloud host to set.
+ * @param port Payara server port to set.
+ * @param localServer Payara cloud local server to set.
+ */
+ public PayaraCloudEntity(String name, String host, int port,
+ PayaraServer localServer) {
+ this.name = name;
+ this.host = host;
+ this.port = port;
+ this.localServer = localServer;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara cloud name (display name in IDE).
+ * <p/>
+ * @return Payara cloud name (display name in IDE).
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set Payara cloud name (display name in IDE).
+ * <p/>
+ * @param name Payara cloud name to set (display name in IDE).
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get Payara cloud host.
+ * <p/>
+ * @return Payara cloud host.
+ */
+ @Override
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * Set Payara cloud host.
+ * <p/>
+ * @param host Payara cloud host to set.
+ */
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ /**
+ * Get Payara server port.
+ * <p/>
+ * @return Payara server port.
+ */
+ @Override
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * Set Payara server port.
+ * <p/>
+ * @param port Payara server port to set.
+ */
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ /**
+ * Get Payara cloud local server.
+ * <p/>
+ * @return Payara cloud local server.
+ */
+ @Override
+ public PayaraServer getLocalServer() {
+ return localServer;
+ }
+
+ /**
+ * Set Payara cloud local server.
+ * <p/>
+ * @param localServer Payara cloud local server to set.
+ */
+ public void setLocalServer(PayaraServer localServer) {
+ this.localServer = localServer;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * String representation of this Payara cloud entity.
+ * <p/>
+ * @return String representation of this Payara cloud entity.
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/logging/Logger.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/logging/Logger.java
new file mode 100644
index 0000000..7c75f25
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/logging/Logger.java
@@ -0,0 +1,420 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.logging;
+
+import java.io.IOException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+
+/**
+ * Payara IDE SDK Logger.
+ * <p>
+ * Facade to access IDE Logger methods.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class Logger {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara IDE SDK logger name. Deprecated. */
+ private static final String LOGGER_NAME = "org.netbeans.modules.payara.tooling";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Find or create a logger for Payara IDE SDK. If a logger has
+ * already been created with the given name it is returned. Otherwise
+ * a new logger is created.
+ * <p>
+ * If a new logger is created its log level will be configured
+ * based on the LogManager configuration and it will configured
+ * to also send logging output to its parent's Handlers. It will
+ * be registered in the LogManager global name space.
+ * <p>
+ * @return Payara IDE SDK Logger
+ * @deprecated Instantiate Logger class!
+ */
+ public static java.util.logging.Logger getLogger() {
+ return java.util.logging.Logger.getLogger(LOGGER_NAME);
+ }
+
+ /**
+ * Check if a message of the given level would actually be logged
+ * by this logger. This check is based on the Loggers effective level,
+ * which may be inherited from its parent.
+ *<p>
+ * @param level A message logging level.
+ * @return <code>true</code> if the given message level is currently being
+ * logged or <code>false</code> otherwise.
+ * @deprecated Instantiate Logger class!
+ */
+ public static boolean loggable(Level level) {
+ return getLogger().isLoggable(level);
+ }
+
+ /**
+ * Log a message, with associated <code>Throwable</code> information.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then the given arguments are stored in a LogRecord
+ * which is forwarded to all registered output handlers.
+ * <p>
+ * Note that the thrown argument is stored in the LogRecord thrown
+ * property, rather than the LogRecord parameters property. Thus is it
+ * processed specially by output Formatters and is not treated
+ * as a formatting parameter to the LogRecord message property.
+ * <p>
+ * @param level One of the message level identifiers, e.g., SEVERE.
+ * @param msg The string message (or a key in the message catalog).
+ * @param thrown <code>Throwable</code> associated with log message.
+ * @deprecated Instantiate Logger class!
+ */
+ public static void log(Level level, String msg, Throwable thrown) {
+ getLogger().log(level, msg, thrown);
+ }
+
+ /**
+ * Log a message, with one object parameter.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then a corresponding LogRecord is created and forwarded
+ * to all the registered output Handler objects.
+ * <p>
+ * @param level One of the message level identifiers, e.g. SEVERE.
+ * @param msg The string message (or a key in the message catalog).
+ * @param param Parameter to the message.
+ * @deprecated Instantiate Logger class!
+ */
+ public static void log(Level level, String msg, Object param) {
+ getLogger().log(level, msg, param);
+ }
+
+ /**
+ * Log a message, with an array of object arguments.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then a corresponding LogRecord is created and forwarded
+ * to all the registered output Handler objects.
+ * <p>
+ * @param level One of the message level identifiers, e.g. SEVERE.
+ * @param msg The string message (or a key in the message catalog).
+ * @param params Array of parameters to the message.
+ * @deprecated Instantiate Logger class!
+ */
+ public static void log(Level level, String msg, Object params[]) {
+ getLogger().log(level, msg, params);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Properties file containing log messages. */
+ static final String MESSAGES_FILE = "LogMessages";
+
+ /** Properties file containing exception messages. */
+ static final String EXCEPTIONS_FILE = "ExceptionMessages";
+
+ /** Properties file suffix. */
+ static final String PROPERTIES_FILE_SUFFIX = ".properties";
+
+ /** Message key elements separator. */
+ private static final char KEY_SEPARATOR = '.';
+
+ /** Log messages cache for individual packages. */
+ private static final Map<Package, Properties> logProps = new HashMap<>();
+
+ /** Exception messages cache for individual packages. */
+ private static final Map<Package, Properties> excProps = new HashMap<>();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build properties file name with suffix.
+ * <p/>
+ * @param file Messages catalog file name.
+ * @param locales Add locale suffix when <code>true</code> or do not add it
+ * when <code>false</code>.
+ * @return Messages catalog file name with properties file suffix.
+ */
+ private static String buildPropertiesFileName(final String file,
+ final boolean locales) {
+ StringBuilder sb = new StringBuilder(
+ file.length() + PROPERTIES_FILE_SUFFIX.length());
+ sb.append(file);
+ sb.append(PROPERTIES_FILE_SUFFIX);
+ return sb.toString();
+ }
+
+ /**
+ * Return message from package properties catalog map with given key.
+ * <p/>
+ * Properties catalog for package of provided class will be loaded from
+ * provided file when missing.
+ * <p/>
+ * @param file Messages catalog file name.
+ * @param propsMap Package to properties catalog mapping.
+ * @param c Class to determine properties file package.
+ * @param key Exception message properties key.
+ * @return Message from package properties catalog map with given key.
+ */
+ private static String message(final String file,
+ final Map<Package, Properties> propsMap, final Class c,
+ final String key) {
+ Package pkg = c.getPackage();
+ Properties props;
+ synchronized(propsMap) {
+ props = propsMap.get(pkg);
+ if (props == null) {
+ props = new Properties();
+ URL url = JavaUtils.getPropertiesURL(
+ c, buildPropertiesFileName(file, false));
+ if (url != null) {
+ try {
+ url.openStream();
+ props.load(url.openStream());
+ // Initialize properties as empty and send log message
+ // on IOException
+ } catch (IOException ioe) {
+ props = new Properties();
+// Logger.log(Level.INFO, "Error reading {0} from {1}",
+// new String[] {file, pkg.getName()});
+ }
+ }
+ propsMap.put(pkg, props);
+ }
+ }
+ String property = props.getProperty(key);
+ return property != null ? property : key;
+ }
+
+ /**
+ * Return message from log messages properties file with given key.
+ * <p/>
+ * @param c Class to determine properties file package.
+ * @param key Exception message properties key.
+ * @return Message from log messages properties file with given key.
+ */
+ public static String logMsg(Class c, String key) {
+ return message(MESSAGES_FILE, logProps, c, key);
+ }
+
+ /**
+ * Return message from exception messages properties file with given key.
+ * <p/>
+ * @param c Class to determine properties file package.
+ * @param key Exception message properties key.
+ * @return Message from exception messages properties file with given key.
+ */
+ public static String excMsg(Class c, String key) {
+ return message(EXCEPTIONS_FILE, excProps, c, key);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger name (derived from full class name including package). */
+ private final String name;
+
+ /** Logger package (derived from class package). */
+ private final Class cl;
+
+ /** {@link java.util.logging.Logger} instance. */
+ private final java.util.logging.Logger logger;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of library internal logger.
+ * <p/>
+ * @param c Class where logger instance was created.
+ */
+ public Logger(final Class c) {
+ name = c.getName();
+ cl = c;
+ logger = java.util.logging.Logger.getLogger(name);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Builds message key as
+ * <code><class_name>.<method_name>.<key></code>.
+ * <p/>
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @return Message key as
+ * <code><class_name>.<method_name>.<key></code>.
+ */
+ public String buildKey(final String method, final String key) {
+ if (method == null || key == null) {
+ throw new IllegalArgumentException("Key value shall not be null.");
+ }
+ String clName = cl.getSimpleName();
+ StringBuilder sb = new StringBuilder(
+ clName.length() + method.length() + key.length() + 2);
+ sb.append(clName);
+ sb.append(KEY_SEPARATOR);
+ sb.append(method);
+ sb.append(KEY_SEPARATOR);
+ sb.append(key);
+ return sb.toString();
+ }
+
+ /**
+ * Return message from exception messages properties file with given key.
+ * <p/>
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @return Message from exception messages properties file with given key.
+ */
+ public String excMsg(final String method, final String key) {
+ return message(EXCEPTIONS_FILE, excProps, cl, buildKey(method, key));
+ }
+
+ /**
+ * Return message from exception messages properties file with given key
+ * and attributes.
+ * <p/>
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @param attrs Message attributes.
+ * @return Message from exception messages properties file with given key
+ * and attributes.
+ */
+ public String excMsg(final String method, final String key,
+ final String ...attrs) {
+ String message = message(
+ EXCEPTIONS_FILE, excProps, cl, buildKey(method, key));
+ return MessageFormat.format(message, (Object[])attrs);
+ }
+
+ /**
+ * Check if a message of the given level would actually be logged
+ * by this logger. This check is based on the Loggers effective level,
+ * which may be inherited from its parent.
+ *<p>
+ * @param level A message logging level.
+ * @return <code>true</code> if the given message level is currently being
+ * logged or <code>false</code> otherwise.
+ */
+ public boolean isLoggable(Level level) {
+ return logger.isLoggable(level);
+ }
+
+ /**
+ * Log a message, with no arguments from log messages catalog.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then the given message is forwarded to all the
+ * registered output Handler objects.
+ * <p>
+ * @param level One of the message level identifiers, e.g., SEVERE.
+ * @param method The message string method key.
+ * @param key The message string key.
+ */
+ public void log(Level level, final String method, final String key) {
+ logger.log(level, logMsg(cl, buildKey(method, key)));
+ }
+
+ /**
+ * Log a message, with associated <code>Throwable</code> information
+ * from log messages catalog.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then the given arguments are stored in a LogRecord
+ * which is forwarded to all registered output handlers.
+ * <p>
+ * Note that the thrown argument is stored in the LogRecord thrown
+ * property, rather than the LogRecord parameters property. Thus is it
+ * processed specially by output Formatters and is not treated
+ * as a formatting parameter to the LogRecord message property.
+ * <p>
+ * @param level One of the message level identifiers, e.g., SEVERE.
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @param thrown <code>Throwable</code> associated with log message.
+ */
+ public void log(final Level level, final String method, final String key,
+ final Throwable thrown) {
+ logger.log(level, logMsg(cl, buildKey(method, key)), thrown);
+ }
+
+ /**
+ * Log a message with one object parameter from log messages catalog.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then a corresponding LogRecord is created and forwarded
+ * to all the registered output Handler objects.
+ * <p>
+ * @param level One of the message level identifiers, e.g. SEVERE.
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @param param Parameter to the message.
+ */
+ public void log(final Level level, final String method, final String key,
+ final Object param) {
+ logger.log(level, logMsg(cl, buildKey(method, key)), param);
+ }
+
+ /**
+ * Log a message with an array of object arguments
+ * from log messages catalog.
+ * <p>
+ * If the logger is currently enabled for the given message
+ * level then a corresponding LogRecord is created and forwarded
+ * to all the registered output Handler objects.
+ * <p>
+ * @param level One of the message level identifiers, e.g. SEVERE.
+ * @param method The message string method key.
+ * @param key The message string key.
+ * @param params Array of parameters to the message.
+ */
+ public void log(final Level level, final String method, final String key,
+ final Object params[]) {
+ logger.log(level, logMsg(cl, buildKey(method, key)), params);
+ }
+
+ /**
+ * Log an exception message as is.
+ * @param level One of the message level identifiers, e.g. SEVERE.
+ * @param message The message to be logged as is.
+ */
+ public void exception(final Level level, String message) {
+ logger.log(level, message);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ExceptionMessages.properties
new file mode 100644
index 0000000..fa32273
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ExceptionMessages.properties
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# FetchLogLocal class
+FetchLogLocal.initInputFile.cantInit=Cannot initialize input stream
+
+# FetchLogPiped class
+FetchLogPiped.init.cantInit=Cannot initialize output stream
+FetchLogPiped.addListener.listenerNull=Listener parameter shall not be null
+FetchLogPiped.removeListener.listenerNull=Listener parameter shall not be null
+FetchLogPiped.stop.interrupted=Reader task was interrupted
+FetchLogPiped.stop.exception=Reader task thrown an exception
+FetchLogPiped.stop.cancelled=Reader task was canceled
+
+# ServerTasks class
+ServerTasks.startServer.readXMLerror=Unable to read jvm configuration from {0}.
+ServerTasks.startServer.noBootstrapJar=Unable to find bootstrap jar.
+ServerTasks.startServer.failed=DAS start failed:
\ No newline at end of file
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLog.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLog.java
new file mode 100644
index 0000000..632511d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLog.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Fetch Payara log from server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class FetchLog {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(FetchLog.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server for fetching server log. */
+ PayaraServer server;
+
+ /** Input stream which will provide access to log retrieved from server. */
+ final InputStream in;
+
+ /** Request to skip to the end of log. */
+ final boolean skip;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Abstract methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor callback which will initialize log <code>InputStream</code>.
+ * <p/>
+ * @return <code>InputStream</code> where log lines received from server
+ * will be available to read.
+ */
+ abstract InputStream initInputStream();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an empty instance of Payara server log fetcher using
+ * provided input stream.
+ * <p/>
+ * <code>InputStream</code> is set using constructor argument. Child class
+ * <code>initInputStream</code> method is ignored.
+ * <p/>
+ * @param in Input stream used to read server log.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLog(InputStream in, boolean skip) {
+ this.server = null;
+ this.in = in;
+ this.skip = skip;
+ }
+
+ /**
+ * Constructs an instance of Payara server log fetcher.
+ * <p/>
+ * <code>InputStream</code> is set using child
+ * <code>initInputStream</code> method.
+ * <p/>
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ */
+ @SuppressWarnings("OverridableMethodCallInConstructor")
+ FetchLog(PayaraServer server, boolean skip) {
+ this.server = server;
+ this.in = initInputStream();
+ this.skip = skip;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get input stream for reading lines from server log file.
+ * <p/>
+ * @return Input stream for reading lines from server log file.
+ */
+ public InputStream getInputStream() {
+ return this.in;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Close input stream used to access log lines received from server.
+ * <p/>
+ * This should be overridden in child classes to handle all streams and
+ * threads properly.
+ */
+ public void close() {
+ final String METHOD = "close";
+ if (this.in != null) {
+ try {
+ this.in.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ioe);
+ }
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "isNull");
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEvent.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEvent.java
new file mode 100644
index 0000000..b62c2cd
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEvent.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+
+/**
+ * Events in Payara log fetcher.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class FetchLogEvent {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Current log fetcher task state. */
+ private TaskState state;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of event in Payara log fetcher.
+ * <p/>
+ * @param state Current log fetcher task state.
+ */
+ FetchLogEvent(TaskState state) {
+ this.state = state;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get current log fetcher task state.
+ * <p/>
+ * @return Current log fetcher task state.
+ */
+ public TaskState getState() {
+ return state;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEventListener.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEventListener.java
new file mode 100644
index 0000000..f1a2ac5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogEventListener.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+/**
+ * Listens for events in Payara log fetcher.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public interface FetchLogEventListener {
+
+ /**
+ * Notification method called when log fetcher state was changed.
+ * <p/>
+ * @param event Payara log fetcher state change event.
+ */
+ public void stateChanged(final FetchLogEvent event);
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogException.java
new file mode 100644
index 0000000..a5fdee5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogException.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Payara IDE SDK Exception related to reading logs from server.
+ * <p>
+ * All exceptions are logging themselves on WARNING level when created.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class FetchLogException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>FetchLogException</code> without
+ * detail message.
+ */
+ public FetchLogException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>FetchLogException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public FetchLogException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>FetchLogException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public FetchLogException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogLocal.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogLocal.java
new file mode 100644
index 0000000..469dc9b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogLocal.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.*;
+import java.util.concurrent.ExecutorService;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Fetch Payara log from local server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class FetchLogLocal extends FetchLogPiped {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(FetchLogLocal.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara local server log fetcher.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>FileInputStream</code> before this constructor code is being
+ * executed.
+ * <p/>
+ * @param server Payara server for fetching local server log. Both
+ * <code>getDomainsFolder</code>
+ * and <code>getDomainName</code> should not return null.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLogLocal(final PayaraServer server, final boolean skip) {
+ super(server, skip);
+ }
+
+ /**
+ * Constructs an instance of Payara local server log fetcher with
+ * external {@link ExecutorService}.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>FileInputStream</code> before this constructor code is being
+ * executed.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param server Payara server for fetching local server log. Both
+ * <code>getDomainsFolder</code>
+ * and <code>getDomainName</code> should not return null.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLogLocal(final ExecutorService executor, final PayaraServer server,
+ final boolean skip) {
+ super(executor, server, skip);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initializes active log file <code>InputStream</code>
+ * as <code>FileInputStream</code> sending data from local server
+ * log file.
+ * <p/>
+ * @return <code>FileInputStream</code> where log lines from server
+ * active log file will be available to read.
+ */
+ private InputStream initInputFile() {
+ final String METHOD = "initInputFile";
+ File logFile = ServerUtils.getServerLogFile(server);
+ InputStream log;
+ try {
+ log = new FileInputStream(logFile);
+ } catch (FileNotFoundException fnfe) {
+ LOGGER.log(Level.INFO, METHOD,
+ "fileNotFound", logFile.getAbsolutePath());
+ return null;
+ }
+ if (skip) {
+ int count;
+ try {
+ while ((count = log.available()) > 0) {
+ log.skip(count);
+ }
+ } catch (IOException ioe) {
+ try {
+ log.close();
+ } catch (IOException ioec) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ioec);
+ }
+ throw new FetchLogException(
+ LOGGER.excMsg(METHOD, "cantInit"), ioe);
+ }
+ }
+ return log;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Runnable call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Remote server log lines reading task.
+ * <p/>
+ * Reads new log lines from server using Payara remote administration API
+ * and sends them into pipe (<code>PipedInputStream</code>).
+ * <p/>
+ * @return <code>TaskState.COMPLETED</code> when remote administration API
+ * stopped responding or <code>TaskState.FAILED</code> when
+ * exception was caught.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public TaskState call() {
+ final String METHOD = "call";
+ notifyListeners(TaskState.RUNNING);
+ InputStream fIn = initInputFile();
+ byte[] buff = new byte[PIPE_BUFFER_SIZE];
+ File logFile = ServerUtils.getServerLogFile(server);
+ int inCount;
+ long lastModified;
+ if (fIn == null) {
+ return notifyListeners(TaskState.FAILED);
+ }
+ while (taksExecute) {
+ try {
+ inCount = fIn.available();
+ lastModified = logFile.lastModified();
+ // Nothing to read. Check log rotation after delay.
+ if (inCount <= 0) {
+ Thread.sleep(LOG_REFRESH_DELAY);
+ inCount = fIn.available();
+ if (inCount <= 0 && logFile.lastModified() > lastModified) {
+ LOGGER.log(Level.FINER, METHOD, "rotation");
+ fIn.close();
+ fIn = initInputFile();
+ }
+ }
+ if (inCount > 0) {
+ while (inCount > 0) {
+ int count = fIn.read(buff);
+ LOGGER.log(Level.FINEST, METHOD, "read",
+ new Object[]{new Integer(count)});
+ if (count > 0) {
+ out.write(buff, 0, count);
+ }
+ inCount -= count;
+ if (inCount <= 0) {
+ inCount = fIn.available();
+ }
+ }
+ out.flush();
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, METHOD, "interrupted", ie.getMessage());
+ Thread.currentThread().interrupt();
+ return notifyListeners(TaskState.COMPLETED);
+ } catch (InterruptedIOException ie) {
+ LOGGER.log(Level.INFO, METHOD,
+ "interruptedIO", ie.getMessage());
+ Thread.currentThread().interrupt();
+ return notifyListeners(TaskState.COMPLETED);
+ } catch (IOException ioe) {
+ if (taksExecute) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ioe);
+ return notifyListeners(TaskState.FAILED);
+ } else {
+ LOGGER.log(Level.INFO, METHOD,
+ "ioExceptionMsg", ioe.getMessage());
+ return notifyListeners(TaskState.COMPLETED);
+ }
+ }
+
+ }
+ return notifyListeners(TaskState.COMPLETED);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogPiped.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogPiped.java
new file mode 100644
index 0000000..b13c32a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogPiped.java
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.concurrent.*;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.LinkedList;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Fetch Payara log from local or remote server.
+ * <p/>
+ * Data are fetched in service thread and passed into
+ * <code>PipedOutputStream</code>.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class FetchLogPiped
+ extends FetchLog implements Callable<TaskState> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(FetchLogPiped.class);
+
+ /** Size of internal buffer in pipe input stream. */
+ static final int PIPE_BUFFER_SIZE = 8192;
+
+ /** Log refresh delay in miliseconds. */
+ static final int LOG_REFRESH_DELAY = 1000;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server log fetcher depending
+ * on server being remote or local.
+ * <p/>
+ * Decision if server is local or remote depends on domains folder and
+ * domain name attributes stored in <code>PayaraServer</code> object.
+ * <p/>
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ * @return Newly created <code>FetchLog</code> instance.
+ */
+ public static FetchLogPiped create(final PayaraServer server,
+ final boolean skip) {
+ boolean isLocal = server.getDomainsFolder() != null;
+ FetchLogPiped fetchLog = isLocal
+ ? new FetchLogLocal(server, skip)
+ : new FetchLogRemote(server, skip);
+ fetchLog.start();
+ return fetchLog;
+ }
+
+ /**
+ * Constructs an instance of Payara server log fetcher depending
+ * on server being remote or local.
+ * <p/>
+ * Decision if server is local or remote depends on domains folder and
+ * domain name attributes stored in <code>PayaraServer</code> object.
+ * Log file is passed whole as is without skipping to the end.
+ * <p/>
+ * @param server Payara server for fetching server log.
+ * @return Newly created <code>FetchLog</code> instance.
+ */
+ public static FetchLogPiped create(final PayaraServer server) {
+ return create(server, false);
+ }
+
+ /**
+ * Constructs an instance of Payara server log fetcher depending
+ * on server being remote or local with external {@link ExecutorService}.
+ * <p/>
+ * Decision if server is local or remote depends on domains folder and
+ * domain name attributes stored in <code>PayaraServer</code> object.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ * @return Newly created <code>FetchLog</code> instance.
+ */
+ public static FetchLogPiped create(final ExecutorService executor,
+ final PayaraServer server, final boolean skip) {
+ boolean isLocal = server.getDomainsFolder() != null;
+ FetchLogPiped fetchLog = isLocal
+ ? new FetchLogLocal(executor, server, skip)
+ : new FetchLogRemote(executor, server, skip);
+ fetchLog.start();
+ return fetchLog;
+ }
+
+ /**
+ * Constructs an instance of Payara server log fetcher depending
+ * on server being remote or local with external {@link ExecutorService}.
+ * <p/>
+ * Decision if server is local or remote depends on domains folder and
+ * domain name attributes stored in <code>PayaraServer</code> object.
+ * Log file is passed whole as is without skipping to the end.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param server Payara server for fetching server log.
+ * @return Newly created <code>FetchLog</code> instance.
+ */
+ public static FetchLogPiped create(final ExecutorService executor,
+ final PayaraServer server) {
+ return create(executor, server, false);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Output stream where to write retrieved remote server log. */
+ final PipedOutputStream out;
+
+ /** Running task that reads log lines from remote server. */
+ Future<TaskState> task;
+
+ /** <code>ExecutorService</code> used to run read remote server log tasks. */
+ private ExecutorService executor;
+
+ /** Internal <code>ExecutorService</code> was used. */
+ private final boolean internalExecutor;
+
+ /** Indicate whether log lines reading task should continue or exit. */
+ volatile boolean taksExecute;
+
+ /** Listeners for state change events in Payara log fetcher. */
+ private final LinkedList<FetchLogEventListener> eventListeners;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara remote server log fetcher.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>PipedInputStream</code> before this constructor code is being
+ * executed. Here we can simply connect already initialized
+ * <code>PipedInputStream</code> with newly created
+ * <code>PipedInputStream</code>.
+ * <p/>
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLogPiped(final PayaraServer server, boolean skip) {
+ super(server, skip);
+ final String METHOD = "init";
+ this.eventListeners = new LinkedList();
+ try {
+ out = new PipedOutputStream((PipedInputStream)this.in);
+ } catch (IOException ioe) {
+ super.close();
+ throw new FetchLogException(LOGGER.excMsg(METHOD, "cantInit"), ioe);
+ }
+ taksExecute = true;
+ // Create internal executor to run log reader task.
+ executor = new ThreadPoolExecutor(0, 1, 0L, TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r, FetchLogPiped.class.getName()
+ + server.getUrl());
+ t.setDaemon(true);
+ return t;
+ }
+ });
+ internalExecutor = true;
+ }
+
+ /**
+ * Constructs an instance of Payara remote server log fetcher with
+ * external {@link ExecutorService}.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>PipedInputStream</code> before this constructor code is being
+ * executed. Here we can simply connect already initialized
+ * <code>PipedInputStream</code> with newly created
+ * <code>PipedInputStream</code>.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ */
+ @SuppressWarnings("LeakingThisInConstructor")
+ FetchLogPiped(final ExecutorService executor, final PayaraServer server,
+ boolean skip) {
+ super(server, skip);
+ final String METHOD = "init";
+ this.eventListeners = new LinkedList();
+ try {
+ out = new PipedOutputStream((PipedInputStream)this.in);
+ } catch (IOException ioe) {
+ super.close();
+ throw new FetchLogException(LOGGER.excMsg(METHOD, "cantInit"), ioe);
+ }
+ taksExecute = true;
+ // Use external executor to run log reader task.
+ this.executor = executor;
+ internalExecutor = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor callback which initializes log <code>InputStream</code>
+ * as <code>PipedInputStream</code> sending data from remote server
+ * log reader.
+ * <p/>
+ * This initialization is called form <code>FetchLog</code> super class
+ * constructor. It already exists when <code>FetchLogRemote</code>
+ * constructor is running so it may be used as argument for local
+ * <code>PipedOutputStream</code> initialization.
+ * <p/>
+ * @return <code>PipedInputStream</code> where log lines received from server
+ * will be available to read.
+ */
+ @Override
+ InputStream initInputStream() {
+ return new PipedInputStream(PIPE_BUFFER_SIZE);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add Payara log fetcher state change listener at the end
+ * of listeners list.
+ * <p/>
+ * @param listener Listener for state change events in Payara log fetcher
+ * to be added. Value shall not be <code>null</code>.
+ * @throws FetchLogException When <code>listener</code> parameter
+ * is <code>null</code>.
+ */
+ public final void addListener(final FetchLogEventListener listener)
+ throws FetchLogException {
+ final String METHOD = "addListener";
+ if (listener == null) {
+ throw new FetchLogException(LOGGER.excMsg(METHOD, "listenerNull"));
+ }
+ synchronized(eventListeners) {
+ eventListeners.addLast(listener);
+ }
+ }
+
+ /**
+ * Remove all occurrences of log fetcher state change listener
+ * from listeners list.
+ * <p/>
+ * @param listener Listener for state change events in Payara log fetcher
+ * to be removed. Value shall not be <code>null</code>.
+ * @return Value of <code>true</code> when at least one listener was removed
+ * or <code>false</code> otherwise.
+ * @throws FetchLogException When <code>listener</code> parameter
+ * is <code>null</code>.
+ */
+ public final boolean removeListener(final FetchLogEventListener listener)
+ throws FetchLogException {
+ final String METHOD = "removeListener";
+ if (listener == null) {
+ throw new FetchLogException(LOGGER.excMsg(METHOD, "listenerNull"));
+ }
+ boolean removed = false;
+ synchronized(eventListeners) {
+ boolean isElement = !eventListeners.isEmpty();
+ eventListeners.first();
+ while (isElement) {
+ if (listener.equals(eventListeners.getCurrent())) {
+ isElement = eventListeners.isNext();
+ eventListeners.removeAndNextOrPrevious();
+ removed = true;
+ } else {
+ isElement = eventListeners.next();
+ }
+ }
+ }
+ return removed;
+ }
+
+ /**
+ * Notify all Payara log fetcher state change listeners about state
+ * change event.
+ * <p/>
+ * @param state Current Payara log fetcher state.
+ * @return Current Payara log fetcher state.
+ */
+ final TaskState notifyListeners(final TaskState state) {
+ if (!eventListeners.isEmpty()) {
+ synchronized (eventListeners) {
+ boolean isElement = !eventListeners.isEmpty();
+ if (isElement) {
+ FetchLogEvent event = new FetchLogEvent(state);
+ eventListeners.first();
+ while (isElement) {
+ eventListeners.getCurrent().stateChanged(event);
+ isElement = eventListeners.next();
+ }
+ }
+ }
+ }
+ return state;
+ }
+
+ /**
+ * Start task.
+ */
+ private void start() {
+ task = executor.submit(this);
+ notifyListeners(TaskState.READY);
+ }
+
+ /**
+ * Stop running task if it's still running.
+ * <p/>
+ * @return Task execution result.
+ */
+ private TaskState stop() {
+ final String METHOD = "stop";
+ taksExecute = false;
+ if (this.out != null) {
+ try {
+ this.out.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ioe);
+ }
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "isNull");
+ }
+ TaskState result;
+ try {
+ result = task.get();
+ } catch (InterruptedException ie) {
+ throw new FetchLogException(
+ LOGGER.excMsg(METHOD, "interrupted"), ie);
+ } catch (ExecutionException ee) {
+ throw new FetchLogException(
+ LOGGER.excMsg(METHOD, "exception"), ee);
+ } catch (CancellationException ce) {
+ throw new FetchLogException(
+ LOGGER.excMsg(METHOD, "cancelled"), ce);
+ }
+ return result;
+ }
+
+ /**
+ * Stop log lines reading task and close input and output streams used
+ * to access log lines received from server.
+ */
+ @Override
+ public void close() {
+ final String METHOD = "close";
+ TaskState result = stop();
+ super.close();
+ // Clean up internal executor.
+ if (internalExecutor) {
+ executor.shutdownNow();
+ }
+ // We may possibly change this to throw an exception when needed.
+ // But streams must be cleaned up first.
+ if (result != TaskState.COMPLETED) {
+ LOGGER.log(Level.INFO, METHOD, "failed");
+ }
+ }
+
+ /**
+ * Check if log lines reading task is running.
+ * <p/>
+ * @return Returns <code>true</code> when task is still running
+ * or <code>false></code> otherwise.
+ */
+ public boolean isRunning() {
+ return !task.isDone();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogRemote.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogRemote.java
new file mode 100644
index 0000000..e04eac3
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogRemote.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.admin.CommandFetchLogData;
+import org.netbeans.modules.payara.tooling.admin.ResultLog;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Fetch Payara log from remote server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class FetchLogRemote extends FetchLogPiped {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(FetchLogPiped.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara remote server log fetcher.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>PipedInputStream</code> before this constructor code is being
+ * executed. Here we can simply connect already initialized
+ * <code>PipedInputStream</code> with newly created
+ * <code>PipedInputStream</code>.
+ * <p/>
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLogRemote(final PayaraServer server, final boolean skip) {
+ super(server, skip);
+ }
+
+ /**
+ * Constructs an instance of Payara remote server log fetcher with
+ * external {@link ExecutorService}.
+ * <p/>
+ * Super class constructor will call <code>initInputStream</code> method
+ * which initializes <code>InputStream</code> as
+ * <code>PipedInputStream</code> before this constructor code is being
+ * executed. Here we can simply connect already initialized
+ * <code>PipedInputStream</code> with newly created
+ * <code>PipedInputStream</code>.
+ * <p/>
+ * @param executor Executor service used to start task.
+ * @param server Payara server for fetching server log.
+ * @param skip Skip to the end of the log file.
+ */
+ FetchLogRemote(final ExecutorService executor, final PayaraServer server,
+ final boolean skip) {
+ super(executor, server, skip);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Runnable call() Method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Remote server log lines reading task.
+ * <p/>
+ * Reads new log lines from server using Payara remote administration API
+ * and sends them into pipe (<code>PipedInputStream</code>).
+ * <p/>
+ * @return <code>TaskState.COMPLETED</code> when remote administration API
+ * stopped responding or <code>TaskState.FAILED</code> when
+ * exception was caught.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Override
+ public TaskState call() {
+ final String METHOD = "call";
+ notifyListeners(TaskState.RUNNING);
+ String paramsAppendNext = null;
+ Future<ResultLog> future = ServerAdmin.<ResultLog>exec(server,
+ new CommandFetchLogData());
+ try {
+ ResultLog result = future.get();
+ if (!skip && result.getState() == TaskState.COMPLETED) {
+ paramsAppendNext = result.getValue().getParamsAppendNext();
+ for (String line : result.getValue().getLines()) {
+ out.write(line.getBytes());
+ out.write(OsUtils.LINES_SEPARATOR.getBytes());
+ }
+ out.flush();
+ }
+ byte[] lineSeparatorOut = OsUtils.LINES_SEPARATOR.getBytes();
+ while (taksExecute && result.getState() == TaskState.COMPLETED) {
+ future = ServerAdmin.<ResultLog>exec(server,
+ new CommandFetchLogData(
+ paramsAppendNext));
+ result = future.get();
+ if (result.getState() == TaskState.COMPLETED) {
+ paramsAppendNext = result.getValue().getParamsAppendNext();
+ for (String line : result.getValue().getLines()) {
+ byte[] lineOut = line.getBytes();
+ LOGGER.log(Level.FINEST, METHOD, "read", new Object[] {
+ new Integer(lineOut.length
+ + lineSeparatorOut.length)});
+ out.write(lineOut);
+ out.write(lineSeparatorOut);
+ }
+ out.flush();
+ }
+ Thread.sleep(LOG_REFRESH_DELAY);
+ }
+ } catch (InterruptedException ie) {
+ LOGGER.log(Level.INFO, METHOD, "interrupted", ie.getMessage());
+ Thread.currentThread().interrupt();
+ return notifyListeners(TaskState.COMPLETED);
+ } catch (ExecutionException ee) {
+ LOGGER.log(Level.INFO, METHOD, "exception", ee);
+ return notifyListeners(TaskState.FAILED);
+ } catch (InterruptedIOException ie) {
+ LOGGER.log(Level.INFO, METHOD, "interruptedIO", ie.getMessage());
+ Thread.currentThread().interrupt();
+ return notifyListeners(TaskState.COMPLETED);
+ } catch (IOException ioe) {
+ if (taksExecute) {
+ LOGGER.log(Level.INFO, METHOD, "ioException", ioe);
+ return notifyListeners(TaskState.FAILED);
+ } else {
+ LOGGER.log(Level.INFO, METHOD,
+ "ioExceptionMsg", ioe.getMessage());
+ return notifyListeners(TaskState.COMPLETED);
+ }
+ }
+ return notifyListeners(TaskState.COMPLETED);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogSimple.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogSimple.java
new file mode 100644
index 0000000..43dce71
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/FetchLogSimple.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.InputStream;
+
+/**
+ * Fetch Payara log from provided stream.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class FetchLogSimple extends FetchLog {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server log fetcher using provided
+ * stream.
+ * <p/>
+ * Super class constructor will not call <code>initInputStream</code> method
+ * so this method should be ignored.
+ * Old log lines are never skipped so whole log is always available in
+ * <code>InputStream</code>
+ * <p/>
+ * @param in Input stream to access server log.
+ */
+ public FetchLogSimple(InputStream in) {
+ super(in, false);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Implemented Abstract Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructor callback makes no sense in this child class.
+ * <p/>
+ * This method throws an exception when called.
+ * <p/>
+ * @return <code>FileInputStream</code> where log lines received from server
+ * will be available to read.
+ */
+ @Override
+ InputStream initInputStream() {
+ throw new UnsupportedOperationException(
+ "Method initInputStream should not be called in " +
+ "FetchLogSimple class!");
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/JpaSupport.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/JpaSupport.java
new file mode 100644
index 0000000..9c04f50
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/JpaSupport.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.util.concurrent.atomic.AtomicReferenceArray;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+
+/**
+ * Payara server JPA support matrix.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class JpaSupport {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Individual JPA specifications support.
+ */
+ public static class ApiVersion {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** JPA 1.0 supported. */
+ final boolean _1_0;
+
+ /** JPA 2.0 supported. */
+ final boolean _2_0;
+
+ /** JPA 2.1 supported. */
+ final boolean _2_1;
+
+ /** JPA provider class. */
+ final String provider;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual JPA specifications support class.
+ * <p/>
+ * @param jpa_1_0 JPA 1.0 supported.
+ * @param jpa_2_0 JPA 2.0 supported.
+ * @param jpa_2_1 JPA 2.1 supported.
+ * @param provider JPA provider class.
+ */
+ ApiVersion(boolean jpa_1_0, boolean jpa_2_0,
+ boolean jpa_2_1, String provider) {
+ this._1_0 = jpa_1_0;
+ this._2_0 = jpa_2_0;
+ this._2_1 = jpa_2_1;
+ this.provider = provider;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Is JPA 1.0 supported.
+ * <p/>
+ * @return Value of <code>true</code> when JPA 1.0 supported
+ * or <code>false</code> otherwise.
+ */
+ public boolean is10() {
+ return _1_0;
+ }
+
+ /**
+ * Is JPA 2.0 supported.
+ * <p/>
+ * @return Value of <code>true</code> when JPA 2.0 supported
+ * or <code>false</code> otherwise.
+ */
+ public boolean is20() {
+ return _2_0;
+ }
+
+ /**
+ * Is JPA 2.1 supported.
+ * <p/>
+ * @return Value of <code>true</code> when JPA 2.1 supported
+ * or <code>false</code> otherwise.
+ */
+ public boolean is21() {
+ return _2_1;
+ }
+
+ /**
+ * Get JPA provider class.
+ * <p/>
+ * @return JPA provider class name.
+ */
+ public String getProvider() {
+ return provider;
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server JPA provider class since V1. */
+ private static final String JPA_PROVIDER_SINCE_V1
+ = "oracle.toplink.essentials.PersistenceProvider";
+
+ /** Payara server JPA provider class since V3. */
+ private static final String JPA_PROVIDER_SINCE_V3
+ = "org.eclipse.persistence.jpa.PersistenceProvider";
+
+ /**
+ * Payara JPA support matrix:<p/><table>
+ * <tr><th>Payara</th><th>JPA 1.0</th><th>JPA 2.0</th><th>JPA 2.1</th></tr>
+ * <tr><th>V1</th><td>YES</td><td>NO</td><td>NO</td></tr>
+ * <tr><th>V2</th><td>YES</td><td>NO</td><td>NO</td></tr>
+ * <tr><th>V3</th><td>YES</td><td>YES</td><td>NO</td></tr>
+ * <tr><th>V4</th><td>YES</td><td>YES</td><td>YES</td></tr>
+ * </table><p/>
+ * Array is stored as <code>Object[] array</code> internally which
+ * is initialized with all values set to <code>null</code>.
+ */
+ private static final AtomicReferenceArray<ApiVersion> jpaSupport
+ = new AtomicReferenceArray<>(PayaraVersion.length);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara JPA support information for given Payara version.
+ * <p/>
+ * @param version Payara version to get JPA support information for.
+ * @return Payara JPA support information for given Payara version.
+ */
+ public static ApiVersion getApiVersion(PayaraVersion version) {
+ ApiVersion apiVersion = jpaSupport.get(version.ordinal());
+ if (apiVersion != null) {
+ return apiVersion;
+ }
+ synchronized(jpaSupport) {
+ apiVersion = jpaSupport.get(version.ordinal());
+ if (apiVersion == null) {
+ jpaSupport.set(version.ordinal(), new ApiVersion(true,false,
+ version.ordinal() >= PayaraVersion.PF_4_1_144.ordinal(),
+ version.ordinal() < PayaraVersion.PF_4_1_144.ordinal()
+ ? JPA_PROVIDER_SINCE_V1 : JPA_PROVIDER_SINCE_V3));
+ }
+ }
+ return jpaSupport.get(version.ordinal());
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/LogMessages.properties
new file mode 100644
index 0000000..e344cdb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/LogMessages.properties
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# FetchLog class
+FetchLog.close.cantClose=Cannot close input stream:
+FetchLog.close.isNull=Input stream is null.
+
+# FetchLogLocal class
+FetchLogLocal.initInputFile.fileNotFound=Server log file {0} was not found.
+FetchLogLocal.initInputFile.cantClose=Cannot close input stream:
+FetchLogLocal.call.rotation=Log rotation dedected, switching stream.
+FetchLogLocal.call.read=Read {0} bytes from local log file.
+FetchLogLocal.call.interrupted=Caught InterruptedException: {0}
+FetchLogLocal.call.interruptedIO=Caught InterruptedIOException: {0}
+FetchLogLocal.call.ioException=Caught IOException:
+FetchLogLocal.call.ioExceptionMsg=Caught IOException: {0}
+
+# FetchLogPiped class
+FetchLogPiped.stop.cantClose=Cannot close output stream:
+FetchLogPiped.stop.isNull=Output stream is null.
+FetchLogPiped.close.failed=Log lines reading task execution failed.
+
+# FetchLogRemote class
+FetchLogRemote.call.read=Read {0} bytes from remote log file.
+FetchLogRemote.call.interrupted=Caught InterruptedException: {0}
+FetchLogRemote.call.interruptedIO=Caught InterruptedIOException: {0}
+FetchLogRemote.call.exception=Caught ExecutionException:
+FetchLogRemote.call.ioException=Caught IOException:
+FetchLogRemote.call.ioExceptionMsg=Caught IOException: {0}
+
+# ServerStatus class
+AdminPortTask.handleIOException.messageTm=[{0}] {1}
+AdminPortTask.handleIOException.message={0}
+AdminPortTask.check.success=[{0} {1}] Port status check succeeded.
+LocationsTask.start.started=[{0}] Locations task started.
+LocationsTask.logExceptionOnJoin.failed=[{0}] Locations task failed: {1} {2}
+LocationsTask.join.completed=[{0}] Locations task completed.
+VersionTask.start.started=[{0}] Version task started.
+VersionTask.logExceptionOnJoin..failed=[{0}] Version task failed: {1} {2}
+VersionTask.join.completed=[{0}] Version task completed.
+
+# ServerTasks class
+ServerTasks.computeClassPath.cpError=Unable to read main class path \
+from payara main jar when building launch classpath.
+ServerTasks.appendOptions.jvmOptVal=DOMAIN.XML: jvm opt: {0} = {1}
+ServerTasks.appendOptions.jvmOpt=DOMAIN.XML: jvm opt: {0}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerStatus.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerStatus.java
new file mode 100644
index 0000000..94d38d1
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerStatus.java
@@ -0,0 +1,1129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.CommandLocation;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.CommandVersion;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.text.MessageFormat;
+import java.util.concurrent.*;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Check server status using administration commands <code>__locations</code>
+ * and <code>version</code> and also verify if server is at least listening
+ * on its administration port.
+ * <p/>
+ * Administration commands and port check are run in parallel to reduce delay.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ServerStatus implements Closeable {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Individual server check status returned.
+ */
+ public static enum Status {
+ /** Server status check passed. */
+ SUCCESS,
+
+ /** Server status check failed with <code>FAILED</code> result. */
+ FAILED,
+
+ /** Server status check failed on timeout. */
+ TIMEOUT,
+
+ /** Server status check failed on IO Exception. */
+ EXCEPTION,
+
+ /** Server status check failed because of invalid arguments. */
+ INVALID,
+
+ /** Server status check failed because of unexpected fatal issue. */
+ FATAL;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>Status</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ switch(this) {
+ case SUCCESS: return "SUCCESS";
+ case FAILED: return "FAILED";
+ case TIMEOUT: return "TIMEOUT";
+ case EXCEPTION: return "EXCEPTION";
+ case INVALID: return "INVALID";
+ case FATAL: return "FATAL";
+ default:
+ throw new IllegalStateException("Unknown Status value");
+ }
+ }
+
+ }
+
+ /**
+ * Individual server status result including additional information.
+ */
+ public static class Result {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Individual server status returned. */
+ final Status status;
+
+ /** IO Exception caught. */
+ private final IOException ioe;
+
+ /** Fatal issue Exception caught. */
+ private final Exception ex;
+
+ /** Task failure event. */
+ private final TaskEvent failureEvent;
+
+ /** Server name. */
+ private final String serverName;
+
+ /** Exception message. */
+ private final String exceptionMeasage;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * IO Exception caught in asynchronous task is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ioe IO Exception caught in asynchronous task.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ Result(final Status status, final IOException ioe,
+ final TaskEvent failureEvent, final String serverName,
+ final String exceptionMeasage) {
+ this.status = status;
+ this.ioe = ioe;
+ this.ex = null;
+ this.failureEvent = failureEvent;
+ this.serverName = serverName;
+ this.exceptionMeasage = exceptionMeasage;
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * Common Exception caught is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ex Common Exception caught.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ Result(final Status status, final Exception ex,
+ final TaskEvent failureEvent, final String serverName,
+ final String exceptionMeasage) {
+ this.status = status;
+ this.ioe = null;
+ this.ex = ex;
+ this.failureEvent = failureEvent;
+ this.serverName = serverName;
+ this.exceptionMeasage = exceptionMeasage;
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * No additional value except result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ Result(final Status status, final TaskEvent failureEvent,
+ final String serverName, final String exceptionMeasage) {
+ this.status = status;
+ this.ioe = null;
+ this.ex = null;
+ this.failureEvent = failureEvent;
+ this.serverName = serverName;
+ this.exceptionMeasage = exceptionMeasage;
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * IO Exception caught in asynchronous task is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ioe IO Exception caught in asynchronous task.
+ */
+ Result(final Status status, final IOException ioe) {
+ this(status, ioe, null, null, null);
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * Common Exception caught is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ex Common Exception caught.
+ */
+ Result(final Status status, final Exception ex) {
+ this(status, ex, null, null, null);
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * No additional value except result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ */
+ Result(final Status status) {
+ this(status, null, null, null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get individual check task status.
+ * <p/>
+ * @return Individual check task status.
+ */
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * Get task failure event.
+ * <p/>
+ * @return Task failure event.
+ */
+ public TaskEvent getFailureEvent() {
+ return failureEvent;
+ }
+
+ /**
+ * Get server name.
+ * <p/>
+ * @return Server name.
+ */
+ public String getServerName() {
+ return serverName;
+ }
+
+ /**
+ * Get exception message.
+ * <p/>
+ * @return Exception message.
+ */
+ public String getExceptionMeasage() {
+ return exceptionMeasage;
+ }
+ }
+
+ /**
+ * Server status task execution result for <code>__locations</code> command
+ * including additional information.
+ * <p/>
+ * This class stores task execution result only. Value <code>SUCCESS</code>
+ * means that Locations command task execution finished successfully but it
+ * does not mean that administration command itself returned with
+ * <code>COMPLETED</code> status.
+ * When <code>SUCCESS</code> status is set, stored <code>result</code> value
+ * shall be examined too to see real administration command execution
+ * result.
+ */
+ public static class ResultLocations extends Result {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Command <code>__locations</code> execution result. */
+ final ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>__locations</code> command.
+ * <p/>
+ * Command <code>__locations</code> result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultLocations(final ResultMap<String, String> result,
+ final Status status, final TaskEvent failureEvent,
+ final String serverName, final String exceptionMeasage) {
+ super(status, failureEvent, serverName, exceptionMeasage);
+ this.result = result;
+ }
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>__locations</code> command.
+ * <p/>
+ * Common Exception caught is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ex Common Exception caught.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultLocations(final Status status, final Exception ex,
+ final TaskEvent failureEvent, final String serverName,
+ final String exceptionMeasage) {
+ super(status, ex, failureEvent, serverName, exceptionMeasage);
+ this.result = null;
+ }
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>__locations</code> command.
+ * <p/>
+ * No additional value except result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultLocations(final Status status, final TaskEvent failureEvent,
+ final String serverName, final String exceptionMeasage) {
+ super(status, failureEvent, serverName, exceptionMeasage);
+ this.result = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>__locations</code> command execution result.
+ * <p/>
+ * @return <code>__locations</code> command execution result.
+ */
+ public ResultMap<String, String> getResult() {
+ return result;
+ }
+
+ }
+
+ /**
+ * Individual server status result for <code>version</code> command
+ * including additional information.
+ * <p/>
+ * This class stores task execution result only. Value <code>SUCCESS</code>
+ * means that Locations command task execution finished successfully but it
+ * does not mean that administration command itself returned with
+ * <code>COMPLETED</code> status.
+ * When <code>SUCCESS</code> status is set, stored <code>result</code> value
+ * shall be examined too to see real administration command execution
+ * result.
+ */
+ public static class ResultVersion extends Result {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Command <code>version</code> execution result. */
+ final ResultString result;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>version</code> command.
+ * <p/>
+ * Command <code>version</code> result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultVersion(final ResultString result, final Status status,
+ final TaskEvent failureEvent, final String serverName,
+ final String exceptionMeasage) {
+ super(status, failureEvent, serverName, exceptionMeasage);
+ this.result = result;
+ }
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>version</code> command.
+ * <p/>
+ * Common Exception caught is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param ex Common Exception caught.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultVersion(final Status status, final Exception ex,
+ final TaskEvent failureEvent, final String serverName,
+ final String exceptionMeasage) {
+ super(status, ex, failureEvent, serverName, exceptionMeasage);
+ this.result = null;
+ }
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>version</code> command.
+ * <p/>
+ * No additional value except result is stored.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ * @param serverName Target Payara server name.
+ * @param exceptionMeasage Exception message from command task.
+ */
+ ResultVersion(final Status status, final TaskEvent failureEvent,
+ final String serverName, final String exceptionMeasage) {
+ super(status, failureEvent, serverName, exceptionMeasage);
+ this.result = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>version</code> command execution result.
+ * <p/>
+ * @return <code>version</code> command execution result.
+ */
+ public ResultString getResult() {
+ return result;
+ }
+
+ }
+
+ /**
+ * Common individual server status check task.
+ */
+ private static abstract class Task implements TaskStateListener {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Format time value in miliseconds to be printed as value in seconds
+ * and miliseconds <code>s.ms<code>.
+ * <p/>
+ * @param tm Time value in miliseconds
+ * @return Time string formated as econds and miliseconds
+ * <code>s.ms<code>.
+ */
+ static String tm(final long tm) {
+ StringBuilder sb = new StringBuilder(8);
+ sb.append(Long.toString(tm/1000));
+ sb.append('.');
+ sb.append(Long.toString(tm%1000));
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Payara server to be tested. */
+ final PayaraServer server;
+
+ /** Task start time. Used for logging purposes. Value of <code>-1</code>
+ * means that start time was not set.*/
+ long tmStart;
+
+ /** Task failure event filled by last state change. */
+ TaskEvent failureEvent;
+
+ /** Server name filled by last state change. */
+ String serverName;
+
+ /** Exception message filled by last state change. */
+ String exceptionMeasage;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of common individual server status check.
+ * <p/>
+ * @param server Payara server to be checked.
+ */
+ Task(final PayaraServer server) {
+ this.server = server;
+ this.tmStart = -1;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Compute task result waiting timeout based on task start time, actual
+ * time and minimal timeout limit.
+ * <p/>
+ * @param startup Startup mode to select longer timeout.
+ * @return Task result waiting timeout.
+ */
+ long timeout(final boolean startup) {
+ long timeout = (startup ? COMAND_STARTUP_TIMEOUT : COMAND_TIMEOUT)
+ - System.currentTimeMillis() + tmStart;
+ if (timeout > COMAND_TIMEOUT_MIN) {
+ return timeout;
+ } else {
+ return COMAND_TIMEOUT_MIN;
+ }
+ }
+
+ /**
+ * Store event that caused task failure.
+ * <p/>
+ * @param newState Current task state.
+ * @param event Event that caused task change.
+ * @param args Unused interface parameter.
+ */
+ @Override
+ public void operationStateChanged(
+ final TaskState newState, final TaskEvent event,
+ final String[] args) {
+ if (args != null && args.length >= 3) {
+ serverName = args[0];
+ exceptionMeasage = args[2];
+ } else {
+ serverName = exceptionMeasage = null;
+ }
+ switch(newState) {
+ case FAILED:
+ failureEvent = event;
+ }
+ }
+
+ }
+
+ /**
+ * Individual server status check task to verify if server administration
+ * port is alive.
+ * <p/>
+ * This task does not run in a separate thread but uses existing main thread
+ * instead.
+ */
+ private static class AdminPortTask extends Task {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(AdminPortTask.class);
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Server administration interface host. */
+ String host;
+
+ /** Server administration interface port. */
+ int port;
+
+ /** Socked connecting timeout [ms]. */
+ int timeout;
+
+ /** Server administration port status check result. */
+ private Result result;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of administration port status check.
+ * <p/>
+ * @param server Payara server to be checked.
+ * @param timeout Socked connecting timeout.
+ */
+ AdminPortTask(final PayaraServer server, final int timeout) {
+ super(server);
+ this.host = server.getHost();
+ this.port = server.getAdminPort();
+ this.timeout = timeout;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get server administration port status check result.
+ * <p/>
+ * @return Server administration port status check result.
+ */
+ Result getResult() {
+ return result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Close socket and handle <code>IOException</code> that could
+ * be thrown.
+ * <p/>
+ * @param socket Socket to be closed.
+ */
+ private void closeSocket(final Socket socket) {
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ handleIOException(ioe, host, port,
+ "Socket closing failed when connecting to {0}:{1}: {2}");
+ }
+ }
+
+ /**
+ * Handle IO Exception caught in server administration port verification
+ * task.
+ * <p/>
+ * @param ioe <code>IOException</code> caught.
+ * @param host Server administration host.
+ * @param port Server administration port.
+ * @param message Message to be logged. Shall not be <code>null</code>.
+ */
+ private void handleIOException(final IOException ioe,
+ final String host, final int port, final String message) {
+ final String METHOD = "handleIOException";
+ String logMsg = MessageFormat.format(message, new Object[] {
+ server.getName(), host, Integer.toString(port),
+ ioe.getMessage()});
+ if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) {
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINE, METHOD, "messageTm",
+ new Object[] {logMsg, tm(tm)});
+
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "message", logMsg);
+ }
+ }
+
+ // Based on original code from
+ // org.netbeans.modules.payara.common.CommonServerSupport.isRunning(...)
+ /**
+ * Parent thread task to verify if server administration port is alive.
+ * <p/>
+ * @return Returns <code>true</code> when server administration port
+ * is alive or <code>false</code> otherwise.
+ */
+ Result check() {
+ final String METHOD = "check";
+ if (port < 0 || host == null) {
+ result = new Result(Status.INVALID);
+ return result;
+ }
+ this.tmStart = System.currentTimeMillis();
+ InetSocketAddress sa = new InetSocketAddress(host, port);
+ Socket socket = new Socket();
+ try {
+ socket.connect(sa, timeout);
+ socket.setSoTimeout(timeout);
+ } catch (java.net.ConnectException ce) {
+ handleIOException(ce, host, port,
+ "[{0}] Port check could not connect to {1}:{2}: {3}");
+ result = new Result(Status.FAILED, ce);
+ return result;
+ } catch (java.net.SocketTimeoutException ste) {
+ handleIOException(ste, host, port,
+ "[{0}] Port check timeout when connecting to {1}:{2}: {3}");
+ result = new Result(Status.TIMEOUT, ste);
+ return result;
+ } catch (IOException ioe) {
+ handleIOException(ioe, host, port,
+ "[{0}] Port check caught IO exception when connecting to {1}:{2}: {3}");
+ result = new Result(Status.EXCEPTION, ioe);
+ return result;
+ } finally {
+ closeSocket(socket);
+ }
+ if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) {
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINE, METHOD, "success",
+ new Object[] {tm(tm), server.getName()});
+ }
+ result = new Result(Status.SUCCESS);
+ return result;
+ }
+
+ }
+
+ /**
+ * Individual server status check task with <code>__locations</code>
+ * administration command execution.
+ */
+ private static class LocationsTask extends Task {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(LocationsTask.class);
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Locations command. */
+ private final CommandLocation command;
+
+ /** Locations command execution result; */
+ private Future<ResultMap<String, String>> future;
+
+ /** Locations command result; */
+ ResultMap<String, String> taskResult;
+
+ /** Locations command status check result. */
+ private ResultLocations result;
+
+ /** Startup mode. Triggers longer administration commands execution
+ * timeouts when <code>true</code>. */
+ private final boolean startup;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>__locations</code> server status check.
+ * <p/>
+ * @param server Payara server to be checked.
+ * @param startup Trigger startup mode. Triggers longer administration
+ * commands execution timeouts when <code>true</code>.
+ */
+ LocationsTask(final PayaraServer server, final boolean startup) {
+ super(server);
+ this.command = new CommandLocation();
+ this.startup = startup;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>__locations</code> command status check result.
+ * <p/>
+ * @return <code>__locations</code> command status check result.
+ */
+ ResultLocations getResult() {
+ return result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Start server Location task.
+ */
+ void start(final ExecutorService executor) {
+ final String METHOD = "start";
+ this.tmStart = System.currentTimeMillis();
+ future = ServerAdmin.<ResultMap<String, String>>
+ exec(executor, server, command, this);
+ if (tmStart >=0 && LOGGER.isLoggable(Level.FINE)) {
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINE, METHOD, "started", tm(tm));
+ }
+ }
+
+ /**
+ * Log Exception caught on task join.
+ * <p/>
+ * @param ex Exception caught.
+ */
+ private void logExceptionOnJoin(final Exception ex) {
+ final String METHOD = "logExceptionOnJoin";
+ LOGGER.log(Level.FINE, METHOD, "failed",
+ new Object[] {tm(System.currentTimeMillis() - tmStart),
+ ex.getClass().getName(),
+ ex.getMessage() != null ? ex.getMessage() : ""});
+ }
+
+ /**
+ * Wait for server Location task to finish.
+ */
+ void join() {
+ final String METHOD = "join";
+ try {
+ taskResult = future.get(
+ timeout(startup), TimeUnit.MILLISECONDS);
+ result = new ResultLocations(taskResult, Status.SUCCESS,
+ failureEvent, serverName, exceptionMeasage);
+ LOGGER.log(Level.FINE, METHOD, "completed",
+ tm(System.currentTimeMillis() - tmStart));
+ // This means administration port is not responding.
+ } catch (TimeoutException te) {
+ result = new ResultLocations(Status.TIMEOUT,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(te);
+ // Expected exceptions are handled in call() method so this
+ // is something serious.
+ } catch (ExecutionException ee) {
+ result = new ResultLocations(Status.FATAL, ee,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(ee);
+ // Interrupted after administration port check failed.
+ } catch (InterruptedException | CancellationException ie) {
+ result = new ResultLocations(Status.FAILED, ie,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(ie);
+ // Cancelled after administration port check failed.
+ }
+ }
+
+ /**
+ * Attempt to cancel execution of this task.
+ */
+ void cancel() {
+ if (!future.isDone()) {
+ future.cancel(true);
+ }
+ }
+
+ }
+
+ /**
+ * Individual server status check task with <code>version</code>
+ * administration command execution.
+ */
+ private static class VersionTask extends Task {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(VersionTask.class);
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Version command. */
+ private final CommandVersion command;
+
+ /** Version command execution result; */
+ private Future<ResultString> future;
+
+ /** Version command result; */
+ ResultString taskResult;
+
+ /** Version command status check result. */
+ private ResultVersion result;
+
+ /** Startup mode. Triggers longer administration commands execution
+ * timeouts when <code>true</code>. */
+ private final boolean startup;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>version</code> server status check.
+ * <p/>
+ * @param server Payara server to be checked.
+ * @param startup Trigger startup mode. Triggers longer administration
+ * commands execution timeouts when <code>true</code>.
+ */
+ VersionTask(final PayaraServer server, final boolean startup) {
+ super(server);
+ this.command = new CommandVersion();
+ this.startup = startup;
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>version</code> command status check result.
+ * <p/>
+ * @return <code>version</code> command status check result.
+ */
+ ResultVersion getResult() {
+ return result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Start server Version task.
+ */
+ void start(final ExecutorService executor) {
+ final String METHOD = "start";
+ this.tmStart = System.currentTimeMillis();
+ future = ServerAdmin.<ResultString>
+ exec(executor, server, command, this);
+ if (tmStart >=0 && LOGGER.isLoggable(Level.FINE)) {
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINE, METHOD, "started", tm(tm));
+ }
+ }
+
+ /**
+ * Log Exception caught on task join.
+ * <p/>
+ * @param ex Exception caught.
+ */
+ private void logExceptionOnJoin(final Exception ex) {
+ final String METHOD = "logExceptionOnJoin";
+ LOGGER.log(Level.FINE, METHOD, "failed",
+ new Object[] {tm(System.currentTimeMillis() - tmStart),
+ ex.getClass().getName(),
+ ex.getMessage() != null ? ex.getMessage() : ""});
+ }
+
+ /**
+ * Wait for server Version task to finish.
+ */
+ void join() {
+ final String METHOD = "join";
+ try {
+ taskResult = future.get(
+ timeout(startup), TimeUnit.MILLISECONDS);
+ result = new ResultVersion(taskResult, Status.SUCCESS,
+ failureEvent, serverName, exceptionMeasage);
+ LOGGER.log(Level.FINE, "completed",
+ tm(System.currentTimeMillis() - tmStart));
+ // This means administration port is not responding.
+ } catch (TimeoutException te) {
+ result = new ResultVersion(Status.TIMEOUT,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(te);
+ // Expected exceptions are handled in call() method so this
+ // is something serious.
+ } catch (ExecutionException ee) {
+ result = new ResultVersion(Status.FATAL, ee,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(ee);
+ // Interrupted after administration port check failed.
+ } catch (InterruptedException | CancellationException ie) {
+ result = new ResultVersion(Status.FAILED, ie,
+ failureEvent, serverName, exceptionMeasage);
+ logExceptionOnJoin(ie);
+ // Cancelled after administration port check failed.
+ }
+ }
+
+ /**
+ * Attempt to cancel execution of this task.
+ */
+ void cancel() {
+ if (!future.isDone()) {
+ future.cancel(true);
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ServerStatus.class);
+
+ /** Executor thread pool size (amount of threads to run in parallel). */
+ private static final int EXECUTOR_POOL_SIZE = 2;
+
+ /** Administration port connect timeout [ms]. */
+ private static final int CONNECT_TIMEOUT = 15000;
+
+ /** Minimal administration command execution timeout [ms]. */
+ private static final int COMAND_TIMEOUT_MIN = 100;
+
+ /** Administration command execution timeout [ms]. */
+ private static final int COMAND_TIMEOUT = 30000;
+
+ /** Administration command execution timeout [ms] in startup mode. */
+ private static final int COMAND_STARTUP_TIMEOUT = 600000;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Executor used to run asynchronous server status checks in parallel. */
+ private final ExecutorService executor;
+
+ /** Server status check task to verify if server administration
+ * port is alive. */
+ private final AdminPortTask adminPortTask;
+
+ /** Server status check task with <code>version</code> administration
+ * command. */
+ private final VersionTask versionTask;
+
+ /** Server status check task with <code>__locations</code> administration
+ * command. */
+ private final LocationsTask locationsTask;
+
+ /** Asynchronous server status checks start time. Used for logging
+ * purposes. Value of <code>-1</code> means that start time was not set. */
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of server status check.
+ * <p/>
+ * Method {@link #close()} must be called at the end to release
+ * system resources.
+ * <p/>
+ * @param server Payara server to be checked.
+ * @param startup Trigger startup mode. Triggers longer administration
+ * commands execution timeouts when <code>true</code>.
+ */
+ public ServerStatus(final PayaraServer server, final boolean startup) {
+ this.executor = ServerAdmin.executor(EXECUTOR_POOL_SIZE);
+ this.adminPortTask = new AdminPortTask(server, CONNECT_TIMEOUT);
+ this.versionTask = new VersionTask(server, startup);
+ this.locationsTask = new LocationsTask(server, startup);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get server administration port status check result.
+ * <p/>
+ * @return Server administration port status check result.
+ */
+ public Result getAdminPortResult() {
+ return adminPortTask.result;
+ }
+
+ /**
+ * Get <code>version</code> command status check result.
+ * <p/>
+ * @return <code>version</code> command status check result.
+ */
+ public ResultVersion getVersionResult() {
+ return versionTask.result;
+ }
+
+ /**
+ * Get <code>__locations</code> command status check result.
+ * <p/>
+ * @return <code>__locations</code> command status check result.
+ */
+ public ResultLocations getLocationsResult() {
+ return locationsTask.result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Run asynchronous server status checks.
+ * <p/>
+ * Server administration port status check is run in parent thread. When
+ * administration port has not been available, remaining command tasks
+ * are canceled.
+ */
+ public void check() {
+ versionTask.start(executor);
+ locationsTask.start(executor);
+ Result result = adminPortTask.check();
+ if (result.status != Status.SUCCESS) {
+ versionTask.cancel();
+ locationsTask.cancel();
+ }
+ versionTask.join();
+ locationsTask.join();
+ }
+
+ /**
+ * Clean up all resources.
+ * <p/>
+ * Removes internal thread pool.
+ *
+ */
+ @Override
+ public void close() {
+ executor.shutdownNow();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerTasks.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerTasks.java
new file mode 100644
index 0000000..6103efb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/ServerTasks.java
@@ -0,0 +1,409 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import static java.util.stream.Collectors.toList;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.admin.CommandStartDAS;
+import org.netbeans.modules.payara.tooling.admin.ResultProcess;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.data.StartupArgs;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.parser.JvmConfigReader;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser;
+import org.netbeans.modules.payara.tooling.utils.JavaUtils;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.utils.Utils;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.netbeans.modules.payara.tooling.data.JDKVersion.IDE_JDK_VERSION;
+import org.netbeans.modules.payara.tooling.data.JDKVersion;
+import org.netbeans.modules.payara.tooling.server.parser.JvmConfigReader.JvmOption;
+
+/**
+ * This class should contain task methods for GF server.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ServerTasks {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public enum StartMode {
+ /** Regular server start. */
+ START,
+ /** Start server in debug mode. */
+ DEBUG,
+ /** Start server in profiling mode. */
+ PROFILE;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ServerTasks.class);
+
+ /** Default name of the DAS server. */
+ private static final String DAS_NAME = "server";
+
+ /**
+ * Build server variables map.
+ * <p/>
+ * @param server Payara server entity
+ * @param javaHome Java SE JDK home used to run Payara.
+ */
+ private static Map varMap(PayaraServer server, String javaHome) {
+ HashMap<String, String> varMap = new HashMap<>();
+ varMap.put(ServerUtils.PF_HOME_PROPERTY, server.getServerHome());
+ varMap.put(ServerUtils.PF_DOMAIN_ROOT_PROPERTY,
+ ServerUtils.getDomainPath(server));
+ varMap.put(ServerUtils.PF_JAVA_ROOT_PROPERTY, javaHome);
+ varMap.put(ServerUtils.PF_DERBY_ROOT_PROPERTY,
+ ServerUtils.getDerbyRoot(server));
+ return varMap;
+ }
+
+ /**
+ * Add java agents into server options.
+ * <p/>
+ * @param server Payara server entity.
+ * @param jvmConfigReader Contains <code>jvm-options</code>
+ * from <code>domain.xwl</code>.
+ */
+ private static void addJavaAgent(PayaraServer server,
+ JvmConfigReader jvmConfigReader) {
+ List<JvmOption> optList = jvmConfigReader.getJvmOptions();
+ File serverHome = new File(server.getServerHome());
+ File btrace = new File(serverHome, "lib/monitor/btrace-agent.jar");
+ File flight = new File(serverHome, "lib/monitor/flashlight-agent.jar");
+ if (jvmConfigReader.isMonitoringEnabled()) {
+ if (btrace.exists()) {
+ optList.add(new JvmOption("-javaagent:" + Utils.
+ quote(btrace.getAbsolutePath())
+ + "=unsafe=true,noServer=true")); // NOI18N
+ } else if (flight.exists()) {
+ optList.add(new JvmOption("-javaagent:"
+ + Utils.quote(flight.getAbsolutePath())));
+ }
+ }
+ }
+
+ /**
+ * Adds server variables from variables map into Java VM options
+ * for server startup.
+ * <p/>
+ * @param javaOpts Java VM options {@link StringBuilder} instance.
+ * @param varMap Server variables map.
+ */
+ private static void appendVarMap(
+ StringBuilder javaOpts, Map<String, String> varMap) {
+ for (Map.Entry<String, String> entry : varMap.entrySet()) {
+ javaOpts.append(' ');
+ JavaUtils.systemProperty(
+ javaOpts, entry.getKey(), entry.getValue());
+ }
+ }
+
+ /**
+ * Starts local GF server.
+ * <p/>
+ * The own start is done by calling CommandStartDAS. This method prepares
+ * command-line arguments that need to be provided for the command.
+ * The parameters come from domain.xml and from parameter <code>args</code>
+ * provided by caller.
+ * <p/>
+ * @param server Payara server entity.
+ * @param args Startup arguments provided by caller.
+ * @param mode Mode which we are starting GF in.
+ * @return ResultProcess returned by CommandStartDAS to give caller
+ * opportunity to monitor the start process.
+ * @throws PayaraIdeException
+ */
+ public static ResultProcess startServer(PayaraServer server,
+ StartupArgs args, StartMode mode) throws PayaraIdeException {
+ final String METHOD = "startServer";
+ // reading jvm config section from domain.xml
+ JvmConfigReader jvmConfigReader = new JvmConfigReader(DAS_NAME);
+ String domainAbsolutePath = server.getDomainsFolder() + File.separator
+ + server.getDomainName();
+ String domainXmlPath = domainAbsolutePath + File.separator + "config"
+ + File.separator + "domain.xml";
+ if (!TreeParser.readXml(new File(domainXmlPath), jvmConfigReader)) {
+ // retry with platform default
+ LOGGER.log(Level.INFO, "Retrying with {0} encoding", Charset.defaultCharset());
+ jvmConfigReader = new JvmConfigReader(DAS_NAME);
+ if (!TreeParser.readXml(new File(domainXmlPath), Charset.defaultCharset(), jvmConfigReader)) {
+ throw new PayaraIdeException(LOGGER.excMsg(
+ METHOD, "readXMLerror"), domainXmlPath);
+ }
+ }
+
+ JDKVersion javaVersion = args.getJavaVersion() != null ? args.getJavaVersion() : IDE_JDK_VERSION;
+ List<String> optList
+ = jvmConfigReader.getJvmOptions()
+ .stream()
+ .filter(fullOption -> JDKVersion.isCorrectJDK(javaVersion, fullOption.minVersion, fullOption.maxVersion))
+ .map(fullOption -> fullOption.option)
+ .collect(toList());
+
+ Map<String, String> propMap = jvmConfigReader.getPropMap();
+ addJavaAgent(server, jvmConfigReader);
+ // try to find bootstraping jar - usually glassfish.jar
+ File bootstrapJar = ServerUtils.getJarName(server.getServerHome(),
+ ServerUtils.GF_JAR_MATCHER);
+ if (bootstrapJar == null) {
+ throw new PayaraIdeException(
+ LOGGER.excMsg(METHOD, "noBootstrapJar"));
+ }
+ // compute classpath using properties from jvm-config element of
+ // domain.xml
+ String classPath = computeClassPath(propMap,
+ new File(domainAbsolutePath), bootstrapJar);
+
+ StringBuilder javaOpts = new StringBuilder(1024);
+ StringBuilder payaraArgs = new StringBuilder(256);
+ // preparing variables to replace placeholders in options
+ Map<String, String> varMap = varMap(server, args.getJavaHome());
+ // Add debug parameters read from domain.xml.
+ // It's important to add them before java options specified by user
+ // in case user specified it by himslef.
+ if (mode.equals(StartMode.DEBUG)) {
+ String debugOpts = propMap.get("debug-options");
+ String[] debugOptsSplited = debugOpts.split("\\s+(?=-)");
+ optList.addAll(Arrays.asList(debugOptsSplited));
+ }
+ // add profile parameters
+ if (mode.equals(StartMode.PROFILE)) {
+ }
+ // appending IDE specified options after the ones got from domain.xml
+ // IDE specified are takind precedence this way
+ if (args.getJavaArgs() != null) {
+ optList.addAll(args.getJavaArgs());
+ }
+ appendOptions(javaOpts, optList, varMap);
+ appendVarMap(javaOpts, varMap);
+ if (args.getPayaraArgs() != null) {
+ appendPayaraArgs(payaraArgs, args.getPayaraArgs());
+ }
+ // starting the server using command
+ CommandStartDAS startCommand = new CommandStartDAS(args.getJavaHome(),
+ classPath, javaOpts.toString(), payaraArgs.toString(),
+ domainAbsolutePath);
+ Future<ResultProcess> future =
+ ServerAdmin.<ResultProcess>exec(server, startCommand);
+ try {
+ return future.get();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new PayaraIdeException(LOGGER.excMsg(METHOD, "failed"), e);
+ }
+ }
+
+ /**
+ * Convenient method to start payara in START mode.
+ * <p/>
+ * @param server Payara server entity.
+ * @param args Startup arguments provided by caller.
+ * @return ResultProcess returned by CommandStartDAS to give caller
+ * opportunity to monitor the start process.
+ * @throws PayaraIdeException
+ */
+ public static ResultProcess startServer(PayaraServer server,
+ StartupArgs args) throws PayaraIdeException {
+ return startServer(server, args, StartMode.START);
+ }
+
+ /**
+ * Computing class path for <code>-cp</code> option of java.
+ * <p/>
+ * @param propMap Attributes of <code>jvm-config</code> element
+ * of <code>domain.xml</code>.
+ * @param domainDir Relative paths will be added to this directory.
+ * @param bootstrapJar Bootstrap jar will be also added to class path.
+ * @return Class path for <code>-cp</code> option of java.
+ */
+ private static String computeClassPath(Map<String, String> propMap,
+ File domainDir, File bootstrapJar) {
+ final String METHOD = "computeClassPath";
+ String result = null;
+ List<File> prefixCP = Utils.classPathToFileList(
+ propMap.get("classpath-prefix"), domainDir);
+ List<File> suffixCP = Utils.classPathToFileList(
+ propMap.get("classpath-suffix"), domainDir);
+ boolean useEnvCP = "false".equals(
+ propMap.get("env-classpath-ignored"));
+ List<File> envCP = Utils.classPathToFileList(
+ useEnvCP ? System.getenv("CLASSPATH") : null, domainDir);
+ List<File> systemCP = Utils.classPathToFileList(
+ propMap.get("system-classpath"), domainDir);
+
+ if (prefixCP.size() > 0 || suffixCP.size() > 0 || envCP.size() > 0
+ || systemCP.size() > 0) {
+ List<File> mainCP = Utils.classPathToFileList(
+ bootstrapJar.getAbsolutePath(), null);
+
+ if (mainCP.size() > 0) {
+ List<File> completeCP = new ArrayList<>(32);
+ completeCP.addAll(prefixCP);
+ completeCP.addAll(mainCP);
+ completeCP.addAll(systemCP);
+ completeCP.addAll(envCP);
+ completeCP.addAll(suffixCP);
+
+ // Build classpath in proper order - prefix / main / system
+ // / environment / suffix
+ // Note that completeCP should always have at least 2 elements
+ // at this point (1 from mainCP and 1 from some other CP
+ // modifier)
+ StringBuilder classPath = new StringBuilder(1024);
+ Iterator<File> iter = completeCP.iterator();
+ classPath.append(Utils.quote(iter.next().getPath()));
+ while (iter.hasNext()) {
+ classPath.append(File.pathSeparatorChar);
+ classPath.append(Utils.quote(iter.next().getPath()));
+ }
+ result = classPath.toString();
+ } else {
+ LOGGER.log(Level.WARNING, METHOD, "cpError");
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Takes an list of java options and produces a valid string that can be put
+ * on command line.
+ * <p/>
+ * There are two kinds of options that can be found in option list:
+ * <code>key=value</code> and simple options not containing
+ * <code>=</code>.
+ * In the list there are both options from domain.xml and users options.
+ * Thus some of them can be there more than once. For <code>key=value</code>
+ * ones we can detect it and only the latest one in list will be appended to
+ * command-line. For simple once maybe some duplicate detection will be
+ * added in the future.
+ * <p/>
+ * @param argumentBuf Returned string.
+ * @param optList List of java options.
+ * @param varMap Map to be used for replacing place holders, Contains
+ * <i>place holder</i> - <i>place holder</i> value pairs.
+ */
+ private static void appendOptions(StringBuilder argumentBuf,
+ List<String> optList, Map<String, String> varMap) {
+ final String METHOD = "appendOptions";
+ List<String> moduleOptions = new ArrayList<>();
+ HashMap<String, String> keyValueArgs = new HashMap<>();
+ LinkedList<String> keyOrder = new LinkedList<>();
+ String name, value;
+ // first process optList aquired from domain.xml
+ for (String opt : optList) {
+ // do placeholder substitution
+ opt = Utils.doSub(opt.trim(), varMap);
+ int splitIndex = opt.indexOf('=');
+ // && !opt.startsWith("-agentpath:") is a temporary hack to
+ // not touch already quoted -agentpath. Later we should handle it
+ // in a better way.
+ if (splitIndex != -1 && !opt.startsWith("-agentpath:")) {
+ // key=value type of option
+ name = opt.substring(0, splitIndex);
+ value = Utils.quote(opt.substring(splitIndex + 1));
+ LOGGER.log(Level.FINER, METHOD,
+ "jvmOptVal", new Object[] {name, value});
+
+ } else {
+ name = opt;
+ value = null;
+ LOGGER.log(Level.FINER, METHOD, "jvmOpt", name);
+ }
+
+ // seperate modules options
+ if (name.startsWith("--add-")) {
+ moduleOptions.add(opt);
+ } else {
+ if (!keyValueArgs.containsKey(name)) {
+ keyOrder.add(name);
+ }
+ keyValueArgs.put(name, value);
+ }
+ }
+
+ // override the values that are found in the domain.xml file.
+ // this is totally a copy/paste from StartTomcat...
+ final String[] PROXY_PROPS = {
+ "http.proxyHost", // NOI18N
+ "http.proxyPort", // NOI18N
+ "http.nonProxyHosts", // NOI18N
+ "https.proxyHost", // NOI18N
+ "https.proxyPort", // NOI18N
+ };
+ boolean isWindows = OsUtils.isWin();
+ for (String prop : PROXY_PROPS) {
+ value = System.getProperty(prop);
+ if (value != null && value.trim().length() > 0) {
+ if (isWindows && "http.nonProxyHosts".equals(prop)) {
+ // enclose in double quotes to escape the pipes separating
+ // the hosts on windows
+ value = "\"" + value + "\""; // NOI18N
+ }
+ keyValueArgs.put(JavaUtils.systemPropertyName(prop), value);
+ }
+ }
+
+ // appending module options --add-modules --add-opens --add-exports
+ argumentBuf.append(String.join(" ", moduleOptions));
+
+ // appending key=value options to the command line argument
+ // using the same order as they came in argument - important!
+ for (String key : keyOrder) {
+ argumentBuf.append(' ');
+ argumentBuf.append(key);
+ if (keyValueArgs.get(key) != null) {
+ argumentBuf.append("="); // NOI18N
+ argumentBuf.append(keyValueArgs.get(key));
+ }
+ }
+ }
+
+ /**
+ * Append Payara startup arguments to given {@link StringBuilder}.
+ * <p/>
+ * @param payaraArgs Target {@link StringBuilder} to append arguments.
+ * @param payaraArgsList Arguments to be appended.
+ */
+ private static void appendPayaraArgs(StringBuilder payaraArgs,
+ List<String> payaraArgsList) {
+ for (String arg : payaraArgsList) {
+ payaraArgs.append(' ');
+ payaraArgs.append(arg);
+ }
+ // remove the first space
+ if (payaraArgs.length() > 0) {
+ payaraArgs.deleteCharAt(0);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/AsadminTool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/AsadminTool.java
new file mode 100644
index 0000000..298de66
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/AsadminTool.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import org.netbeans.modules.payara.tooling.data.ToolConfig;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+
+/**
+ * Payara asadmin tool.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class AsadminTool extends PayaraTool implements ToolConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Asadmin tool JAR path (relative under Payara home). */
+ private final String jar;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara asadmin tool.
+ * <p/>
+ * @param lib Tools library directory (relative under Payara home).
+ * @param jar Asadmin tool JAR (relative under tools library directory).
+ */
+ public AsadminTool(final String lib, final String jar) {
+ super(lib);
+ this.jar = OsUtils.joinPaths(lib, jar);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get asadmin tool JAR path (relative under Payara home)
+ * <p/>
+ * @return Asadmin tool JAR path (relative under Payara home)
+ */
+ @Override
+ public String getJar() {
+ return jar;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Config.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Config.java
new file mode 100644
index 0000000..376311f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Config.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.net.URL;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+
+/**
+ * Library builder configuration.
+ * <p/>
+ * Stores library configuration files mapped to Payara versions.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class Config {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Class used to pass library builder configuration for next (newer)
+ * Payara versions to library builder configuration constructor.
+ * <p/>
+ * Contains pair of Payara version and related libraries configuration
+ * file to define configuration file change points in version sequence.
+ */
+ public static class Next {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Libraries XML configuration file. */
+ URL configFile;
+
+ /** Payara version. */
+ PayaraVersion version;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of libraries configuration for given version.
+ * <p/>
+ * @param version Payara version.
+ * @param configFile Libraries XML configuration file associated
+ * to given version.
+ */
+ public Next(PayaraVersion version, URL configFile) {
+ this.configFile = configFile;
+ this.version = version;
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Configuration files. */
+ final URL[] configFiles;
+
+ /** Version to configuration file mapping table. */
+ final int[] index;
+
+
+ /**
+ * Creates an instance of library builder configuration.
+ * <p/>
+ * @param defaultConfig Default libraries configuration file.
+ * @param nextConfig Next libraries configuration file(s) starting from
+ * provided version. Versions must be passed
+ * in ascending order.
+ */
+ public Config(URL defaultConfig,
+ Next... nextConfig) {
+ int indexSize
+ = nextConfig == null ? 1 : nextConfig.length + 1;
+ index = new int[PayaraVersion.length];
+ configFiles = new URL[indexSize];
+ int i = 0;
+ configFiles[i] = defaultConfig;
+ Next config = nextConfig != null && i < nextConfig.length
+ ? nextConfig[i] : null;
+ for (PayaraVersion version : PayaraVersion.values()) {
+ int versionIndex = version.ordinal();
+ if (config != null
+ && config.version.ordinal() <= version.ordinal()) {
+ configFiles[++i] = config.configFile;
+ config = i < nextConfig.length
+ ? nextConfig[i] : null;
+ }
+ index[versionIndex] = i;
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilder.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilder.java
new file mode 100644
index 0000000..ca247c8
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilder.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraJavaEEConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraJavaSEConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraLibrary;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+
+/**
+ * Provides Payara library information from XML configuration files.
+ * <p/>
+ * Instance of library builder for single version of Payara server.
+ * Version of Payara server is supplied with first configuration getter call.
+ * Each subsequent configuration getter call on the same instance must be used
+ * with the same Payara version.
+ * <p/>
+ * XML configuration file is read just once with first configuration getter
+ * call. Returned values are cached for subsequent getter calls which
+ * are very fast.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ConfigBuilder {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build <code>List</code> of <code>PayaraLibrary</code> objects
+ * representing libraries found in particular Payara server installation.
+ * <p/>
+ * @param libConfigs List of libraries configuration nodes.
+ * @param classpathHome Directory tree to search for class path elements.
+ * @param javadocsHome Directory tree to search for java doc.
+ * @param srcHome Directory tree to search for source files.
+ * @return <code>List</code> of <code>PayaraLibrary</code> objects
+ * representing libraries found in particular Payara server
+ * installation.
+ */
+ private static List<PayaraLibrary> getLibraries(
+ final List<LibraryNode> libConfigs, final File classpathHome,
+ final File javadocsHome, final File srcHome) {
+
+ List<PayaraLibrary> result = new LinkedList<>();
+
+ try {
+ for (LibraryNode libConfig : libConfigs) {
+
+ List<File> classpath = ConfigUtils.processFileset(
+ libConfig.classpath, classpathHome.getAbsolutePath());
+ List<File> javadocs = ConfigUtils.processFileset(
+ libConfig.javadocs, javadocsHome.getAbsolutePath());
+ List<URL> javadocUrls
+ = ConfigUtils.processLinks(libConfig.javadocs);
+ List<File> sources = ConfigUtils.processFileset(
+ libConfig.sources, srcHome.getAbsolutePath());
+ result.add(new PayaraLibrary(libConfig.libraryID,
+ buildUrls(classpath),
+ buildUrls(javadocs, javadocUrls),
+ libConfig.javadocs.getLookups(),
+ buildUrls(sources),
+ ConfigUtils.processClassPath(classpath)));
+ }
+ } catch (FileNotFoundException e) {
+ throw new PayaraIdeException(
+ "Some files required by configuration were not found.", e);
+ }
+ return result;
+ }
+
+ /**
+ * Converts provided list of files to <code>URL</code> objects and appends
+ * supplied <code>URL</code> objects to this list.
+ * <p/>
+ * @param files List of files to convert to <code>URL</code> objects.
+ * @param urls <code>URL</code> objects to append to this list.
+ * @return List of <code>URL</code> objects containing content of both
+ * supplied lists.
+ */
+ private static List<URL> buildUrls(
+ final List<File> files, final List<URL> urls) {
+ List<URL> result = buildUrls(files);
+ result.addAll(urls);
+ return result;
+ }
+
+ /**
+ * Converts provided list of files to <code>URL</code> objects.
+ * <p/>
+ * @param files List of files to convert to <code>URL</code> objects.
+ * @return List of <code>URL</code> objects containing files from
+ * supplied list.
+ */
+ private static List<URL> buildUrls(final List<File> files) {
+ ArrayList<URL> result = new ArrayList<>(files.size());
+ for (File file : files) {
+ URL url = ConfigUtils.fileToURL(file);
+ if (url != null) {
+ result.add(url);
+ }
+ }
+ return result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Library builder configuration. */
+ private final Config config;
+
+ /** Classpath search prefix. */
+ private final File classpathHome;
+
+ /** Javadoc search prefix. */
+ private final File javadocsHome;
+
+ /** Source code search prefix. */
+ private final File srcHome;
+
+ /** Libraries cache. */
+ /* GuarderBy(this)*/
+ private List<PayaraLibrary> libraryCache;
+
+ /** Payara JavaEE configuration cache. */
+ /* GuarderBy(this)*/
+ private PayaraJavaEEConfig javaEEConfigCache;
+
+ /** Payara JavaSE configuration cache. */
+ /* GuarderBy(this)*/
+ private PayaraJavaSEConfig javaSEConfigCache;
+
+ /** Version check. */
+ /* GuarderBy(this)*/
+ private PayaraVersion version;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara library builder.
+ * <p/>
+ * Stores provided Payara version to configuration file mapping.
+ * <p/>
+ * @param config Library builder configuration. Should not
+ * be <code>null</code>.
+ * @param classpathHome Classpath search prefix.
+ * @param javadocsHome Javadoc search prefix.
+ * @param srcHome Source code search prefix.
+ */
+ ConfigBuilder(final Config config, final String classpathHome,
+ final String javadocsHome, final String srcHome) {
+ this.config = config;
+ this.classpathHome = new File(classpathHome);
+ this.javadocsHome = new File(javadocsHome);
+ this.srcHome = new File(srcHome);
+ }
+
+ /**
+ * Creates an instance of Payara library builder.
+ * <p/>
+ * Stores provided Payara version to configuration file mapping.
+ * <p/>
+ * @param config Library builder configuration. Should not
+ * be <code>null</code>.
+ * @param classpathHome Classpath search prefix.
+ * @param javadocsHome Javadoc search prefix.
+ * @param srcHome Source code search prefix.
+ */
+ ConfigBuilder(final Config config, final File classpathHome,
+ File javadocsHome, File srcHome) {
+ this.config = config;
+ this.classpathHome = classpathHome;
+ this.javadocsHome = javadocsHome;
+ this.srcHome = srcHome;
+ }
+
+ /**
+ * Internal version check to avoid usage of a single builder instance
+ * for multiple Payara versions.
+ * <p/>
+ * @param version Payara version being checked.
+ * @throws ServerConfigException when builder is used with multiple
+ * Payara versions.
+ */
+ private synchronized void versionCheck(final PayaraVersion version)
+ throws ServerConfigException {
+ if (this.version == null) {
+ this.version = version;
+ } else if (this.version != version) {
+ throw new ServerConfigException(
+ "Library builder was already used for Payara "
+ + this.version + " use new instance for Payara"
+ + version);
+ }
+ }
+
+ /**
+ * Get Payara libraries configured for provided Payara version.
+ * <p/>
+ * This method shall not be used with multiple Payara versions
+ * for the same instance of {@link ConfigBuilder} class.
+ * <p/>
+ * @param version Payara version.
+ * @return List of libraries configured for Payara of given version.
+ * @throws ServerConfigException when builder instance is used with multiple
+ * Payara versions.
+ */
+ public List<PayaraLibrary> getLibraries(
+ final PayaraVersion version) throws ServerConfigException {
+ versionCheck(version);
+ synchronized (this) {
+ if (libraryCache != null) {
+ return libraryCache;
+ }
+ PayaraConfig configAdapter
+ = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(version));
+ List<LibraryNode> libConfigs
+ = configAdapter.getLibrary();
+ libraryCache = getLibraries(
+ libConfigs, classpathHome, javadocsHome, srcHome);
+ return libraryCache;
+ }
+ }
+
+ /**
+ * Get Payara JavaEE configuration for provided Payara version.
+ * <p/>
+ * This method shall not be used with multiple Payara versions
+ * for the same instance of {@link ConfigBuilder} class.
+ * <p/>
+ * @param version Payara version.
+ * @return Payara JavaEE configuration for provided Payara
+ * of given version.
+ * @throws ServerConfigException when builder instance is used with multiple
+ * Payara versions.
+ */
+ public PayaraJavaEEConfig getJavaEEConfig(
+ final PayaraVersion version) throws ServerConfigException {
+ versionCheck(version);
+ synchronized (this) {
+ if (javaEEConfigCache != null) {
+ return javaEEConfigCache;
+ }
+ PayaraConfig configAdapter
+ = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(version));
+ javaEEConfigCache = new PayaraJavaEEConfig(
+ configAdapter.getJavaEE(), classpathHome);
+ return javaEEConfigCache;
+ }
+ }
+
+ /**
+ * Get Payara JavaSE configuration for provided Payara version.
+ * <p/>
+ * This method shall not be used with multiple Payara versions
+ * for the same instance of {@link ConfigBuilder} class.
+ * <p/>
+ * @param version Payara version.
+ * @return Payara JavaSE configuration for provided Payara
+ * of given version.
+ * @throws ServerConfigException when builder instance is used with multiple
+ * Payara versions.
+ */
+ public PayaraJavaSEConfig getJavaSEConfig(
+ final PayaraVersion version) throws ServerConfigException {
+ versionCheck(version);
+ synchronized (this) {
+ if (javaSEConfigCache != null) {
+ return javaSEConfigCache;
+ }
+ PayaraConfig configAdapter
+ = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(version));
+ javaSEConfigCache = new PayaraJavaSEConfig(
+ configAdapter.getJavaSE());
+ return javaSEConfigCache;
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderProvider.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderProvider.java
new file mode 100644
index 0000000..0fa89b2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderProvider.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Configuration builder provider.
+ * <p/>
+ * This class is responsible for handling providers for individual server
+ * instances. Because {@link ConfigBuilder} class instance shall not be used
+ * for multiple Payara server versions there must be one configuration class
+ * instance for every single Payara server version.
+ * Also every single server instance has it's own directory structure which
+ * is used to search for modules. Because of that every single Payara server
+ * instance must have it's own configuration builder.
+ * Configuration builder is created with first request for given server version
+ * and reused for every subsequent request.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ConfigBuilderProvider {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Library builder default configuration file. */
+ private static final URL CONFIG_V3
+ = ConfigBuilderProvider.class.getResource("PayaraV3.xml");
+
+ /** Library builder configuration since Payara 4.1. */
+ private static final Config.Next CONFIG_V4_1
+ = new Config.Next(PayaraVersion.PF_4_1_144,
+ ConfigBuilderProvider.class.getResource("PayaraV4.xml"));
+
+ /** Library builder configuration since Payara 5.181 */
+ private static final Config.Next CONFIG_V5_181
+ = new Config.Next(PayaraVersion.PF_5_181,
+ ConfigBuilderProvider.class.getResource("PayaraV5.xml"));
+
+ /** Library builder configuration since Payara 5.192 */
+ private static final Config.Next CONFIG_V5_192
+ = new Config.Next(PayaraVersion.PF_5_192,
+ ConfigBuilderProvider.class.getResource("PayaraV5_192.xml"));
+
+ /** Library builder configuration for Payara. */
+ private static final Config config
+ = new Config(CONFIG_V3, CONFIG_V4_1, CONFIG_V5_181, CONFIG_V5_192);
+
+ /** Builders array for each server instance. */
+ private static final Map<PayaraServer, ConfigBuilder> builders
+ = new HashMap<>();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get library builder configuration for given Payara server version.
+ * <p/>
+ * @param version Payara server version.
+ * @return Library builder configuration for given Payara server version.
+ */
+ public static URL getBuilderConfig(final PayaraVersion version) {
+ return config.configFiles[config.index[version.ordinal()]];
+ }
+
+ /**
+ * Get configuration builder instance for given Payara server entity
+ * instance.
+ * <p/>
+ * @param server Payara server entity for which builder is returned.
+ * <p/>
+ * @return Configuration builder for given Payara server entity.
+ * @throws ServerConfigException when there is no version ser in Payara
+ * server entity object or this object is null.
+ */
+ public static ConfigBuilder getBuilder(final PayaraServer server) {
+ if (server == null) {
+ throw new ServerConfigException(
+ "Payara server entity shall not be null");
+ }
+ ConfigBuilder builder;
+ synchronized (builders) {
+ builder = builders.get(server);
+ if (builder != null) {
+ return builder;
+ }
+ String serverHome = server.getServerHome();
+ builder = new ConfigBuilder(config, serverHome, serverHome, serverHome);
+ builders.put(server, builder);
+ }
+ return builder;
+ }
+
+
+ /**
+ * Remove configuration builder instance for given Payara server entity
+ * instance.
+ * <p/>
+ * Allows to free resources when configuration builder instance will no more
+ * be needed (e.g. Payara server entity is being destroyed).
+ * <p/>
+ * @param server Payara server entity for which builder is destroyed.
+ */
+ public static void destroyBuilder(final PayaraServer server) {
+ if (server == null) {
+ throw new ServerConfigException(
+ "Payara server entity shall not be null");
+ }
+ synchronized (builders) {
+ builders.remove(server);
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigUtils.java
new file mode 100644
index 0000000..2bdf8e0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ConfigUtils.java
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import org.netbeans.modules.payara.tooling.data.PayaraLibrary;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigUtils {
+
+ /** Maven Group ID property name. */
+ private static final String MVN_PROP_GROUP_ID = "groupId";
+
+ /** Maven Artifact ID property name. */
+ private static final String MVN_PROP_ARTIFACT_ID = "artifactId";
+
+ /** Maven Version property name. */
+ private static final String MVN_PROP_VERSION = "version";
+
+ /** */
+ private static final Pattern MVN_PROPS_PATTERN
+ = Pattern.compile("META-INF/maven/[^/]+/[^/]+/pom.properties");
+
+ /**
+ * Convert {@link File} to {@link URL}.
+ * <p/>
+ * @param file {@link File} to be converted to {@link URL}.
+ */
+ static URL fileToURL(File file) {
+ try {
+ return file != null ? file.toURI().normalize().toURL() : null;
+ } catch (MalformedURLException ex) {
+ Logger.log(Level.WARNING, "Unable to convert file "
+ + file.getAbsolutePath() + " to URL", ex);
+ return null;
+ }
+ }
+
+ /**
+ * Process <code>List</code> of links from library node and convert them
+ * to <code>List</code> of {@link URL}s.
+ * <p/>
+ * @param fileset Library node.
+ * @return <code>List</code> of {@link URL}s from library node.
+ */
+ static List<URL> processLinks(FileSet fileset) {
+ List<String> links = fileset.getLinks();
+ ArrayList<URL> result = new ArrayList<>(links.size());
+ for (String urlString : links) {
+ try {
+ result.add(new URL(urlString));
+ } catch (MalformedURLException mue) {
+ Logger.log(Level.WARNING, "Cannot process URL: " + urlString
+ + ".", mue);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Process <code>List</code> of links from library node and convert them
+ * of <code>List</code> of {@link File}s.
+ * <p/>
+ * @param fileset Library node.
+ * @param rootDir File system search root.
+ * @return <code>List</code> of {@link File}s from library node.
+ * @throws FileNotFoundException When file from paths element was not found.
+ */
+ static List<File> processFileset(FileSet fileset, String rootDir)
+ throws FileNotFoundException {
+ Map<String, List<String>> filesets = fileset.getFilesets();
+ List<String> paths = fileset.getPaths();
+ ArrayList<File> result = new ArrayList<>();
+
+ for (String dir : filesets.keySet()) {
+ File d = new File(dir);
+ String dirPrefix;
+ if (!d.isAbsolute()) {
+ dirPrefix = new File(rootDir, d.getPath()).getAbsolutePath();
+ } else {
+ dirPrefix = d.getAbsolutePath();
+ }
+
+ List<Pattern> patterns = compilePatterns(filesets.get(dir));
+ File[] fileArray = new File(dirPrefix).listFiles(createFilter(
+ patterns));
+ if (fileArray != null) {
+ Collections.addAll(result, fileArray);
+ }
+ }
+
+ for (String path : paths) {
+ File f = new File(path);
+ if (!f.isAbsolute()) {
+ f = new File(rootDir, f.getPath());
+ }
+ if (!f.exists()) {
+ throw new FileNotFoundException("File with name "
+ + path + " does not exist.");
+ }
+ result.add(f);
+ }
+
+ return result;
+ }
+
+ /**
+ * Search class path for Maven information.
+ * <p/>
+ * @param classpath List of class path JAR files.
+ * @return List of Maven information
+ */
+ static List<PayaraLibrary.Maven> processClassPath(List<File> classpath) {
+ List<PayaraLibrary.Maven> mvnList = new LinkedList<>();
+ for (File jar : classpath) {
+ ZipFile zip = null;
+ try {
+ zip = new ZipFile(jar);
+ Enumeration<? extends ZipEntry> entries = zip.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Matcher matcher
+ = MVN_PROPS_PATTERN.matcher(entry.getName());
+ if (matcher.matches()) {
+ PayaraLibrary.Maven mvnInfo
+ = getMvnInfoFromProperties(zip.getInputStream(
+ entry));
+ if (mvnInfo != null) {
+ mvnList.add(mvnInfo);
+ break;
+ }
+ }
+ }
+ } catch (ZipException ze) {
+ Logger.log(Level.WARNING, "Cannot open JAR file "
+ + jar.getAbsolutePath() + ":", ze);
+ } catch (IOException | IllegalStateException ioe) {
+ Logger.log(Level.WARNING, "Cannot process JAR file "
+ + jar.getAbsolutePath() + ":", ioe);
+ } finally {
+ if (zip != null) try {
+ zip.close();
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING, "Cannot close JAR file "
+ + jar.getAbsolutePath() + ":", ioe);
+ }
+ }
+
+ }
+ return mvnList;
+ }
+
+ /**
+ * Process <code>pom.properties</code> content to retrieve Maven information
+ * from JAR.
+ * <p/>
+ * @param propStream Input stream to read <code>pom.properties</code>
+ * file from JAR.
+ */
+ private static PayaraLibrary.Maven getMvnInfoFromProperties(
+ InputStream propStream) throws IOException {
+ Properties props = new Properties();
+ props.load(propStream);
+ String groupId = props.getProperty(MVN_PROP_GROUP_ID);
+ String artifactId = props.getProperty(MVN_PROP_ARTIFACT_ID);
+ String version = props.getProperty(MVN_PROP_VERSION);
+ if (groupId != null && artifactId != null && version != null) {
+ return new PayaraLibrary.Maven(groupId, artifactId, version);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Creates file name filter from <code>List</code>
+ * of <cpode>Pattern</code>s.
+ * <p/>
+ * @param patterns <code>List</code> of <cpode>Pattern</code>s.
+ * @return File name filter.
+ */
+ private static FilenameFilter createFilter(final List<Pattern> patterns) {
+ return new FilenameFilter() {
+
+ @Override
+ public boolean accept(File dir, String name) {
+ for (Pattern p : patterns) {
+ if (p.matcher(name).matches()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ /**
+ * Compile pattern <code>String</code>s.
+ * <p/>
+ * @param names <code>List</code> of pattern <code>String</code>s.
+ * @return <code>List</code> of compiled <code>Pattern</code>s.
+ */
+ private static List<Pattern> compilePatterns(List<String> names) {
+ ArrayList<Pattern> patterns = new ArrayList<>(names.size());
+ for (String name : names) {
+ patterns.add(Pattern.compile(name));
+ }
+ return patterns;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/FileSet.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/FileSet.java
new file mode 100644
index 0000000..a5ca165
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/FileSet.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Library content set for library content for Payara features configuration.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class FileSet {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Paths retrieved from XML elements. */
+ private final List<String> paths;
+
+ /** Links retrieved from XML elements. */
+ private final List<String> links;
+
+ /** File sets retrieved from XML elements. */
+ private final Map<String, List<String>> filesets;
+
+ /** Links retrieved from XML elements. */
+ private final List<String> lookups;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Library content for Payara libraries
+ * configuration.
+ * <p/>
+ * @param paths Paths retrieved from XML elements.
+ * @param links Links retrieved from XML elements.
+ * @param filesets File sets retrieved from XML elements.
+ * @param lookups Lookups retrieved from XML elements.
+ */
+ public FileSet(final List<String> paths, final List<String> links,
+ final Map<String, List<String>> filesets,
+ final List<String> lookups) {
+ this.paths = paths;
+ this.links = links;
+ this.filesets = filesets;
+ this.lookups = lookups;
+ }
+
+ /**
+ * Creates an instance of Library content for Payara libraries
+ * configuration.
+ * <p/>
+ * Content of links and lookups is set to <code>null</code>.
+ * <p/>
+ * @param paths Paths retrieved from XML elements.
+ * @param filesets File sets retrieved from XML elements.
+ */
+ public FileSet(final List<String> paths,
+ final Map<String, List<String>> filesets) {
+ this(paths, null, filesets, null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get paths retrieved from XML elements.
+ * <p/>
+ * @return Paths sets retrieved from XML elements.
+ */
+ public List<String> getPaths() {
+ return paths;
+ }
+
+ /**
+ * Get links retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ public List<String> getLinks() {
+ return links;
+ }
+
+ /**
+ * Get file sets retrieved from XML elements.
+ * <p/>
+ * @return File sets retrieved from XML elements.
+ */
+ public Map<String, List<String>> getFilesets() {
+ return filesets;
+ }
+
+ /**
+ * Get lookups retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ public List<String> getLookups() {
+ return lookups;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEEProfile.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEEProfile.java
new file mode 100644
index 0000000..4d67c49
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEEProfile.java
@@ -0,0 +1,312 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * JavaEE profiles supported by Payara.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum JavaEEProfile {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JavaEE 1.2. */
+ v1_2(Version.v1_2, Type.FULL, "1.2"),
+
+ /** JavaEE 1.3. */
+ v1_3(Version.v1_3, Type.FULL, "1.3"),
+
+ /** JavaEE 1.4. */
+ v1_4(Version.v1_4, Type.FULL, "1.4"),
+
+ /** JavaEE 1.5. */
+ v1_5(Version.v1_5, Type.FULL, "1.5"),
+
+ /** JavaEE 1.6 web profile. */
+ v1_6_web(Version.v1_6, Type.WEB, "1.6-web"),
+
+ /** JavaEE 1.6 full profile. */
+ v1_6(Version.v1_6, Type.FULL, "1.6"),
+
+ /** JavaEE 1.7 web profile. */
+ v1_7_web(Version.v1_7, Type.WEB, "1.7-web"),
+
+ /** JavaEE 1.7 full profile. */
+ v1_7(Version.v1_7, Type.FULL, "1.7"),
+
+ /** JavaEE 1.8 web profile. */
+ v1_8_web(Version.v1_8, Type.WEB, "1.8-web"),
+
+ /** JavaEE 1.8 full profile. */
+ v1_8(Version.v1_8, Type.FULL, "1.8");
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner enums //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JavaEE profile type. */
+ public enum Type {
+ /** Web profile. */
+ WEB("web"),
+ /** Full profile. */
+ FULL("full");
+
+ /** JavaEE profile type name. */
+ private final String name;
+
+ /**
+ * Creates an instance of JavaEE profile type.
+ * <p/>
+ * @param name JavaEE profile type name.
+ */
+ private Type(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Converts JavaEE profile type value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+ }
+
+ /** JavaEE version. */
+ public enum Version {
+ /** JavaEE 1.2. */
+ v1_2("1.2"),
+ /** JavaEE 1.3. */
+ v1_3("1.3"),
+ /** JavaEE 1.4. */
+ v1_4("1.4"),
+ /** JavaEE 1.5. */
+ v1_5("1.5"),
+ /** JavaEE 1.6. */
+ v1_6("1.6"),
+ /** JavaEE 1.7. */
+ v1_7("1.7"),
+ /** JavaEE 1.8. */
+ v1_8("1.8");
+
+ /** JavaEE profile type name. */
+ private final String name;
+
+ /**
+ * Creates an instance of JavaEE profile type.
+ * <p/>
+ * @param name JavaEE profile type name.
+ */
+ private Version(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Converts JavaEE profile type value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value
+ * of this object.
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara JavaEE profile enumeration length. */
+ public static final int length = JavaEEProfile.values().length;
+
+ /** JavaEE profile type element separator character. */
+ public static final char TYPE_SEPARATOR = '-';
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, JavaEEProfile> stringValuesMap
+ = new HashMap<>(values().length);
+
+ // Initialize backward String conversion Map.
+ static {
+ for (JavaEEProfile profile : JavaEEProfile.values()) {
+ String[] names = createNames(profile);
+ for (String name : names) {
+ stringValuesMap.put(name.toUpperCase(), profile);
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create JavaEE profile names to be recognized.
+ * <p/>
+ * @param profile JavaEE profile.
+ * @return Array of names.
+ * @throws ServerConfigException when JavaEE profile type is not recognized.
+ */
+ private static String[] createNames(final JavaEEProfile profile)
+ throws ServerConfigException {
+ String[] names;
+ StringBuilder sb = new StringBuilder(profile.version.toString().length()
+ + 1 + profile.type.toString().length());
+ sb.append(profile.version.toString());
+ sb.append(TYPE_SEPARATOR);
+ sb.append(profile.type.toString());
+ switch(profile.type) {
+ // Full profile should recognize version base name and full name.
+ case FULL:
+ names = new String[2];
+ names[0] = profile.version.toString();
+ names[1] = sb.toString();
+ break;
+ // Web profile should regognize full name only .
+ case WEB:
+ names = new String[1];
+ names[0] = sb.toString();
+ break;
+ // This is unrechable in regular conditions.
+ default:
+ throw new ServerConfigException(
+ ServerConfigException.INVALID_EE_PLATFORM_TYPE);
+ }
+ return names;
+ }
+
+ /**
+ * Returns a <code>JavaEEProfile</code> with a value represented by the
+ * specified <code>String</code>. The <code>JavaEEProfile</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param name Value containing <code>JavaEEProfile</code>
+ * <code>toString</code> representation.
+ * @return <code>JavaEEProfile</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static JavaEEProfile toValue(final String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns a <code>JavaEEProfile</code> with a value represented by the
+ * specified <code>version</code> and <code>type</code>
+ * <code>String</code>s. The <code>JavaEEProfile</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param version Value containing <code>JavaEEProfile</code> version
+ * <code>toString</code> representation.
+ * @param type Value containing <code>JavaEEProfile</code> type
+ * <code>toString</code> representation.
+ * @return <code>JavaEEProfile</code> value represented
+ * by code>version</code> and <code>type</code> <code>String</code>
+ * or <code>null</code> if value was not recognized.
+ */
+ public static JavaEEProfile toValue(
+ final String version, final String type) {
+ if (version != null && type != null) {
+ StringBuilder sb
+ = new StringBuilder(version.length() + 1 + type.length());
+ sb.append(version);
+ sb.append(TYPE_SEPARATOR);
+ sb.append(type);
+ return (stringValuesMap.get(sb.toString().toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JavaEE profile version. */
+ private final Version version;
+
+ /** JavaEE profile type. */
+ private final Type type;
+
+ /** Name of JavaEE profile value. */
+ private final String name;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of JavaEE profiles supported by Payara.
+ * <p/>
+ * @param version JavaEE profile version.
+ * @param type JavaEE profile type.
+ * @param name Name of JavaEE profile value.
+ */
+ private JavaEEProfile(
+ final Version version, final Type type, final String name) {
+ this.version = version;
+ this.type = type;
+ this.name = name;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Converts JavaEE profile version value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ /**
+ * Get profile type.
+ * <p/>
+ * @return Profile type.
+ */
+ public Type getType() {
+ return type;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEESet.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEESet.java
new file mode 100644
index 0000000..b744a8e
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaEESet.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.modules.payara.tooling.server.parser.JavaEEModuleReader;
+import org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileCheckReader;
+import org.netbeans.modules.payara.tooling.server.parser.JavaEEProfileReader;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+
+/**
+ * Container of Payara JavaEE features configuration.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaEESet extends JavaSet {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Modules retrieved from XML elements. */
+ private final List<JavaEEModuleReader.Module> modules;
+
+ /** Profiles retrieved from XML elements. */
+ private final List<JavaEEProfileReader.Profile> profiles;
+
+ /** Java EE platform checks retrieved from XML elements. */
+ private final Map<String, List<String>> checks;
+
+ /** Java EE platform check results cache. */
+ private final Map<String, Boolean> checkResults;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of container of Payara JavaEE features
+ * configuration.
+ * <p/>
+ * @param modules Modules retrieved from XML elements.
+ * @param profiles Profiles retrieved from XML elements.
+ * @param version Highest JavaEE specification version implemented.
+ */
+ public JavaEESet(final List<JavaEEModuleReader.Module> modules,
+ final List<JavaEEProfileReader.Profile> profiles,
+ final List<JavaEEProfileCheckReader.Check> checks,
+ final String version) {
+ super(version);
+ this.modules = Collections.unmodifiableList(modules);
+ this.profiles = Collections.unmodifiableList(profiles);
+ Map<String, List<String>> checksMap
+ = new HashMap<>(checks.size());
+ for (JavaEEProfileCheckReader.Check check : checks) {
+ checksMap.put(check.getName(), check.getFiles());
+ }
+ this.checks = Collections.unmodifiableMap(checksMap);
+ this.checkResults = new HashMap<>(checks.size());
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get modules retrieved from XML elements.
+ * <p/>
+ * @return Modules retrieved from XML elements.
+ */
+ public List<JavaEEModuleReader.Module> getModules() {
+ return modules;
+ }
+
+ /**
+ * Get profiles retrieved from XML elements.
+ * <p/>
+ * @return Profiles retrieved from XML elements.
+ */
+ public List<JavaEEProfileReader.Profile> getProfiles() {
+ return profiles;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get existing cached check result or run a new check if no such cached
+ * check result exists.
+ * <p/>
+ * Cached check results depends on provided <code>classpathHome</code>
+ * and they should be reset before <code>classpathHome</code> will
+ * be changed.
+ * <p/>
+ * @param name Name of check to be run.
+ * @param classpathHome Classpath search prefix.
+ */
+ private boolean check(final String name, final File classpathHome) {
+ // No name given means check passed.
+ if (name == null) {
+ return true;
+ }
+ Boolean result = checkResults.get(name);
+ if (result != null) {
+ return result.booleanValue();
+ }
+ List<String> files = checks.get(name);
+ boolean resultValue = true;
+ if (files != null && !files.isEmpty()) {
+ for (String fileName : files) {
+ File file = ServerUtils.getJarName(
+ classpathHome.getAbsolutePath(), fileName);
+ if (file == null || !file.exists()) {
+ resultValue = false;
+ }
+ }
+ }
+ checkResults.put(name, Boolean.valueOf(resultValue));
+ return resultValue;
+ }
+
+ /**
+ * Reset cached check results before using another class path search prefix.
+ */
+ public void reset() {
+ checkResults.clear();
+ }
+
+ /**
+ * Build {@link Set} of {@link ModuleType} for known module types retrieved
+ * from XML elements.
+ * <p/>
+ * @param classpathHome Classpath search prefix.
+ * @return {@link Set} of {@link ModuleType} for known module types.
+ */
+ public Set<ModuleType> moduleTypes(final File classpathHome) {
+ int size = modules != null ? modules.size() : 0;
+ EnumSet<ModuleType> typesSet = EnumSet.noneOf(ModuleType.class);
+ if (size > 0) {
+ for (JavaEEModuleReader.Module module : modules) {
+ ModuleType type = ModuleType.toValue(module.getType());
+ if (type != null && check(module.getCheck(), classpathHome)) {
+ typesSet.add(type);
+ }
+ }
+ }
+ return typesSet;
+ }
+
+ /**
+ * Build {@link Set} of {@link JavaEEProfile} for known JavaEE profiles
+ * retrieved from XML elements.
+ * <p/>
+ * @param classpathHome Classpath search prefix.
+ * @return {@link Set} of {@link ModuleType} for known profiles.
+ */
+ public Set<JavaEEProfile> profiles(final File classpathHome) {
+ int size = profiles != null ? profiles.size() : 0;
+ EnumSet<JavaEEProfile> profilesSet
+ = EnumSet.noneOf(JavaEEProfile.class);
+ if (size > 0) {
+ for (JavaEEProfileReader.Profile profileFromXML : profiles) {
+ JavaEEProfile profile = JavaEEProfile.toValue(
+ profileFromXML.getVersion(), profileFromXML.getType());
+ if (profile != null
+ && check(profileFromXML.getCheck(), classpathHome)) {
+ profilesSet.add(profile);
+ }
+ }
+ }
+ return profilesSet;
+ }
+
+}
+
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSEPlatform.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSEPlatform.java
new file mode 100644
index 0000000..9d37405
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSEPlatform.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * JavaSE platforms supported by Payara.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum JavaSEPlatform {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JavaSE 1.1. */
+ v1_1,
+ /** JavaSE 1.2. */
+ v1_2,
+ /** JavaSE 1.3. */
+ v1_3,
+ /** JavaSE 1.4. */
+ v1_4,
+ /** JavaSE 1.5. */
+ v1_5,
+ /** JavaSE 1.6. */
+ v1_6,
+ /** JavaSE 1.7. */
+ v1_7,
+ /** JavaSE 1.8. */
+ v1_8,
+ /** JavaSE 11. */
+ v11;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara JavaEE platform enumeration length. */
+ public static final int length = JavaSEPlatform.values().length;
+
+ /** JavaEE platform version elements separator character. */
+ public static final char SEPARATOR = '.';
+
+ /** A <code>String</code> representation of v1_1 value. */
+ static final String V1_1_STR = "1.1";
+
+ /** A <code>String</code> representation of v1_2 value. */
+ static final String V1_2_STR = "1.2";
+
+ /** A <code>String</code> representation of v1_3 value. */
+ static final String V1_3_STR = "1.3";
+
+ /** A <code>String</code> representation of v1_4 value. */
+ static final String V1_4_STR = "1.4";
+
+ /** A <code>String</code> representation of v1_5 value. */
+ static final String V1_5_STR = "1.5";
+
+ /** A <code>String</code> representation of v1_6 value. */
+ static final String V1_6_STR = "1.6";
+
+ /** A <code>String</code> representation of v1_7 value. */
+ static final String V1_7_STR = "1.7";
+
+ /** A <code>String</code> representation of v1_8 value. */
+ static final String V1_8_STR = "1.8";
+
+ /** A <code>String</code> representation of v11 value. */
+ static final String V11_STR = "11";
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, JavaSEPlatform> stringValuesMap
+ = new HashMap<>(values().length);
+
+ // Initialize backward String conversion Map.
+ static {
+ for (JavaSEPlatform platform : JavaSEPlatform.values()) {
+ stringValuesMap.put(platform.toString().toUpperCase(), platform);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>JavaSEPlatform</code> with a value represented by the
+ * specified <code>String</code>. The <code>JavaSEPlatform</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param platformName Value containing <code>JavaSEPlatform</code>
+ * <code>toString</code> representation.
+ * @return <code>JavaSEPlatform</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static JavaSEPlatform toValue(final String platformName) {
+ if (platformName != null) {
+ return (stringValuesMap.get(platformName.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert JavaEE platform version value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case v1_1: return V1_1_STR;
+ case v1_2: return V1_2_STR;
+ case v1_3: return V1_3_STR;
+ case v1_4: return V1_4_STR;
+ case v1_5: return V1_5_STR;
+ case v1_6: return V1_6_STR;
+ case v1_7: return V1_7_STR;
+ case v1_8: return V1_8_STR;
+ case v11: return V11_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new ServerConfigException(
+ ServerConfigException.INVALID_SE_PLATFORM_VERSION);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSESet.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSESet.java
new file mode 100644
index 0000000..79999b7
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSESet.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */package org.netbeans.modules.payara.tooling.server.config;
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Container of Payara JavaSE features configuration.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaSESet extends JavaSet {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Platforms retrieved from XML elements. */
+ private final List<String> platforms;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of container of Payara JavaSE features
+ * configuration.
+ * <p/>
+ * @param platforms Platforms retrieved from XML elements.
+ * @param version Highest JavaSE specification version implemented.
+ */
+ public JavaSESet(final List<String> platforms, final String version) {
+ super(version);
+ this.platforms = platforms;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get platforms retrieved from XML elements.
+ * <p/>
+ * @return Platforms retrieved from XML elements.
+ */
+ public List<String> getPlatforms() {
+ return platforms;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build {@link Set} of {@link JavaSEPlatform} for known platforms
+ * retrieved from XML elements.
+ * <p/>
+ * @return {@link Set} of {@link JavaSEPlatform} for known platforms.
+ */
+ public Set<JavaSEPlatform> platforms() {
+ int size = platforms != null ? platforms.size() : 0;
+ EnumSet<JavaSEPlatform> platformsSet
+ = EnumSet.noneOf(JavaSEPlatform.class);
+ if (size > 0) {
+ for (String name : platforms) {
+ JavaSEPlatform type = JavaSEPlatform.toValue(name);
+ if (type != null) {
+ platformsSet.add(type);
+ }
+ }
+ }
+ return platformsSet;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSet.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSet.java
new file mode 100644
index 0000000..2ccf10d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/JavaSet.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+/**
+ * Abstract Container of Payara Java features configuration.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public abstract class JavaSet {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Highest Java specification version implemented. */
+ private final String version;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of container of Payara Java features
+ * configuration.
+ * <p/>
+ * @param version Highest JavaEE specification version implemented.
+ */
+ public JavaSet(final String version) {
+ this.version = version;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get highest JavaEE specification version implemented.
+ * <p/>
+ * @return Highest JavaEE specification version implemented.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/LibraryNode.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/LibraryNode.java
new file mode 100644
index 0000000..72fd677
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/LibraryNode.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+/**
+ * Internal library node element.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class LibraryNode {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Library ID. */
+ final String libraryID;
+
+ /** Class path file set. */
+ final FileSet classpath;
+
+ /** Java doc file set. */
+ final FileSet javadocs;
+
+ /** Java sources file set. */
+ final FileSet sources;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of internal library node element.
+ * <p/>
+ * @param libraryID Library ID.
+ * @param classpath Class path file set
+ * @param javadocs Java doc file set.
+ * @param sources Java sources file set.
+ */
+ public LibraryNode(final String libraryID, final FileSet classpath,
+ final FileSet javadocs, final FileSet sources) {
+ this.libraryID = libraryID;
+ this.classpath = classpath;
+ this.javadocs = javadocs;
+ this.sources = sources;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ModuleType.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ModuleType.java
new file mode 100644
index 0000000..2fbd285
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ModuleType.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * JavaEE modules supported by Payara.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public enum ModuleType {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** The module is an EAR archive. */
+ EAR,
+ /** The module is an Enterprise Java Bean archive. */
+ EJB,
+ /** The module is an Client Application archive. */
+ CAR,
+ /** The module is an Connector archive. */
+ RAR,
+ /** The module is an Web Application archive. */
+ WAR;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara JavaEE profile enumeration length. */
+ public static final int length = ModuleType.values().length;
+
+ /** A <code>String</code> representation of EAR value. */
+ static final String EAR_STR = "ear";
+
+ /** A <code>String</code> representation of EJB value. */
+ static final String EJB_STR = "ejb";
+
+ /** A <code>String</code> representation of CAR value. */
+ static final String CAR_STR = "car";
+
+ /** A <code>String</code> representation of RAR value. */
+ static final String RAR_STR = "rar";
+
+ /** A <code>String</code> representation of WAR value. */
+ static final String WAR_STR = "war";
+
+ /**
+ * Stored <code>String</code> values for backward <code>String</code>
+ * conversion.
+ */
+ private static final Map<String, ModuleType> stringValuesMap
+ = new HashMap<>(2 * values().length);
+
+ // Initialize backward String conversion Map.
+ static {
+ for (ModuleType profile : ModuleType.values()) {
+ stringValuesMap.put(profile.toString().toUpperCase(), profile);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>ModuleType</code> with a value represented by the
+ * specified <code>String</code>. The <code>ModuleType</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param stateStr Value containing <code>ModuleType</code>
+ * <code>toString</code> representation.
+ * @return <code>ModuleType</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static ModuleType toValue(final String stateStr) {
+ if (stateStr != null) {
+ return (stringValuesMap.get(stateStr.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert module type name to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ switch (this) {
+ case EAR: return EAR_STR;
+ case EJB: return EJB_STR;
+ case CAR: return CAR_STR;
+ case RAR: return RAR_STR;
+ case WAR: return WAR_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new ServerConfigException(
+ ServerConfigException.INVALID_MODULE_TYPE_NAME);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigManager.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigManager.java
new file mode 100644
index 0000000..7ba8624
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigManager.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.net.URL;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+
+/**
+ * Payara configuration manager.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraConfigManager {
+
+ /**
+ * Get Payara configuration access object.
+ * <p/>
+ * @param configFile Payara configuration XML file.
+ * @return Payara configuration API.
+ */
+ public static PayaraConfig getConfig(URL configFile) {
+ return new PayaraConfigXMLImpl(configFile);
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigXMLImpl.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigXMLImpl.java
new file mode 100644
index 0000000..e01d501
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigXMLImpl.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.net.URL;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.parser.ConfigReaderServer;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+
+/**
+ * Payara configuration reader API.
+ * <p/>
+ * Allows to access Payara server features and libraries configuration
+ * XML file using configuration XML file parser.
+ * <p/>
+ * XML configuration file reader is called only once. Any subsequent
+ * configuration values access will return values cached from first attempt.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraConfigXMLImpl implements PayaraConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara configuration XML file. */
+ private final URL configFile;
+
+ /** Payara configuration XML file reader. */
+ private final ConfigReaderServer reader = new ConfigReaderServer();
+
+ /** Stores information whether Payara configuration XML file
+ * was already read and processed */
+ private volatile boolean readDone;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara configuration API.
+ * <p/>
+ * @param configFile Payara configuration XML file.
+ */
+ public PayaraConfigXMLImpl(final URL configFile) {
+ this.configFile = configFile;
+ readDone = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara libraries configuration.
+ * <p/>
+ * @return Payara libraries configuration.
+ */
+ @Override
+ public List<LibraryNode> getLibrary() {
+ readXml();
+ return reader.getLibraries();
+ }
+
+ /**
+ * Get Payara JavaEE configuration.
+ * <p/>
+ * @return Payara JavaEE configuration.
+ */
+ @Override
+ public JavaEESet getJavaEE() {
+ readXml();
+ return reader.getJavaEE();
+ }
+
+ /**
+ * Get Payara JavaSE configuration.
+ * <p/>
+ * @return Payara JavaSE configuration.
+ */
+ @Override
+ public JavaSESet getJavaSE() {
+ readXml();
+ return reader.getJavaSE();
+ }
+
+ /**
+ * Get Payara tools configuration.
+ * <p/>
+ * @return Payara tools configuration.
+ */
+ @Override
+ public Tools getTools() {
+ readXml();
+ return reader.getTools();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Make sure Payara configuration XML file was read and processed.
+ */
+ private void readXml() {
+ if (readDone)
+ return;
+ synchronized(reader) {
+ if (!readDone) {
+ TreeParser.readXml(configFile, reader);
+ readDone = true;
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraTool.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraTool.java
new file mode 100644
index 0000000..8444047
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraTool.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+/**
+ * Payara tool.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public abstract class PayaraTool {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Tools library directory (relative under Payara home). */
+ private final String lib;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara tool.
+ * <p/>
+ * @param lib Tools library directory (relative under Payara home).
+ */
+ public PayaraTool(final String lib) {
+ this.lib = lib;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get tools library directory (relative under Payara home).
+ * <p/>
+ * @return Tools library directory (relative under Payara home).
+ */
+ public String getLib() {
+ return lib;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV3.xml b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV3.xml
new file mode 100644
index 0000000..a3f35dc
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV3.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+-->
+<server>
+ <tools lib="modules">
+ <asadmin jar="admin-cli.jar"/>
+ </tools>
+ <java version="1.6">
+ <platform version="1.6"/>
+ <platform version="1.7"/>
+ <platform version="1.8"/>
+ </java>
+ <javaee version="1.6">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ <include name="jersey-core.jar"/>
+ </fileset>
+ <fileset dir="modules/endorsed">
+ <include name=".+\.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 1">
+ <classpath>
+ <fileset dir="modules">
+ <include name="asm-all-repackaged\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ <include name="jsr.+-api\.jar"/>
+ <include name="mimepull\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/com/sun/jersey/glassfish/v32/jersey-gfv3-docs-and-samples/1.13/jersey-gfv3-docs-and-samples-1.13-project.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="jsr311-api.jar"/>
+ <include name="jersey-core.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV4.xml b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV4.xml
new file mode 100644
index 0000000..f65b50b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV4.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+-->
+<server>
+ <tools lib="lib">
+ <asadmin jar="client/appserver-cli.jar"/>
+ </tools>
+ <java version="1.7">
+ <platform version="1.7"/>
+ <platform version="1.8"/>
+ </java>
+ <javaee version="1.7">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <profile version="1.7" type="web"/>
+ <profile version="1.7" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="cdi-api.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="jaxr-api-osgi.jar"/>
+ <include name="jaxrpc-api-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ </fileset>
+ <fileset dir="modules/endorsed">
+ <include name=".+\.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 2">
+ <classpath>
+ <fileset dir="modules">
+ <include name="guava.+\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.0-m05-2/jersey-documentation-2.0-m05-2-docbook.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax.ws.rs-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5.xml b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5.xml
new file mode 100644
index 0000000..f413c99
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+-->
+<server>
+ <tools lib="lib">
+ <asadmin jar="client/appserver-cli.jar"/>
+ </tools>
+ <java version="1.8">
+ <platform version="1.8"/>
+ </java>
+ <javaee version="1.8">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <profile version="1.7" type="web"/>
+ <profile version="1.7" type="full" check="full"/>
+ <profile version="1.8" type="web"/>
+ <profile version="1.8" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="cdi-api.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="jaxr-api-osgi.jar"/>
+ <include name="jaxrpc-api-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ </fileset>
+ <fileset dir="modules/endorsed">
+ <include name=".+\.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 2">
+ <classpath>
+ <fileset dir="modules">
+ <include name="guava.+\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.0-m05-2/jersey-documentation-2.0-m05-2-docbook.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax.ws.rs-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5_192.xml b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5_192.xml
new file mode 100644
index 0000000..ba7de9f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/PayaraV5_192.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+-->
+<server>
+ <tools lib="lib">
+ <asadmin jar="client/appserver-cli.jar"/>
+ </tools>
+ <java version="1.8">
+ <platform version="1.8"/>
+ <platform version="11"/>
+ </java>
+ <javaee version="1.8">
+ <profile version="1.3" type="full"/>
+ <profile version="1.4" type="full"/>
+ <profile version="1.5" type="full"/>
+ <profile version="1.6" type="web"/>
+ <profile version="1.6" type="full" check="full"/>
+ <profile version="1.7" type="web"/>
+ <profile version="1.7" type="full" check="full"/>
+ <profile version="1.8" type="web"/>
+ <profile version="1.8" type="full" check="full"/>
+ <module type="war"/>
+ <module type="car" check="full"/>
+ <module type="ear" check="full"/>
+ <module type="ejb" check="full"/>
+ <module type="rar" check="full"/>
+ <check name="full">
+ <file path="appclient-server-core.jar"/>
+ </check>
+ </javaee>
+ <library id="Java EE">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax\..+\.jar"/>
+ <include name="bean-validator.jar"/>
+ <include name="cdi-api.jar"/>
+ <include name="jaxb-osgi.jar"/>
+ <include name="jaxr-api-osgi.jar"/>
+ <include name="jaxrpc-api-osgi.jar"/>
+ <include name="webservices-osgi.jar"/>
+ <include name="weld-osgi-bundle.jar"/>
+ </fileset>
+ <fileset dir="../mq/lib">
+ <include name="jaxm-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <lookup path="docs/javaee-doc-api.jar"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="Jersey 2">
+ <classpath>
+ <fileset dir="modules">
+ <include name="guava.+\.jar"/>
+ <include name="jackson.+\.jar"/>
+ <!-- include name="javax.ws.+\.jar"/ -->
+ <include name="jersey.+\.jar"/>
+ <include name="jettison.*\.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ <link url="http://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.0-m05-2/jersey-documentation-2.0-m05-2-docbook.zip"/>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+ <library id="JAX-RS">
+ <classpath>
+ <fileset dir="modules">
+ <include name="javax.ws.rs-api.jar"/>
+ </fileset>
+ </classpath>
+ <javadocs>
+ </javadocs>
+ <sources>
+ </sources>
+ </library>
+</server>
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ServerConfigException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ServerConfigException.java
new file mode 100644
index 0000000..52bcac9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/ServerConfigException.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Payara IDE SDK Exception related to server configuration problems.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ServerConfigException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Exception message for invalid Payara JavaSE profile version. */
+ static final String INVALID_SE_PLATFORM_VERSION
+ = "Invalid Payara JavaSE version";
+
+ /** Exception message for invalid Payara JavaEE profile type. */
+ static final String INVALID_EE_PLATFORM_TYPE
+ = "Invalid Payara JavaEE profile type";
+
+ /** Exception message for invalid Payara module type name. */
+ static final String INVALID_MODULE_TYPE_NAME
+ = "Invalid Payara module type name";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> without
+ * detail message.
+ */
+ public ServerConfigException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public ServerConfigException(final String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public ServerConfigException(final String msg, final Object... arguments) {
+ super(msg, arguments);
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ServerConfigException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Tools.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Tools.java
new file mode 100644
index 0000000..68dbbf4
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/config/Tools.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import org.netbeans.modules.payara.tooling.data.ToolsConfig;
+
+/**
+ * Payara tools.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class Tools implements ToolsConfig {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Asadmin tool. */
+ private final AsadminTool asadmin;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Payara tools.
+ * <p/>
+ * @param asadmin Payara asadmin tool.
+ */
+ public Tools(AsadminTool asadmin) {
+ this.asadmin = asadmin;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get asadmin tool.
+ * <p/>
+ * @return Asadmin tool.
+ */
+ @Override
+ public AsadminTool getAsadmin() {
+ return asadmin;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/AbstractReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/AbstractReader.java
new file mode 100644
index 0000000..84c7df6
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/AbstractReader.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+/**
+ * Abstract XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public abstract class AbstractReader extends TreeParser.NodeListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Tree parser element path. */
+ final String path;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE platform check configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ * @param node XML element name.
+ */
+ AbstractReader(final String pathPrefix, final String node) {
+ StringBuilder sb = new StringBuilder(
+ (pathPrefix != null ? pathPrefix.length() : 0)
+ + TreeParser.PATH_SEPARATOR.length() + node.length());
+ if (pathPrefix != null)
+ sb.append(pathPrefix);
+ sb.append(TreeParser.PATH_SEPARATOR);
+ sb.append(node);
+ path = sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get current element tree parser path.
+ * <p/>
+ * @return Current element tree parser path.
+ */
+ String getPath() {
+ return path;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReader.java
new file mode 100644
index 0000000..edf0e22
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReader.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Common library configuration XML elements reader.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class ConfigReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>fileset</code> XML element reader. */
+ final FilesetReader filesetReader = new FilesetReader();
+
+ /** <code>file</code> XML element reader. */
+ final PathReader pathReader
+ = new PathReader("/server/library/classpath");
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get file sets retrieved from XML elements.
+ * <p/>
+ * @return File sets retrieved from XML elements.
+ */
+ Map<String, List<String>> getFilesets() {
+ return filesetReader.getFilesets();
+ }
+
+ /**
+ * Get paths retrieved from XML elements.
+ * <p/>
+ * @return Paths sets retrieved from XML elements.
+ */
+ List<String> getPaths() {
+ return pathReader.getPaths();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ void reset() {
+ filesetReader.reset();
+ pathReader.reset();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderClasspath.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderClasspath.java
new file mode 100644
index 0000000..d31af63
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderClasspath.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+
+/**
+ * <code>classpath</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderClasspath extends ConfigReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for internal <code>javadocs</code> elements.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new Path("/server/library/classpath/file", pathReader));
+ paths.add(new Path("/server/library/classpath/fileset", filesetReader));
+ return paths;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJava.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJava.java
new file mode 100644
index 0000000..512a392
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJava.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Abstract Java configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public abstract class ConfigReaderJava
+extends AbstractReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>version</code> XML element attribute name. */
+ private static final String VERSION_ATTR = "version";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Highest JavaEE specification version implemented. */
+ private String version;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE configuration XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ * @param node XML element name.
+ */
+ ConfigReaderJava(final String pathPrefix, String node) {
+ super(pathPrefix, node);
+ version = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ version = attributes.getValue(VERSION_ATTR);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get highest JavaEE specification version implemented.
+ * <p/>
+ * @return Highest JavaEE specification version implemented.
+ */
+ String getVersion() {
+ return version;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ void reset() {
+ version = null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaEE.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaEE.java
new file mode 100644
index 0000000..9cabb1a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaEE.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.JavaEESet;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Java EE configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderJavaEE extends ConfigReaderJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>javaee</code> XML element name. */
+ static final String NODE = "javaee";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>profile</code> XML element reader. */
+ private final JavaEEProfileReader profileReader;
+
+ /** <code>module</code> XML element reader. */
+ private final JavaEEModuleReader moduleReader;
+
+ /**<code>check</code> XML element reader. */
+ private final JavaEEProfileCheckReader checkReader;
+
+ /** JavaEE set for Payara features configuration read from XML. */
+ JavaEESet javaEE;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE configuration XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ ConfigReaderJavaEE(final String pathPrefix) {
+ super(pathPrefix, NODE);
+ profileReader = new JavaEEProfileReader(path);
+ moduleReader = new JavaEEModuleReader(path);
+ checkReader = new JavaEEProfileCheckReader(path);
+ javaEE = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for <code>javaee</code> element and it's content.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new TreeParser.Path(path, this));
+ paths.add(new TreeParser.Path(profileReader.getPath(), profileReader));
+ paths.add(new TreeParser.Path(moduleReader.getPath(), moduleReader));
+ paths.addAll(checkReader.getPathsToListen());
+ return paths;
+ }
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ super.readAttributes(qname, attributes);
+ }
+
+ /**
+ * Finish <code>javaee</code> element processing.
+ * <p/>
+ * @param qname Current XML element name.
+ * @throws ServerConfigException when more than one <code>javaee</code>
+ * XML elements were found.
+ */
+ @Override
+ public void endNode(final String qname) throws SAXException {
+ if (NODE.equals(qname)) {
+ if (javaEE != null) {
+ throw new SAXException(
+ "Multiple " + NODE + " XML element is not allowed.");
+ }
+ javaEE = new JavaEESet(
+ getModules(), getProfiles(), getChecks(), getVersion());
+ reset();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get profiles retrieved from XML elements.
+ * <p/>
+ * @return Profiles retrieved from XML elements.
+ */
+ private List<JavaEEProfileReader.Profile> getProfiles() {
+ return profileReader.getProfiles();
+ }
+
+ /**
+ * Get modules retrieved from XML elements.
+ * <p/>
+ * @return Modules sets retrieved from XML elements.
+ */
+ private List<JavaEEModuleReader.Module> getModules() {
+ return moduleReader.getModules();
+ }
+
+ /**
+ * Get Java EE platform checks retrieved from XML elements.
+ * <p/>
+ * @return Java EE platform checks retrieved from XML elements.
+ */
+ private List<JavaEEProfileCheckReader.Check> getChecks() {
+ return checkReader.getChecks();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ @Override
+ void reset() {
+ super.reset();
+ profileReader.reset();
+ moduleReader.reset();
+ checkReader.reset();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaSE.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaSE.java
new file mode 100644
index 0000000..4dc303a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavaSE.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Java SE configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderJavaSE extends ConfigReaderJava {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>java</code> XML element name. */
+ static final String NODE = "java";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>platform</code> XML element reader. */
+ private final JavaSEPlatformReader platformReader;
+
+ /** JavaSE set for Payara features configuration read from XML. */
+ JavaSESet javaSE;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE configuration XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ ConfigReaderJavaSE(final String pathPrefix) {
+ super(pathPrefix, NODE);
+ platformReader = new JavaSEPlatformReader(path);
+ javaSE = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for <code>java</code> element and it's content.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new TreeParser.Path(path, this));
+ paths.add(new TreeParser.Path(
+ platformReader.getPath(), platformReader));
+ return paths;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ super.readAttributes(qname, attributes);
+ }
+
+ /**
+ * Finish <code>java</code> element processing.
+ * <p/>
+ * @param qname Current XML element name.
+ * @throws ServerConfigException when more than one <code>java</code>
+ * XML elements were found.
+ */
+ @Override
+ public void endNode(final String qname) throws SAXException {
+ if (NODE.equals(qname)) {
+ if (javaSE != null) {
+ throw new SAXException(
+ "Multiple " + NODE + " XML element is not allowed.");
+ }
+ javaSE = new JavaSESet(getPlatforms(), getVersion());
+ reset();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get platforms retrieved from XML elements.
+ * <p/>
+ * @return Platforms retrieved from XML elements.
+ */
+ private List<String> getPlatforms() {
+ return platformReader.getPlatforms();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ @Override
+ void reset() {
+ super.reset();
+ platformReader.reset();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavadocs.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavadocs.java
new file mode 100644
index 0000000..c8066af
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderJavadocs.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+
+/**
+ * <code>javadocs</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderJavadocs extends ConfigReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>link</code> XML element reader. */
+ private final LinkReader linkReader = new LinkReader();
+
+ /** <code>lookup</code> XML element reader. */
+ private final LookupReader lookupReader = new LookupReader();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for internal <code>javadocs</code> elements.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new Path("/server/library/javadocs/file", pathReader));
+ paths.add(new Path("/server/library/javadocs/fileset", filesetReader));
+ paths.add(new Path("/server/library/javadocs/link", linkReader));
+ paths.add(new Path("/server/library/javadocs/lookup", lookupReader));
+ return paths;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get links retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ List<String> getLinks() {
+ return linkReader.getLinks();
+ }
+
+ /**
+ * Get lookups retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ List<String> getLookups() {
+ return lookupReader.getLookups();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ @Override
+ void reset() {
+ super.reset();
+ linkReader.reset();
+ lookupReader.reset();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderServer.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderServer.java
new file mode 100644
index 0000000..8c69909
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderServer.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.FileSet;
+import org.netbeans.modules.payara.tooling.server.config.JavaEESet;
+import org.netbeans.modules.payara.tooling.server.config.JavaSESet;
+import org.netbeans.modules.payara.tooling.server.config.LibraryNode;
+import org.netbeans.modules.payara.tooling.server.config.Tools;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Whole <code>server</code> configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderServer extends TreeParser.NodeListener implements
+ XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>classpath</code> library configuration XML element reader. */
+ private ConfigReaderClasspath classpathReader = new ConfigReaderClasspath();
+
+ /** <code>javadocs</code> library configuration XML element reader. */
+ private ConfigReaderJavadocs javadocsReader = new ConfigReaderJavadocs();
+
+ /** <code>sources</code> library configuration XML element reader. */
+ private ConfigReaderSources sourcesReader = new ConfigReaderSources();
+
+ /** Java SE configuration XML element reader. */
+ private ConfigReaderJavaSE javaSEReader = new ConfigReaderJavaSE("/server");
+
+ /** Java EE configuration XML element reader. */
+ private ConfigReaderJavaEE javaEEReader = new ConfigReaderJavaEE("/server");
+
+ /** Tools configuration XML element reader. */
+ private ConfigReaderTools configReaderTools
+ = new ConfigReaderTools("/server");
+
+ /** Libraries read from XML file. */
+ private List<LibraryNode> libraries = new LinkedList<>();
+
+ /** Library ID. */
+ private String actualLibID;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for <code>server</code> element and it's content.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ ArrayList<Path> paths = new ArrayList<>(14);
+ paths.add(new Path("/server/library", this));
+ paths.addAll(classpathReader.getPathsToListen());
+ paths.addAll(javadocsReader.getPathsToListen());
+ paths.addAll(sourcesReader.getPathsToListen());
+ paths.addAll(javaSEReader.getPathsToListen());
+ paths.addAll(javaEEReader.getPathsToListen());
+ paths.addAll(configReaderTools.getPathsToListen());
+ return paths;
+ }
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname,
+ final Attributes attributes) throws SAXException {
+ actualLibID = attributes.getValue("id");
+ }
+
+ /**
+ * Finish <code>javaee</code> element processing.
+ * <p/>
+ * @param qname Current XML element name.
+ * @throws ServerConfigException when more than one <code>javaee</code>
+ * XML elements were found.
+ */
+ @Override
+ public void endNode(final String qname) throws SAXException {
+ if ("library".equals(qname)) {
+ FileSet classpath = new FileSet(classpathReader.getPaths(),
+ classpathReader.getFilesets());
+ FileSet javadocs = new FileSet(javadocsReader.getPaths(),
+ javadocsReader.getLinks(),
+ javadocsReader.getFilesets(),
+ javadocsReader.getLookups());
+ FileSet sources = new FileSet(sourcesReader.getPaths(),
+ sourcesReader.getFilesets());
+ LibraryNode config = new LibraryNode(actualLibID, classpath,
+ javadocs,
+ sources);
+ libraries.add(config);
+ actualLibID = null;
+ classpathReader.reset();
+ javadocsReader.reset();
+ sourcesReader.reset();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get libraries read from XML file.
+ * <p/>
+ * @return Libraries read from XML file.
+ */
+ public List<LibraryNode> getLibraries() {
+ return libraries;
+ }
+
+ /**
+ * Get JavaEE set for Payara features configuration read from XML.
+ * <p/>
+ * @return JavaEE set for Payara features configuration read from XML.
+ */
+ public JavaEESet getJavaEE() {
+ return javaEEReader.javaEE;
+ }
+
+ /**
+ * Get JavaSE set for Payara features configuration read from XML.
+ * <p/>
+ * @return JavaSE set for Payara features configuration read from XML.
+ */
+ public JavaSESet getJavaSE() {
+ return javaSEReader.javaSE;
+ }
+
+ /**
+ * Get Payara tools configuration read from XML.
+ * <p/>
+ * @return Payara tools configuration read from XML.
+ */
+ public Tools getTools() {
+ return configReaderTools.tools;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderSources.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderSources.java
new file mode 100644
index 0000000..288d420
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderSources.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * <code>sources</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderSources extends ConfigReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for internal <code>javadocs</code> elements.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new TreeParser.Path("/server/library/sources/file", pathReader));
+ paths.add(new TreeParser.Path("/server/library/sources/fileset", filesetReader));
+ return paths;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderTools.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderTools.java
new file mode 100644
index 0000000..0a5f863
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ConfigReaderTools.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.AsadminTool;
+import org.netbeans.modules.payara.tooling.server.config.Tools;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Tools configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ConfigReaderTools extends AbstractReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>tools</code> XML element name. */
+ static final String NODE = "tools";
+
+ /** <code>lib</code> XML element attribute name. */
+ private static final String LIB_ATTR = "lib";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Tools library directory (relative under Payara home). */
+ private String lib;
+
+ /** <code>asadmin</code> XML element reader. */
+ private final ToolsAsadminReader toolsAsadminReader;
+
+ /** Tools configuration read from XML. */
+ Tools tools;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>tools</code> configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ ConfigReaderTools(final String pathPrefix) {
+ super(pathPrefix, NODE);
+ toolsAsadminReader = new ToolsAsadminReader(path);
+ lib = null;
+ tools = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for <code>tools</code> element and it's content.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new TreeParser.Path(path, this));
+ paths.add(new TreeParser.Path(
+ toolsAsadminReader.getPath(), toolsAsadminReader));
+ return paths;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ lib = attributes.getValue(LIB_ATTR);
+ }
+
+ /**
+ * Finish <code>tools</code> element processing.
+ * <p/>
+ * @param qname Current XML element name.
+ * @throws ServerConfigException when more than one <code>tools</code>
+ * XML elements were found.
+ */
+ @Override
+ public void endNode(final String qname) throws SAXException {
+ if (NODE.equals(qname)) {
+ if (tools != null) {
+ throw new SAXException(
+ "Multiple " + NODE + " XML element is not allowed.");
+ }
+ tools = new Tools(new AsadminTool(getLib(), getJar()));
+ reset();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get tools library directory (relative under Payara home).
+ * <p/>
+ * @return Tools library directory (relative under Payara home).
+ */
+ String getLib() {
+ return lib;
+ }
+
+ /**
+ * Get asadmin tool JAR.
+ * <p/>
+ * @return Asadmin tool JAR.
+ */
+ String getJar() {
+ return toolsAsadminReader.getJar();
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ void reset() {
+ lib = null;
+ toolsAsadminReader.reset();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/FilesetReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/FilesetReader.java
new file mode 100644
index 0000000..1bccbbb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/FilesetReader.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>fileset</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class FilesetReader extends TreeParser.NodeListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** File sets retrieved from XML elements. */
+ private Map<String, List<String>> filesets
+ = new HashMap<String, List<String>>();
+
+ /** File set being actually processed. */
+ private List<String> actualFileset = null;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ String dirName = attributes.getValue("dir");
+ if ((actualFileset = filesets.get(dirName)) == null) {
+ actualFileset = new ArrayList<>();
+ filesets.put(dirName, actualFileset);
+ }
+ }
+
+ /**
+ * Process child elements from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readChildren(final String qname, final Attributes attributes)
+ throws SAXException {
+ actualFileset.add(attributes.getValue("name"));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get file sets retrieved from XML elements.
+ * <p/>
+ * @return File sets retrieved from XML elements.
+ */
+ public Map<String, List<String>> getFilesets() {
+ return filesets;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ filesets = new HashMap<String, List<String>>();
+ actualFileset = null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpData.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpData.java
new file mode 100644
index 0000000..db069c0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpData.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+/**
+ * Data holder for port informations from domain.xml.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class HttpData {
+
+ private final String id;
+ private final int port;
+ private final boolean secure;
+
+ public HttpData(String id, int port, boolean secure) {
+ this.id = id;
+ this.port = port;
+ this.secure = secure;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public boolean isSecure() {
+ return secure;
+ }
+
+ @Override
+ public String toString() {
+ return "{ " + id + ", " + port + ", " + secure + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpListenerReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpListenerReader.java
new file mode 100644
index 0000000..5efa71f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/HttpListenerReader.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads configuration of http listeners from domain.xml.
+ * For each http listener returns one {@link HttpData} object that
+ * contains name of listener, port number and information whether
+ * this listener is secured.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class HttpListenerReader extends TargetConfigReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(HttpListenerReader.class);
+
+ public static final String DEFAULT_PATH =
+ "/domain/configs/config/http-service/http-listener";
+
+ private String path;
+
+ private Map<String, HttpData> result;
+
+ public HttpListenerReader(String targetConfigName) {
+ this(DEFAULT_PATH, targetConfigName);
+ }
+
+ public HttpListenerReader(String path, String targetConfigName) {
+ super(targetConfigName);
+ this.path = path;
+ this.result = new HashMap<String, HttpData>();
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ final String METHOD = "readAttributes";
+ // <http-listener
+ // id="http-listener-1" port="8080" xpowered-by="true"
+ // enabled="true" address="0.0.0.0" security-enabled="false"
+ // family="inet" default-virtual-server="server"
+ // server-name="" blocking-enabled="false" acceptor-threads="1">
+ if (readData) {
+ try {
+ String id = attributes.getValue("id");
+ if (id != null && id.length() > 0) {
+ int port = Integer.parseInt(attributes.getValue("port"));
+ boolean secure = Boolean.TRUE.toString().equals(attributes.
+ getValue("security-enabled"));
+ boolean enabled = !Boolean.FALSE.toString().
+ equals(attributes.
+ getValue("enabled"));
+ LOGGER.log(Level.INFO, METHOD, "port", new Object[] {
+ Integer.toString(port), Boolean.toString(enabled),
+ Boolean.toString(secure)});
+ if (enabled) {
+ HttpData data = new HttpData(id, port, secure);
+ LOGGER.log(Level.INFO, METHOD, "add", data);
+ result.put(id, data);
+ }
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "noName");
+ }
+ } catch (NumberFormatException ex) {
+ LOGGER.log(Level.SEVERE, METHOD, "numberFormat", ex);
+ }
+ }
+ }
+
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<TreeParser.Path>();
+ paths.add(new Path(path, this));
+ paths.add(new Path(CONFIG_PATH, new TargetConfigMarker()));
+ return paths;
+ }
+
+ public Map<String, HttpData> getResult() {
+ return result;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEModuleReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEModuleReader.java
new file mode 100644
index 0000000..230fae9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEModuleReader.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.ServerConfigException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>module</code> Java EE configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaEEModuleReader extends AbstractReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java EE module values from XML element. */
+ public class Module {
+
+ /** Java EE module type. */
+ final String type;
+
+ /** Java EE module check reference. */
+ final String check;
+
+ /**
+ * Creates an instance of Java EE module values from XML element.
+ * <p/>
+ * @param type Java EE module type.
+ * @param check Java EE module check reference.
+ */
+ Module(final String type, final String check) {
+ this.type = type;
+ this.check = check;
+ }
+
+ /**
+ * Get Java EE module type.
+ * <p/>
+ * @return Java EE module type.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Get Java EE module check reference.
+ * <p/>
+ * @return Java EE module check reference.
+ */
+ public String getCheck() {
+ return check;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>javaee</code> XML element name. */
+ private static final String NODE = "module";
+
+ /** <code>type</code> XML element attribute name. */
+ private static final String TYPE_ATTR = "type";
+
+ /** <code>check</code> XML element attribute name. */
+ private static final String CHECK_ATTR = "check";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Modules retrieved from XML elements. */
+ private List<Module> modules;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>module</code> Java EE configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ JavaEEModuleReader(final String pathPrefix) throws ServerConfigException {
+ super(pathPrefix, NODE);
+ modules = new LinkedList<>();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ modules.add(new Module(attributes.getValue(TYPE_ATTR),
+ attributes.getValue(CHECK_ATTR)));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get modules retrieved from XML elements.
+ * <p/>
+ * @return Modules retrieved from XML elements.
+ */
+ public List<Module> getModules() {
+ return modules;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ modules = new LinkedList<>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileCheckReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileCheckReader.java
new file mode 100644
index 0000000..a8351f0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileCheckReader.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Java EE platform check configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaEEProfileCheckReader
+ extends AbstractReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java EE platform check values from XML element. */
+ public class Check {
+
+ /** Java EE platform check name (unique ID). */
+ final String name;
+
+ /** Java EE platform check files. */
+ List<String> files;
+
+ /**
+ * Creates an instance of Java EE platform check values
+ * from XML element.
+ * <p/>
+ * Internal file list to check is initialized as an empty list.
+ * <p/>
+ * @param name Java EE platform check name (unique ID).
+ */
+ Check(final String name) {
+ this.name = name;
+ this.files = null;
+ }
+
+ /**
+ * Set Java EE platform check files.
+ * <p/>
+ * @param files Java EE platform check files.
+ */
+ void setFiles(final List<String> files) {
+ this.files = files;
+ }
+
+ /**
+ * Get Java EE platform check name (unique ID).
+ * <p/>
+ * @return Java EE platform check name (unique ID).
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get Java EE platform check files.
+ * <p/>
+ * @return Java EE platform check files.
+ */
+ public List<String> getFiles() {
+ return files;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>check</code> XML element name. */
+ static final String NODE = "check";
+
+ /** <code>name</code> XML element attribute name. */
+ private static final String NAME_ATTR = "name";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java EE platform check value from XML element. */
+ Check currentCheck;
+
+ /** All Java EE platform check values from XML elements on this level. */
+ List<Check> checks;
+
+ /** <code>file</code> XML element reader. */
+ final PathReader pathReader;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE platform check configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ JavaEEProfileCheckReader(final String pathPrefix) {
+ super(pathPrefix, NODE);
+ pathReader = new PathReader(path);
+ checks = new LinkedList<>();
+ currentCheck = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get all Java EE platform check values from XML elements on this level.
+ * <p/>
+ * @return All Java EE platform check values from XML elements on this level.
+ */
+ List<Check> getChecks() {
+ return checks;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // XML reader methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Provide paths to listen on.
+ * <p/>
+ * Sets readers for <code>javaee</code> element and it's content.
+ * <p/>
+ * @return Paths that the reader listens to.
+ */
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new TreeParser.Path(path, this));
+ paths.add(new TreeParser.Path(pathReader.getPath(), pathReader));
+ return paths;
+ }
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ currentCheck = new Check(attributes.getValue(NAME_ATTR));
+ }
+
+ /**
+ * Finish <code>javaee</code> element processing.
+ * <p/>
+ * @param qname Current XML element name.
+ * @throws ServerConfigException when more than one <code>javaee</code>
+ * XML elements were found.
+ */
+ @Override
+ public void endNode(final String qname) throws SAXException {
+ if (NODE.equals(qname)) {
+ currentCheck.setFiles(pathReader.getPaths());
+ checks.add(currentCheck);
+ localReset();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader to allow reading of next element
+ * on the same level.
+ */
+ private void localReset() {
+ currentCheck = null;
+ pathReader.reset();
+ }
+
+ /**
+ * Full reset of XML element reader.
+ */
+ public void reset() {
+ localReset();
+ checks = new LinkedList<>();
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileReader.java
new file mode 100644
index 0000000..54eaaff
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaEEProfileReader.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.ServerConfigException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>profile</code> Java EE configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaEEProfileReader extends AbstractReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java EE profile values from XML element. */
+ public class Profile {
+
+ /** Java EE profile version. */
+ final String version;
+
+ /** Java EE profile type. */
+ final String type;
+
+ /** Java EE profile check reference. */
+ final String check;
+
+ /**
+ * Creates an instance of Java EE profile values from XML element.
+ * <p/>
+ * @param version Java EE profile version.
+ * @param type Java EE profile type.
+ * @param check Java EE profile check reference.
+ */
+ Profile(final String version, final String type, final String check) {
+ this.version = version;
+ this.type = type;
+ this.check = check;
+ }
+
+ /**
+ * Get Java EE profile version.
+ * <p/>
+ * @return Java EE profile version.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Get Java EE profile type.
+ * <p/>
+ * @return Java EE profile type.
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Get Java EE profile check reference.
+ * <p/>
+ * @return Java EE profile check reference.
+ */
+ public String getCheck() {
+ return check;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>javaee</code> XML element name. */
+ private static final String NODE = "profile";
+
+ /** <code>version</code> XML element attribute name. */
+ private static final String VERSION_ATTR = "version";
+
+ /** <code>type</code> XML element attribute name. */
+ private static final String TYPE_ATTR = "type";
+
+ /** <code>check</code> XML element attribute name. */
+ private static final String CHECK_ATTR = "check";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Profiles retrieved from XML elements. */
+ private List<Profile> profiles;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>profile</code> Java EE configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ JavaEEProfileReader(final String pathPrefix) throws ServerConfigException {
+ super(pathPrefix, NODE);
+ profiles = new LinkedList<>();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ profiles.add(new Profile(attributes.getValue(VERSION_ATTR),
+ attributes.getValue(TYPE_ATTR),
+ attributes.getValue(CHECK_ATTR)));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get profiles retrieved from XML elements.
+ * <p/>
+ * @return Profiles retrieved from XML elements.
+ */
+ public List<Profile> getProfiles() {
+ return profiles;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ profiles = new LinkedList<>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaSEPlatformReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaSEPlatformReader.java
new file mode 100644
index 0000000..fa3b25c
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JavaSEPlatformReader.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.config.ServerConfigException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>platform</code> Java SE configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JavaSEPlatformReader extends AbstractReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>platform</code> XML element name. */
+ private static final String NODE = "platform";
+
+ /** <code>type</code> XML element attribute name. */
+ private static final String VERSION_ATTR = "version";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Platforms retrieved from XML elements. */
+ private List<String> platforms;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>platform</code> Java EE configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ JavaSEPlatformReader(final String pathPrefix) throws ServerConfigException {
+ super(pathPrefix, NODE);
+ platforms = new LinkedList<>();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ platforms.add(attributes.getValue(VERSION_ATTR));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get platforms retrieved from XML elements.
+ * <p/>
+ * @return Platforms retrieved from XML elements.
+ */
+ public List<String> getPlatforms() {
+ return platforms;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ platforms = new LinkedList<>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JmxConnectorReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JmxConnectorReader.java
new file mode 100644
index 0000000..8a56271
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JmxConnectorReader.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reader for jmx connector port number as string from domain.xml.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class JmxConnectorReader extends TargetConfigReader implements XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(JmxConnectorReader.class);
+
+ public static final String DEFAULT_PATH =
+ "/domain/configs/config/admin-service/jmx-connector";
+
+ private String path;
+
+ private String result;
+
+ public JmxConnectorReader(String path, String targetConfigName) {
+ super(targetConfigName);
+ this.path = path;
+ }
+
+ public JmxConnectorReader(String targetConfigName) {
+ this(DEFAULT_PATH, targetConfigName);
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes)
+ throws SAXException {
+ final String METHOD = "getServerConfig";
+ /*
+ <admin-service type="das-and-server" system-jmx-connector-name="system">
+ <jmx-connector ..... port="8686" />
+ */
+ if (readData) {
+ String jmxAttr = attributes.getValue("port");
+ try {
+ int port = Integer.parseInt(jmxAttr);
+ result = "" + port; //$NON-NLS-1$
+ LOGGER.log(Level.INFO, METHOD, "port", result);
+ } catch (NumberFormatException ex) {
+ LOGGER.log(Level.SEVERE, METHOD, "error", ex);
+ }
+ }
+
+ }
+
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<TreeParser.Path>();
+ paths.add(new Path(path, this));
+ paths.add(new Path(CONFIG_PATH, new TargetConfigMarker()));
+ return paths;
+ }
+
+ public String getResult() {
+ return result;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JvmConfigReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JvmConfigReader.java
new file mode 100644
index 0000000..6c92314
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/JvmConfigReader.java
@@ -0,0 +1,274 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.tooling.data.JDKVersion;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.NodeListener;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class JvmConfigReader extends NodeListener implements XMLReader {
+
+ private static String JVM_OPTIONS_TAG = "jvm-options";
+
+ private String serverName;
+ /**
+ * Holds all values found in <jvm-options> tags
+ */
+ private List<JvmOption> jvmOptions = new ArrayList<>();
+ /**
+ * Holds all key-value pairs representing attributes of jvm-config tag.
+ * These are used for computing the classpath.
+ */
+ private HashMap<String, String> propMap = new HashMap<>();
+ private boolean isMonitoringEnabled = false;
+ private String serverConfigName;
+ private boolean readConfig = false;
+ private StringBuilder b = new StringBuilder();
+
+ public JvmConfigReader(String serverName) {
+ this.serverName = serverName;
+ }
+
+ public TreeParser.NodeListener getServerFinder() {
+ return new TreeParser.NodeListener() {
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <server lb-weight="100" name="server" config-ref="server-config">
+ if (serverConfigName == null || serverConfigName.length() == 0) {
+ if (serverName.equals(attributes.getValue("name"))) { // NOI18N
+ serverConfigName = attributes.getValue("config-ref"); // NOI18N
+ //Logger.getLogger("payara").finer("DOMAIN.XML: Server profile defined by " + serverConfigName); // NOI18N
+ }
+ }
+ }
+ };
+ }
+
+ public TreeParser.NodeListener getConfigFinder() {
+ return new TreeParser.NodeListener() {
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <config name="server-config" dynamic-reconfiguration-enabled="true">
+ if (serverConfigName != null && serverConfigName.equals(attributes.getValue("name"))) { // NOI18N
+ readConfig = true;
+ //Logger.getLogger("payara").finer("DOMAIN.XML: Reading JVM options from server profile " + serverConfigName); // NOI18N
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ if ("config".equals(qname)) {
+ readConfig = false;
+ }
+ }
+ };
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+// <java-config
+// classpath-prefix="CP-PREFIX"
+// classpath-suffix="CP-SUFFIX"
+// debug-enabled="false"
+// debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009"
+// env-classpath-ignored="false"
+// java-home="${com.sun.aas.javaRoot}"
+// javac-options="-g"
+// native-library-path-prefix="NATIVE-LIB-PREFIX"
+// native-library-path-suffix="NATIVE-LIB-SUFFIX"
+// rmic-options="-iiop -poa -alwaysgenerate -keepgenerated -g"
+// server-classpath="SERVER-CLASSPATH"
+// system-classpath="SYSTEM-CLASSPATH">
+ if (readConfig) {
+ int attrLen = attributes.getLength();
+ for (int i = 0; i < attrLen; i++) {
+ String name = attributes.getLocalName(i);
+ // seems that sometimes from uknown reasons
+ // getLocalName returns empty string...
+ if ((name == null) || name.isEmpty()) {
+ name = attributes.getQName(i);
+ }
+ String value = attributes.getValue(i);
+ if (name != null && name.length() > 0 && value != null && value.length() > 0) {
+ propMap.put(name, value);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void readCData(String qname, char[] ch, int start, int length) throws SAXException {
+// <jvm-options>-client</jvm-options>
+// <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
+ if (readConfig && JVM_OPTIONS_TAG.equals(qname)) {
+ b.append(ch, start, length);
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ if (readConfig && JVM_OPTIONS_TAG.equals(qname)) {
+ jvmOptions.add(new JvmOption(b.toString()));
+ b.delete(0, b.length());
+ }
+ }
+
+ public TreeParser.NodeListener getMonitoringFinder() {
+ return new TreeParser.NodeListener() {
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws SAXException {
+ // <monitoring-service [monitoring-enabled="false"]
+ if (readConfig) {
+ isMonitoringEnabled = !"false".equals(attributes.getValue("monitoring-enabled"));
+// if (monitoringAgent.exists()) {
+// if (!"false".equals(attributes.getValue("monitoring-enabled"))) { // NOI18N
+// //optList.add("-javaagent:"+Utils.quote(monitoringAgent.getAbsolutePath())+"=unsafe=true,noServer=true"); // NOI18N
+// isMonitoringEnabled = true;
+// }
+// }
+ }
+ }
+ };
+ }
+
+// private NodeListener getOptionsReader() {
+// return new NodeListener() {
+//
+//
+// @Override
+// public void endNode(String qname) throws SAXException {
+// if (readJvmConfig) {
+// optList.add(b.toString());
+// b.delete(0, b.length());
+// }
+// }
+//
+// };
+// }
+//
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<>();
+ paths.add(new Path("/domain/servers/server", getServerFinder()));
+ paths.add(new Path("/domain/configs/config", getConfigFinder()));
+ paths.add(new Path("/domain/configs/config/java-config", this));
+ paths.add(new Path("/domain/configs/config/monitoring-service", getMonitoringFinder()));
+ return paths;
+ }
+
+ public List<JvmOption> getJvmOptions() {
+ return jvmOptions;
+ }
+
+ public Map<String, String> getPropMap() {
+ return propMap;
+ }
+
+ public boolean isMonitoringEnabled() {
+ return isMonitoringEnabled;
+ }
+
+ public static class JvmOption {
+
+ public final String option;
+ public final Optional<JDKVersion> minVersion;
+ public final Optional<JDKVersion> maxVersion;
+
+ // splits the versioned JVM option pattern into three groups:
+ // Gr1 Gr2 Gr3
+ // <> <> <------------>
+ // Ex: [1.7|1.8]-XX:MyJvmOption (both min and max version present)
+ // Below examples have missing verisions, with is also OK
+ // Ex: [|1.8]-XX:MyJvmOption (only max version present)
+ // Ex: [1.7|]-XX:MyJvmOption (only min version present)
+ // Gr1 or Gr2 can be null (optional)
+ private static final Pattern PATTERN = Pattern.compile("^\\[(.*)\\|(.*)\\](.*)");
+
+ public JvmOption(String option) {
+ Matcher matcher = PATTERN.matcher(option);
+ if (matcher.matches()) {
+ this.minVersion = Optional.ofNullable(JDKVersion.toValue(matcher.group(1)));
+ this.maxVersion = Optional.ofNullable(JDKVersion.toValue(matcher.group(2)));
+ this.option = matcher.group(3);
+ } else {
+ this.option = option;
+ this.minVersion = Optional.empty();
+ this.maxVersion = Optional.empty();
+ }
+ }
+
+ public JvmOption(String option, String minVersion, String maxVersion) {
+ this.option = option;
+ this.minVersion = Optional.ofNullable(JDKVersion.toValue(minVersion));
+ this.maxVersion = Optional.ofNullable(JDKVersion.toValue(maxVersion));
+ }
+
+ public static boolean hasVersionPattern(String option) {
+ return PATTERN.matcher(option).matches();
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 79 * hash + Objects.hashCode(this.option);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final JvmOption other = (JvmOption) obj;
+ if (!Objects.equals(this.option, other.option)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ if (!minVersion.isPresent() && !maxVersion.isPresent()) {
+ return option;
+ }
+ return String.format("[%s|%s]%s", minVersion.isPresent() ? minVersion.get() : "", maxVersion.isPresent() ? maxVersion.get() : "", option);
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LinkReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LinkReader.java
new file mode 100644
index 0000000..35d273d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LinkReader.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>link</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class LinkReader extends TreeParser.NodeListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Links retrieved from XML elements. */
+ private List<String> links = new LinkedList<>();
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ links.add(attributes.getValue("url"));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get links retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ public List<String> getLinks() {
+ return links;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ links = new LinkedList<>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LogMessages.properties
new file mode 100644
index 0000000..8045158
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LogMessages.properties
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# HttpListenerReader class
+HttpListenerReader.readAttributes.port=HTTP listener port {0} enabled {1} \
+secure-enabled {2}.
+HttpListenerReader.readAttributes.add=Adding {0}.
+HttpListenerReader.readAttributes.noName=HTTP listener found with no name.
+HttpListenerReader.readAttributes.numberFormat=Error reading HTTP listener:
+
+# JmxConnectorReader class
+JmxConnectorReader.getServerConfig.port=JMX port {0}
+JmxConnectorReader.getServerConfig.error=Error reading JMX port:
+
+# NetworkListenerReader class
+NetworkListenerReader.readAttributes.port=Network listener port {0} \
+enabled {1} secure-enabled {2}.
+NetworkListenerReader.readAttributes.add=Adding {0}.
+NetworkListenerReader.readAttributes.noName=Network listener found with no name.
+NetworkListenerReader.readAttributes..numberFormat=Error reading network \
+listener:
+
+# TreeParser class
+TreeParser.readXml.cantClose=Cannot close XML file input stream:
+TreeParser.startElement.skipReading=Skip reading {0}.
+TreeParser.startElement.skipDescend=Skip descend, depth is {0}, qn is {1}.
+TreeParser.startElement.roverDescend=Rover descend to {0}.
+TreeParser.startElement.roverEnter=Rover enter and read node {0}.
+TreeParser.startElement.skipStart=Skip start, depth is {0}, qn is {1}.
+TreeParser.endElement.doesNotMatch=Skip {0} does not match {1} at depth {2}.
+TreeParser.endElement.skipAscend=Skip ascend, depth is {0}.
+TreeParser.endElement.roverEnter=Rover exit and read node {0}.
+TreeParser.endElement.roverAscend=Rover ascend to {0}.
+TreeParser.buildTree.invalidNoParts=Invalid entry, no parts, skipping {0}.
+TreeParser.buildTree.invalidNullRoot=Invalid entry, null root, skipping {0}.
+TreeParser.buildTree.createdRootNode=Created root node {0}.
+TreeParser.buildTree.existing=Existing node {0} at level {1}.
+TreeParser.buildTree.add=Adding node {0} at level {1}.
+TreeParser.buildTree.broken=Broken parts found in {0} at level {1}.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LookupReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LookupReader.java
new file mode 100644
index 0000000..ded4f0d
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/LookupReader.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>lookup</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class LookupReader extends TreeParser.NodeListener {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Lookups retrieved from XML elements. */
+ private List<String> lookups = new LinkedList<>();
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ lookups.add(attributes.getValue("path"));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get lookups retrieved from XML elements.
+ * <p/>
+ * @return Links sets retrieved from XML elements.
+ */
+ public List<String> getLookups() {
+ return lookups;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ lookups = new LinkedList<String>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/NetworkListenerReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/NetworkListenerReader.java
new file mode 100644
index 0000000..f897c88
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/NetworkListenerReader.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads configuration of network listeners.
+ * For each listener returns one {@link HttpData} object that contains
+ * port number, protocol and information whether this protocol is secured.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class NetworkListenerReader extends TargetConfigReader implements
+ XMLReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(NetworkListenerReader.class);
+
+ public static final String DEFAULT_PATH =
+ "/domain/configs/config/network-config/network-listeners/network-listener";
+
+ private String path;
+
+ private Map<String, HttpData> result;
+
+ public NetworkListenerReader(String targetConfigName) {
+ this(DEFAULT_PATH, targetConfigName);
+ }
+
+ public NetworkListenerReader(String path, String targetConfigName) {
+ super(targetConfigName);
+ this.path = path;
+ this.result = new HashMap<String, HttpData>();
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ final String METHOD = "readAttributes";
+ /*
+ <network-listeners>
+ <thread-pool max-thread-pool-size="20" min-thread-pool-size="2" thread-pool-id="http-thread-pool" max-queue-size="4096"></thread-pool>
+ <network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
+ <network-listener port="8181" enabled="false" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
+ <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>
+ </network-listeners>
+ */
+ if (readData) {
+ try {
+ String id = attributes.getValue("name");
+ if (id != null && id.length() > 0) {
+
+ if (attributes.getValue("port").startsWith("$")) { // ignore these template entries
+ return;
+ }
+ int port = Integer.parseInt(attributes.getValue("port"));
+ boolean secure = "true".equals(attributes.getValue(
+ "security-enabled"));
+ boolean enabled = !"false".equals(attributes.getValue(
+ "enabled"));
+ LOGGER.log(Level.INFO, METHOD, "port", new Object[] {
+ Integer.toString(port), Boolean.toString(enabled),
+ Boolean.toString(secure)});
+ if (enabled) {
+ HttpData data = new HttpData(id, port, secure);
+ LOGGER.log(Level.INFO, METHOD, "add", data);
+ result.put(id, data);
+ }
+ } else {
+ LOGGER.log(Level.INFO, METHOD, "noName");
+ }
+ } catch (NumberFormatException ex) {
+ LOGGER.log(Level.SEVERE, METHOD, "numberFormat", ex);
+ }
+ }
+ }
+
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<TreeParser.Path>();
+ paths.add(new Path(path, this));
+ paths.add(new Path(CONFIG_PATH, new TargetConfigMarker()));
+ return paths;
+ }
+
+ public Map<String, HttpData> getResult() {
+ return result;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/PathReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/PathReader.java
new file mode 100644
index 0000000..4407538
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/PathReader.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>file</code> library configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PathReader extends AbstractReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>file</code> XML element name. */
+ static final String NODE = "file";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Paths retrieved from XML elements. */
+ private List<String> paths = new LinkedList<>();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of Java EE platform check configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ PathReader(final String pathPrefix) {
+ super(pathPrefix, NODE);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ paths.add(attributes.getValue("path"));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get paths retrieved from XML elements.
+ * <p/>
+ * @return Paths sets retrieved from XML elements.
+ */
+ public List<String> getPaths() {
+ return paths;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ public void reset() {
+ paths = new LinkedList<>();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ResourcesReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ResourcesReader.java
new file mode 100644
index 0000000..4781e9f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ResourcesReader.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.NodeListener;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads resources from domain.xml.
+ * User has to specify an {@link ResourceType} which specifies
+ * path and name of attribute value of which will be the key
+ * in returned map.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ResourcesReader extends NodeListener implements
+ XMLReader {
+
+ /**
+ * Paths and key names for various resource types.
+ */
+ public enum ResourceType {
+
+ JDBC_RESOURCE("/resources/jdbc-resource", "jndi-name"),
+ JDBC_CONNECTION_POOL("/resources/jdbc-connection-pool", "name"),
+ JAVA_MAIL("/resources/mail-resource", "jndi-name"),
+ CONNECTOR_RESOURCE("/resources/connector-resource", "jndi-name"),
+ CONNECTOR_POOL("/resources/connector-connection-pool", "name"),
+ ADMIN_OBJECT_RESOURCE("/resources/admin-object-resource", "jndi-name");
+
+ private String defaultKeyName;
+
+ private String defaultPath;
+
+ private ResourceType(String defaultPath, String defaultKeyName) {
+ this.defaultPath = defaultPath;
+ this.defaultKeyName = defaultKeyName;
+ }
+
+ public String getDefaultPath() {
+ return defaultPath;
+ }
+
+ public String getDefaultKeyName() {
+ return defaultKeyName;
+ }
+ }
+
+ private String path;
+
+ private String keyName;
+
+ private Map<String, String> properties = null;
+
+ private Map<String, Map<String, String>> resourceData =
+ new HashMap<String, Map<String, String>>();
+
+ public ResourcesReader(ResourceType type) {
+ this(type.getDefaultPath(), type.getDefaultKeyName());
+ }
+
+ public ResourcesReader(String path, String keyName) {
+ this.path = path;
+ this.keyName = keyName;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ properties = new HashMap<String, String>();
+
+ String resourceName = attributes.getValue(keyName);
+ properties.put(keyName, resourceName);
+
+ int attrLen = attributes.getLength();
+ for (int i = 0 ; i < attrLen ; i++) {
+ String name = attributes.getQName(i);
+ String value = attributes.getValue(i);
+ if (name != null && name.length() > 0 && value != null && value.
+ length() > 0) {
+ properties.put(name, value);
+ }
+ }
+ }
+
+ @Override
+ public void readChildren(String qname, Attributes attributes) throws
+ SAXException {
+ String propName = qname + "." + attributes.getValue("name"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put(propName, attributes.getValue("value")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ String poolName = properties.get(keyName);
+ resourceData.put(poolName, properties);
+ }
+
+ @Override
+ public List<TreeParser.Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<TreeParser.Path>();
+ paths.add(new Path(path, this));
+ return paths;
+ }
+
+ public Map<String, Map<String, String>> getResourceData() {
+ return resourceData;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigNameReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigNameReader.java
new file mode 100644
index 0000000..2372413
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigNameReader.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.Path;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Reads the name of the configuration for given target (server
+ * or cluster).
+ * TODO now it reads only servers and not clusters...
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class TargetConfigNameReader extends TreeParser.NodeListener implements
+ XMLReader {
+
+ public static final String SERVER_PATH =
+ "/domain/servers/server";
+
+ public static final String DEFAULT_TARGET = "server";
+
+ private String targetConfigName = null;
+
+ private String targetName;
+
+ public TargetConfigNameReader() {
+ this(DEFAULT_TARGET);
+ }
+
+ public TargetConfigNameReader(String targetName) {
+ this.targetName = targetName;
+ }
+
+ public String getTargetConfigName() {
+ return targetConfigName;
+ }
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ if (attributes.getValue("name").equalsIgnoreCase(targetName)) {
+ targetConfigName = attributes.getValue("config-ref");
+ }
+ }
+
+ @Override
+ public List<Path> getPathsToListen() {
+ LinkedList<TreeParser.Path> paths = new LinkedList<TreeParser.Path>();
+ paths.add(new Path(SERVER_PATH, this));
+ return paths;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigReader.java
new file mode 100644
index 0000000..9b3da6f
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TargetConfigReader.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser.NodeListener;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Marks that the xml parser is currently inside config element with
+ * give name.
+ * This information is used by descendants of this class.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+class TargetConfigReader extends NodeListener {
+
+ public static final String CONFIG_PATH =
+ "/domain/configs/config";
+
+ public static final String DEFAULT_TARGET = "server";
+
+ protected static boolean readData = false;
+
+ private String targetConfigName = null;
+
+ public TargetConfigReader(String targetConfigName) {
+ this.targetConfigName = targetConfigName;
+ // TODO all parsing has to be rewritten at some point
+ this.readData = false;
+ }
+
+ class TargetConfigMarker extends NodeListener {
+
+
+ @Override
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ if ((targetConfigName != null) && attributes.getValue("name").equalsIgnoreCase(targetConfigName)) {
+ readData = true;
+ }
+ }
+
+ @Override
+ public void endNode(String qname) throws SAXException {
+ if ("config".equals(qname)) {
+ readData = false;
+ }
+ }
+
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ToolsAsadminReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ToolsAsadminReader.java
new file mode 100644
index 0000000..501749b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/ToolsAsadminReader.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import org.netbeans.modules.payara.tooling.server.config.ServerConfigException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * <code>asadmin</code> tool configuration XML element reader.
+ * <p/>
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class ToolsAsadminReader extends AbstractReader {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** <code>asadmin</code> XML element name. */
+ private static final String NODE = "asadmin";
+
+ /** <code>type</code> XML element attribute name. */
+ private static final String JAR_ATTR = "jar";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Platforms retrieved from XML elements. */
+ private String jar;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of <code>asadmin</code> tool configuration
+ * XML element reader.
+ * <p/>
+ * @param pathPrefix Tree parser path prefix to be prepended before
+ * current XML element.
+ */
+ ToolsAsadminReader(final String pathPrefix) throws ServerConfigException {
+ super(pathPrefix, NODE);
+ jar = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Tree parser methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Process attributes from current XML element.
+ * <p/>
+ * @param qname Not used.
+ * @param attributes List of XML attributes.
+ * @throws SAXException When any problem occurs.
+ */
+ @Override
+ public void readAttributes(final String qname, final Attributes attributes)
+ throws SAXException {
+ jar = attributes.getValue(JAR_ATTR);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get asadmin tool JAR.
+ * <p/>
+ * @return Asadmin tool JAR.
+ */
+ String getJar() {
+ return jar;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this XML element reader.
+ */
+ void reset() {
+ jar = null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TreeParser.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TreeParser.java
new file mode 100644
index 0000000..fa34fb9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/TreeParser.java
@@ -0,0 +1,479 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.io.*;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.*;
+import java.util.logging.Level;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * SAX parser that invokes a user defined node reader(s) on a list of xpath
+ * designated nodes.
+ * <p/>
+ * @author Peter Williams
+ */
+public final class TreeParser extends DefaultHandler {
+
+ /** XML elements path items separator. */
+ static final String PATH_SEPARATOR = "/";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(TreeParser.class);
+
+ private static final boolean isFinestLoggable = LOGGER.isLoggable(
+ Level.FINEST);
+
+ private static final boolean isFinerLoggable = LOGGER.
+ isLoggable(Level.FINER);
+
+ /**
+ * Stops SAX parser from accessing remote DTDs or schemas.
+ */
+ private static final EntityResolver DUMMY_RESOLVER = new EntityResolver() {
+ @Override
+ public InputSource resolveEntity(String string, String string1) throws
+ SAXException,
+ IOException {
+ return new InputSource(new StringReader(""));
+ }
+ };
+
+ public static boolean readXml(File xmlFile, XMLReader... pathList) {
+ return readXml(xmlFile, null, pathList);
+ }
+
+ public static boolean readXml(File xmlFile, Charset charset, XMLReader... pathList) {
+ final String METHOD = "readXml";
+ try {
+ // !PW FIXME what to do about entity resolvers? Timed out when
+ // looking up doctype for sun-resources.xml earlier today (Jul 10)
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ // !PW If namespace-aware is enabled, make sure localpart and
+ // qname are treated correctly in the handler code.
+ //
+ factory.setNamespaceAware(false);
+ SAXParser saxParser = factory.newSAXParser();
+ org.xml.sax.XMLReader reader = saxParser.getXMLReader();
+
+ reader.setEntityResolver(DUMMY_RESOLVER);
+ DefaultHandler handler = new TreeParser(pathList);
+ reader.setContentHandler(handler);
+
+ if (charset == null) {
+ InputStream is = new BufferedInputStream(new FileInputStream(xmlFile));
+ try {
+ reader.parse(new InputSource(is));
+ return true;
+ } finally {
+ try {
+ is.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ex);
+ }
+ }
+ } else {
+ Reader r = new InputStreamReader(new BufferedInputStream(new FileInputStream(xmlFile)), charset);
+ try {
+ reader.parse(new InputSource(r));
+ return true;
+ } finally {
+ try {
+ r.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ex);
+ }
+ }
+ }
+ } catch (ParserConfigurationException | SAXException | IOException ex) {
+ LOGGER.log(Level.INFO, null, ex);
+ }
+ return false;
+ }
+
+ public static boolean readXml(URL xmlFile, XMLReader... pathList)
+ throws IllegalStateException {
+ final String METHOD = "readXml";
+ boolean result = false;
+ InputStream is = null;
+ try {
+ // !PW FIXME what to do about entity resolvers? Timed out when
+ // looking up doctype for sun-resources.xml earlier today (Jul 10)
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ // !PW If namespace-aware is enabled, make sure localpart and
+ // qname are treated correctly in the handler code.
+ //
+ factory.setNamespaceAware(false);
+ SAXParser saxParser = factory.newSAXParser();
+ DefaultHandler handler = new TreeParser(pathList);
+ is = new BufferedInputStream(xmlFile.openStream());
+ saxParser.parse(new InputSource(is), handler);
+ result = true;
+ } catch (ParserConfigurationException | SAXException | IOException ex) {
+ throw new IllegalStateException(ex);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ex) {
+ LOGGER.log(Level.INFO, METHOD, "cantClose", ex);
+ }
+ }
+ }
+ return result;
+ }
+
+ // Parser internal state
+ private final TreeParser.Node root;
+
+ private TreeParser.Node rover;
+
+ // For skipping node blocks
+ private String skipping;
+
+ private int depth;
+
+ private TreeParser.NodeListener childNodeReader;
+
+ private TreeParser(XMLReader[] readers) {
+ ArrayList<Path> pathList = new ArrayList<>();
+ for (XMLReader r : readers) {
+ pathList.addAll(r.getPathsToListen());
+ }
+ root = buildTree(pathList);
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (childNodeReader != null) {
+ childNodeReader.readCData(skipping, ch, start, length);
+ }
+ }
+
+ @Override
+ public void startElement(String uri, String localname, String qname,
+ Attributes attributes) throws SAXException {
+ final String METHOD = "startElement";
+ if (skipping != null) {
+ depth++;
+ if (childNodeReader != null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "skipReading", qname);
+ }
+ childNodeReader.readChildren(qname, attributes);
+ }
+ if (isFinestLoggable) {
+ LOGGER.log(Level.FINEST, METHOD,
+ "skipDescend", new Object[] {depth, qname});
+ }
+ } else {
+ TreeParser.Node child = rover.findChild(qname);
+ if (child != null) {
+ rover = child;
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "roverDescend", rover);
+ }
+
+ TreeParser.NodeListener reader = rover.getReader();
+ if (reader != null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "roverEnter", qname);
+ }
+ reader.readAttributes(qname, attributes);
+ }
+ } else {
+ skipping = qname;
+ depth = 1;
+ childNodeReader = rover.getReader();
+ if (childNodeReader != null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "skipReading", qname);
+ }
+ childNodeReader.readChildren(qname, attributes);
+ }
+ if (isFinestLoggable) {
+ LOGGER.log(Level.FINEST, METHOD,
+ "skipStart", new Object[] {depth, qname});
+ }
+ }
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localname, String qname)
+ throws SAXException {
+ final String METHOD = "endElement";
+ if (skipping != null) {
+ if (childNodeReader != null) {
+ childNodeReader.endNode(qname);
+ }
+ if (--depth == 0) {
+ if (!skipping.equals(qname)) {
+ LOGGER.log(Level.WARNING, METHOD, "doesNotMatch",
+ new Object[] {skipping, qname, depth});
+ }
+ skipping = null;
+ childNodeReader = null;
+ }
+ LOGGER.log(Level.FINER, METHOD, "skipAscend", depth);
+ } else {
+ TreeParser.NodeListener reader = rover.getReader();
+ if (reader != null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "roverEnter", qname);
+ }
+ reader.endNode(qname);
+ }
+ rover = rover.getParent();
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "roverAscend", rover);
+ }
+ }
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ rover = root;
+ skipping = null;
+ depth = 0;
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ }
+
+ @Override
+ public InputSource resolveEntity(String string, String string1) throws
+ IOException,
+ SAXException {
+ return super.resolveEntity(string, string1);
+ }
+
+ public static abstract class NodeListener {
+
+ public void readAttributes(String qname, Attributes attributes) throws
+ SAXException {
+ }
+
+ public void readChildren(String qname, Attributes attributes) throws
+ SAXException {
+ }
+
+ public void readCData(String qname, char[] ch, int start, int length)
+ throws SAXException {
+ }
+
+ public void endNode(String qname) throws SAXException {
+ }
+ }
+
+ public static class Path {
+
+ private final String path;
+
+ private final TreeParser.NodeListener reader;
+
+ public Path(String path) {
+ this(path, null);
+ }
+
+ public Path(String path, TreeParser.NodeListener reader) {
+ this.path = path;
+ this.reader = reader;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public TreeParser.NodeListener getReader() {
+ return reader;
+ }
+
+ @Override
+ public String toString() {
+ return path;
+ }
+ }
+
+ private static TreeParser.Node buildTree(List<TreeParser.Path> paths) {
+ final String METHOD = "buildTree";
+ TreeParser.Node root = null;
+ for (TreeParser.Path path : paths) {
+ String[] parts = path.getPath().split("/");
+ if (parts == null || parts.length == 0) {
+ LOGGER.log(Level.WARNING, METHOD, "invalidNoParts", path);
+ continue;
+ }
+ if (parts[0] == null) {
+ LOGGER.log(Level.WARNING, METHOD, "invalidNullRoot", path);
+ continue;
+ }
+ if (root == null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD,
+ "createdRootNode", parts[0]);
+ }
+ root = new TreeParser.Node(parts[0]);
+ }
+ TreeParser.Node rover = root;
+ for (int i = 1 ; i < parts.length ; i++) {
+ if (parts[i] != null && parts[i].length() > 0) {
+ TreeParser.Node existing = rover.findChild(parts[i]);
+ if (existing != null) {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "existing",
+ new Object[] {parts[i],
+ Integer.toString(i)});
+ }
+ rover = existing;
+ } else {
+ if (isFinerLoggable) {
+ LOGGER.log(Level.FINER, METHOD, "add",
+ new Object[] {parts[i],
+ Integer.toString(i)});
+ }
+ rover = rover.addChild(parts[i]);
+ }
+ } else {
+ LOGGER.log(Level.WARNING, METHOD, "broken",
+ new Object[] {path, Integer.toString(i)});
+ }
+ }
+ if (rover != null) {
+ rover.setReader(path.getReader());
+ }
+ }
+ return root;
+ }
+
+ private static class Node implements Comparable<TreeParser.Node> {
+
+ private final String element;
+
+ private final Map<String, TreeParser.Node> children;
+
+ private TreeParser.Node parent;
+
+ private TreeParser.NodeListener reader;
+
+ public Node(String element) {
+ this(element, null);
+ }
+
+ private Node(String element, TreeParser.Node parent) {
+ this.element = element;
+ this.children = new HashMap<>();
+ this.parent = parent;
+ }
+
+ public TreeParser.Node addChild(String tag) {
+ TreeParser.Node child = new TreeParser.Node(tag, this);
+ children.put(tag, child);
+ return child;
+ }
+
+ public TreeParser.Node findChild(String tag) {
+ return children.get(tag);
+ }
+
+ public TreeParser.Node getParent() {
+ return parent;
+ }
+
+ public TreeParser.NodeListener getReader() {
+ return reader;
+ }
+
+ public void setReader(TreeParser.NodeListener reader) {
+ this.reader = reader;
+ }
+
+ @Override
+ public int compareTo(TreeParser.Node o) {
+ return element.compareTo(o.element);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TreeParser.Node other = (TreeParser.Node)obj;
+ if (this.element != other.element
+ && (this.element == null
+ || !this.element.equals(other.element))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 41 * hash + (this.element != null
+ ? this.element.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ boolean comma = false;
+ StringBuilder buf = new StringBuilder(500);
+ buf.append("{ ");
+ if (element != null && element.length() > 0) {
+ buf.append(element);
+ comma = true;
+ }
+ if (parent == null) {
+ if (comma) {
+ buf.append(", ");
+ }
+ buf.append("root");
+ comma = true;
+ }
+ if (children.size() > 0) {
+ if (comma) {
+ buf.append(", ");
+ }
+ buf.append(children.size());
+ buf.append(" sub(s)");
+ }
+ buf.append(" }");
+ return buf.toString();
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/XMLReader.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/XMLReader.java
new file mode 100644
index 0000000..950d411
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/parser/XMLReader.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.parser;
+
+import java.util.List;
+
+/**
+ * Interface for various implementations that read data from domain config (domain.xml).
+ *
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public interface XMLReader {
+
+ /**
+ * Every implementation needs to provide path objects.
+ * Path represents the xpath on which the reader wants to be notified.
+ *
+ * @return paths that the reader listens to
+ */
+ public List<TreeParser.Path> getPathsToListen();
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AbstractTask.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AbstractTask.java
new file mode 100644
index 0000000..6e6b47a
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AbstractTask.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheck;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Abstract task for server status verification.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public abstract class AbstractTask implements Runnable {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(AbstractTask.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Server status check job internal data. */
+ final StatusJob job;
+
+ /** Individual status check task data. */
+ final StatusJob.Task task;
+
+ /** Internal job status when this task was created. */
+ final StatusJobState jobState;
+
+ /** Server status check type. */
+ final PayaraStatusCheck type;
+
+ /** Listeners that want to know about command state. */
+ final TaskStateListener[] stateListeners;
+
+ /** Cancellation notification. */
+ boolean cancelled;
+
+ /**
+ * Creates an instance of abstract task for server status verification.
+ * <p/>
+ * @param job Server status check job internal data.
+ * @param task Individual status check task data.
+ * @param type Server status check type.
+ */
+ AbstractTask(final StatusJob job, final StatusJob.Task task,
+ final PayaraStatusCheck type) {
+ this.job = job;
+ this.task = task;
+ this.jobState = job.getState();
+ this.type = type;
+ this.stateListeners = task.getListeners();
+ this.cancelled = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Mark this task as canceled.
+ * <p/>
+ * Listeners won't be notified about server status verification task state
+ * change after task was canceled.
+ */
+ void cancel() {
+ cancelled = true;
+ }
+
+ /**
+ * Notify all registered task state listeners server status verification
+ * task state change.
+ * <p/>
+ * This method should be used after task is submitted into
+ * <code>ExecutorService</code>.
+ * <p/>
+ * @param taskState New task execution state.
+ * @param taskEvent Event related to execution state change.
+ * @param args Additional arguments.
+ */
+ void handleStateChange(final TaskState taskState,
+ final TaskEvent taskEvent, final String... args) {
+ if (stateListeners != null && !cancelled) {
+ for (int i = 0; i < stateListeners.length; i++) {
+ if (stateListeners[i] != null) {
+ stateListeners[i].operationStateChanged(taskState,
+ taskEvent, args);
+ }
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AdminPortTask.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AdminPortTask.java
new file mode 100644
index 0000000..8038026
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/AdminPortTask.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheck;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Individual server status check task to verify if server administration
+ * port is alive.
+ * <p/>
+ * @author Tomas Kraus
+ */
+class AdminPortTask extends AbstractTask {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(AdminPortTask.class);
+
+ /** Log message identifier suffix when using message with timestamp. */
+ private final String TM_SUFFIX = "Tm";
+
+ /** Task name for logging purposes. */
+ private final String TASK_NAME = "port-check";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Format time value in miliseconds to be printed as value in seconds
+ * and miliseconds
+ * <code>s.ms<code>.
+ * <p/>
+ * @param tm Time value in miliseconds
+ * @return Time string formated as econds and miliseconds
+ * <code>s.ms<code>.
+ */
+ static String tm(final long tm) {
+ StringBuilder sb = new StringBuilder(8);
+ sb.append(Long.toString(tm / 1000));
+ sb.append('.');
+ sb.append(Long.toString(tm % 1000));
+ return sb.toString();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Socked connecting timeout [ms]. */
+ int timeout;
+
+ /** Server administration port status check result. */
+ private StatusResult result;
+
+ /** Task start time. Used for logging purposes. Value of <code>-1</code>
+ * means that start time was not set.*/
+ private long tmStart;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of administration port status check.
+ * <p/>
+ * @param job Server status check job internal data.
+ * @param task Individual status check task data.
+ * @param timeout Socked connecting timeout.
+ */
+ AdminPortTask(final StatusJob job, final StatusJob.Task task,
+ final int timeout) {
+ super(job, task, PayaraStatusCheck.PORT);
+ this.timeout = timeout;
+ this.result = null;
+ this.tmStart = -1;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get last command task execution result.
+ * <p/>
+ * @return Last command task execution result.
+ */
+ StatusResult getResult() {
+ return result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Build arguments for operationStateChanged method listening for state
+ * changes.
+ * <p/>
+ * Send <code>false</code> display argument to operationStateChanged method
+ * to not display GUI message about this event.
+ * <p/>
+ * @param exMessage Exception message.
+ * @return Arguments for operationStateChanged method listening for state
+ * changes.
+ */
+ String[] stateChangeArgs(final String exMessage) {
+ return new String[] {
+ job.getStatus().getServer().getHost(), TASK_NAME,
+ exMessage, Boolean.toString(false)
+ };
+ }
+
+ /**
+ * Close socket and handle <code>IOException</code> that could
+ * be thrown.
+ * <p/>
+ * @param socket Socket to be closed.
+ */
+ private void closeSocket(final Socket socket) {
+ final String METHOD = "closeSocket";
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ handleIOException(ioe, job.getStatus().getServer().getHost(),
+ job.getStatus().getServer().getAdminPort(),
+ METHOD, "failed");
+ }
+ }
+
+ /**
+ * Handle IO Exception caught in server administration port verification
+ * task.
+ * <p/>
+ * Set task result and call registered listeners.
+ * <p/>
+ * @param ioe <code>IOException</code> caught.
+ * @param host Server administration host.
+ * @param port Server administration port.
+ * @param message Message to be logged. Shall not be <code>null</code>.
+ */
+ private void handleIOException(final IOException ioe,
+ final String host, final int port,
+ final String method, final String message) {
+ if (tmStart >= 0 && LOGGER.isLoggable(Level.FINEST)) {
+ StringBuilder sb = new StringBuilder(
+ message.length() + TM_SUFFIX.length());
+ sb.append(message).append(TM_SUFFIX);
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINEST, method, sb.toString(), new Object[] {
+ tm(tm), host, Integer.toString(port), ioe.getMessage()});
+
+ } else {
+ LOGGER.log(Level.FINEST, method, message, new Object[] {
+ host, Integer.toString(port), ioe.getMessage()});
+ }
+ result = new StatusResult(
+ PayaraStatusCheckResult.FAILED, TaskEvent.EXCEPTION);
+ handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION,
+ stateChangeArgs(ioe.getLocalizedMessage()));
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Runnable run() method //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Thread main method to be executed.
+ * <p/>
+ * Runs administration port check.
+ */
+ @Override
+ public void run() {
+ final String METHOD = "run";
+ if (cancelled) {
+ LOGGER.log(Level.FINER, METHOD, "cancelled");
+ throw new IllegalStateException(LOGGER.excMsg(METHOD, "cancelled"));
+ }
+ LOGGER.log(Level.FINER, METHOD, "started", new String[] {
+ job.getStatus().getServer().getName(), jobState.toString()});
+ String host = job.getStatus().getServer().getHost();
+ int port = job.getStatus().getServer().getAdminPort();
+ if (port < 0 || host == null) {
+ result = new StatusResult(PayaraStatusCheckResult.FAILED);
+ handleStateChange(TaskState.FAILED,
+ TaskEvent.CMD_FAILED, stateChangeArgs(null));
+ }
+ this.tmStart = System.currentTimeMillis();
+ InetSocketAddress sa = new InetSocketAddress(host, port);
+ Socket socket = new Socket();
+ try {
+ socket.connect(sa, timeout);
+ socket.setSoTimeout(timeout);
+ } catch (java.net.ConnectException ce) {
+ handleIOException(ce, host, port, METHOD, "connect");
+ return;
+ } catch (java.net.SocketTimeoutException ste) {
+ handleIOException(ste, host, port, METHOD, "timeout");
+ return;
+ } catch (IOException ioe) {
+ handleIOException(ioe, host, port, METHOD, "ioException");
+ return;
+ } finally {
+ closeSocket(socket);
+ }
+ if (tmStart >= 0 && LOGGER.isLoggable(Level.FINEST)) {
+ long tm = System.currentTimeMillis() - tmStart;
+ LOGGER.log(Level.FINEST, METHOD, "success",
+ new Object[] {tm(tm), jobState.toString(),
+ host, Integer.toString(port)});
+ }
+ result = new StatusResult(
+ PayaraStatusCheckResult.SUCCESS, TaskEvent.CMD_COMPLETED);
+ handleStateChange(TaskState.COMPLETED, TaskEvent.CMD_COMPLETED,
+ stateChangeArgs(null));
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ExceptionMessages.properties
new file mode 100644
index 0000000..4121cde
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ExceptionMessages.properties
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# AdminPortTask class
+AdminPortTask.run.cancelled=Running already canceled administrator port check \
+task.
+
+# PayaraVersion class
+PayaraVersion.toString.invalidVersion=Invalid Payara version
+
+# RunnerTask class
+RunnerTask.run.cancelled=Running already canceled asadmin command check task.
+
+# StatusJobState class
+StatusJobState.toString.invalidVersion=Invalid server status check internal \
+state
+
+# StatusScheduler class
+StatusScheduler.scheduleNew.illegalState=Server status check job should be \
+in UNKNOWN state.
+StatusScheduler.reschedule.reschedule=Server status check job shall not be in \
+UNKNOWN state.
+StatusScheduler.reschedule.unhandled=Missing reschedule handling for some state.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/LogMessages.properties
new file mode 100644
index 0000000..e325221
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/LogMessages.properties
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# AdminPortTask class
+AdminPortTask.closeSocket.failed=Socket closing failed when connecting \
+to {0}:{1}: {2}
+AdminPortTask.closeSocket.failedTm=[{0}] Socket closing failed when connecting \
+to {1}:{2}: {3}
+# AdminPortTask class
+AdminPortTask.run.cancelled=Running already canceled administrator port check \
+task.
+AdminPortTask.run.started=Administrator port check task for server {0} \
+in state {1} started.
+AdminPortTask.run.connect=Port check could not connect to {0}:{1}: {2}
+AdminPortTask.run.connectTm=[{0}] Port check could not connect to {1}:{2}: {3}
+AdminPortTask.run.timeout=Port check timeout when connecting to {0}:{1}: {2}
+AdminPortTask.run.timeoutTm=[{0}] Port check timeout when connecting \
+to {1}:{2}: {3}
+AdminPortTask.run.ioException=Port check caught IO exception when connecting \
+to {0}:{1}: {2}
+AdminPortTask.run.ioExceptionTm=[{0}] Port check caught IO exception when \
+connecting to {1}:{2}: {3}
+AdminPortTask.run.success=[{0}] Port status check for state {1} succeeded \
+on {2}:{3}
+
+# StatusJob class
+StatusJob.portCheckTransition.transition=Port check transition {0}: {1} -> {2}
+StatusJob.commandLocationsTransition.transition=Command check transition \
+{0}: {1} -> {2}
+StatusJob.commandVersionTransition.transition=Version check transition \
+{0}: {1} -> {2}
+
+# StatusJob.ListenerLocations class
+ListenerLocations.operationStateChanged.result=Status check locations command \
+result: {0}
+
+# StatusJob.ListenerVersion class
+ListenerVersion.operationStateChanged.result=Status check version command \
+result: {0}
+
+# StatusJob.ListenerPortCheck class
+ListenerPortCheck.operationStateChanged.result=Status administrator port check \
+result: {0}
+
+# RunnerTask class
+RunnerTask.run.cancelled=Running already canceled asadmin command check task.
+RunnerTask.run.started=Asadmin command task for server {0} in state {1} started.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusEntity.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusEntity.java
new file mode 100644
index 0000000..30b7238
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusEntity.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Payara server status entity.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class PayaraStatusEntity implements PayaraServerStatus {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(PayaraStatusEntity.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server entity. */
+ private PayaraServer server;
+
+ /** Current Payara server status. */
+ private PayaraStatus status;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server status entity.
+ * <p/>
+ * Initial server status value is set as unknown.
+ * <p/>
+ * @param server Payara server entity.
+ */
+ public PayaraStatusEntity(final PayaraServer server) {
+ this.server = server;
+ this.status = PayaraStatus.UNKNOWN;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara server entity.
+ * <p/>
+ * @return Payara server entity.
+ */
+ @Override
+ public PayaraServer getServer() {
+ return server;
+ }
+
+ /**
+ * Set Payara server entity.
+ * <p/>
+ * @param server Payara server entity.
+ */
+ void setServer(final PayaraServer server) {
+ this.server = server;
+ }
+
+ /**
+ * Get current Payara server status.
+ * <p/>
+ * @return Current Payara server status.
+ */
+ @Override
+ public PayaraStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * Set current Payara server status.
+ * <p/>
+ * @param status Current Payara server status.
+ */
+ void setStatus(final PayaraStatus status) {
+ this.status = status;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/RunnerTask.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/RunnerTask.java
new file mode 100644
index 0000000..43a56a2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/RunnerTask.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.admin.AdminFactory;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.Result;
+import org.netbeans.modules.payara.tooling.admin.Runner;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheck;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Individual server administrator command task to verify if server
+ * is responding properly.
+ * <p/>
+ * @author Tomas Kraus
+ */
+class RunnerTask extends AbstractTask {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Command execution listener.
+ * <p/>
+ * Passes {@link TaskStateListener} arguments to job command task listeners
+ * registered for {@link RunnerTask} class.
+ */
+ private class RunnerListener implements TaskStateListener {
+
+ /** Server administrator command task. */
+ final RunnerTask runnerTask;
+
+ /**
+ * Constructs an instance of {@link Runner} listener.
+ */
+ private RunnerListener(final RunnerTask runnerTask) {
+ this.runnerTask = runnerTask;
+ }
+
+ /**
+ * Get notification about state change in {@link Runner} task.
+ * <p/>
+ * This is being called in {@link Runner#call()} method execution
+ * context.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener:<ul>
+ * <li><code>args[0]</code> server name</li>
+ * <li><code>args[1]</code> administration command</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <li><code>args[3]</code> display message in GUI</li></ul>
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args Additional String arguments.
+ */
+ @Override
+ public void operationStateChanged(final TaskState newState,
+ final TaskEvent event, final String... args) {
+ runnerTask.handleStateChange(newState, event, args);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(RunnerTask.class);
+
+ /** Server administration command to be executed. */
+ private final Command cmd;
+
+ /** Runner task execution result. */
+ Result result;
+
+ /**
+ * Constructs an instance of individual server administrator command task.
+ * <p/>
+ * @param job Server status check job internal data.
+ * @param task Individual status check task data.
+ * @param type Server status check type.
+ */
+ RunnerTask(final StatusJob job, final StatusJob.RunnerTask task,
+ final PayaraStatusCheck type) {
+ super(job, task, type);
+ this.cmd = task.getCommand();
+ this.result = null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Runnable run() method //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Thread main method to be executed.
+ * <p/>
+ * Runs command runner without starting new thread.
+ */
+ @Override
+ public void run() {
+ final String METHOD = "run";
+ if (cancelled) {
+ LOGGER.log(Level.FINER, METHOD, "cancelled");
+ throw new IllegalStateException(LOGGER.excMsg(METHOD, "cancelled"));
+ }
+ LOGGER.log(Level.FINER, METHOD, "started", new String[] {
+ job.getStatus().getServer().getName(), jobState.toString()});
+ TaskStateListener[] listeners = task.getListeners();
+ AdminFactory af = AdminFactory.getInstance(
+ job.getStatus().getServer().getAdminInterface());
+ Runner runner = af.getRunner(job.getStatus().getServer(), cmd);
+ if (listeners != null) {
+ for (int i = 0 ; i < listeners.length ; i++) {
+ if (listeners[i] instanceof StatusJob.Listener) {
+ ((StatusJob.Listener)listeners[i]).setRunner(runner);
+ }
+ }
+ }
+ runner.setStateListeners(
+ new TaskStateListener[] {new RunnerListener(this)});
+ runner.setReadyState();
+ result = runner.call();
+ if (listeners != null) {
+ for (int i = 0 ; i < listeners.length ; i++) {
+ if (listeners[i] instanceof StatusJob.Listener) {
+ ((StatusJob.Listener)listeners[i]).clearRunner();
+ }
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ServerStateException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ServerStateException.java
new file mode 100644
index 0000000..4e33685
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/ServerStateException.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Payara IDE SDK Exception related to server configuration problems.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class ServerStateException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> without
+ * detail message.
+ */
+ public ServerStateException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public ServerStateException(final String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public ServerStateException(final String msg, final Object... arguments) {
+ super(msg, arguments);
+ }
+
+ /**
+ * Constructs an instance of <code>ServerConfigException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ServerStateException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJob.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJob.java
new file mode 100644
index 0000000..13541d2
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJob.java
@@ -0,0 +1,1352 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.util.concurrent.ScheduledFuture;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.CommandLocation;
+import org.netbeans.modules.payara.tooling.admin.CommandVersion;
+import org.netbeans.modules.payara.tooling.admin.Result;
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.Runner;
+import org.netbeans.modules.payara.tooling.TaskState;
+import static org.netbeans.modules.payara.tooling.TaskState.COMPLETED;
+import org.netbeans.modules.payara.tooling.TaskStateListener;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheck;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.NO_CHECK;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.UNKNOWN;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.UNKNOWN_PORT;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.OFFLINE;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.OFFLINE_PORT;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.ONLINE;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.SHUTDOWN_PORT;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.STARTUP;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.STARTUP_PORT;
+import org.netbeans.modules.payara.tooling.utils.LinkedList;
+import org.netbeans.modules.payara.tooling.PayaraStatusListener;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusTask;
+
+/**
+ * Server status check internal data for individual Payara server instance.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class StatusJob {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Common server status check command execution state listener.
+ */
+ abstract static class Listener implements TaskStateListener {
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(Listener.class);
+
+ /** Should contain {@link Runner} object when it's {@link Runner#call()}
+ * method is executed. */
+ Runner runner;
+
+ /** Server status check internal data for individual Payara
+ * server instance. */
+ final StatusJob job;
+
+ /**
+ * Constructs an instance of common command execution
+ * state listener.
+ * <p/>
+ * @param job Server status check internal data for individual Payara
+ * server instance.
+ */
+ private Listener(final StatusJob job) {
+ this.runner = null;
+ this.job = job;
+ }
+
+ /**
+ * Set {@link Runner} object instance before it's {@link Runner#call()}
+ * method is executed.
+ * <p/>
+ * @param runner Payara server command execution runner.
+ */
+ void setRunner(final Runner runner) {
+ this.runner = runner;
+ }
+
+ /**
+ * Clear {@link Runner} object instance after {@link Runner#call()}
+ * method is finished.
+ */
+ void clearRunner() {
+ this.runner = null;
+ }
+
+ }
+
+ /**
+ * Locations command execution state listener.
+ */
+ static class ListenerLocations extends Listener {
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(ListenerLocations.class);
+
+ /**
+ * Constructs an instance of <code>__locations</code> command execution
+ * state listener.
+ * <p/>
+ * @param job Server status check internal data for individual Payara
+ * server instance.
+ */
+ private ListenerLocations(final StatusJob job) {
+ super(job);
+ }
+
+ /**
+ * Evaluate <code>__locations</code> response to verify Payara server
+ * home and domain directories.
+ * <p/>
+ * @return Returns <code>true</code> when <code>__locations</code>
+ * response matches domain directory in Payara server entity
+ * or <code>false</code> otherwise.
+ */
+ private boolean verifyResult() {
+ Result result = runner.getResult();
+ if (result instanceof ResultMap) {
+ ResultMap<String, String> resultMap
+ = (ResultMap<String, String>)result;
+ return CommandLocation.verifyResult(
+ resultMap, job.status.getServer());
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Get notification about state change in {@link Runner} task.
+ * <p/>
+ * This is being called in {@link Runner#call()} method execution
+ * context.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener:<ul>
+ * <li><code>args[0]</code> server name</li>
+ * <li><code>args[1]</code> administration command</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <li><code>args[3]</code> display message in GUI</li></ul>
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args Additional String arguments.
+ */
+ @Override
+ public void operationStateChanged(final TaskState newState,
+ final TaskEvent event, final String... args) {
+ final String METHOD = "operationStateChanged";
+ switch (newState) {
+ case COMPLETED: case FAILED:
+ String serverName;
+ String exceptionMeasage;
+ ResultMap<String, String> taskResult
+ = (ResultMap<String, String>)runner.getResult();
+ if (args != null && args.length >= 3) {
+ serverName = args[0];
+ exceptionMeasage = args[2];
+ } else {
+ serverName = null;
+ exceptionMeasage = null;
+ }
+ // Store task result into job task object
+ boolean notifyError = false;
+ synchronized (job.locations) {
+ switch (newState) {
+ case COMPLETED:
+ // Breaks only for true result. False result
+ // is handeld by FAILED case.
+ if (verifyResult()) {
+ job.locations.setResult(new StatusResultLocations(
+ taskResult,
+ PayaraStatusCheckResult.SUCCESS,
+ event));
+ break;
+ }
+ case FAILED:
+ job.locations.setResult(new StatusResultLocations(taskResult,
+ PayaraStatusCheckResult.FAILED,
+ event));
+ notifyError = true;
+ break;
+ }
+ }
+ LOGGER.log(Level.FINE, METHOD, "result",
+ job.locations.getResult().status.toString());
+ if (notifyError) {
+ synchronized (job) {
+ job.notifyErrorListeners(job.locations);
+ }
+ }
+ commandTransition(job, job.locations);
+ }
+
+ }
+
+ }
+
+ /**
+ * Locations command execution state listener.
+ */
+ static class ListenerVersion extends Listener {
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ListenerVersion.class);
+
+ /**
+ * Constructs an instance of <code>version</code> command execution
+ * state listener.
+ * <p/>
+ * @param job Server status check internal data for individual Payara
+ * server instance.
+ */
+ private ListenerVersion(final StatusJob job) {
+ super(job);
+ }
+
+ /**
+ * Evaluate <code>version</code> response to verify Payara server
+ * version.
+ * <p/>
+ * @return Returns <code>true</code> when <code>version</code>
+ * response matches version in Payara server entity
+ * or <code>false</code> otherwise.
+ */
+ private boolean verifyResult() {
+ Result result = runner.getResult();
+ if (result instanceof ResultString) {
+ ResultString resultString = (ResultString)result;
+ return CommandVersion.verifyResult(
+ resultString, job.status.getServer());
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Get notification about state change in {@link Runner} task.
+ * <p/>
+ * This is being called in {@link Runner#call()} method execution
+ * context.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener:<ul>
+ * <li><code>args[0]</code> server name</li>
+ * <li><code>args[1]</code> administration command</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <li><code>args[3]</code> display message in GUI</li></ul>
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args Additional String arguments.
+ */
+ @Override
+ public void operationStateChanged(final TaskState newState,
+ final TaskEvent event, final String... args) {
+ final String METHOD = "operationStateChanged";
+ switch (newState) {
+ case COMPLETED: case FAILED:
+ String serverName;
+ String exceptionMeasage;
+ ResultString taskResult = (ResultString)runner.getResult();
+ if (args != null && args.length >= 3) {
+ serverName = args[0];
+ exceptionMeasage = args[2];
+ } else {
+ serverName = null;
+ exceptionMeasage = null;
+ }
+ // Store task result into job task object
+ boolean notifyError = false;
+ synchronized (job.version) {
+ switch (newState) {
+ case COMPLETED:
+ // Breaks only for true result. False result
+ // is handeld by FAILED case.
+ if (verifyResult()) {
+ job.version.setResult(new StatusResultVersion(
+ taskResult,
+ PayaraStatusCheckResult.SUCCESS,
+ event));
+ break;
+ }
+ case FAILED:
+ job.version.setResult(new StatusResultVersion(taskResult,
+ PayaraStatusCheckResult.FAILED,
+ event));
+ notifyError = true;
+ break;
+ }
+ }
+ LOGGER.log(Level.FINE, METHOD, "result",
+ job.version.getResult().status.toString());
+ if (notifyError) {
+ synchronized (job) {
+ job.notifyErrorListeners(job.version);
+ }
+ }
+ commandTransition(job, job.version);
+ }
+ }
+
+ }
+
+ /**
+ * Administrator port check task state listener.
+ */
+ static class ListenerPortCheck extends Listener {
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER
+ = new Logger(ListenerPortCheck.class);
+
+ /**
+ * Constructs an instance of <code>version</code> command execution
+ * state listener.
+ * <p/>
+ * @param job Server status check internal data for individual Payara
+ * server instance.
+ */
+ private ListenerPortCheck(final StatusJob job) {
+ super(job);
+ }
+
+ /**
+ * Get notification about state change in running task.
+ * <p/>
+ * This is being called in {@link Runnable#run()} method execution
+ * context.
+ * <p/>
+ * <code>String</codce> arguments passed to state listener:<ul>
+ * <li><code>args[0]</code> host name</li>
+ * <li><code>args[1]</code> port check task name</li>
+ * <li><code>args[2]</code> exception message</li>
+ * <p/>
+ * @param newState New command execution state.
+ * @param event Event related to execution state change.
+ * @param args Additional String arguments.
+ */
+ @Override
+ public void operationStateChanged(final TaskState newState,
+ final TaskEvent event, final String... args) {
+ final String METHOD = "operationStateChanged";
+ // Store task result into job task object
+ AdminPortTask task = (AdminPortTask)job.portCheck.getTask();
+ job.portCheck.setResult(task.getResult());
+ LOGGER.log(Level.FINE, METHOD, "result",
+ job.portCheck.getResult().status.toString());
+ // Evaluate taks result
+ portCheckTransition(job, job.portCheck);
+ }
+
+ }
+
+ /**
+ * Individual status check task data.
+ */
+ static class Task implements PayaraStatusTask {
+
+ /** Server status task execution listener for asynchronous
+ * command execution. */
+ private Listener listener;
+
+ /** Last command task execution result. */
+ StatusResult result;
+
+ /** Task thread currently being executed. */
+ AbstractTask task;
+
+ /** Task execution handler. */
+ private ScheduledFuture future;
+
+ /** All task listeners. */
+ private TaskStateListener[] listeners;
+
+ /** Server status check type. */
+ private final PayaraStatusCheck type;
+
+ /**
+ * Constructs an instance of individual job task.
+ * <p/>
+ * @param type Server status check type.
+ * @param listener Server status task execution listener
+ * for asynchronous command execution.
+ */
+ private Task(final PayaraStatusCheck type,
+ final Listener listener) {
+ this.listener = listener;
+ this.type = type;
+ this.result = null;
+ this.task = null;
+ this.future = null;
+ this.listeners = new TaskStateListener[] {listener};
+ }
+
+ /**
+ * Get server status task execution listener for asynchronous
+ * command execution.
+ * <p/>
+ * @return Server status task execution listener
+ * for asynchronous command execution.
+ */
+ Listener getListener() {
+ return listener;
+ }
+
+ /**
+ * Set server status task execution listener for asynchronous
+ * command execution.
+ * <p/>
+ * @param listener Server status task execution listener
+ * for asynchronous command execution.
+ */
+ void setListener(final Listener listener) {
+ this.listener = listener;
+ }
+
+ /**
+ * Get server status check type.
+ * <p/>
+ * @return Server status check type.
+ */
+ @Override
+ public PayaraStatusCheck getType() {
+ return type;
+ }
+
+ /**
+ * Get last command task execution result.
+ * <p/>
+ * @return Last command task execution result.
+ */
+ StatusResult getResult() {
+ return result;
+ }
+
+ /**
+ * Set last command task execution result.
+ * <p/>
+ * @param result Last command task execution result.
+ */
+ void setResult(final StatusResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Get last command task execution status.
+ * <p/>
+ * @return Last command task execution status.
+ */
+ @Override
+ public PayaraStatusCheckResult getStatus() {
+ return result != null ? result.status : null;
+ }
+
+ /**
+ * Get last command task execution status.
+ * <p/>
+ * @return Last command task execution status.
+ */
+ @Override
+ public TaskEvent getEvent() {
+ return result != null ? result.event : null;
+ }
+
+ /**
+ * Get task thread currently being executed.
+ * <p/>
+ * @return Task thread currently being executed.
+ */
+ AbstractTask getTask() {
+ return task;
+ }
+
+ /**
+ * Set task thread currently being executed.
+ * <p/>
+ * @param task Task thread currently being executed.
+ */
+ void setTask(final AbstractTask task) {
+ this.task = task;
+ }
+
+ /**
+ * Get all task listeners.
+ * <p/>
+ * @return All task listeners.
+ */
+ TaskStateListener[] getListeners() {
+ return listeners;
+ }
+
+ /**
+ * Get task execution handler.
+ * <p/>
+ * @return Task execution handler.
+ */
+ ScheduledFuture getFuture() {
+ return future;
+ }
+
+ /**
+ * Set task execution handler.
+ * <p/>
+ * @param future Task execution handler.
+ */
+ void setFuture(final ScheduledFuture future) {
+ this.future = future;
+ }
+
+ /**
+ * Set task execution handler and thread currently being executed.
+ * <p/>
+ * @param task Task thread currently being executed.
+ * @param future Task execution handler.
+ */
+ void setTaskFuture(final AbstractTask task,
+ final ScheduledFuture future) {
+ this.task = task;
+ this.future = future;
+ }
+
+ /**
+ * Clear task execution handler and thread currently being executed.
+ */
+ void clearTaskFuture() {
+ this.task = null;
+ this.future = null;
+ }
+
+ /**
+ * Evaluate task execution result.
+ * <p/>
+ * Task will fail only when task is scheduled for execution
+ * (<code>task</code> value is not null) and stored task result
+ * is <code>FAILED</code> or does not exist.
+ * <p/>
+ * @return Task execution result evaluation.
+ */
+ PayaraStatusCheckResult evalResult() {
+ return task == null
+ ? PayaraStatusCheckResult.SUCCESS : result == null
+ ? PayaraStatusCheckResult.FAILED : result.status;
+ }
+
+ }
+
+ /**
+ * Individual administrator command status check task data.
+ */
+ static class RunnerTask extends Task {
+
+ /** Server administration command to be executed. */
+ private final Command command;
+
+ /**
+ * Constructs an instance of individual job runner task.
+ * <p/>
+ * @param type Server status check type.
+ * @param cmd Server administration command to be executed.
+ * @param listener Server status task execution listener
+ * for asynchronous command execution.
+ */
+ private RunnerTask(final PayaraStatusCheck type,
+ final Command cmd, final Listener listener) {
+ super(type, listener);
+ this.command = cmd;
+ }
+
+ /**
+ * Get server administration command to be executed.
+ * <p/>
+ * @return Server administration command to be executed.
+ */
+ Command getCommand() {
+ return command;
+ }
+
+ }
+
+ /**
+ * Individual administrator command status check task data using
+ * <code>version</code> command.
+ */
+ static class RunnerTaskLocations extends RunnerTask {
+
+ /**
+ * Constructs an instance of individual job runner task running
+ * <code>__locations</code> command.
+ * <p/>
+ * @param listener Server status task execution listener
+ * for asynchronous command execution.
+ */
+ private RunnerTaskLocations(final Listener listener) {
+ super(PayaraStatusCheck.LOCATIONS,
+ new CommandLocation(), listener);
+ }
+
+ }
+
+ /**
+ * Individual administrator command status check task data using
+ * <code>version</code> command.
+ */
+ static class RunnerTaskVersion extends RunnerTask {
+
+ /**
+ * Constructs an instance of individual job runner task running
+ * <code>version</code> command.
+ * <p/>
+ * @param listener Server status task execution listener
+ * for asynchronous command execution.
+ */
+ private RunnerTaskVersion(final Listener listener) {
+ super(PayaraStatusCheck.VERSION,
+ new CommandVersion(), listener);
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(StatusJob.class);
+
+ /** State transition depending on administrator port check result . */
+ private static final StatusJobState[][] portCheckTransition = {
+ // SUCCESS FAILED
+ { NO_CHECK, NO_CHECK }, // NO_CHECK
+ { UNKNOWN_PORT, OFFLINE }, // UNKNOWN
+ { UNKNOWN_PORT, OFFLINE }, // UNKNOWN_PORT
+ { OFFLINE_PORT, OFFLINE }, // OFFLINE
+ { OFFLINE_PORT, OFFLINE }, // OFFLINE_PORT
+ { STARTUP_PORT, STARTUP }, // STARTUP
+ { STARTUP_PORT, OFFLINE }, // STARTUP_PORT
+ { ONLINE, OFFLINE_PORT }, // ONLINE
+ { SHUTDOWN, SHUTDOWN_PORT }, // SHUTDOWN
+ { SHUTDOWN_PORT, OFFLINE } // SHUTDOWN_PORT
+ };
+
+ /** State transition depending on administrator command execution result. */
+ private static final StatusJobState[][] commandTransition = {
+ // SUCCESS FAILED
+ { NO_CHECK, NO_CHECK }, // NO_CHECK
+ { ONLINE, UNKNOWN }, // UNKNOWN
+ { ONLINE, OFFLINE }, // UNKNOWN_PORT
+ { ONLINE, OFFLINE }, // OFFLINE
+ { ONLINE, OFFLINE_PORT }, // OFFLINE_PORT
+ { ONLINE, STARTUP }, // STARTUP
+ { ONLINE, STARTUP_PORT }, // STARTUP_PORT
+ { ONLINE, OFFLINE_PORT }, // ONLINE
+ { SHUTDOWN, SHUTDOWN_PORT }, // SHUTDOWN
+ { SHUTDOWN, SHUTDOWN_PORT } // SHUTDOWN_PORT
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Evaluate check result depending on running tasks and their result.
+ * <p/>
+ * @param job Server status job.
+ * @return Check result depending on running tasks and their result.
+ */
+ private static PayaraStatusCheckResult checkResult(final StatusJob job) {
+ return PayaraStatusCheckResult.and(job.portCheck.evalResult(),
+ job.version.evalResult(), job.locations.evalResult());
+ }
+
+ /**
+ * Handles state transition and server status check tasks reschedule
+ * for administrator port check result evaluation.
+ * <p/>
+ * @param job Server status job.
+ * @param task Payara server status check task details.
+ */
+ private static void portCheckTransition(
+ final StatusJob job, final PayaraStatusTask task) {
+ final String METHOD = "portCheckTransition";
+ PayaraStatus oldState;
+ PayaraStatus newState;
+ synchronized (job) {
+ StatusJobState oldInternalState = job.state;
+ oldState = job.status.getStatus();
+ job.state = portCheckTransition[job.state.ordinal()]
+ [job.portCheck.result.status.ordinal()];
+ LOGGER.log(Level.FINE, METHOD, "transition",
+ new String[] {job.portCheck.result.status.toString(),
+ oldInternalState.toString(), job.state.toString()});
+ if (oldInternalState != job.state) {
+ StatusScheduler scheduler = StatusScheduler.getInstance();
+ scheduler.remove(job);
+ scheduler.reschedule(job);
+ }
+ newState = job.state.toPayaraStatus();
+ if (oldState != newState) {
+ job.status.setStatus(newState);
+ }
+ }
+ if (job.portCheck.result.status == PayaraStatusCheckResult.FAILED) {
+ job.notifyErrorListeners(job.portCheck);
+ }
+ if (oldState != newState) {
+ job.notifyNewStatusListeners(job.status.getStatus(), task);
+ }
+ job.notifyCurrStatusListeners(job.status.getStatus(), task);
+ }
+
+ /**
+ * Handles state transition and server status check tasks reschedule
+ * for administrator command execution result evaluation.
+ * <p/>
+ * @param job Server status job.
+ * @param task Payara server status check task details.
+ */
+ private static void commandTransition(
+ final StatusJob job, final PayaraStatusTask task) {
+ final String METHOD = "commandLocationsTransition";
+ PayaraStatusCheckResult status = checkResult(job);
+ PayaraStatus oldState;
+ PayaraStatus newState;
+ synchronized (job) {
+ StatusJobState oldInternalState = job.state;
+ oldState = job.status.getStatus();
+ job.state = commandTransition[job.state.ordinal()]
+ [status.ordinal()];
+ LOGGER.log(Level.FINE, METHOD, "transition", new String[] {status.
+ toString(), oldInternalState.toString(), job.state.toString()});
+ if (oldInternalState != job.state) {
+ StatusScheduler scheduler = StatusScheduler.getInstance();
+ scheduler.remove(job);
+ scheduler.reschedule(job);
+ }
+ newState = job.state.toPayaraStatus();
+ if (oldState != newState) {
+ job.status.setStatus(newState);
+ }
+ }
+ if (oldState != newState) {
+ job.notifyNewStatusListeners(job.status.getStatus(), task);
+ }
+ job.notifyCurrStatusListeners(job.status.getStatus(), task);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Payara server status entity. */
+ private final PayaraStatusEntity status;
+
+ /** Server status job internal state. */
+ private StatusJobState state;
+
+ /** Administrator port check asynchronous task. */
+ private final Task portCheck;
+
+ /** Command <code>__locations</code> asynchronous task. */
+ private final RunnerTask locations;
+
+ /** Command <code>version</code> asynchronous task. */
+ private final RunnerTask version;
+
+ /** Listeners to be notified about server status change. */
+ private final LinkedList<PayaraStatusListener>[] newStatusListeners;
+
+ /** Listeners to be notified about every server status check result. */
+ private final LinkedList<PayaraStatusListener> currStatusListeners;
+
+ /** Listeners to be notified about every server status check error. */
+ private final LinkedList<PayaraStatusListener> errorListeners;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Payara server status check internal data.
+ * <p/>
+ * @param status Payara server status entity.
+ */
+ StatusJob(final PayaraStatusEntity status) {
+ this.status = status;
+ state = StatusJobState.UNKNOWN;
+ portCheck = new Task(
+ PayaraStatusCheck.PORT, new ListenerPortCheck(this));
+ locations = new RunnerTaskLocations(new ListenerLocations(this));
+ version = new RunnerTaskVersion(new ListenerVersion(this));
+ newStatusListeners = new LinkedList[PayaraStatus.length];
+ for (int i = 0; i < PayaraStatus.length; i++) {
+ newStatusListeners[i] = new LinkedList<>();
+ }
+ currStatusListeners = new LinkedList<>();
+ errorListeners = new LinkedList<>();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Getters and Setters //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * get Payara server status entity.
+ * <p/>
+ * @return Payara server status entity.
+ */
+ PayaraStatusEntity getStatus() {
+ return status;
+ }
+
+ /**
+ * Get server status job internal state.
+ * <p/>
+ * @return Server status job internal state.
+ */
+ StatusJobState getState() {
+ return state;
+ }
+
+ /**
+ * Get server status job internal state.
+ * <p/>
+ * @param state Server status job internal state.
+ */
+ void setState(final StatusJobState state) {
+ this.state = state;
+ }
+
+ /**
+ * Get administrator port check asynchronous task.
+ * <p/>
+ * @return Administrator port check asynchronous task.
+ */
+ Task getPortCheck() {
+ return portCheck;
+ }
+
+ /**
+ * Get command <code>__locations</code> asynchronous task.
+ * <p/>
+ * @return Command <code>__locations</code> asynchronous task.
+ */
+ RunnerTask getLocations() {
+ return locations;
+ }
+
+ /**
+ * Get command <code>version</code> asynchronous task.
+ * <p/>
+ * @return Command <code>version</code> asynchronous task.
+ */
+ RunnerTask getVersion() {
+ return version;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Attempts to restart job switching it into <code>UNKNOWN_PORT</code> state
+ * to restart status checking with fastest possible check.
+ * <p/>
+ * Job can be switched into <code>UNKNOWN_PORT</code> state only when it's
+ * in <code>NO_CHECK</code> state. This is equivalent to state transition
+ * methods.
+ * If listener is provided, it will be registered to receive any state
+ * change notification following status checking restart. This listener
+ * won't be unregistered automatically so caller should handle it properly.
+ * <p/>
+ * Called by job tasks scheduler.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ * @param listener Server status listener to be registered when status
+ * checking is being restarted.
+ * @return Value of <code>true</code> when job was successfully switched
+ * into startup mode or false otherwise.
+ */
+ boolean restartJob(final StatusScheduler scheduler,
+ final PayaraStatusListener listener) {
+ boolean result;
+ synchronized (this) {
+ switch (state) {
+ case NO_CHECK:
+ state = UNKNOWN_PORT;
+ status.setStatus(state.toPayaraStatus());
+ scheduler.remove(this);
+ scheduler.reschedule(this);
+ result = true;
+ if (listener != null) {
+ addNewStatusListener(listener, PayaraStatus.values());
+ }
+ break;
+ default:
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Stops job switching it into <code>NO_CHECK</code> state.
+ * <p/>
+ * Job can be switched into <code>NO_CHECK</code> state from any state.
+ * This is equivalent to state transition methods.
+ * <p/>
+ * Called by job tasks scheduler.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ */
+ void stopJob(StatusScheduler scheduler) {
+ synchronized (this) {
+ PayaraStatus oldStatus = state.toPayaraStatus();
+ state = NO_CHECK;
+ status.setStatus(state.toPayaraStatus());
+ scheduler.remove(this);
+ scheduler.reschedule(this);
+ if (oldStatus != status.getStatus()) {
+ notifyNewStatusListeners(status.getStatus(), null);
+ }
+ }
+ }
+
+ /**
+ * Switches job into <code>STARTUP</code> state.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ * @param listener Server status listener to be registered together with
+ * switching into startup mode.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ */
+ private void startStateImpl(StatusScheduler scheduler,
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ PayaraStatus oldStatus = status.getStatus();
+ state = STARTUP;
+ status.setStatus(state.toPayaraStatus());
+ scheduler.remove(this);
+ scheduler.reschedule(this);
+ if (oldStatus != status.getStatus()) {
+ notifyNewStatusListeners(status.getStatus(), null);
+ }
+ if (listener != null) {
+ addNewStatusListener(listener, newState);
+ }
+ }
+
+ /**
+ * Attempts to switch job into <code>STARTUP</code> state.
+ * <p/>
+ * Job can be switched into <code>STARTUP</code> state only when it's
+ * in <code>OFFLINE</code> or <code>OFFLINE_PORT</code> state. This is
+ * equivalent to state transition methods.
+ * <p/>
+ * Called by job tasks scheduler.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ * @param force Force startup mode for Payara server instance
+ * from any state then <code>true</code>.
+ * @param listener Server status listener to be registered together with
+ * switching into startup mode.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when job was successfully switched
+ * into startup mode or false otherwise.
+ */
+ boolean startState(StatusScheduler scheduler, final boolean force,
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ boolean result;
+ synchronized (this) {
+ switch (state) {
+ case OFFLINE:
+ case OFFLINE_PORT:
+ startStateImpl(scheduler, listener, newState);
+ result = true;
+ break;
+ case STARTUP:
+ result = false;
+ break;
+ default:
+ if (force) {
+ startStateImpl(scheduler, listener, newState);
+ result = true;
+ } else {
+ result = false;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Attempts to switch job into <code>SHUTDOWN</code> state.
+ * <p/>
+ * Job can be switched into <code>SHUTDOWN</code> state only when it's
+ * in <code>ONLINE</code> state. This is equivalent to state transition
+ * methods.
+ * <p/>
+ * Called by job tasks scheduler.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ * @return Value of <code>true</code> when job was successfully switched
+ * into shutdown mode or false otherwise.
+ */
+ boolean shutdownState(StatusScheduler scheduler) {
+ boolean result;
+ synchronized (this) {
+ switch (state) {
+ case ONLINE:
+ state = SHUTDOWN;
+ status.setStatus(state.toPayaraStatus());
+ scheduler.remove(this);
+ scheduler.reschedule(this);
+ result = true;
+ notifyNewStatusListeners(status.getStatus(), null);
+ break;
+ default:
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Initial server status task schedule.
+ * <p/>
+ * Called by job tasks scheduler.
+ * <p/>
+ * @param scheduler Job tasks scheduler calling this method.
+ */
+ void scheduleNew(StatusScheduler scheduler) {
+ synchronized (this) {
+ scheduler.scheduleNew(this);
+ }
+ }
+
+ /**
+ * Notify server status change listeners about state change.
+ * <p/>
+ * Listeners list access is synchronized but they are just copied into
+ * temporary array and executed outside synchronized block to avoid
+ * deadlocks.
+ * <p/>
+ * @param status Current server status.
+ * @param task Payara server status check task details.
+ */
+ public void notifyNewStatusListeners(
+ final PayaraStatus status, final PayaraStatusTask task) {
+ PayaraStatusListener[] call;
+ // Copy registered status change listeners.
+ int i = 0;
+ boolean isElement;
+ LinkedList<PayaraStatusListener> listeners;
+ synchronized (newStatusListeners) {
+ listeners = newStatusListeners[status.ordinal()];
+ call = new PayaraStatusListener[listeners.size()];
+ isElement = listeners.first();
+ while(isElement) {
+ call[i++] = listeners.getCurrent();
+ isElement = listeners.next();
+ }
+ }
+ // Execute them outside synchronized block.
+ for (PayaraStatusListener listener : call) {
+ listener.newState(this.status.getServer(), status, task);
+ }
+ }
+
+ /**
+ * Notify server status change listeners about current server status
+ * after every check.
+ * <p/>
+ * Listeners list access is synchronized but they are just copied into
+ * temporary array and executed outside synchronized block to avoid
+ * deadlocks.
+ * <p/>
+ * @param status Current server status.
+ * @param task Payara server status check task details.
+ */
+ public void notifyCurrStatusListeners(
+ final PayaraStatus status, final PayaraStatusTask task) {
+ PayaraStatusListener[] call;
+ // Copy registered status change listeners.
+ int i = 0;
+ boolean isElement;
+ synchronized (currStatusListeners) {
+ call = new PayaraStatusListener[currStatusListeners.size()];
+ isElement = currStatusListeners.first();
+ while(isElement) {
+ call[i++] = currStatusListeners.getCurrent();
+ isElement = currStatusListeners.next();
+ }
+ }
+ // Execute them outside synchronized block.
+ for (PayaraStatusListener listener : call) {
+ listener.currentState(this.status.getServer(), status, task);
+ }
+ }
+
+ /**
+ * Notify server status check error listeners about every check error.
+ * <p/>
+ * Listeners list access is synchronized but they are just copied into
+ * temporary array and executed outside synchronized block to avoid
+ * deadlocks.
+ * <p/>
+ * @param task Payara server status check task details.
+ */
+ public void notifyErrorListeners(final PayaraStatusTask task) {
+ PayaraStatusListener[] call;
+ // Copy registered status change listeners.
+ int i = 0;
+ boolean isElement;
+ synchronized (errorListeners) {
+ call = new PayaraStatusListener[errorListeners.size()];
+ isElement = errorListeners.first();
+ while(isElement) {
+ call[i++] = errorListeners.getCurrent();
+ isElement = errorListeners.next();
+ }
+ }
+ // Execute them outside synchronized block.
+ for (PayaraStatusListener listener : call) {
+ listener.error(this.status.getServer(), task);
+ }
+ }
+
+ /**
+ * Register server status listener to be notified about current server
+ * status after every check.
+ * <p/>
+ * @param listener Server status listener to be registered.
+ * @return Value of <code>true</code> when listener was added
+ * or <code>false</code> when this listener was already registered.
+ */
+ public boolean addCurrStatusListener(
+ final PayaraStatusListener listener) {
+ boolean added = false;
+ boolean exists = false;
+ boolean isElement;
+ synchronized (currStatusListeners) {
+ isElement = currStatusListeners.first();
+ while(isElement) {
+ if (listener.equals(currStatusListeners.getCurrent())) {
+ exists = true;
+ }
+ isElement = currStatusListeners.next();
+ }
+ if (!exists) {
+ currStatusListeners.addLast(listener);
+ added = true;
+ }
+ }
+ if (added && listener != null) {
+ listener.added();
+ }
+ return added;
+ }
+
+ /**
+ * Register server status listener to be notified about server status
+ * change.
+ * <p/>
+ * @param listener Server status listener to be registered.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when listener was added in at least
+ * one list or <code>false</code> when this listener was already
+ * registered in all requested lists.
+ */
+ public boolean addNewStatusListener(
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ boolean added = false;
+ boolean exists;
+ boolean isElement;
+ LinkedList<PayaraStatusListener> listeners;
+ synchronized (newStatusListeners) {
+ for (PayaraStatus stateToAdd : newState) {
+ listeners = newStatusListeners[stateToAdd.ordinal()];
+ exists = false;
+ isElement = listeners.first();
+ while(isElement) {
+ if (listener.equals(listeners.getCurrent())) {
+ exists = true;
+ }
+ isElement = listeners.next();
+ }
+ if (!exists) {
+ listeners.addLast(listener);
+ added = true;
+ }
+
+ }
+ }
+ if (added && listener != null) {
+ listener.added();
+ }
+ return added;
+ }
+
+ /**
+ * Register server status listener to be notified about server status
+ * check errors.
+ * <p/>
+ * @param listener Server status listener to be registered.
+ * @return Value of <code>true</code> when listener was added
+ * or <code>false</code> when this listener was already registered.
+ */
+ public boolean addErrorListener(
+ final PayaraStatusListener listener) {
+ boolean added = false;
+ boolean exists = false;
+ boolean isElement;
+ synchronized (errorListeners) {
+ isElement = errorListeners.first();
+ while(isElement) {
+ if (listener.equals(errorListeners.getCurrent())) {
+ exists = true;
+ }
+ isElement = errorListeners.next();
+ }
+ if (!exists) {
+ errorListeners.addLast(listener);
+ added = true;
+ }
+ }
+ if (added && listener != null) {
+ listener.added();
+ }
+ return added;
+ }
+
+ /**
+ * Register server status listener.
+ * <p/>
+ * @param listener Server status listener to be registered.
+ * @param currentState Notify about current server status after every check
+ * when <code>true</code>.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when listener was added in at least
+ * one list or <code>false</code> when this listener was already
+ * registered in all requested lists.
+ */
+ public boolean addStatusListener(
+ final PayaraStatusListener listener,
+ final boolean currentState, final PayaraStatus... newState) {
+ boolean added;
+ // Notify about current server status after every check.
+ if (currentState) {
+ added = addCurrStatusListener(listener);
+ } else {
+ added = false;
+ }
+ // Notify about server status change.
+ if (newState != null) {
+ added = addNewStatusListener(listener, newState) || added;
+ }
+ if (added && listener != null) {
+ listener.added();
+ }
+ return added;
+ }
+
+ /**
+ * Unregister server status listener.
+ * <p/>
+ * @param listener Server status listener to be unregistered.
+ * @return Value of <code>true</code> when listener was found and removed
+ * or <code>false</code> when listener was not found among
+ * registered listeners.
+ */
+ public boolean removeStatusListener(
+ final PayaraStatusListener listener) {
+ boolean removed = false;
+ // Remove from current server status after every check list.
+ boolean isElement;
+ synchronized (currStatusListeners) {
+ isElement = currStatusListeners.first();
+ while(isElement) {
+ if (listener.equals(currStatusListeners.getCurrent())) {
+ currStatusListeners.removeAndNext();
+ isElement = currStatusListeners.isCurrent();
+ removed = true;
+ } else {
+ isElement = currStatusListeners.next();
+ }
+ }
+ }
+ // Remove from server status change lists.
+ LinkedList<PayaraStatusListener> listeners;
+ synchronized (newStatusListeners) {
+ for (PayaraStatus stateToRemove : PayaraStatus.values()) {
+ listeners = newStatusListeners[stateToRemove.ordinal()];
+ isElement = listeners.first();
+ while(isElement) {
+ if (listener.equals(listeners.getCurrent())) {
+ listeners.removeAndNext();
+ isElement = listeners.isCurrent();
+ removed = true;
+ } else {
+ isElement = listeners.next();
+ }
+ }
+
+ }
+ }
+ // Remove from server status check errors list.
+ synchronized (errorListeners) {
+ isElement = errorListeners.first();
+ while(isElement) {
+ if (listener.equals(errorListeners.getCurrent())) {
+ errorListeners.removeAndNext();
+ isElement = errorListeners.isCurrent();
+ removed = true;
+ } else {
+ isElement = errorListeners.next();
+ }
+ }
+ }
+ if (removed && listener != null) {
+ listener.removed();
+ }
+ return removed;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJobState.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJobState.java
new file mode 100644
index 0000000..90147d6
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusJobState.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.DataException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Server status check internal state.
+ * <p/>
+ * Internally there are more states to be recognized when server is partially up
+ * but not fully responding. This helps to use just subset of checks in some
+ * states and also to use different checks synchronization strategy.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public enum StatusJobState {
+ ////////////////////////////////////////////////////////////////////////////
+ // Enum values //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Server status checks are turned off. */
+ NO_CHECK,
+
+ /** Server status is unknown. */
+ UNKNOWN,
+
+ /** Server status yet unknown but administrator port is alive. */
+ UNKNOWN_PORT,
+
+ /** Server is offline (not running, not responding and administrator port
+ * is not alive). */
+ OFFLINE,
+
+ /** Server is offline (not responding but running and administrator port
+ * is alive). */
+ OFFLINE_PORT,
+
+ /** Server start or restart was requested but server is still not
+ * responding and administrator port is not alive. */
+ STARTUP,
+
+ /** Server start or restart was requested but server is still not
+ * bully responding but administrator port is alive. */
+ STARTUP_PORT,
+
+ /** Server is running and responding. */
+ ONLINE,
+
+ /** Server shutdown was requested but server is still running, responding
+ * and administrator port is alive. */
+ SHUTDOWN,
+
+ /** Server shutdown was requested but server is still running, administrator
+ * port is alive but server is not responding. . */
+ SHUTDOWN_PORT;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(StatusJobState.class);
+
+ /** Payara version enumeration length. */
+ public static final int length = StatusJobState.values().length;
+
+ /** A <code>String</code> representation of NO_CHECK value. */
+ private static final String NO_CHECK_STR = "NO_CHECK";
+
+ /** A <code>String</code> representation of UNKNOWN value. */
+ private static final String UNKNOWN_STR = "UNKNOWN";
+
+ /** A <code>String</code> representation of UNKNOWN_PORT value. */
+ private static final String UNKNOWN_PORT_STR = "UNKNOWN_PORT";
+
+ /** A <code>String</code> representation of OFFLINE value. */
+ private static final String OFFLINE_STR = "OFFLINE";
+
+ /** A <code>String</code> representation of OFFLINE_PORT value. */
+ private static final String OFFLINE_PORT_STR = "OFFLINE_PORT";
+
+ /** A <code>String</code> representation of STARTUP value. */
+ private static final String STARTUP_STR = "STARTUP";
+
+ /** A <code>String</code> representation of STARTUP_PORT value. */
+ private static final String STARTUP_PORT_STR = "STARTUP_PORT";
+
+ /** A <code>String</code> representation of ONLINE value. */
+ private static final String ONLINE_STR = "ONLINE";
+
+ /** A <code>String</code> representation of SHUTDOWN value. */
+ private static final String SHUTDOWN_STR = "SHUTDOWN";
+
+ /** A <code>String</code> representation of SHUTDOWN_PORT value. */
+ private static final String SHUTDOWN_PORT_STR = "SHUTDOWN_PORT";
+
+ /** Stored <code>String</code> values for backward <code>String</code>
+ * conversion. */
+ private static final Map<String, StatusJobState> stringValuesMap
+ = new HashMap<>(length);
+ static {
+ for (StatusJobState state : StatusJobState.values()) {
+ stringValuesMap.put(state.toString().toUpperCase(), state);
+ }
+ }
+
+ /** Server status check internal state to public Payara server status
+ * translation table. */
+ private static final PayaraStatus toPayaraStatus[] = {
+ PayaraStatus.UNKNOWN, // NO_CHECK
+ PayaraStatus.UNKNOWN, // UNKNOWN
+ PayaraStatus.UNKNOWN, // UNKNOWN_PORT
+ PayaraStatus.OFFLINE, // OFFLINE
+ PayaraStatus.OFFLINE, // OFFLINE_PORT
+ PayaraStatus.STARTUP, // STARTUP
+ PayaraStatus.STARTUP, // STARTUP_PORT
+ PayaraStatus.ONLINE, // ONLINE
+ PayaraStatus.SHUTDOWN, // SHUTDOWN
+ PayaraStatus.SHUTDOWN // SHUTDOWN_PORT
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns a <code>PayaraStatus</code> with a value represented by the
+ * specified <code>String</code>. The <code>PayaraStatus</code> returned
+ * represents existing value only if specified <code>String</code>
+ * matches any <code>String</code> returned by <code>toString</code> method.
+ * Otherwise <code>null</code> value is returned.
+ * <p>
+ * @param name Value containing <code>PayaraStatus</code>
+ * <code>toString</code> representation.
+ * @return <code>PayaraStatus</code> value represented
+ * by <code>String</code> or <code>null</code> if value
+ * was not recognized.
+ */
+ public static StatusJobState toValue(final String name) {
+ if (name != null) {
+ return (stringValuesMap.get(name.toUpperCase()));
+ } else {
+ return null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Convert <code>StatusJobState</code> value to <code>String</code>.
+ * <p/>
+ * @return A <code>String</code> representation of the value of this object.
+ */
+ @Override
+ public String toString() {
+ final String METHOD = "toString";
+ switch (this) {
+ case NO_CHECK: return NO_CHECK_STR;
+ case UNKNOWN: return UNKNOWN_STR;
+ case UNKNOWN_PORT: return UNKNOWN_PORT_STR;
+ case OFFLINE: return OFFLINE_STR;
+ case OFFLINE_PORT: return OFFLINE_PORT_STR;
+ case STARTUP: return STARTUP_STR;
+ case STARTUP_PORT: return STARTUP_PORT_STR;
+ case ONLINE: return ONLINE_STR;
+ case SHUTDOWN: return SHUTDOWN_STR;
+ case SHUTDOWN_PORT: return SHUTDOWN_PORT_STR;
+ // This is unrecheable. Being here means this class does not handle
+ // all possible values correctly.
+ default: throw new DataException(
+ LOGGER.excMsg(METHOD, "invalidVersion"));
+ }
+ }
+
+ /**
+ * Convert <code>StatusJobState</code> value to {@link PayaraStatus}.
+ * <p/>
+ * @return A {@link PayaraStatus} representation of the value
+ * of this object.
+ */
+ PayaraStatus toPayaraStatus() {
+ return toPayaraStatus[this.ordinal()];
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResult.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResult.java
new file mode 100644
index 0000000..a44210b
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResult.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+
+/**
+ * Individual server status result including additional information.
+ * <p/>
+ * @author tomas Kraus
+ */
+class StatusResult {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Individual server status returned. */
+ final PayaraStatusCheckResult status;
+
+ /** Task failure event. */
+ final TaskEvent event;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * @param status Individual server status returned.
+ * @param event Current status cause.
+ */
+ StatusResult(final PayaraStatusCheckResult status,
+ final TaskEvent event) {
+ this.status = status;
+ this.event = event;
+ }
+
+ /**
+ * Creates an instance of individual server status result.
+ * <p/>
+ * @param status Individual server status returned.
+ */
+ StatusResult(final PayaraStatusCheckResult status) {
+ this(status, null);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get individual check task status.
+ * <p/>
+ * @return Individual check task status.
+ */
+ public PayaraStatusCheckResult getStatus() {
+ return status;
+ }
+
+ /**
+ * Get task failure event.
+ * <p/>
+ * @return Task failure event.
+ */
+ public TaskEvent getEvent() {
+ return event;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultLocations.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultLocations.java
new file mode 100644
index 0000000..7932269
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultLocations.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.admin.ResultMap;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+
+/**
+ * Server status task execution result for <code>__locations</code> command
+ * including additional information.
+ * <p/>
+ * This class stores task execution result only. Value <code>SUCCESS</code>
+ * means that Locations command task execution finished successfully but it
+ * does not mean that administration command itself returned with
+ * <code>COMPLETED</code> status.
+ * When <code>SUCCESS</code> status is set, stored <code>result</code> value
+ * shall be examined too to see real administration command execution result.
+ * <p/>
+ * @author Tomas Kraus
+ */
+class StatusResultLocations extends StatusResult {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Command <code>__locations</code> execution result. */
+ final ResultMap<String, String> result;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>__locations</code> command.
+ * <p/>
+ * Command <code>__locations</code> result is stored.
+ * <p/>
+ * @param result Command <code>__locations</code> execution result.
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ */
+ StatusResultLocations(final ResultMap<String, String> result,
+ final PayaraStatusCheckResult status,
+ final TaskEvent failureEvent) {
+ super(status, failureEvent);
+ this.result = result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get <code>__locations</code> command execution result.
+ * <p/>
+ * @return <code>__locations</code> command execution result.
+ */
+ public ResultMap<String, String> getStatusResult() {
+ return result;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultVersion.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultVersion.java
new file mode 100644
index 0000000..b1314b7
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusResultVersion.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheckResult;
+import org.netbeans.modules.payara.tooling.TaskEvent;
+
+/**
+ * Individual server status result for <code>version</code> command including
+ * additional information.
+ * <p/>
+ * This class stores task execution result only. Value <code>SUCCESS</code>
+ * means that Locations command task execution finished successfully but it
+ * does not mean that administration command itself returned with
+ * <code>COMPLETED</code> status.
+ * When <code>SUCCESS</code> status is set, stored <code>result</code> value
+ * shall be examined too to see real administration command execution result.
+ * <p/>
+ * @author Tomas Kraus
+ */
+class StatusResultVersion extends StatusResult {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Command <code>version</code> execution result. */
+ final ResultString result;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of individual server status result
+ * for <code>version</code> command.
+ * <p/>
+ * Command <code>version</code> result is stored.
+ * <p/>
+ * @param result Command <code>version</code> execution result.
+ * @param status Individual server status returned.
+ * @param failureEvent Failure cause.
+ */
+ StatusResultVersion(final ResultString result,
+ final PayaraStatusCheckResult status,
+ final TaskEvent failureEvent) {
+ super(status, failureEvent);
+ this.result = result;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Getters //
+ ////////////////////////////////////////////////////////////////////////
+ /**
+ * Get <code>version</code> command execution result.
+ * <p/>
+ * @return <code>version</code> command execution result.
+ */
+ public ResultString getResult() {
+ return result;
+ }
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusScheduler.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusScheduler.java
new file mode 100644
index 0000000..4ec6a91
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/server/state/StatusScheduler.java
@@ -0,0 +1,763 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.PayaraStatusCheck;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.NO_CHECK;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.SHUTDOWN;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.SHUTDOWN_PORT;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.STARTUP;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.STARTUP_PORT;
+import static org.netbeans.modules.payara.tooling.server.state.StatusJobState.UNKNOWN;
+import org.netbeans.modules.payara.tooling.PayaraStatusListener;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerStatus;
+
+/**
+ * Thread responsible for processing all server status checks and updating
+ * server status entity objects with current server status.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class StatusScheduler {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Payara status tasks scheduler {@link ThreadFactory}.
+ * <p/>
+ * Constructs new threads for Payara log fetcher tasks.
+ */
+ private static final class ThreadFactory
+ implements java.util.concurrent.ThreadFactory {
+
+ /** Thread name. */
+ private static final String THREAD_NAME = "Payara Status Tasks";
+
+ /** {@link ThreadGroup} of constructed thread. */
+ private static final ThreadGroup threadGroup = initThreadGroup();
+
+ /**
+ * Initialize {@link ThreadGroup} object for threads being created
+ * in this factory.
+ * <p/>
+ * @return {@link ThreadGroup} object for threads being created
+ * in this factory.
+ */
+ private static ThreadGroup initThreadGroup() {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ if (tg != null) {
+ ThreadGroup tgParrent;
+ while ((tgParrent = tg.getParent()) != null) {
+ tg = tgParrent;
+ }
+ }
+ return new ThreadGroup(tg, THREAD_NAME);
+ }
+
+ /**
+ * Constructs a new {@link Thread}.
+ * <p/>
+ * @param r A runnable to be executed by new {@link Thread} instance.
+ * @return Constructed thread.
+ */
+ @Override
+ public Thread newThread(final Runnable r) {
+ Thread t = new Thread(threadGroup, r, THREAD_NAME);
+ t.setDaemon(true);
+ return t;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(StatusScheduler.class);
+
+ /** External executor instance. */
+ private static ScheduledThreadPoolExecutor scheduledExecutor;
+
+ /** Singleton object instance. */
+ private static volatile StatusScheduler instance;
+
+ /** The number of threads to keep in the pool, even if they are idle.
+ * Applies only to internal executor. */
+ private static final int DEFAULT_INTERNAL_CORE_POOL_SIZE = 3;
+
+ /** Tasks execution delay [ms]. */
+ private static final long DELAY = 6000;
+
+ /** Tasks execution initial delay [ms]. */
+ private static final long INITIAL_DELAY = 2000;
+
+ /** Tasks execution delay in startup mode [ms]. */
+ private static final long DELAY_STARTUP = 3000;
+
+ /** Tasks execution initial delay in startup mode [ms]. */
+ private static final long INITIAL_DELAY_STARTUP = 1000;
+
+ /** Administration port connect timeout [ms]. */
+ private static final int CONNECT_TIMEOUT = 5000;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Allows to initialize this class to use external executor.
+ * <p/>
+ * This method must be called before first usage of {@link #getInstance()}
+ * method.
+ * <p/>
+ * @param executor External executor to be supplied.
+ */
+ public static void init(final ScheduledThreadPoolExecutor executor) {
+ synchronized (StatusScheduler.class) {
+ if (instance == null) {
+ scheduledExecutor = executor;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ /**
+ * Allows to initialize this class to use internal executor.
+ * <p/>
+ * This method must be called before first usage of {@link #getInstance()}
+ * method. Caller should hold <code>StatusScheduler.class</code> lock.
+ */
+ private static ScheduledThreadPoolExecutor newScheduledExecutor() {
+ ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(
+ DEFAULT_INTERNAL_CORE_POOL_SIZE, new ThreadFactory());
+ executor.setRemoveOnCancelPolicy(true);
+ return executor;
+ }
+
+ /**
+ * Return existing singleton instance of this class or create a new one
+ * when no instance exists.
+ * <p>
+ * @return <code>PayaraAccountInstanceProvider</code> singleton instance.
+ */
+ public static StatusScheduler getInstance() {
+ if (instance != null) {
+ return instance;
+ }
+ synchronized (StatusScheduler.class) {
+ if (instance == null) {
+ if (scheduledExecutor == null) {
+ scheduledExecutor = newScheduledExecutor();
+ }
+ instance = new StatusScheduler(scheduledExecutor);
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Select tasks execution delay depending on current job internal state.
+ * <p/>
+ * @param state Current job internal state.
+ * @return Tasks execution delay.
+ */
+ private static long selectDelay(final StatusJobState state) {
+ switch(state) {
+ case STARTUP: case STARTUP_PORT: case SHUTDOWN: case SHUTDOWN_PORT:
+ return DELAY_STARTUP;
+ default:
+ return DELAY;
+ }
+ }
+
+ /**
+ * Select tasks execution initial delay depending on current job internal
+ * state.
+ * <p/>
+ * @param state Current job internal state.
+ * @return Tasks execution initial delay.
+ */
+ private static long selectInitialDelay(final StatusJobState state) {
+ switch(state) {
+ case STARTUP: case STARTUP_PORT: case SHUTDOWN: case SHUTDOWN_PORT:
+ return INITIAL_DELAY_STARTUP;
+ default:
+ return INITIAL_DELAY;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Executor to run server status checks. */
+ private ScheduledThreadPoolExecutor executor;
+
+ /** Server status jobs. */
+ private final Map<PayaraServer, StatusJob> jobs;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of server status checks scheduler.
+ * <p/>
+ * @param executor External executor.
+ */
+ private StatusScheduler(final ScheduledThreadPoolExecutor executor) {
+ this.executor = executor;
+ jobs = new HashMap<>();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check if given GlassFisg server instance is registered.
+ * <p/>
+ * @param srv GlassFisg server instance to be checked.
+ * @return Value of <code>true</code> when server instance is registered
+ * in scheduler or <code>false</code> otherwise.
+ */
+ public boolean exists(final PayaraServer srv) {
+ boolean result;
+ synchronized (jobs) {
+ result = jobs.containsKey(srv);
+ }
+ return result;
+ }
+
+ /**
+ * Get GlassFisg server instance status object from scheduler.
+ * <p/>
+ * When status checking is disabled, it will restart it and return current
+ * status which is probably <code>UNKNOWN</code>. If listener is provided,
+ * it will be registered to receive any state change notification following
+ * status checking restart. This listener won't be unregistered
+ * automatically so caller should handle it properly.
+ * <p/>
+ * @param srv GlassFisg server instance to search for in jobs.
+ * @param listener Server status listener to be registered when status
+ * checking is being restarted.
+ * @return GlassFisg server status {@link PayaraServerStatus} object.
+ * Returns <code>null</code> value for unregistered server instance.
+ */
+ public PayaraServerStatus get(final PayaraServer srv,
+ final PayaraStatusListener listener) {
+ StatusJob job = getJob(srv);
+ if (job != null) {
+ if (job.getState() == NO_CHECK) {
+ job.restartJob(this, listener);
+ }
+ return job.getStatus();
+ }
+ return null;
+ }
+
+ /**
+ * Switch GlassFisg server status monitoring into startup mode.
+ * <p/>
+ * @param srv GlassFisg server instance to be started.
+ * @param force Force startup mode for Payara server instance
+ * from any state then <code>true</code>.
+ * @param listener Server status listener to be registered together with
+ * switching into startup mode.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when server instance is being
+ * monitored in startup mode or <code>false</code> if switching
+ * failed.
+ */
+ public boolean start(final PayaraServer srv, final boolean force,
+ final PayaraStatusListener listener,
+ final PayaraStatus... newState) {
+ StatusJob job = getJob(srv);
+ return job != null
+ ? job.startState(this, force, listener, newState) : false;
+ }
+
+ /**
+ * Switch GlassFisg server status monitoring into shutdown mode.
+ * <p/>
+ * @param srv GlassFisg server instance to be stopped.
+ * @return Value of <code>true</code> when server instance is being
+ * monitored in startup mode or <code>false</code> if switching
+ * failed.
+ */
+ public boolean shutdown(final PayaraServer srv) {
+ StatusJob job = getJob(srv);
+ return job != null ? job.shutdownState(this) : false;
+ }
+
+ /**
+ * Register GlassFisg server instance into scheduler, register server status
+ * listener and launch server status checking jobs.
+ * <p/>
+ * @param status Payara server status entity.
+ * @param listener Server status listener to be registered.
+ * @param currentState Notify about current server status after every check
+ * when <code>true</code>.
+ * @param newState Notify about server status change for new states
+ * provided as this argument.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public boolean add(final PayaraStatusEntity status,
+ final PayaraStatusListener listener, final boolean currentState,
+ final PayaraStatus... newState) {
+ boolean result;
+ StatusJob job = new StatusJob(status);
+ job.addStatusListener(listener, currentState, newState);
+ if (result = addJob(job)) {
+ job.scheduleNew(this);
+ }
+ return result;
+ }
+
+ /**
+ * Register GlassFisg server instance into scheduler and launch server
+ * status checking jobs.
+ * <p/>
+ * @param status Payara server status entity.
+ * @return Value of <code>true</code> when server instance was successfully
+ * added into scheduler and status checking job was started
+ * or <code>false</code> otherwise.
+ */
+ public boolean add(final PayaraStatusEntity status) {
+ boolean result;
+ StatusJob job = new StatusJob(status);
+ if (result = addJob(job)) {
+ job.scheduleNew(this);
+ }
+ return result;
+ }
+
+ /**
+ * Unregister GlassFisg server instance from scheduler and and stop server
+ * status checking jobs.
+ * <p/>
+ * @param srv GlassFisg server instance to unregister.
+ * @return Value of <code>true</code> when server instance was successfully
+ * removed from scheduler and status checking job was stopped.
+ * or <code>false</code> when server instance was not registered.
+ */
+ public boolean remove(final PayaraServer srv) {
+ StatusJob job = removeJob(srv);
+ if (job != null) {
+ remove(job);
+ }
+ return job != null;
+ }
+
+ /**
+ * Suspend server status monitoring for GlassFisg server instance.
+ * <p/>
+ * @param srv Payara server instance for which to suspend monitoring.
+ * @return Value of <code>true</code> when server instance monitoring
+ * was suspended or <code>false</code> when server instance
+ * is not registered.
+ */
+ public boolean suspend(final PayaraServer srv) {
+ StatusJob job = getJob(srv);
+ if (job == null) {
+ return false;
+ } else {
+ job.stopJob(this);
+ return true;
+ }
+ }
+
+ /**
+ * Get server status job from jobs {@link Map}.
+ * <p/>
+ * @param srv GlassFisg server instance to search for in jobs.
+ * @return Server status job associated with GlassFisg server instance
+ * or <code>null</code> when no such job exists.
+ */
+ public StatusJob getJob(final PayaraServer srv) {
+ StatusJob job;
+ synchronized (jobs) {
+ job = jobs.get(srv);
+ }
+ return job;
+ }
+
+ /**
+ * Add server status job into jobs {@link Map}.
+ * <p/>
+ * Server status job will be added only if there is no other job for
+ * GlassFisg server instance associated with this job.
+ * <p/>
+ * @return Value of <code>true</code> when jow was added into jobs
+ * {@link Map} or <code>false</code> otherwise.
+ */
+ private boolean addJob(final StatusJob job) {
+ synchronized (jobs) {
+ if (jobs.get(job.getStatus().getServer()) == null) {
+ jobs.put(job.getStatus().getServer(), job);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Remove server status job from jobs {@link Map}.
+ * <p/>
+ * @param srv GlassFisg server instance associated with job to be removed.
+ * @return Server status job that was removed or <code>null</code> when
+ * no job for given server instance was found.
+ */
+ private StatusJob removeJob(final PayaraServer srv) {
+ StatusJob job;
+ synchronized (jobs) {
+ job = jobs.remove(srv);
+ }
+ return job;
+ }
+
+ /**
+ * Schedule periodic execution of <code>__locations</code>
+ * asynchronous task.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ * @param initialDelay Task execution initial delay.
+ */
+ private ScheduledFuture scheduleLocationsTask(
+ final StatusJob job, final long initialDelay) {
+ RunnerTask runnerTask = new RunnerTask(job,
+ job.getLocations(), PayaraStatusCheck.LOCATIONS);
+ long delay = selectDelay(job.getState());
+ ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay(
+ runnerTask, initialDelay, delay, TimeUnit.MILLISECONDS);
+ job.getLocations().setTaskFuture(runnerTask, scheduledFuture);
+ return scheduledFuture;
+ }
+
+ /**
+ * Schedule periodic execution of <code>version</code> asynchronous task.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ * @param initialDelay Task execution initial delay.
+ */
+ private ScheduledFuture scheduleVersionTask(
+ final StatusJob job, final long initialDelay) {
+ RunnerTask runnerTask = new RunnerTask(job,
+ job.getVersion(), PayaraStatusCheck.VERSION);
+ long delay = selectDelay(job.getState());
+ ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay(
+ runnerTask, initialDelay, delay, TimeUnit.MILLISECONDS);
+ job.getVersion().setTaskFuture(runnerTask, scheduledFuture);
+ return scheduledFuture;
+ }
+
+ /**
+ * Schedule periodic execution of <code>__locations</code>
+ * asynchronous task.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private ScheduledFuture scheduleLocationsTask(final StatusJob job) {
+ long initialDelay = selectInitialDelay(job.getState());
+ return scheduleLocationsTask(job, initialDelay);
+ }
+
+ /**
+ * Schedule periodic execution of <code>version</code> asynchronous task.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private ScheduledFuture scheduleVersionTask(final StatusJob job) {
+ long initialDelay = selectInitialDelay(job.getState());
+ return scheduleVersionTask(job, initialDelay);
+ }
+
+ /**
+ * Schedule periodic execution of port check asynchronous task.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private ScheduledFuture scheduleAdminPortTask(final StatusJob job) {
+ AdminPortTask portTask = new AdminPortTask(job,
+ job.getPortCheck(), CONNECT_TIMEOUT);
+ long delay = selectDelay(job.getState());
+ long initialDelay = selectInitialDelay(job.getState());
+ ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay(
+ portTask, initialDelay, delay, TimeUnit.MILLISECONDS);
+ job.getPortCheck().setTaskFuture(portTask, scheduledFuture);
+ return scheduledFuture;
+ }
+
+ /**
+ * Cancel execution of scheduled job task.
+ * <p/>
+ * @param task Individual status check task data.
+ */
+ void cancel(final StatusJob.Task task) {
+ ScheduledFuture future = task.getFuture();
+ if (future != null) {
+ future.cancel(true);
+ }
+ AbstractTask runnable = task.getTask();
+ if (runnable != null) {
+ runnable.cancel();
+ executor.remove(runnable);
+ }
+ task.clearTaskFuture();
+ }
+
+ /**
+ * Administrator port only check for states where we do not expect server
+ * to be fully responding.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void portCheckOnly(final StatusJob job) {
+ scheduleAdminPortTask(job);
+ job.getVersion().clearTaskFuture();
+ job.getLocations().clearTaskFuture();
+ }
+
+ /**
+ * All checks at once when we need full result ASAP.
+ * <p/>
+ * Local check does not need version. Locations is enough to see if
+ * server is running from registered installation directory and domain.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void localChecksAtOnce(final StatusJob job) {
+ scheduleAdminPortTask(job);
+ scheduleLocationsTask(job);
+ job.getVersion().clearTaskFuture();
+ }
+
+ /**
+ * All checks step by step when server state is stable and we have to run
+ * all checks.
+ * <p/>
+ * Local check does not need version. Locations is enough to see if
+ * server is running from registered installation directory and domain.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void localChecksStepByStep(final StatusJob job) {
+ long delay = selectDelay(job.getState());
+ long initialDelay = selectInitialDelay(job.getState());
+ scheduleAdminPortTask(job);
+ scheduleLocationsTask(job, initialDelay + delay / 2);
+ job.getVersion().clearTaskFuture();
+ }
+
+ /**
+ * Checks for local server when in stable online state.
+ * <p/>
+ * Local check does not need version. Locations is enough to see if
+ * server is running from registered installation directory and domain.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void localChecksCommand(final StatusJob job) {
+ long initialDelay = selectInitialDelay(job.getState());
+ scheduleLocationsTask(job, initialDelay);
+ job.getPortCheck().clearTaskFuture();
+ job.getVersion().clearTaskFuture();
+ }
+
+ /**
+ * Checks for remote server at once when we need full result ASAP.
+ * <p/>
+ * Locations task makes no sense for remote server because there is no way
+ * to verify registered installation directory and domain. We can at least
+ * check server version.
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void remoteChecksAtOnce(final StatusJob job) {
+ scheduleAdminPortTask(job);
+ scheduleVersionTask(job);
+ job.getLocations().clearTaskFuture();
+
+ }
+
+ /**
+ * Checks for remote server step by step when server state is stable and
+ * we have to run all checks.
+ * <p/>
+ * Locations task makes no sense for remote server because there is no way
+ * to verify registered installation directory and domain. We can at least
+ * check server version.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void remoteChecksStepByStep(final StatusJob job) {
+ long delay = selectDelay(job.getState());
+ long initialDelay = selectInitialDelay(job.getState());
+ scheduleAdminPortTask(job);
+ scheduleVersionTask(job, initialDelay + delay / 2);
+ job.getLocations().clearTaskFuture();
+ }
+
+ /**
+ * Checks for remote server when in stable online state.
+ * <p/>
+ * Locations task makes no sense for remote server because there is no way
+ * to verify registered installation directory and domain. We can at least
+ * check server version.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void remoteChecksCommand(final StatusJob job) {
+ long initialDelay = selectInitialDelay(job.getState());
+ scheduleVersionTask(job, initialDelay);
+ job.getPortCheck().clearTaskFuture();
+ job.getLocations().clearTaskFuture();
+ }
+
+ /**
+ * Do not run any check.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status check job internal data.
+ */
+ private void noChecks(final StatusJob job) {
+ job.getPortCheck().clearTaskFuture();
+ job.getLocations().clearTaskFuture();
+ job.getVersion().clearTaskFuture();
+
+ }
+
+ /**
+ * Remove all scheduled tasks from executor.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ */
+ void remove(final StatusJob job) {
+ cancel(job.getPortCheck());
+ cancel(job.getVersion());
+ cancel(job.getLocations());
+ executor.purge();
+ }
+
+ /**
+ * Schedule new server status job.
+ * <p/>
+ * Schedule tasks for newly created server status job which is still
+ * in <code>UNKNOWN</code> state.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status job.
+ */
+ void scheduleNew(final StatusJob job) {
+ final String METHOD = "scheduleNew";
+ switch (job.getState()) {
+ case UNKNOWN:
+ portCheckOnly(job);
+ return;
+ default:
+ throw new IllegalStateException(
+ LOGGER.excMsg(METHOD, "illegalState"));
+ }
+ }
+
+ /**
+ * Schedule server status job after internal state transition to follow
+ * current strategy.
+ * <p/>
+ * Schedule tasks for already existing job can be in any state except
+ * <code>UNKNOWN</code>.
+ * <p/>
+ * Caller must own <code>job</code> lock.
+ * <p/>
+ * @param job Server status job.
+ */
+ void reschedule(final StatusJob job) {
+ final String METHOD = "reschedule";
+ switch (job.getState()) {
+ case NO_CHECK:
+ noChecks(job);
+ return;
+ case OFFLINE: case STARTUP: case SHUTDOWN_PORT: case UNKNOWN:
+ portCheckOnly(job);
+ return;
+ case ONLINE:
+ if (job.getStatus().getServer().isRemote())
+ remoteChecksCommand(job);
+ else
+ localChecksCommand(job);
+ return;
+ case SHUTDOWN:
+ if (job.getStatus().getServer().isRemote())
+ remoteChecksStepByStep(job);
+ else
+ localChecksStepByStep(job);
+ return;
+ case STARTUP_PORT: case OFFLINE_PORT: case UNKNOWN_PORT:
+ if (job.getStatus().getServer().isRemote())
+ remoteChecksAtOnce(job);
+ else
+ localChecksAtOnce(job);
+ return;
+ default:
+ throw new IllegalStateException(
+ LOGGER.excMsg(METHOD, "unhandled"));
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBuffer.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBuffer.java
new file mode 100644
index 0000000..502c343
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBuffer.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import org.netbeans.modules.payara.tooling.logging.Logger;
+
+/**
+ * Cyclic <code>String</code> buffer.
+ * <p/>
+ * Stores up to <code><size></code> characters in cyclic buffer and allows
+ * to simply append new characters to the end or prepend new characters
+ * to the beginning of the buffer without necessity to move buffer content.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class CyclicStringBuffer {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CyclicStringBuffer.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Buffer size. */
+ private int size;
+
+ /** Buffer content. */
+ private char[] buff;
+
+ /** Count of valid characters in the buffer. */
+ private int len;
+
+ /** Current beginning of valid characters storage. */
+ private int beg;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of cyclic <code>String</code> buffer.
+ * <p/>
+ * @param size Cyclic <code>String</code> buffer size.
+ */
+ public CyclicStringBuffer(final int size) {
+ this.size = size;
+ this.buff = new char[size];
+ len = 0;
+ beg = 0;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Resize cyclic <code>String</code> buffer.
+ * <p/>
+ * Content of buffer will be removed.
+ * <p/>
+ * @param size New cyclic <code>String</code> buffer size.
+ */
+ public void resize(final int size) {
+ if (this.size != size) {
+ this.size = size;
+ this.buff = new char[size];
+ }
+ len = 0;
+ beg = 0;
+ }
+
+ /**
+ * Appends character at the end of the buffer.
+ * <p/>
+ * First character in the buffer will be discarded when buffer is full.
+ * <p/>
+ * @param c Character to be appended.
+ * @return Value of <code>true</code> when buffer was full and first
+ * character in the buffer got overwritten or <code>false</code>
+ * otherwise.
+ */
+ public boolean append(final char c) {
+ buff[(beg + len) % size] = c;
+ if (len == size) {
+ beg = (beg + 1) % size;
+ return true;
+ } else {
+ len += 1;
+ return false;
+ }
+ }
+
+ /**
+ * Appends character at the beginning of the buffer.
+ * <p/>
+ * Last character in the buffer will be discarded when buffer is full.
+ * <p/>
+ * @param c Character to be prepended.
+ * @return Value of <code>true</code> when buffer was full and last
+ * character in the buffer got overwritten or <code>false</code>
+ * otherwise.
+ */
+ public boolean prepend(final char c) {
+ beg = (beg + size - 1) % size;
+ buff[beg] = c;
+ if (len == size) {
+ return true;
+ } else {
+ len += 1;
+ return false;
+ }
+ }
+
+ /**
+ * Compares buffer content to the specific {@link String}.
+ * <p/>
+ * Empty {@link String} value and <code>null</code> value are considered
+ * as equivalent and are equal to zero length buffer content.
+ * <p/>
+ * @return Value of <code>true</code> if buffer content represents
+ * {@link String} equivalent to this provided string
+ * or <code>false</code> otherwise.
+ */
+ public boolean equals(final String s) {
+ // Handle null value.
+ if (s == null) {
+ return len == 0;
+ }
+ // Cut evaluation for differend lengths.
+ if (len != s.length()) {
+ return false;
+ }
+ boolean result = true;
+ for (int i = 0; i < len; i++) {
+ if (buff[(beg + i) % size] != s.charAt(i)) {
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns {@link String} stored in buffer.
+ * <p/>
+ * Zero length content is returned as zero length {@link String};
+ * <p/>
+ * @return {@link String} stored in buffer.
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(len);
+ for (int i = 0; i < len; i++) {
+ sb.append(buff[(beg + i) % size]);
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/EnumUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/EnumUtils.java
new file mode 100644
index 0000000..c269150
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/EnumUtils.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+/**
+ * Enumeration helper methods:<ul>
+ * <li>Ordinal value based comparison.</li>
+ * </ul>
+ * @author Tomas Kraus
+ */
+public final class EnumUtils {
+
+ /**
+ * Ordinal value based comparison: <i>equals</i> {@code v1 == v2}.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * and {@code v2} are equal or both values are {@code null}.
+ * Value of {@code false} otherwise.
+ */
+ public static final boolean eq(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() == v2.ordinal() : false)
+ : v2 == null;
+ }
+
+ /**
+ * Ordinal value based comparison: <i>not equals</i> {@code v1 != v2}.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * and {@code v2} are not equal or one of the values
+ * is {@code null} and second one is not {@code null}. Value
+ * of {@code false} otherwise.
+ */
+ public static final boolean ne(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() != v2.ordinal() : true)
+ : v2 != null;
+ }
+
+ /**
+ * Ordinal value based comparison: <i>less than</i> {@code v1 < v2}.
+ * Value of {@code null} is considered less than any ordinal value.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * is less than {@code v2} or {@code v1} is {@code null}
+ * and {@code v2} is not {@code null}. Value of {@code false}
+ * otherwise.
+ */
+ public static final boolean lt(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() < v2.ordinal() : false)
+ : v2 != null;
+ }
+
+ /**
+ * Ordinal value based comparison: <i>less than or equal</i> {@code v1 <= v2}.
+ * Value of {@code null} is considered less than any ordinal value.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * is less than or equal to {@code v2} or {@code v1} is {@code null}
+ * and {@code v2} is not {@code null}. Value of {@code false}
+ * otherwise.
+ */
+ public static final boolean le(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() <= v2.ordinal() : false)
+ : true;
+ }
+
+ /**
+ * Ordinal value based comparison: <i>greater than</i> {@code v1 > v2}.
+ * Value of {@code null} is considered less than any ordinal value.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * is greater than {@code v2} or {@code v1} is {@code null}
+ * and {@code v2} is not {@code null}. Value of {@code false}
+ * otherwise.
+ */
+ public static final boolean gt(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() > v2.ordinal() : true)
+ : false;
+ }
+
+ /**
+ * Ordinal value based comparison: <i>greater than or equal</i> {@code v1 >= v2}.
+ * Value of {@code null} is considered less than any ordinal value.
+ * <p/>
+ * @param v1 First {@link Enum} instance to be compared.
+ * @param v2 Second {@link Enum} instance to be compared.
+ * @return Value of {@code true} when ordinal values of {@code v1}
+ * is greater than or equal to {@code v2} or {@code v1} is not {@code null}
+ * and {@code v2} is {@code null}. Value of {@code false}
+ * otherwise.
+ */
+ public static final boolean ge(
+ final Enum<? extends Enum> v1, final Enum<? extends Enum> v2) {
+ return v1 != null
+ ? (v2 != null ? v1.ordinal() >= v2.ordinal() : true)
+ : v2 == null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ExceptionMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ExceptionMessages.properties
new file mode 100644
index 0000000..d780451
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ExceptionMessages.properties
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Exception messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# NetUtils class
+NetUtils.getHostIPs.exception=Could not retrieve host IP addresses.
+NetUtils.getHostIP4s.exception=Could not retrieve host IPv4 addresses.
+NetUtils.getHostIP6s.exception=Could not retrieve host IPv6 addresses.
+
+# ServerUtils class
+ServerUtils.getDomainConfigFile.domainsRootNull=Payara server domains root \
+full path shall not be null.
+ServerUtils.getDomainConfigFile.domainNameNull=Payara server domains name \
+shall not be null.
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Jar.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Jar.java
new file mode 100644
index 0000000..6efd303
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Jar.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+/**
+ * JAR file utilities.
+ * <p/>
+ * This class is a stream wrapper. {@link #close} method should be called
+ * before class instance is abandoned like when working with streams.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class Jar {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** JManifest attribute containing version string. */
+ public static final String MANIFEST_BUNDLE_VERSION = "Bundle-Version";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+ /** JAR file input stream. */
+ private final JarInputStream jar;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Creates an instance of JAR file.
+ * <p/>
+ * @param jarfile JAR file to be opened.
+ */
+ public Jar(File jarfile) {
+ JarInputStream jarStream = null;
+ try {
+ jarStream = new JarInputStream(new FileInputStream(jarfile));
+ } catch (IOException ioe) {
+ jar = null;
+ throw new JarException(JarException.OPEN_ERROR, ioe);
+ }
+ jar = jarStream;
+ }
+
+ /**
+ * Creates an instance of JAR file.
+ * <p/>
+ * @param jarfile JAR file to be opened.
+ */
+ public Jar(String jarfile) {
+ JarInputStream jarStream = null;
+ try {
+ jarStream = new JarInputStream(new FileInputStream(jarfile));
+ } catch (IOException ioe) {
+ jar = null;
+ throw new JarException(JarException.OPEN_ERROR, ioe);
+ }
+ jar = jarStream;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Returns the <code>Manifest</code> for this JAR file, or
+ * <code>null</code> if none.
+ * <p/>
+ * @return The <code>Manifest</code> for this JAR file, or
+ * <code>null</code> if none.
+ */
+ public Manifest getManifest() {
+ return jar.getManifest();
+ }
+
+ /**
+ * Returns the bundle version string from Manifest file.
+ * <p/>
+ * @return Bundle version string from Manifest file or <code>null</code>
+ * when no such attribute exists.
+ */
+ public String getBundleVersion() {
+ Manifest manifest = jar.getManifest();
+ Attributes attrs = manifest != null
+ ? manifest.getMainAttributes() : null;
+ return attrs != null ? attrs.getValue(MANIFEST_BUNDLE_VERSION) : null;
+ }
+
+ /**
+ * Close JAR file and release all allocated resources.
+ * <p/>
+ * This method should be called when this object is being released to avoid
+ * memory leaks.
+ */
+ public void close() {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException ioe) {
+ throw new JarException(JarException.CLOSE_ERROR, ioe);
+ }
+ }
+ }
+
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JarException.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JarException.java
new file mode 100644
index 0000000..5a6aec9
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JarException.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */package org.netbeans.modules.payara.tooling.utils;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+
+/**
+ * Utils JAR Exception related to JAR file handling problems.
+ * <p>
+ * All exceptions are logging themselves on WARNING level when created.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class JarException extends PayaraIdeException {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Exception message for JAR file opening issues. */
+ static final String OPEN_ERROR = "Cannot open JAR file.";
+
+ /** Exception message for JAR file opening issues. */
+ static final String CLOSE_ERROR = "Cannot close JAR file.";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of <code>JarException</code> without
+ * detail message.
+ */
+ public JarException() {
+ super();
+ }
+
+ /**
+ * Constructs an instance of <code>JarException</code> with the
+ * specified detail message.
+ * <p>
+ * @param msg The detail message.
+ */
+ public JarException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs an instance of <code>JarException</code> with the
+ * specified detail message and arguments.
+ * <p/>
+ * Uses {@link java.text.MessageFormat} to format message.
+ * <p/>
+ * @param msg The detail message.
+ * @param arguments Arguments to be inserted into message.
+ */
+ public JarException(String msg, Object... arguments) {
+ super(msg, arguments);
+ }
+
+ /**
+ * Constructs an instance of <code>JarException</code> with the
+ * specified detail message and cause. Exception is logged on WARN level.
+ * <p>
+ * Note that the detail message associated with {@code cause} is <i>not</i>
+ * automatically incorporated in this runtime exception's detail message.
+ * <p>
+ * @param msg the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <code>null</code> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public JarException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JavaUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JavaUtils.java
new file mode 100644
index 0000000..6874581
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/JavaUtils.java
@@ -0,0 +1,372 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.config.JavaSEPlatform;
+
+/**
+ * Java related utilities
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class JavaUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Java executables directory underJava home. */
+ private static final String JAVA_BIN_DIR = "bin";
+
+ /** Java VM executable file name (without path). */
+ private static final String JAVA_VM_EXE = "java";
+
+ /** Java VM command line option to retrieve version. */
+ private static final String VM_VERSION_OPT = "-version";
+
+ /** Java SE JDK class path option. */
+ public static final String VM_CLASSPATH_OPTION = "-cp";
+
+ /** Java VM system property option. */
+ private static final String VM_SYS_PROP_OPT = "-D";
+
+ /** Java VM system property quoting character. */
+ private static final char VM_SYS_PROP_QUOTE = '"';
+
+ /** Java VM system property assignment. */
+ private static final String VM_SYS_PROP_ASSIGN = "=";
+
+ /** Java VM system environment <code>JAVA_HOME</code> variable name. */
+ public static final String JAVA_HOME_ENV = "JAVA_HOME";
+
+ /** UTF-8 {@link Charset}. */
+ public static final Charset UTF_8 = Charset.forName("UTF-8");
+ /**
+ * Java VM version output regular expression pattern.
+ * <p/>
+ * Regular expression contains tokens to read individual version number
+ * components. Expected input is string like
+ * <code>java version "1.6.0_30"</code>.
+ */
+// private static final String VM_VERSION_PATTERN =
+// " *[jJ][aA][vV][aA] +[vV][eE][rR][sS][iI][oO][nN] +" +
+// "\"{0,1}([0-9]+).([0-9]+).([0-9]+)_([0-9]+)\"{0,1} *";
+ private static final String VM_VERSION_PATTERN =
+ "[^0-9]*([0-9]+)\\.([0-9]+)(?:\\.([0-9]+)(?:[-_\\.]([0-9]+)){0,1}){0,1}[^0-9]*";
+
+ /** Number of <code>Matcher</code> groups (REGEX tokens) expected in Java VM
+ * version output. */
+ private static final int VM_MIN_VERSION_TOKENS = 2;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Java VM version storage class.
+ * <p/>
+ * Stored version is in
+ * <code><major>.<minor<.<revision<_<update<></code>
+ */
+ public static class JavaVersion {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Major version number. */
+ final int major;
+
+ /** Minor version number. */
+ final int minor;
+
+ /** Revision number. */
+ final int revision;
+
+ /** Patch update number. */
+ final int patch;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of Java VM version number.
+ * <p/>
+ * @param major
+ */
+ public JavaVersion(int major, int minor, int revision, int patch) {
+ this.major = major;
+ this.minor = minor;
+ this.revision = revision;
+ this.patch = patch;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Compares this <code>JavaVersion</code> object against another one.
+ * <p/>
+ * @param version <code>JavaVersion</code> object to compare with
+ * <code>this</code> object.
+ * @return Compare result:<ul>
+ * <li/>Value <code>1</code> if <code>this</code> value
+ * is greater than supplied <code>version</code> value.
+ * <li/>Value <code>-1</code> if <code>this</code> value
+ * is lesser than supplied <code>version</code> value.
+ * <li/>Value <code>0</code> if both <code>this</code> value
+ * and supplied <code>version</code> values are equal.
+ * </ul>
+ */
+ public int comapreTo(JavaVersion version) {
+ return this.major > version.major ? 1 :
+ this.major < version.major ? -1 :
+ this.minor > version.minor ? 1 :
+ this.minor < version.minor ? -1 :
+ this.revision > version.revision ? 1 :
+ this.revision < version.revision ? -1 :
+ this.patch > version.patch ? 1 :
+ this.patch < version.patch ? -1 : 0;
+ }
+
+ /**
+ * Return <code>String</code> representation of Java VM version object.
+ * <p/>
+ * @return Java VM version string.
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(16);
+ sb.append(major);
+ sb.append('.');
+ sb.append(minor);
+ sb.append('.');
+ sb.append(revision);
+ sb.append('_');
+ sb.append(patch);
+ return sb.toString();
+ }
+
+ /**
+ * Return {@link JavaSEPlatform} matching this Java SE version.
+ * <p/>
+ * @return {@link JavaSEPlatform} matching this Java SE version.
+ */
+ public JavaSEPlatform toPlatform() {
+ StringBuilder sb = new StringBuilder(6);
+ sb.append(major);
+ sb.append('.');
+ sb.append(minor);
+ return JavaSEPlatform.toValue(sb.toString());
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // TODO: This test should be rewritten to use probe class to retrieve
+ // system properties from JRE.
+ /**
+ * Java VM version detector.
+ * <p/>
+ * Executes java -version and tries to find output line containing<ul>
+ * <li/><code>java version "MA.MI.RE_PA"</code>
+ * </ul>
+ * Where<ul>
+ * <li/>MA is major version number,
+ * <li/>MI is minor version number,
+ * <li/>RE is revision number and
+ * <li/>PA is patch update number,
+ * </ul>
+ * Label <code>java version</code> is parsed as non case sensitive.
+ */
+ public static JavaVersion javaVmVersion(File javaVm) {
+ // Run Java VM: java -version.
+ ProcessBuilder pb = new ProcessBuilder(
+ javaVm.getAbsolutePath(), VM_VERSION_OPT);
+ Process process;
+ pb.redirectErrorStream(true);
+ try {
+ process = pb.start();
+ // Handle I/O errors.
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING,
+ "Caught IOException while executing Java VM.", ioe);
+ return null;
+ // Handle security issues.
+ } catch (SecurityException se) {
+ Logger.log(Level.WARNING,
+ "Caught SecurityException while executing Java VM.", se);
+ return null;
+ }
+ // Read and parse Java VM output to search for version string.
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(process.getInputStream()));
+ int major = 0, minor = 0, revision = 0, patch = 0;
+ String line;
+ Pattern pattern = Pattern.compile(VM_VERSION_PATTERN);
+ try {
+ while ((line = in.readLine()) != null) {
+ Matcher matcher = pattern.matcher(line);
+ if (matcher.find()) {
+ int groupCount = matcher.groupCount();
+ if (groupCount >= VM_MIN_VERSION_TOKENS) {
+ // [0-9]+ REGEX pattern is validating numbers in tokens.
+ // NumberFormatException can't be thrown.
+ major = Integer.parseInt(matcher.group(1));
+ minor = Integer.parseInt(matcher.group(2));
+ revision = groupCount > 2 && matcher.group(3) != null
+ ? Integer.parseInt(matcher.group(3)) : 0;
+ patch = groupCount > 3 && matcher.group(4) != null
+ ? Integer.parseInt(matcher.group(4)) : 0;
+ break;
+ }
+ }
+ }
+ // Handle I/O errors.
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING,
+ "Caught IOException while reading Java VM output.", ioe);
+ return null;
+ }
+ return new JavaVersion(major, minor, revision, patch);
+ }
+
+ /**
+ * Build Java VM executable full path from Java Home directory.
+ * <p/>
+ * @param javaHome Full path to Java Home directory.
+ * @return Java VM executable full path.
+ */
+ public static String javaVmExecutableFullPath(String javaHome) {
+ int javaHomeLen = javaHome.length();
+ int execSuffixLen = OsUtils.EXEC_SUFFIX.length();
+ boolean javaHomeEndsWithPathSep =
+ javaHome.charAt(javaHomeLen - 1) ==
+ File.separatorChar;
+ boolean isExecSuffix = execSuffixLen > 0;
+ // Count full size to avoid resizing.
+ StringBuilder javaExecStr = new StringBuilder(
+ javaHomeLen +
+ (javaHomeEndsWithPathSep ? 0 : 1) +
+ JAVA_BIN_DIR.length() + 1 + JAVA_VM_EXE.length() +
+ (isExecSuffix ? execSuffixLen + 1 : 0));
+ // Build string.
+ javaExecStr.append(javaHome);
+ if (!javaHomeEndsWithPathSep) {
+ javaExecStr.append(File.separatorChar);
+ }
+ javaExecStr.append(JAVA_BIN_DIR);
+ javaExecStr.append(File.separatorChar);
+ javaExecStr.append(JAVA_VM_EXE);
+ if (isExecSuffix) {
+ javaExecStr.append(OsUtils.EXEC_SUFFIX);
+ }
+ return javaExecStr.toString();
+ }
+
+ /**
+ * Build quoted Java VM system property name by prefixing property name
+ * with <code>-D</code> as <code>-D"<name>"</code>.
+ * <p/>
+ * @param name Java VM system property name to be prefixed.
+ */
+ public static String systemPropertyName(String name) {
+ StringBuilder sb = new StringBuilder(
+ 2 + VM_SYS_PROP_OPT.length() + name.length());
+ return systemPropertyName(sb, name);
+ }
+
+ /**
+ * Build quoted Java VM system property name by prefixing property name
+ * with <code>-D</code> as <code>-D"<name>"</code> into
+ * {@link StringBuilder} instance.
+ * <p/>
+ * @param sb {@link StringBuilder} instance where to append Java VM
+ * system property.
+ * @param name Java VM system property name to be prefixed.
+ */
+ public static String systemPropertyName(StringBuilder sb, String name) {
+ sb.append(VM_SYS_PROP_OPT);
+ sb.append(VM_SYS_PROP_QUOTE);
+ sb.append(name);
+ sb.append(VM_SYS_PROP_QUOTE);
+ return sb.toString();
+ }
+
+ /**
+ * Build quoted Java VM system property
+ * <code>-D"<name>=<value>"</code>.
+ * <p/>
+ * @param name Java VM system property name.
+ * @param value Java VM system property value.
+ */
+ public static String systemProperty(String name, String value) {
+ StringBuilder sb = new StringBuilder(2 + VM_SYS_PROP_OPT.length()
+ + name.length() + VM_SYS_PROP_ASSIGN.length() + value.length());
+ return systemProperty(sb, name, value);
+ }
+
+ /**
+ * Append quoted Java VM system property
+ * <code>-D"<name>=<value>"</code> into {@link StringBuilder}
+ * instance.
+ * <p/>
+ * @param sb {@link StringBuilder} instance where to append Java VM
+ * system property.
+ * @param name Java VM system property name.
+ * @param value Java VM system property value.
+ */
+ public static String systemProperty(
+ StringBuilder sb, String name, String value) {
+ sb.append(VM_SYS_PROP_OPT);
+ sb.append(VM_SYS_PROP_QUOTE);
+ sb.append(name);
+ sb.append(VM_SYS_PROP_ASSIGN);
+ sb.append(value);
+ sb.append(VM_SYS_PROP_QUOTE);
+ return sb.toString();
+ }
+
+ /**
+ * Get URL to access properties file in the same package as given class.
+ * <p/>
+ * @param c Class to determine package.
+ * @param file Properties file name (e.g. <code>Messages.properties</code>).
+ * @return URL to access properties file.
+ */
+ public static URL getPropertiesURL(final Class c, final String file) {
+ return c.getResource(file);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LinkedList.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LinkedList.java
new file mode 100644
index 0000000..734d1cb
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LinkedList.java
@@ -0,0 +1,639 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+/**
+ * Doubly linked list with internal iterator.
+ * <p/>
+ * This linked list implementation allows to work with individual list elements
+ * on fly without the need of external iterator.
+ * <p/>
+ * List is not thread safe.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class LinkedList <V> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner Classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Linked list element containing stored value and links to neighbor nodes.
+ */
+ public static class Element<V> {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Pointer to previous element in list. */
+ private Element<V> previous;
+
+ /** Pointer to next element in list. */
+ private Element<V> next;
+
+ /** Stored value object. */
+ private V value;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of linked list element and sets it's stored
+ * <code>value</code> object.
+ * <p/>
+ * Pointers to <code>previous</code> and <code>next</code> element
+ * are set to <code>null</code>.
+ * <p/>
+ * @param value Stored value object.
+ */
+ Element(V value) {
+ this(value, null, null);
+ }
+
+ /**
+ * Constructs an instance of linked list element and sets it's stored
+ * <code>value</code> object and pointers to <code>previous</code>
+ * and <code>next/<code> element.
+ * <p/>
+ * @param value Stored value object.
+ */
+ Element(V value, Element<V> previous, Element<V> next) {
+ this.value = value;
+ this.previous = previous;
+ this.next = next;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Clear all internal attributes (set them to <code>null</code>).
+ * <p/>
+ * Garbage collector helper.
+ */
+ void clear() {
+ previous = null;
+ next = null;
+ value = null;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** List head (first element in the list). List should be empty when this
+ * pointer is <code>null</code>. */
+ private Element<V> head;
+
+ /** List tail (last element in the list). List should be empty when this
+ * pointer is <code>null</code>. */
+ private Element<V> tail;
+
+ /** Current element in the list used by internal iterator. List should
+ * be empty when this pointer is <code>null</code>. */
+ private Element<V> current;
+
+ /** List size. */
+ private int size;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of linked list.
+ * <p/>
+ * List is initialized as empty.
+ */
+ public LinkedList() {
+ head = tail = current = null;
+ size = 0;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add element at the end (after tail) of the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when list is not empty</li> or
+ * <li>will be set to newly added element when list is empty.</li>
+ * </ul>
+ * @param value New value to be added at the end of the list.
+ */
+ public void addLast(V value) {
+ if (tail == null) {
+ head = tail = current = new Element<>(value);
+ } else {
+ tail.next = new Element<>(value, tail, null);
+ tail = tail.next;
+ }
+ size++;
+ }
+
+ /**
+ * Add element at the beginning (before head) of the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when list is not empty</li> or
+ * <li>will be set to newly added element when list is empty.</li>
+ * </ul>
+ * @param value New value to be added at the end of the list.
+ */
+ public void addFirst(V value) {
+ if (tail == null) {
+ head = tail = current = new Element<>(value);
+ } else {
+ head.previous = new Element<>(value, null, head);
+ head = tail.previous;
+ }
+ size++;
+ }
+
+ /**
+ * Remove last (tail) element from the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when it is not tail of the list</li> or
+ * <li>will be set to previous element when it is tail of the list.</li>
+ * </ul>
+ * @return Data stored in removed last element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeLast() {
+ if (tail == null) {
+ return null;
+ } else {
+ Element<V> remove = tail;
+ V value = tail.value;
+ if (tail.previous != null) {
+ tail.previous.next = null;
+ } else {
+ head = null;
+ }
+ if (current == tail) {
+ current = current.previous;
+ }
+ tail = tail.previous;
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Remove first (head) element from the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when it is not head of the list</li> or
+ * <li>will be set to next element when it is head of the list.</li>
+ * </ul>
+ * @return Data stored in removed last element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeFirst() {
+ if (head == null) {
+ return null;
+ } else {
+ Element<V> remove = head;
+ V value = head.value;
+ if (head.next != null) {
+ head.next.previous = null;
+ } else {
+ tail = null;
+ }
+ if (current == head) {
+ current = current.next;
+ }
+ head = head.next;
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Add element after current element in the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when list is not empty</li> or
+ * <li>will be set to newly added element when list is empty.</li>
+ * </ul>
+ * Tail is moved to newly added element when current element is tail.
+ * <p/>
+ * @param value New value to be added at the end of the list.
+ */
+ public void addNext(V value) {
+ if (current == null) {
+ head = tail = current = new Element(value);
+ } else {
+ Element<V> add = new Element<>(value, current, current.next);
+ if (current.next != null) {
+ current.next.previous = add;
+ } else {
+ tail = add;
+ }
+ current.next = add;
+ }
+ size++;
+ }
+
+ /**
+ * Add element before current element in the list.
+ * <p/>
+ * Current element<ul>
+ * <li>won't be changed when list is not empty</li> or
+ * <li>will be set to newly added element when list is empty.</li>
+ * </ul>
+ * Head is moved to newly added element when current element is head.
+ * <p/>
+ * @param value New value to be added at the end of the list.
+ */
+ public void addPrevious(V value) {
+ if (current == null) {
+ head = tail = current = new Element(value);
+ } else {
+ Element<V> add = new Element<>(value, current.previous, current);
+ if (current.previous != null) {
+ current.previous.next = add;
+ } else {
+ head = add;
+ }
+ current.previous = add;
+ }
+ size++;
+ }
+
+ /**
+ * Remove current element and set current element to previous one
+ * if exists or <code>null</code> if there is no previous element.
+ * <p/>
+ * @return Data stored in removed current element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeAndPrevious() {
+ if (current == null) {
+ return null;
+ } else {
+ Element<V> remove = current;
+ V value = current.value;
+ if (remove.previous != null) {
+ remove.previous.next = remove.next;
+ current = remove.previous;
+ } else {
+ head = remove.next;
+ current = null;
+ }
+ if (remove.next != null) {
+ remove.next.previous = remove.previous;
+ } else {
+ tail = remove.previous;
+ }
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Remove current element and set current element to next one
+ * if exists or <code>null</code> if there is no next element.
+ * <p/>
+ * @return Data stored in removed current element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeAndNext() {
+ if (current == null) {
+ return null;
+ } else {
+ Element<V> remove = current;
+ V value = current.value;
+ if (remove.next != null) {
+ remove.next.previous = remove.previous;
+ current = remove.next;
+ } else {
+ tail = remove.previous;
+ current = null;
+ }
+ if (remove.previous != null) {
+ remove.previous.next = remove.next;
+ } else {
+ head = remove.next;
+ }
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Remove current element and set current element to previous one
+ * if exists or next element as fallback option.
+ * <p/>
+ * Current element should not be <code>null</code> except when list
+ * is empty. Additional check may be required to see which direction
+ * current element was moved.
+ * <p/>
+ * @return Data stored in removed current element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeAndPreviousOrNext() {
+ if (current == null) {
+ return null;
+ } else {
+ Element<V> remove = current;
+ V value = current.value;
+ if (remove.previous != null) {
+ remove.previous.next = remove.next;
+ current = remove.previous;
+ } else {
+ head = remove.next;
+ current = remove.next;
+ }
+ if (remove.next != null) {
+ remove.next.previous = remove.previous;
+ } else {
+ tail = remove.previous;
+ }
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Remove current element and set current element to next one
+ * if exists or previous element as fallback option.
+ * <p/>
+ * Current element should not be <code>null</code> except when list
+ * is empty. Additional check may be required to see which direction
+ * current element was moved.
+ * <p/>
+ * @return Data stored in removed current element of the list. Returns
+ * <code>null</code> when list is empty.
+ */
+ public V removeAndNextOrPrevious() {
+ if (current == null) {
+ return null;
+ } else {
+ Element<V> remove = current;
+ V value = current.value;
+ if (remove.next != null) {
+ remove.next.previous = remove.previous;
+ current = remove.next;
+ } else {
+ tail = remove.previous;
+ current = remove.previous;
+ }
+ if (remove.previous != null) {
+ remove.previous.next = remove.next;
+ } else {
+ head = remove.next;
+ }
+ remove.clear();
+ size--;
+ return value;
+ }
+ }
+
+ /**
+ * Set current element to the first (head) element.
+ * <p/>
+ * @return Value of <code>true</code> if first element exists
+ * or <code>false</code> otherwise.
+ */
+ public boolean first() {
+ return (current = head) != null;
+ }
+
+ /**
+ * Set current element to the last (tail) element.
+ * <p/>
+ * @return Value of <code>true</code> if last element exists
+ * or <code>false</code> otherwise.
+ */
+ public boolean last() {
+ return (current = tail) != null;
+ }
+
+ /**
+ * Attempt to move current pointer to next element.
+ * <p/>
+ * Current pointer will be moved only if there is an element after current
+ * one.
+ * <p/>
+ * @return Value of <code>true</code> if current pointer was moved
+ * to next element or <code>false</code> otherwise.
+ */
+ public boolean next() {
+ if (current != null && current.next != null) {
+ current = current.next;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Attempt to move current pointer to previous element.
+ * <p/>
+ * Current pointer will be moved only if there is an element before current
+ * one.
+ * <p/>
+ * @return Value of <code>true</code> if current pointer was moved
+ * to previous element or <code>false</code> otherwise.
+ */
+ public boolean previous() {
+ if (current != null && current.previous != null) {
+ current = current.previous;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Check if list is empty.
+ * <p/>
+ * @return Value of <code>true</code> when list is empty
+ * (contains no elements) or <code>false</code> otherwise.
+ */
+ public boolean isEmpty() {
+ return head == null;
+ }
+
+ /**
+ * Check if there is a current element.
+ * <p/>
+ * @return Value of <code>true</code> when there is a current element
+ * or <code>false</code> otherwise.
+ */
+ public boolean isCurrent() {
+ return current != null;
+ }
+
+ /**
+ * Check if there is an element after current element.
+ * <p/>
+ * @return Value of <code>true</code> if there is an element after current
+ * element or <code>false</code> otherwise.
+ */
+ public boolean isNext() {
+ return current != null && current.next != null;
+ }
+
+ /**
+ * Check if there is an element before current element.
+ * <p/>
+ * @return Value of <code>true</code> if there is an element before current
+ * element or <code>false</code> otherwise.
+ */
+ public boolean isPrevious() {
+ return current != null && current.previous != null;
+ }
+
+ /**
+ * Get current size of list.
+ * <p/>
+ * @return Current size of list.
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Get value stored in current element.
+ * <p/>
+ * @return Value stored in current element or <code>null</code> when list
+ * is empty.
+ */
+ public V getCurrent() {
+ if (current != null) {
+ return current.value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get value stored in first (head) element.
+ * <p/>
+ * @return Value stored in first (head) element or <code>null</code> when
+ * list is empty.
+ */
+ public V getFirst() {
+ if (head != null) {
+ return head.value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get value stored in last (tail) element.
+ * <p/>
+ * @return Value stored in last (tail) element or <code>null</code> when
+ * list is empty.
+ */
+ public V getLast() {
+ if (tail != null) {
+ return tail.value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get value stored in next element (after current).
+ * <p/>
+ * @return Value stored in next element or <code>null</code> when list
+ * is empty or current element is tail.
+ */
+ public V getNext() {
+ if (current != null && current.next != null) {
+ return current.next.value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get value stored in previous element (before current).
+ * <p/>
+ * @return Value stored in previous element or <code>null</code> when list
+ * is empty or current element is head.
+ */
+ public V getPrevious() {
+ if (current != null && current.previous != null) {
+ return current.previous.value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get string representation of list.
+ * </P>
+ * This iteration over the list won't affect current pointer.
+ * <p/>
+ * @return <code>String</code> representation of all list element from head
+ * to tail.
+ */
+ @Override
+ public String toString() {
+ Element<V> element = head;
+ StringBuilder sb = new StringBuilder("[");
+ while (element != null) {
+ sb.append(element.value != null
+ ? element.value.toString() : "null");
+ element = element.next;
+ if (element != null) {
+ sb.append(',');
+ }
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ /**
+ * Clear linked list content.
+ * <p/>
+ * Removes all elements from the list and sets it's <code>size</code>
+ * to <code>0</code>. Also all individual elements are cleared to help
+ * garbage collector.
+ */
+ public void clear() {
+ current = head;
+ while (current != null) {
+ Element<V> delete = current;
+ current = current.next;
+ delete.clear();
+ }
+ head = tail = current = null;
+ size = 0;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LogMessages.properties b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LogMessages.properties
new file mode 100644
index 0000000..d63e5e7
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/LogMessages.properties
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+################################################################################
+# Log messages #
+# Use <class>.<method>.<name> notation for keys. #
+################################################################################
+
+# NetUtils class
+NetUtils.isPortListeningRemote.closeError=Could not close socket: {0}
+NetUtils.isPortListeningLocal.closeError=Could not close socket: {0}
+NetUtils.isSecurePort.socket=Using socket.connect
+
+################################################################################
+# Log messages for tests #
+################################################################################
+
+# StreamLinesList class
+LinesReader.run.exception=Exception while reading server log lines: {0}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/NetUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/NetUtils.java
new file mode 100644
index 0000000..ec3b0f0
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/NetUtils.java
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.NetworkInterface;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import java.io.PrintWriter;
+
+/**
+ * Networking utilities
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class NetUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Comparator for {@link InetAddress} instances to be sorted.
+ */
+ public static class InetAddressComparator
+ implements Comparator<InetAddress> {
+
+ /**
+ * Compares values of <code>InetAddr</code> instances.
+ * <p/>
+ * @param ip1 First <code>InetAddr</code> instance to be compared.
+ * @param ip2 Second <code>InetAddr</code> instance to be compared.
+ * @return A negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ */
+ @Override
+ public int compare(final InetAddress ip1, final InetAddress ip2) {
+ byte[] addr1 = ip1.getAddress();
+ byte[] addr2 = ip2.getAddress();
+ int result = addr2.length - addr1.length;
+ if (result == 0) {
+ for (int i = 0; result == 0 && i < addr1.length; i++) {
+ result = addr1[i] - addr2[i];
+ }
+ }
+ return result;
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ServerUtils.class);
+
+ /** Port check timeout [ms]. */
+ public static final int PORT_CHECK_TIMEOUT = 2000;
+
+ /** Comparator for {@link InetAddress} instances to be sorted. */
+ private static final InetAddressComparator INET_ADDRESS_COMPARATOR
+ = new InetAddressComparator();
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Finds out if server is running on remote host by connecting to remote
+ * host and port.
+ * <p/>
+ * @param host Server host.
+ * @param port Server port.
+ * @param timeout Network connection timeout [ms].
+ * @return Returns <code>true</code> when server port is accepting
+ * connections or <code>false</code> otherwise.
+ */
+ public static boolean isPortListeningRemote(final String host,
+ final int port, final int timeout) {
+ final String METHOD = "isPortListeningRemote";
+ if (null == host) {
+ return false;
+ }
+ Socket socket = null;
+ try {
+ socket = new Socket();
+ socket.connect(new InetSocketAddress(host, port), timeout);
+ return true;
+ } catch (IOException ex) {
+ return false;
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD,
+ "closeError", ioe.getLocalizedMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * Finds out if server is running on remote host by connecting to remote
+ * host and port.
+ * <p/>
+ * @param host Server host.
+ * @param port Server port.
+ * @return Returns <code>true</code> when server port is accepting
+ * connections or <code>false</code> otherwise.
+ */
+ public static boolean isPortListeningRemote(final String host,
+ final int port) {
+ return isPortListeningRemote(host, port, 0);
+ }
+
+ /**
+ * Finds out if server is running on local host by binding to local port.
+ * <p/>
+ * @param host Server host or <code>null</code> value for address of the
+ * loopback interface.
+ * @param port Server port.
+ * @return Returns <code>true</code> when server port is accepting
+ * connections or <code>false</code> otherwise.
+ */
+ public static boolean isPortListeningLocal(final String host,
+ final int port) {
+ final String METHOD = "isPortListeningLocal";
+ ServerSocket socket = null;
+ try {
+ InetAddress ia = InetAddress.getByName(host);
+ socket = new ServerSocket(port, 1, ia);
+ return false;
+ } catch (IOException ioe) {
+ return true;
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO, METHOD,
+ "closeError", ioe.getLocalizedMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * Determine whether an HTTP listener is secure or not..
+ * <p/>
+ * This method accepts a host name and port #. It uses this information
+ * to attempt to connect to the port, send a test query, analyze the
+ * result to determine if the port is secure or is not secure (currently
+ * only HTTP / HTTPS is supported).
+ * it might emit a warning in the server log for Payara cases.
+ * No Harm, just an annoying warning, so we need to use this call only
+ * when really needed.
+ * <p/>
+ * @param hostname The host for the HTTP listener.
+ * @param port The port for the HTTP listener.
+ * @throws IOException
+ * @throws SocketTimeoutException
+ * @throws ConnectException
+ */
+ public static boolean isSecurePort(String hostname, int port)
+ throws IOException, ConnectException, SocketTimeoutException {
+ return isSecurePort(hostname,port, 0);
+ }
+
+ /**
+ * Determine whether an HTTP listener is secure or not..
+ * <p/>
+ * This method accepts a host name and port #. It uses this information
+ * to attempt to connect to the port, send a test query, analyze the
+ * result to determine if the port is secure or is not secure (currently
+ * only HTTP / HTTPS is supported).
+ * it might emit a warning in the server log for Payara cases.
+ * No Harm, just an annoying warning, so we need to use this call only
+ * when really needed.
+ * <p/>
+ * @param hostname The host for the HTTP listener.
+ * @param port The port for the HTTP listener.
+ * @param depth Method calling depth.
+ * @throws IOException
+ * @throws SocketTimeoutException
+ * @throws ConnectException
+ */
+ private static boolean isSecurePort(String hostname, int port, int depth)
+ throws IOException, ConnectException, SocketTimeoutException {
+ final String METHOD = "isSecurePort";
+ boolean isSecure = true;
+ try (Socket socket = new Socket()) {
+ try {
+ LOGGER.log(Level.FINE, METHOD, "socket");
+ socket.connect(new InetSocketAddress(hostname, port), PORT_CHECK_TIMEOUT);
+ socket.setSoTimeout(PORT_CHECK_TIMEOUT);
+ // This could be bug 70020 due to SOCKs proxy not having localhost
+ } catch (SocketException ex) {
+ String socksNonProxyHosts = System.getProperty("socksNonProxyHosts");
+ if(socksNonProxyHosts != null && socksNonProxyHosts.indexOf("localhost") < 0) {
+ String localhost = socksNonProxyHosts.length() > 0 ? "|localhost" : "localhost";
+ System.setProperty("socksNonProxyHosts", socksNonProxyHosts + localhost);
+ ConnectException ce = new ConnectException();
+ ce.initCause(ex);
+ throw ce; //status unknow at this point
+ //next call, we'll be ok and it will really detect if we are secure or not
+ }
+ }
+ java.io.InputStream istream = socket.getInputStream();
+ //This is the test query used to ping the server in an attempt to
+ //determine if it is secure or not.
+ String testQuery = "GET / HTTP/1.0";
+ PrintWriter pw = new PrintWriter(socket.getOutputStream());
+ pw.println(testQuery);
+ pw.println();
+ pw.flush();
+ byte[] respArr = new byte[1024];
+ while (istream.read(respArr) != -1) {
+ String resp = new String(respArr);
+ if (checkHelper(resp) == false) {
+ isSecure = false;
+ break;
+ }
+ }
+ }
+ return isSecure;
+ }
+
+ private static boolean checkHelper(String respText) {
+ boolean isSecure = true;
+ if (respText.startsWith("http/1.") || respText.startsWith("HTTP/1.")) {
+ isSecure = false;
+ } else if (respText.contains("<html")) {
+ isSecure = false;
+ } else if (respText.contains("</html")) {
+ // New test added to resolve 106245
+ // when the user has the IDE use a proxy (like webcache.foo.bar.com),
+ // the response comes back as "d><title>....</html>". It looks like
+ // something eats the "<html><hea" off the front of the data that
+ // gets returned.
+ //
+ // This test makes an allowance for that behavior. I figure testing
+ // the likely "last bit" is better than testing a bit that is close
+ // to the data that seems to get eaten.
+ //
+ isSecure = false;
+ } else if (respText.contains("connection: ")) {
+ isSecure = false;
+ }
+ return isSecure;
+ }
+
+ /**
+ * Retrieve {@link Set} of IP addresses of this host.
+ * <p/>
+ * @return {@link Set} of IP addresses of this host.
+ * @throws PayaraIdeException if addresses of this host could not
+ * be retrieved.
+ */
+ public static Set<InetAddress> getHostIPs() {
+ final String METHOD = "getHostIPs";
+ Set<InetAddress> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR);
+ try {
+ Enumeration<NetworkInterface> ifaces = NetworkInterface.
+ getNetworkInterfaces();
+ while (ifaces.hasMoreElements()) {
+ NetworkInterface iface = ifaces.nextElement();
+ for (Enumeration<InetAddress> e = iface.getInetAddresses(); e.hasMoreElements(); ) {
+ InetAddress a = e.nextElement();
+ addrs.add(a);
+ }
+ }
+ } catch (SocketException se) {
+ addrs = null;
+ throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception"));
+ }
+ return addrs;
+ }
+
+ /**
+ * Retrieve {@link Set} of IPv4 addresses of this host.
+ * <p/>
+ * @return {@link Set} of IPv4 addresses of this host.
+ */
+ public static Set<Inet4Address> getHostIP4s() {
+ Set<Inet4Address> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR);
+ for (InetAddress a : getHostIPs()) {
+ if (a instanceof Inet4Address) {
+ addrs.add((Inet4Address) a);
+ }
+ }
+ return addrs;
+ }
+
+ /**
+ * Retrieve {@link Set} of IPv6 addresses of this host.
+ * <p/>
+ * @return {@link Set} of IPv6 addresses of this host.
+ */
+ public static Set<Inet6Address> getHostIP6s() {
+ Set<Inet6Address> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR);
+ for (InetAddress a : getHostIPs()) {
+ if (a instanceof Inet6Address) {
+ addrs.add((Inet6Address) a);
+ }
+ }
+ return addrs;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/OsUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/OsUtils.java
new file mode 100644
index 0000000..b62bcd5
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/OsUtils.java
@@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * OS related utilities
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class OsUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** System lines separator. */
+ public static final String LINES_SEPARATOR
+ = System.getProperty("line.separator");
+
+ /** System file separator length. */
+ public static final int FILE_SEPARATOR_LENGTH = File.separator.length();
+
+ /** System property to retrieve OS name. */
+ public static final String OS_NAME_PROPERTY = "os.name";
+
+ /** OS name from system properties. */
+ public static final String OS_NAME = System.getProperty(OS_NAME_PROPERTY);
+
+ /** OS name from system properties converted to upper case. */
+ public static final String OS_NAME_UPCASE =
+ OS_NAME != null ? OS_NAME.toUpperCase() : OS_NAME;
+
+ /**
+ * Windows OS name substring used to identify Windows in OS name converted
+ * to upper case.
+ */
+ private static final String OS_WIN_SUBSTR = "WINDOWS";
+
+ /**
+ * Test if OS where this JDK is running windows.
+ * <p/>
+ * Internally cached value.
+ */
+ private static final boolean IS_WIN =
+ OS_NAME != null ? OS_NAME_UPCASE.contains(OS_WIN_SUBSTR) : false;
+
+ /** Executable file suffix (nothing on UNIX, .exe on windows, etc.). */
+ public static final String EXEC_SUFFIX = IS_WIN ? ".exe" : "";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check if OS where this JDK is running is windows.
+ * <p/>
+ * @return <code>true</code> when this JDK is running on Windows
+ * or <code>false</code> otherwise.
+ */
+ public static boolean isWin() {
+ return IS_WIN;
+ }
+
+ /**
+ * Parses parameters from a given string in shell-like manner and append
+ * them to executable file.
+ * <p/>
+ * Users of the Bourne shell (e.g. on Unix) will already be familiar with
+ * the behavior. For example you should be able to:
+ * <ul>
+ * <li/>Include command names with embedded spaces, such as
+ * <code>c:\Program Files\jdk\bin\javac</code>.
+ * <li/>Include extra command arguments, such as <code>-Dname=value</code>.
+ * <li/>Do anything else which might require unusual characters
+ * or processing. For example:
+ * <p/><code><pre>
+ * "c:\program files\jdk\bin\java" -Dmessage="Hello /\\/\\ there!" -Xmx128m
+ * </pre></code>
+ * <p/>This example would create the following executable name and
+ * arguments:
+ * <ol>
+ * <li/> <code>c:\program files\jdk\bin\java</code>
+ * <li/> <code>-Dmessage=Hello /\/\ there!</code>
+ * <li/> <code>-Xmx128m</code>
+ * </ol>
+ * Note that the command string does not escape its backslashes--under
+ * the assumption that Windows users will not think to do this, meaningless
+ * escapes are just left as backslashes plus following character.
+ * </ul>
+ * <em>Caveat</em>: even after parsing, Windows programs (such as the
+ * Java launcher) may not fully honor certain characters, such as quotes,
+ * in command names or arguments. This is because programs under Windows
+ * frequently perform their own parsing and unescaping (since the shell
+ * cannot be relied on to do this). On Unix, this problem should not occur.
+ * <p/>
+ * @param args A String to parse
+ * @return An array of executable file and parameters to be passed to it.
+ */
+ public static String[] parseParameters(String exec, String args) {
+ int NULL = 0x0; // STICK + whitespace or NULL + non_"
+ int INPARAM = 0x1; // NULL + " or STICK + " or INPARAMPENDING + "\ // NOI18N
+ int INPARAMPENDING = 0x2; // INPARAM + \
+ int STICK = 0x4; // INPARAM + " or STICK + non_" // NOI18N
+ int STICKPENDING = 0x8; // STICK + \
+ List<String> params = new LinkedList<>();
+ params.add(exec);
+ char c;
+
+ int state = NULL;
+ StringBuilder buff = new StringBuilder(20);
+ int slength = args.length();
+
+ for (int i = 0; i < slength; i++) {
+ c = args.charAt(i);
+
+ if (Character.isWhitespace(c)) {
+ if (state == NULL) {
+ if (buff.length() > 0) {
+ params.add(buff.toString());
+ buff.setLength(0);
+ }
+ } else if (state == STICK) {
+ params.add(buff.toString());
+ buff.setLength(0);
+ state = NULL;
+ } else if (state == STICKPENDING) {
+ buff.append('\\');
+ params.add(buff.toString());
+ buff.setLength(0);
+ state = NULL;
+ } else if (state == INPARAMPENDING) {
+ state = INPARAM;
+ buff.append('\\');
+ buff.append(c);
+ } else { // INPARAM
+ buff.append(c);
+ }
+
+ continue;
+ }
+
+ if (c == '\\') {
+ if (state == NULL) {
+ ++i;
+
+ if (i < slength) {
+ char cc = args.charAt(i);
+
+ if ((cc == '"') || (cc == '\\')) {
+ buff.append(cc);
+ } else if (Character.isWhitespace(cc)) {
+ buff.append(c);
+ --i;
+ } else {
+ buff.append(c);
+ buff.append(cc);
+ }
+ } else {
+ buff.append('\\');
+
+ break;
+ }
+
+ continue;
+ } else if (state == INPARAM) {
+ state = INPARAMPENDING;
+ } else if (state == INPARAMPENDING) {
+ buff.append('\\');
+ state = INPARAM;
+ } else if (state == STICK) {
+ state = STICKPENDING;
+ } else if (state == STICKPENDING) {
+ buff.append('\\');
+ state = STICK;
+ }
+
+ continue;
+ }
+
+ if (c == '"') {
+ if (state == NULL) {
+ state = INPARAM;
+ } else if (state == INPARAM) {
+ state = STICK;
+ } else if (state == STICK) {
+ state = INPARAM;
+ } else if (state == STICKPENDING) {
+ buff.append('"');
+ state = STICK;
+ } else { // INPARAMPENDING
+ buff.append('"');
+ state = INPARAM;
+ }
+
+ continue;
+ }
+
+ if (state == INPARAMPENDING) {
+ buff.append('\\');
+ state = INPARAM;
+ } else if (state == STICKPENDING) {
+ buff.append('\\');
+ state = STICK;
+ }
+
+ buff.append(c);
+ }
+
+ // collect
+ if (state == INPARAM) {
+ params.add(buff.toString());
+ } else if ((state & (INPARAMPENDING | STICKPENDING)) != 0) {
+ buff.append('\\');
+ params.add(buff.toString());
+ } else { // NULL or STICK
+
+ if (buff.length() != 0) {
+ params.add(buff.toString());
+ }
+ }
+
+ String[] retArgs = new String[params.size()];
+ int i = 0;
+ for (String param : params) {
+ retArgs[i++] = param;
+ }
+ return retArgs;
+ }
+
+ /** Complementary method to parseParameters
+ * @link #parseParameters
+ */
+ public static String escapeParameters(String[] params) {
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < params.length; i++) {
+ escapeString(params[i], sb);
+ sb.append(' ');
+ }
+
+ final int len = sb.length();
+
+ if (len > 0) {
+ sb.setLength(len - 1);
+ }
+
+ return sb.toString().trim();
+ }
+
+ /**
+ * Escapes one string and appends it into provided {@link StringBuffer}.
+ * <p/>
+ * @param s String to be escaped.
+ * @param sb Target {@link StringBuffer}.
+ * @link #escapeParameters
+ */
+ public static void escapeString(String s, StringBuffer sb) {
+ if (s.length() == 0) {
+ sb.append("\"\"");
+ return;
+ }
+ boolean hasSpace = false;
+ final int sz = sb.length();
+ final int slen = s.length();
+ char c;
+ for (int i = 0; i < slen; i++) {
+ c = s.charAt(i);
+ if (Character.isWhitespace(c)) {
+ hasSpace = true;
+ sb.append(c);
+ continue;
+ }
+ if (c == '\\') {
+ sb.append('\\').append('\\');
+ continue;
+ }
+ if (c == '"') {
+ sb.append('\\').append('"');
+ continue;
+ }
+ sb.append(c);
+ }
+ if (hasSpace) {
+ sb.insert(sz, '"');
+ sb.append('"');
+ }
+ }
+
+ /**
+ * Escapes provided {@link String}.
+ * <p/>
+ * @param s {@link String} to be escaped.
+ * @return Escaped {@link String} value.
+ */
+ public static String escapeString(String s) {
+ final int sLen = s.length();
+ int tLen = sLen;
+ boolean quote = sLen == 0;
+ // Count length of target String to avoid StringBuilder resizing
+ for (int i = 0; i < sLen; i++) {
+ char c = s.charAt(i);
+ switch(c) {
+ case '\\': case '"':
+ tLen++;
+ break;
+ default:
+ if (Character.isWhitespace(c)) {
+ quote = true;
+ }
+ }
+ }
+ if (quote) {
+ tLen += 2;
+ }
+ // Build target value.
+ StringBuilder sb = new StringBuilder(tLen);
+ if (quote) {
+ sb.append('\"');
+ }
+ for (int i = 0; i < sLen; i++) {
+ char c = s.charAt(i);
+ switch(c) {
+ case '\\': case '"':
+ sb.append('\\');
+ break;
+ }
+ sb.append(c);
+ }
+ if (quote) {
+ sb.append('\"');
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Recursive delete of internal files and directory structure.
+ * <p/>
+ * Target directory is not removed. It's made empty.
+ * Think twice before using it.
+ * <p/>
+ * @param target File or directory which content will be deleted.
+ */
+ public static boolean rmDirContent(File target) {
+ boolean result = true;
+ if (target != null) {
+ File[] content = target.listFiles();
+ for (File file : content) {
+ if (file.canWrite()) {
+ if (file.isDirectory() && !".".equals(file.getName())
+ && !"..".equals(file.getName())) {
+ result = result && rmDirContent(file);
+ }
+ result = result && file.delete();
+ } else {
+ result = false;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Recursive delete of directory structure.
+ * <p/>
+ * Target directory is also removed.
+ * Think twice before using it.
+ * <p/>
+ * @param target File or directory to be deleted.
+ */
+ public static boolean rmDir(File target) {
+ boolean result = rmDirContent(target);
+ return result && target.delete();
+ }
+
+ /**
+ * Join 2 path elements separating them with path separator if not present
+ * at the end of first path element.
+ * <p/>
+ * @param e1 1st path element.
+ * @param e2 2nd path element.
+ */
+ @SuppressWarnings("null")
+ public static String joinPaths(final String e1, final String e2) {
+ int l1 = e1 != null ? e1.length() : 0;
+ int l2 = e2 != null ? e2.length() : 0;
+ boolean separator = l1 > 0 && !e1.endsWith(File.separator);
+ StringBuilder sb = new StringBuilder(
+ l1 + l2 + (separator ? FILE_SEPARATOR_LENGTH : 0));
+ if (l1 > 0) {
+ sb.append(e1);
+ }
+ if (separator) {
+ sb.append(File.separator);
+ }
+ if (l2 > 0) {
+ sb.append(e2);
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ServerUtils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ServerUtils.java
new file mode 100644
index 0000000..4dbb217
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/ServerUtils.java
@@ -0,0 +1,932 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.xml.bind.DatatypeConverter;
+import org.netbeans.modules.payara.tooling.admin.CommandException;
+import org.netbeans.modules.payara.tooling.data.PayaraContainer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+
+/**
+ * Common utilities.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus, Peter Benedikovic
+ */
+public class ServerUtils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner Classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Filtering the set of directories with Payara server home subdirectory
+ * shown to the user in file filter.
+ */
+ public static class PayaraFilter implements FileFilter {
+
+ /**
+ * Test whether or not the specified pathname is Payara server
+ * subdirectory.
+ * <p/>
+ * @param path Pathname to be tested.
+ * @return Returns <code>true</code> when given <code>File</code>
+ * should be included or <code>false</code> otherwise.
+ */
+ @Override
+ public boolean accept(final File path) {
+ if (path.isDirectory() && path.canRead()) {
+ File commonUtilJar
+ = getCommonUtilJarInModules(path.getAbsolutePath());
+ if (commonUtilJar.isFile() && commonUtilJar.canRead()) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ }
+
+ /**
+ * Filtering the set of Payara servers using file name pattern.
+ */
+ private static class VersionFilter implements FileFilter {
+
+ /** Compiled file name pattern. */
+ private final Pattern pattern;
+
+ /**
+ * Creates an instance of Payara servers file name pattern filter.
+ * <p/>
+ * @param namePattern Payara servers file name pattern.
+ */
+ public VersionFilter(final String namePattern) {
+ pattern = Pattern.compile(namePattern);
+ }
+
+ @Override
+ /**
+ * Test whether or not the specified pathname is valid Payara server.
+ * <p/>
+ * @param path Pathname to be tested.
+ * @return Returns <code>true</code> when given <code>File</code>
+ * should be included or <code>false</code> otherwise.
+ */
+ public boolean accept(final File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ServerUtils.class);
+
+ /** Payara Java VM system environment <code>AS_JAVA</code> variable name.
+ * This value should be equal to system environment <code>JAVA_HOME</code>
+ * value. */
+ public static final String AS_JAVA_ENV = "AS_JAVA";
+
+ /** Payara server Java VM root property name. */
+ public static final String PF_JAVA_ROOT_PROPERTY
+ = "com.sun.aas.javaRoot";
+
+ /** Payara server home property name.
+ * <p/>
+ * It's value says it is server installation root but in reality it is just
+ * <code>payara</code> subdirectory under server installation root which
+ * we usually call server home. */
+ public static final String PF_HOME_PROPERTY
+ = "com.sun.aas.installRoot";
+
+ /** Payara server domain root property name.
+ * </p>
+ * It's value says it is server instance root which is the same. */
+ public static final String PF_DOMAIN_ROOT_PROPERTY
+ = "com.sun.aas.instanceRoot";
+
+ /** Payara server Derby root property name. */
+ public static final String PF_DERBY_ROOT_PROPERTY
+ = "com.sun.aas.derbyRoot";
+
+ /** Payara server home subdirectory filter instance. */
+ public static final PayaraFilter PF_HOME_DIR_FILTER
+ = new PayaraFilter();
+
+ /** Payara server domains subdirectory. */
+ public static final String PF_DOMAINS_DIR_NAME = "domains";
+
+ /** Payara server domains subdirectory. */
+ public static final String PF_DOMAIN_CONFIG_DIR_NAME = "config";
+
+ /** Payara server domains subdirectory. */
+ public static final String PF_DOMAIN_CONFIG_FILE_NAME = "domain.xml";
+
+ /** Payara server modules subdirectory. */
+ public static final String PF_MODULES_DIR_NAME = "modules";
+
+ /** Payara server Derby subdirectory. */
+ public static final String PF_DERBY_DIR_NAME = "javadb";
+
+ /** Payara server libraries subdirectory. */
+ public static final String PF_LIB_DIR_NAME = "lib";
+
+ /** Payara server embedded libraries subdirectory under libraries. */
+ public static final String PF_EMBEDDED_DIR_NAME = "embedded";
+
+ /** Payara server logs subdirectory. */
+ public static String PF_LOG_DIR_NAME = "logs";
+
+ /** Payara server log file. */
+ public static String PF_LOG_FILE_NAME = "server.log";
+
+ public static final String VERSION_MATCHER
+ = "(?:-[0-9bSNAPHOT]+(?:\\.[0-9]+(?:_[0-9]+|)|).*|).jar";
+ public static final String GF_JAR_MATCHER
+ = "glassfish" + VERSION_MATCHER;
+
+ /** Manifest attribute Bundle-Version containing Payara
+ * version <code>String</code>. */
+ public static final String BUNDLE_VERSION = "Bundle-Version";
+
+ /** Common utilities JAR file name. */
+ public static final String PF_COMMON_UTIL_JAR = "common-util.jar";
+
+ /** Jersey 2.x common JAR file name. */
+ public static final String PF_JERSEY_2_COMMON_JAR = "jersey-common.jar";
+
+ /** Jersey 1.x core JAR file name. */
+ public static final String PF_JERSEY_1_CORE_JAR = "jersey-core.jar";
+
+ /** Embedded static shell JAR file name. */
+ public static final String PF_EMBEDDED_STATIC_SHELL_JAR
+ = "glassfish-embedded-static-shell.jar";
+
+ /** Verifier JAR file name. */
+ public static final String PF_VERIFIER_JAR = "verifier.jar";
+
+ /** JavaHelp JAR file name. */
+ public static final String PF_JAVAHELP_JAR = "javahelp.jar";
+
+ /** Payara Version class name (including package). */
+ private static String VERSION_CLASS = "com.sun.appserv.server.util.Version";
+
+ /** Payara VerifierMain class name (including package). */
+ public static String VERIFIER_MAIN_CLASS
+ = "com.sun.enterprise.tools.verifier.VerifierMain";
+
+ /** Regex pattern to retrieve version string like 3.1.2.2 from
+ * full version string. */
+ private static String FULL_VERSION_PATTERN = "[0-9]+(\\.[0-9]+){1,3}";
+
+ /** Payara full version string getter method name. */
+ private static String FULL_VERSION_METHOD = "getFullVersion";
+
+ /** Payara Basic Authorization user and password separator. */
+ private static String AUTH_BASIC_FIELD_SEPARATPR = ":";
+
+ /** Payara server domain name command line argument. */
+ public static String PF_DOMAIN_ARG = "--domain";
+
+ /** Payara server domain directory command line argument. */
+ public static String PF_DOMAIN_DIR_ARG = "--domaindir";
+
+ /** Payara server service response while server is not yet ready.
+ * Copy-pasted from
+ * <code>com.sun.enterprise.v3.admin.AdminAdapter</code>. */
+ public static final String PF_SERVICE_NOT_YET_READY_MSG
+ = "V3 cannot process this command at this time, please wait";
+ /** End of line sequence in Manifest. */
+ public static final String MANIFEST_EOL = "%%%EOL%%%";
+
+ /** REGEX expression used to split resources returned in
+ * <code>Manifest</code> object from HTTP response. */
+ public static final String MANIFEST_RESOURCES_SEPARATOR = "[,;]";
+
+ /** REGEX expression used to split components (applications) returned in
+ * <code>Manifest</code> object from HTTP response. */
+ public static final String MANIFEST_COMPONENTS_SEPARATOR = ";";
+
+ /** REGEX expression used to extract component name and containers from
+ * <code>Manifest</code> attribute. */
+ private static final String MANIFEST_COMPONENT_FULL_REGEX
+ = " *([^ ]+) +< *([^ ,]+) *((?:, *[^ ,]+ *)*)> *";
+
+ /** REGEX expression used to extract additional containers from containers
+ * list of <code>Manifest</code> attribute. */
+ private static final String MANIFEST_COMPONENT_COMP_REGEX = ", *([^ ,]+) *";
+
+ /** REGEX pattern used to extract component name and containers from
+ * <code>Manifest</code> attribute. */
+ private static final Pattern MANIFEST_COMPONENT_FULL_PATTERN
+ = Pattern.compile(MANIFEST_COMPONENT_FULL_REGEX,
+ Pattern.CASE_INSENSITIVE);
+
+ /** REGEX pattern used to extract additional containers from containers
+ * list of <code>Manifest</code> attribute. */
+ private static final Pattern MANIFEST_COMPONENT_COMP_PATTERN
+ = Pattern.compile(MANIFEST_COMPONENT_COMP_REGEX,
+ Pattern.CASE_INSENSITIVE);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Search for <code>.jar</code> file matching given pattern
+ * in <code><serverHome>/modules</code> directory tree.
+ * <p/>
+ * @param serverHome Payara server home.
+ * @param pattern File name pattern.
+ * @return <code>File</code> object containing full <code>.jar<code> file
+ * path or <code>null</code> if no file was found.
+ */
+ public static File getJarName(final String serverHome,
+ final String pattern) {
+ return getJarName(serverHome, pattern, PF_MODULES_DIR_NAME);
+ }
+
+ /**
+ * Search for <code>.jar</code> file matching given pattern
+ * in given directory tree.
+ * <p/>
+ * @param serverHome Payara server home.
+ * @param pattern File name pattern.
+ * @param dir Directory tree root to be searched for
+ * <code>.jar<code> file.
+ * @return <code>File</code> object containing full <code>.jar<code> file
+ * path or <code>null</code> if no file was found.
+ */
+ public static File getJarName(final String serverHome, final String pattern,
+ final String dir) {
+ File dirFile = new File(serverHome + File.separatorChar + dir);
+ return getFileFromPattern(pattern, dirFile);
+ }
+
+ /**
+ * Search for file matching given <code>pattern</code> in given
+ * <code>dir</code>ectory tree.
+ * <p/>
+ * @param pattern Name pattern to search for.
+ * @param dir Directory tree root to be searched for pattern.
+ * @return <code>File</code> object that matches given <code>pattern</code>
+ * or <code>null</code> otherwise.
+ */
+ public static File getFileFromPattern(String pattern, File dir) {
+ assert pattern != null : "Search pattern should not be null";
+ assert dir != null : "Search directory tree root should not be null";
+ // TODO: Check if this is OK of File.pathSeparator should be used.
+ int subindex = pattern.lastIndexOf("/");
+ if (subindex != -1) {
+ String subdir = pattern.substring(0, subindex);
+ pattern = pattern.substring(subindex + 1);
+ dir = new File(dir, subdir);
+ }
+ if (dir.canRead() && dir.isDirectory()) {
+ // Express check first.
+ String expressPattern = pattern.replace(VERSION_MATCHER,
+ ".jar");
+ File candidate = new File(dir, expressPattern);
+ if (!"".equals(expressPattern) && candidate.exists()) {
+ return candidate;
+ }
+ // Longer check second.
+ File[] candidates = dir.listFiles(new VersionFilter(pattern));
+ if (candidates != null && candidates.length > 0) {
+ // First one is returned.
+ return candidates[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Append next path element to existing path in <code>StringBuilder</code>.
+ * Path separator is added only when there is no one at the end of existing
+ * path.
+ * <p/>
+ * @param rootPath Already existing path in <code>StringBuilder</code>.
+ * @param next Path to be appended at the end of already existing path.
+ */
+ public static void addPathElement(final StringBuilder rootPath,
+ final String next) {
+ int rootPathLength = rootPath.length();
+ if (rootPathLength > 0 && rootPath.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != rootPathLength) {
+ rootPath.append(File.separator);
+ }
+ rootPath.append(next);
+ }
+
+ /**
+ * Build path to the <code>common-util.jar</code> file in Payara modules
+ * directory.
+ * <p/>
+ * @param serverHome Payara server home directory.
+ * @return Path to the <code>common-util.jar</code> file in Payara
+ * modules directory.
+ */
+ public static File getCommonUtilJarInModules(final String serverHome) {
+ StringBuilder commonUtilJarPath = new StringBuilder(serverHome.length()
+ + PF_MODULES_DIR_NAME.length() + PF_COMMON_UTIL_JAR.length()
+ + 2 * OsUtils.FILE_SEPARATOR_LENGTH);
+ commonUtilJarPath.append(serverHome);
+ addPathElement(commonUtilJarPath, PF_MODULES_DIR_NAME);
+ addPathElement(commonUtilJarPath, PF_COMMON_UTIL_JAR);
+ return new File(commonUtilJarPath.toString());
+ }
+
+ /**
+ * Build path to the supplied <code>.jar</code> file in Payara
+ * modules directory.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ * @param jarName Supplied JAR file name. This argument should not
+ * be <code>null</code>.
+ * @return Path to the <code>.jar</code> file in Payara
+ * modules directory.
+ */
+ public static File getJarInModules(final String serverHome,
+ final String jarName) {
+ StringBuilder commonUtilJarPath = new StringBuilder(serverHome.length()
+ + PF_MODULES_DIR_NAME.length() + jarName.length()
+ + 2 * OsUtils.FILE_SEPARATOR_LENGTH);
+ commonUtilJarPath.append(serverHome);
+ addPathElement(commonUtilJarPath, PF_MODULES_DIR_NAME);
+ addPathElement(commonUtilJarPath, jarName);
+ return new File(commonUtilJarPath.toString());
+ }
+
+ /**
+ * Build path to the <code>jersey-common.jar</code> or
+ * <code>jersey-core.jar</code> file in Payara modules directory.
+ * <p/>
+ * Searches for Jersey 1.x or 2.x common (core) jersey JAR file name
+ * in Payara modules directory and returns <code>File</code> that was
+ * found or <code>null</code> when no such a file exists and is readable.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ */
+ public static File getJerseyCommonJarInModules(final String serverHome) {
+ File jerseyCommon = ServerUtils.getJarInModules(
+ serverHome, ServerUtils.PF_JERSEY_2_COMMON_JAR);
+ if (jerseyCommon.isFile() && jerseyCommon.canRead()) {
+ return jerseyCommon;
+ }
+ jerseyCommon = ServerUtils.getJarInModules(
+ serverHome, ServerUtils.PF_JERSEY_1_CORE_JAR);
+ if (jerseyCommon.isFile() && jerseyCommon.canRead()) {
+ return jerseyCommon;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Build path to the supplied <code>verifier.jar</code> library in Payara
+ * modules directory.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ * @return Path to the <code>verifier.ja</code> file in Payara
+ * modules directory.
+ */
+ public static String getVerifierJar(final String serverHome) {
+ assert serverHome != null
+ : "Payara server home directory should not be null";
+ boolean appendSeparator = serverHome.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != serverHome.length();
+ StringBuilder sb = new StringBuilder(serverHome.length()
+ + (appendSeparator ? 2 * OsUtils.FILE_SEPARATOR_LENGTH
+ : 1 * OsUtils.FILE_SEPARATOR_LENGTH)
+ + PF_MODULES_DIR_NAME.length() + PF_VERIFIER_JAR.length());
+ sb.append(serverHome);
+ if (appendSeparator) {
+ sb.append(File.separator);
+ }
+ sb.append(PF_MODULES_DIR_NAME);
+ sb.append(File.separator);
+ sb.append(PF_VERIFIER_JAR);
+ return sb.toString();
+ }
+
+ /**
+ * Build path to the supplied <code>javahelp.jar</code> library in Payara
+ * modules directory.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ * @return Path to the <code>javahelp.jar</code> file in Payara
+ * libraries directory.
+ */
+ public static String getJavaHelpJar(final String serverHome) {
+ assert serverHome != null
+ : "Payara server home directory should not be null";
+ boolean appendSeparator = serverHome.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != serverHome.length();
+ StringBuilder sb = new StringBuilder(serverHome.length()
+ + (appendSeparator ? 2 * OsUtils.FILE_SEPARATOR_LENGTH
+ : 1 * OsUtils.FILE_SEPARATOR_LENGTH)
+ + PF_LIB_DIR_NAME.length() + PF_JAVAHELP_JAR.length());
+ sb.append(serverHome);
+ if (appendSeparator) {
+ sb.append(File.separator);
+ }
+ sb.append(PF_LIB_DIR_NAME);
+ sb.append(File.separator);
+ sb.append(PF_JAVAHELP_JAR);
+ return sb.toString();
+ }
+
+ /**
+ * Build path to the <code>glassfish-embedded-static-shell.jar</code>
+ * library in embedded libraries directory.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ * @return Path to the <code>glassfish-embedded-static-shell.jar</code>
+ * file in Payara embedded libraries directory.
+ */
+ public static String getEmbeddedStaticShellJar(final String serverHome) {
+ assert serverHome != null
+ : "Payara server home directory should not be null";
+ boolean appendSeparator = serverHome.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != serverHome.length();
+ StringBuilder sb = new StringBuilder(serverHome.length()
+ + (appendSeparator ? 3 * OsUtils.FILE_SEPARATOR_LENGTH
+ : 2 * OsUtils.FILE_SEPARATOR_LENGTH)
+ + PF_LIB_DIR_NAME.length() + PF_EMBEDDED_DIR_NAME.length()
+ + PF_EMBEDDED_STATIC_SHELL_JAR.length());
+ sb.append(serverHome);
+ if (appendSeparator) {
+ sb.append(File.separator);
+ }
+ sb.append(PF_LIB_DIR_NAME);
+ sb.append(File.separator);
+ sb.append(PF_EMBEDDED_DIR_NAME);
+ sb.append(File.separator);
+ sb.append(PF_EMBEDDED_STATIC_SHELL_JAR);
+ return sb.toString();
+ }
+
+ /**
+ * Retrieve Jersey version string from Payara modules.
+ * <p/>
+ * @param serverHome Payara server home directory. This argument
+ * should not be <code>null</code>.
+ * @return Jersey version string from Payara modules.
+ */
+ public static String getJerseyVersion(final String serverHome) {
+ File jerseyFile = ServerUtils.getJerseyCommonJarInModules(serverHome);
+ if (jerseyFile != null) {
+ Jar jerseyJar = new Jar(jerseyFile);
+ String version = jerseyJar.getBundleVersion();
+ jerseyJar.close();
+ return version;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Retrieve version numbers substring from full version string.
+ * <p/>
+ * @param fullVersionString Payara server full version string, e.g.
+ * <code>Payara Server Open Source Edition
+ * 3.1.2.2 (build 5)</code>
+ * @return Version numbers substring, e.g. <code>3.1.2.2</code>
+ */
+ public static String getVersionString(final String fullVersionString) {
+ if (fullVersionString != null) {
+ Pattern p = Pattern.compile(FULL_VERSION_PATTERN);
+ Matcher m = p.matcher(fullVersionString);
+ if (m.find()) {
+ return fullVersionString.substring(m.start(), m.end());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Retrieve Payara version from local installation using file access.
+ * <p/>
+ * Payara version is read from modules <code>common-util.jar</code>
+ * archive and <code>com.sun.appserv.server.util.Version</code> class.
+ * It's not public Payara API so there is no guaranty for this to work
+ * forever. However Payara development team promised to keep this
+ * API working the same way in Payara 3 and 4.
+ * <p/>
+ * @param serverHome Payara server home directory.
+ * @return Payara server version.
+ */
+ public static PayaraVersion getServerVersion(final String serverHome) {
+ PayaraVersion version = null;
+ File commonUtilJar = getCommonUtilJarInModules(serverHome);
+ if (commonUtilJar.canRead()) {
+ try {
+ ClassLoader cl = new URLClassLoader(new URL[] {commonUtilJar.
+ toURI().toURL()});
+ Class c = cl.loadClass(VERSION_CLASS);
+ // Try to get version from com.sun.appserv.server.util.Version.
+ try {
+ Method mGetFullVersion = c.getMethod(FULL_VERSION_METHOD);
+ System.getProperties().put(PF_HOME_PROPERTY, serverHome);
+ String fullVersionString
+ = (String)mGetFullVersion.invoke(c);
+ System.getProperties().remove(PF_HOME_PROPERTY);
+ String versionString
+ = getVersionString(fullVersionString);
+ if (versionString != null) {
+ version = PayaraVersion.toValue(versionString);
+ }
+ } catch (IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException
+ | SecurityException | NoClassDefFoundError ex) {
+ Logger.log(Level.WARNING, "Cannot retrieve Payara version: "
+ + commonUtilJar.getAbsolutePath() + ": ", ex);
+ }
+ // Use Manifest Bundle-Version as fallback option.
+ if (version == null) {
+ try {
+ JarFile jar = new JarFile(commonUtilJar);
+ Manifest manifest = jar.getManifest();
+ String versionString = getVersionString(manifest
+ .getMainAttributes().getValue(BUNDLE_VERSION));
+ if (versionString != null) {
+ version = PayaraVersion.toValue(versionString);
+ }
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING, "Cannot retrieve Payara version: "
+ + commonUtilJar.getAbsolutePath() + ": ", ioe);
+ }
+ }
+ } catch (MalformedURLException | ClassNotFoundException ex) {
+ Logger.log(Level.WARNING, "Cannot retrieve Payara version: "
+ + commonUtilJar.getAbsolutePath() + ": ", ex);
+ }
+ } else {
+ Logger.log(Level.WARNING, "Cannot retrieve Payara version: "
+ + commonUtilJar.getAbsolutePath() + " is not readable:"
+ + " Exists: " + commonUtilJar.exists()
+ + " Can read: " + commonUtilJar.canRead(), (Throwable) null);
+ }
+ return version;
+ }
+
+ /**
+ * Decode <code>Manifest</code> string to remove EOL sequences.
+ * <p/>
+ * @param str String to be decoded.
+ */
+ public static String manifestDecode(final String str) {
+ if (str == null) {
+ return null;
+ }
+ return str.replaceAll(MANIFEST_EOL, "\n");
+ }
+
+ /**
+ * Build HTTP Basic authorization base64 encoded credentials argument
+ * containing user name and password.
+ * <p/>
+ * @param user Username to be stored into encoded argument.
+ * @param password Password to be stored into encoded argument.
+ */
+ public static String basicAuthCredentials(final String user,
+ final String password) {
+ StringBuilder sb = new StringBuilder(user.length()
+ + AUTH_BASIC_FIELD_SEPARATPR.length() + password.length());
+ sb.append(user);
+ sb.append(AUTH_BASIC_FIELD_SEPARATPR);
+ sb.append(password);
+ return DatatypeConverter.printBase64Binary(sb.toString().getBytes());
+ }
+
+ /**
+ * Tests if the server listener port is occupied.
+ * <p/>
+ * @param server Payara server entity
+ * @return Value of <code>true</code> when server listener port
+ * is occupied or <code>false</code> otherwise.
+ */
+ public static boolean isHttpPortListening(final PayaraServer server) {
+ return server.isRemote()
+ ? NetUtils.isPortListeningRemote(
+ server.getHost(), server.getPort())
+ : NetUtils.isPortListeningLocal(
+ server.getHost(), server.getPort());
+ }
+
+ /**
+ * Tests if the server listener port is occupied.
+ * <p/>
+ * @param server Payara server entity
+ * @param timeout Network timeout [ms].
+ * @return Value of <code>true</code> when server listener port
+ * is occupied or <code>false</code> otherwise.
+ */
+ public static boolean isHttpPortListening(final PayaraServer server,
+ final int timeout) {
+ return server.isRemote()
+ ? NetUtils.isPortListeningRemote(
+ server.getHost(), server.getPort(), timeout)
+ : NetUtils.isPortListeningLocal(
+ server.getHost(), server.getPort());
+ }
+
+ /**
+ * Tests if the server administrator's port is occupied.
+ * <p/>
+ * @param server Payara server entity.
+ * @return Value of <code>true</code> when server administrator port
+ * is occupied or <code>false</code> otherwise.
+ */
+ public static boolean isAdminPortListening(final PayaraServer server) {
+ return server.isRemote()
+ ? NetUtils.isPortListeningRemote(
+ server.getHost(), server.getAdminPort())
+ : NetUtils.isPortListeningLocal(
+ server.getHost(), server.getAdminPort());
+ }
+
+ /**
+ * Tests if the server administrator's port is occupied.
+ * <p/>
+ * @param server Payara server entity.
+ * @param timeout Network timeout [ms].
+ * @return Value of <code>true</code> when server administrator port
+ * is occupied or <code>false</code> otherwise.
+ */
+ public static boolean isAdminPortListening(final PayaraServer server,
+ final int timeout) {
+ return server.isRemote()
+ ? NetUtils.isPortListeningRemote(
+ server.getHost(), server.getAdminPort(), timeout)
+ : NetUtils.isPortListeningLocal(
+ server.getHost(), server.getAdminPort());
+ }
+
+ /**
+ * Builds command line argument containing argument identifier, space
+ * and argument value, e.g. <code>--name value</code>.
+ * <p/>
+ * @param name Command line argument name including dashes at
+ * the beginning.
+ * @param value Value to be appended prefixed with single space.
+ * @return Command line argument concatenated together.
+ */
+ public static String cmdLineArgument(final String name,
+ final String value) {
+ StringBuilder sb = new StringBuilder(name.length() + " ".length()
+ + value.length());
+ sb.append(name);
+ sb.append(" ");
+ sb.append(value);
+ return sb.toString();
+ }
+
+ /**
+ * Parse server component (application) record and add it into
+ * <code>Map</code> containing container to components <code>List</code>
+ * mapping.
+ * <p/>
+ * Component records: <code><name> '<' <container>
+ * [',' <container>] '>'</code>
+ * </p>
+ * @param map Map where new component is stored under it's container key.
+ * @param component Component record retrieved from server.
+ * @throws <code>NullPointerException</code> when provided map argument
+ * is <code>null</code>.
+ */
+ public static void addComponentToMap(final Map<String, List<String>> map,
+ final String component) {
+ Logger.log(Level.FINER, "Processing component \"{0}\"",
+ new Object[]{component});
+ Matcher fullMatecher = ServerUtils.MANIFEST_COMPONENT_FULL_PATTERN
+ .matcher(component);
+ if (fullMatecher.matches()) {
+ String componentName = fullMatecher.group(1);
+ PayaraContainer container = PayaraContainer.toValue(
+ fullMatecher.group(2));
+ String moreContainers = fullMatecher.group(3);
+ if (moreContainers != null && moreContainers.length() > 0) {
+ Matcher compMatcher = ServerUtils
+ .MANIFEST_COMPONENT_COMP_PATTERN.matcher(
+ moreContainers);
+ while (compMatcher.find()) {
+ PayaraContainer nextContainer = PayaraContainer
+ .toValue(compMatcher.group(1));
+ if (nextContainer != null && container != null
+ && nextContainer.ordinal() < container.ordinal()) {
+ container = nextContainer;
+ } else if (nextContainer == null) {
+ Logger.log(Level.WARNING,
+ "Error processing component \"{0}\"",
+ new Object[]{component});
+ }
+ }
+ }
+ String containerName = container != null
+ ? container.toString() : "null";
+ List<String> componentList = map.get(containerName);
+ if (componentList == null) {
+ componentList = new ArrayList<>();
+ map.put(containerName, componentList);
+ }
+ componentList.add(componentName);
+ } else {
+ throw new CommandException(
+ CommandException.MANIFEST_INVALID_COMPONENT_ITEM);
+ }
+ }
+
+ /**
+ * Build Payara server log file sub path under domains root directory.
+ * <p/>
+ * @return Payara server log file path under domains root directory.
+ */
+ public static String serverLogFileRelativePath() {
+ StringBuilder sb = new StringBuilder(PF_LOG_DIR_NAME.length()
+ + File.separator.length() + PF_LOG_FILE_NAME.length());
+ sb.append(PF_LOG_DIR_NAME);
+ sb.append(File.separator);
+ sb.append(PF_LOG_FILE_NAME);
+ return sb.toString();
+ }
+
+ /**
+ * Get Payara server domain root full path.
+ * <p/>
+ * @param server Payara server entity
+ * @return Payara server domain root full path or <code>null</code>
+ * when server domains root folder or domain name is not set.
+ */
+ public static String getDomainPath(final PayaraServer server) {
+ String domainName = server.getDomainName();
+ String domainsFolder = server.getDomainsFolder();
+ boolean appendSeparator = domainsFolder.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != domainsFolder.length();
+ StringBuilder sb = new StringBuilder(server.getDomainsFolder().length()
+ + (appendSeparator ? OsUtils.FILE_SEPARATOR_LENGTH : 0)
+ + domainName.length());
+ sb.append(domainsFolder);
+ if (appendSeparator) {
+ sb.append(File.separator);
+ }
+ sb.append(domainName);
+ return sb.toString();
+ }
+
+ /**
+ * Get Payara server domain configuration directory full path from
+ * domain root.
+ * <p/>
+ * @param domainDir Payara server domain root full path.
+ * @return Payara server domain configuration directory full path
+ */
+ public static String getDomainConfigPath(final String domainDir) {
+ if (domainDir == null) {
+ return PF_DOMAIN_CONFIG_DIR_NAME;
+ }
+ boolean appendSeparator = domainDir.lastIndexOf(File.separator)
+ + OsUtils.FILE_SEPARATOR_LENGTH != domainDir.length();
+ StringBuilder sb = new StringBuilder(domainDir.length()
+ + (appendSeparator ? OsUtils.FILE_SEPARATOR_LENGTH : 0)
+ + PF_DOMAIN_CONFIG_DIR_NAME.length());
+ sb.append(domainDir);
+ if (appendSeparator) {
+ sb.append(File.separator);
+ }
+ sb.append(PF_DOMAIN_CONFIG_DIR_NAME);
+ return sb.toString();
+ }
+
+ /**
+ * Get Payara server domain configuration file (domain.xml) full path
+ * from domains root and domain name.
+ * <p/>
+ * @param domainsRoot Payara server domains root full path.
+ * @param domainName Payara server domain name.
+ * @return Payara server domain configuration file full path
+ */
+ public static String getDomainConfigFile(final String domainsRoot,
+ final String domainName) {
+ final String METHOD = "getDomainConfigFile";
+ if (domainsRoot == null) {
+ throw new IllegalArgumentException(
+ LOGGER.excMsg(METHOD, "domainsRootNull"));
+ }
+ if (domainName == null) {
+ throw new IllegalArgumentException(
+ LOGGER.excMsg(METHOD, "domainNameNull"));
+ }
+ StringBuilder sb = new StringBuilder(domainsRoot.length()
+ + domainName.length() + PF_DOMAIN_CONFIG_DIR_NAME.length()
+ + PF_DOMAIN_CONFIG_FILE_NAME.length()
+ + (3 * OsUtils.FILE_SEPARATOR_LENGTH));
+ sb.append(domainsRoot).append(File.separator);
+ sb.append(domainName).append(File.separator);
+ sb.append(PF_DOMAIN_CONFIG_DIR_NAME).append(File.separator);
+ sb.append(PF_DOMAIN_CONFIG_FILE_NAME);
+ return sb.toString();
+ }
+
+ /**
+ * Get Payara server log {@link File} object.
+ * <p/>
+ * @param server Payara server entity.
+ * @return Payara server log {@link File} object.
+ */
+ public static File getServerLogFile(final PayaraServer server) {
+ return new File(getDomainPath(server),
+ serverLogFileRelativePath());
+ }
+
+ /**
+ * Get Payara server derby root full path.
+ * <p/>
+ * @param server Payara server entity
+ * @return Payara server derby root full path or <code>null</code>
+ * when server server installation directory is not set.
+ */
+ public static String getDerbyRoot(final PayaraServer server) {
+ String serverRoot = server.getServerRoot();
+ if (serverRoot == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder(serverRoot.length()
+ + File.separator.length() + PF_DERBY_DIR_NAME.length());
+ sb.append(serverRoot);
+ sb.append(File.separator);
+ sb.append(PF_DERBY_DIR_NAME);
+ return sb.toString();
+ }
+
+ /**
+ * Get Payara server Java VM root property.
+ * <p/>
+ * @param javaHome Java VM root (home) directory to be set as property
+ * value.
+ * @return Payara server Java VM root property to be passed to server
+ * startup command.
+ */
+ public static String javaRootProperty(final String javaHome) {
+ return JavaUtils.systemProperty(PF_JAVA_ROOT_PROPERTY, javaHome);
+ }
+
+ /**
+ * Check if given message is the one returned by Payara server service
+ * response while server is not yet ready.
+ * <p/>
+ * @param msg Message to be checked.
+ * @return Returns <code>true</code> if given message is server service
+ * response while server is not yet ready or <code>false</code>
+ * otherwise.
+ */
+ public static boolean notYetReadyMsg(final String msg) {
+ if (msg == null) {
+ return false;
+ }
+ return msg.startsWith(PF_SERVICE_NOT_YET_READY_MSG);
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTree.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTree.java
new file mode 100644
index 0000000..ae23c71
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTree.java
@@ -0,0 +1,565 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.util.Iterator;
+import java.util.TreeMap;
+
+/**
+ * String prefix tree used to find <code>String</code> in a set.
+ * <p/>
+ * This class is not thread safe so external synchronization may be needed in
+ * multi threaded environment.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class StringPrefixTree<Type> {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner Classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Prefix tree internal node representing single character of stored
+ * strings.
+ */
+ private class Node {
+
+ /** Mark state as final. */
+ private boolean finalState;
+
+ /** Store value in node. */
+ private Type value;
+
+ /** Next character. */
+ private TreeMap<Character, Node> next;
+
+ /**
+ * Create <code>Character</code> object from given char value and apply
+ * case sensitive settings on it.
+ * <p/>
+ * @param c Character to be used as <Character</code> object value.
+ * @return <code>Character</code> object containing given char value
+ * with case sensitive settings rules applied.
+ */
+ Character toCharacter(final char c) {
+ return Character.valueOf(
+ caseSensitive ? c : Character.toUpperCase(c));
+ }
+
+ /**
+ * Creates an instance of internal tree node in inner state and
+ * no stored value.
+ */
+ Node() {
+ this.finalState = false;
+ this.next = new TreeMap();
+ }
+
+ /**
+ * Creates an instance of internal tree node in final state and stored
+ * value.
+ * <p/>
+ * @param value Value to be stored into node.
+ */
+ Node(Type value) {
+ this.finalState = true;
+ this.next = new TreeMap();
+ this.value = value;
+ }
+
+ /**
+ * Mark node as final state.
+ */
+ void setFinal() {
+ finalState = true;
+ }
+
+ /**
+ * Mark node as inner state.
+ */
+ void setInner() {
+ finalState = false;
+ }
+
+ /**
+ * Store value into node.
+ * <p/>
+ * Old value is overwritten if exists.
+ * <p/>
+ * @param value Value to be stored into node.
+ */
+ void setValue(Type value) {
+ this.value = value;
+ }
+
+ /**
+ * Retrieve value from node.
+ * <p/>
+ * @return Value stored in node or <code>null</code> if no value
+ * is stored.
+ */
+ Type getValue() {
+ return value;
+ }
+
+ /**
+ * Get node state.
+ * <p/>
+ * @return Value of <code>true</code> for final state
+ * or <code>false</code> for inner state.
+ */
+ boolean isFinal() {
+ return finalState;
+ }
+
+ /**
+ * Add next state on transition for given character.
+ * <p/>
+ * @param c Character to set transition to next state.
+ * @param node <code>Node</code> representing next transition.
+ */
+ void add(char c, Node node) {
+ next.put(toCharacter(c), node);
+ }
+
+ /**
+ * Remove next state on transition for given character.
+ * <p/>
+ * @param c Character to remove transition to next state.
+ */
+ Node remove(char c) {
+ return next.remove(toCharacter(c));
+ }
+
+ /**
+ * Get next state on transition for given character.
+ * <p/>
+ * @param c Character to get transition to next state.
+ * @return <code>Node</code> representing next transition
+ * or <code>null</code> if there is no transition.
+ */
+ Node get(char c) {
+ return next.get(toCharacter(c));
+ }
+
+ /**
+ * Get number of transitions to next states from this node.
+ * <p/>
+ * @return Number of transitions to next states from this node.
+ */
+ int size() {
+ return next.size();
+ }
+
+ /**
+ * Destroy node.
+ * <p/>
+ * This is just garbage collector helper.
+ */
+ void destroy() {
+ next.clear();
+ next = null;
+ value = null;
+ }
+
+ /**
+ * Get string representation of node.
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Value=");
+ sb.append(value != null ? value.toString() : "null");
+ sb.append(" Transitions=[");
+ for (Iterator i = next.keySet().iterator(); i.hasNext(); ) {
+ sb.append(i.next());
+ if (i.hasNext()) {
+ sb.append(',');
+ }
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+ }
+ /**
+ * Stack data storage.
+ * <p/>
+ * Used for non recursive tree walk trough. Need to store current
+ * node and child nodes iterator.
+ */
+ private class StackItem {
+
+ /** Tree node. */
+ Node node;
+
+ /** Child nodes iterator.
+ * We don't need keys, walking trough child nodes is enough. */
+ Iterator<Node> child;
+
+ /**
+ * Creates an instance of stack item (stack data storage).
+ * <p/>
+ * @param node Tree node to be processed.
+ */
+ StackItem(Node node) {
+ this.node = node;
+ child = node.next.values().iterator();
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Root tree node. */
+ private Node root;
+
+ /** Size of tree (number of stored strings. */
+ private int size;
+
+ /** Case sensitivity turned on (<code>true</code>)
+ * or off (<code>false</code>).
+ * All strings are stored and compared as upper case when turned on.
+ */
+ private boolean caseSensitive;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public StringPrefixTree(boolean caseSensitive) {
+ root = new Node();
+ size = 0;
+ this.caseSensitive = caseSensitive;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Add value into node and finish <cose>String</code> based on nodes
+ * already stored in prefix tree.
+ * <p/>
+ * This method will modify node that represents last character in newly
+ * added <code>String</code>.
+ * <p/>
+ * @param node Node to be marked as final and used to store value.
+ * @param value Value to be stored into node.
+ */
+ private void finishExistingStringWithValue(Node node, Type value) {
+ size++;
+ node.setFinal();
+ node.setValue(value);
+ }
+
+ /**
+ * Remove value from node and mark node state as inner.
+ * <p/>
+ * This method will modify node that represents last character
+ * of <code>String</code> being removed.
+ * <p/>
+ * @param node Node to be marked as inner and to remove its value
+ */
+ private void removeValuefromString(Node node) {
+ size--;
+ node.setInner();
+ node.setValue(null);
+ }
+
+ /**
+ * Add value into node and finish <cose>String</code> based on nodes
+ * (at least last one) newly added into prefix tree.
+ * <p/>
+ * This method adds new node representing last character in newly
+ * added <code>String</code> under given node which represents character
+ * before last one or nodes root.
+ * <p/>
+ * @param node Node where new node with last character will be attached.
+ * @param value Value to be stored into newly attached node.
+ */
+ private void finishNewStringWithValue(Node node, char c, Type value) {
+ size++;
+ node.add(c, new Node(value));
+ }
+
+ // This should be as fast as possible. Tree walktrough is implemented
+ // as non-recursive.
+ /**
+ * Clear content of <code>String</code> prefix tree.
+ */
+ public void clear() {
+ // Store old prefix tree.
+ Node oldRoot = root;
+ // Reinitialize as empty.
+ root = new Node();
+ size = 0;
+ // Old structure cleanup.
+ LinkedList<StackItem> stack = new LinkedList<>();
+ StackItem item;
+ stack.addFirst(new StackItem(oldRoot));
+ while((item = stack.getLast())!= null) {
+ // Tree step down.
+ if (item.child.hasNext()) {
+ stack.addLast(new StackItem((Node)item.child.next()));
+ // Current node processing and tree setep up.
+ } else {
+ item.node.destroy();
+ stack.removeLast();
+ }
+ }
+ }
+
+ /**
+ * Add new <code>String</code> into prefix tree and set value mapped
+ * to this string.
+ * <p/>
+ * <code>null</code> value of <code>str</code> argument is considered as
+ * empty string.
+ * <p/>
+ * @param str <code>String</code> to be added into prefix tree.
+ * @param value Value mapped to newly added <code>String</code>.
+ * @return Value of <code>true</code> if given <code>String</code> has been
+ * added or <code>false</code> if given <code>String</code> was
+ * already stored in prefix tree before and nothing has changed.
+ */
+ public boolean add(String str, Type value) {
+ int strLen = str != null ? str.length() : 0;
+ int lastIndex = strLen > 0 ? strLen - 1 : 0;
+ Node act = root;
+ // Process inner characters.
+ for (int i = 0; i < lastIndex; i++) {
+ char c = str.charAt(i);
+ Node next = act.get(c);
+ if (next == null) {
+ act.add(c, act = new Node());
+ } else {
+ act = next;
+ }
+ }
+ // Process final character.
+ boolean result;
+ if (strLen == 0 && !root.isFinal()) {
+ result = true;
+ finishExistingStringWithValue(root, value);
+ } else {
+ char c = str.charAt(lastIndex);
+ Node next = act.get(c);
+ if (next == null) {
+ result = true;
+ finishNewStringWithValue(act, c, value);
+ } else {
+ if (result = !next.isFinal()) {
+ finishExistingStringWithValue(next, value);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Remove <code>String</code> from prefix tree and remove value mapped
+ * to this string.
+ * <P/>
+ * @param str <code>String</code> to be removed from prefix tree.
+ * @return Value mapped to removed node.
+ */
+ public Type remove(String str) {
+ Type result = null;
+ int pos = 0;
+ int strLen = str != null ? str.length() : 0;
+ Node act = root;
+ Node last = null;
+ LinkedList<Node> stack = new LinkedList<>();
+ while (pos <= strLen && act != null) {
+ if (pos < strLen) {
+ stack.addLast(act);
+ act = act.get(str.charAt(pos));
+ }
+ if (pos == strLen && act.isFinal()) {
+ result = act.getValue();
+ removeValuefromString(act);
+ }
+ pos++;
+ }
+ if (result != null) {
+ pos = str.length();
+ while (--pos >= 0 &&!act.isFinal() && act.size() == 0) {
+ Node del = act;
+ act = stack.removeLast();
+ Node removed = act.remove(str.charAt(pos));
+ if (removed == del) {
+ del.destroy();
+ } else {
+ throw new VerifyError(
+ "Removed transition does not point to removed state.");
+ }
+ }
+ }
+ stack.clear();
+ return result;
+ }
+
+ /**
+ * Exact match of given <code>CharSequence</code> argument against
+ * <code>String</code>s stored in prefix tree.
+ * <p/>
+ * <code>null</code> value of <code>str</code> argument is considered as
+ * empty string. Matching is done from the beginning of given
+ * <code>String</code> argument.
+ * <p/>
+ * @param str String to match against tree.
+ * @return Value of matching <code>String</code> or <code>null</code> if
+ * no matching <code>String</code> was found.
+ */
+ public Type match(final CharSequence str) {
+ return match(str, 0);
+ }
+
+ /**
+ * Exact match of given <code>CharSequence</code> argument against
+ * <code>String</code>s stored in prefix tree.
+ * <p/>
+ * <code>null</code> value of <code>str</code> argument is considered as
+ * empty string. Matching is done from the beginning of given
+ * <code>String</code> argument.
+ * <p/>
+ * @param str String to match against tree.
+ * @param offset Beginning index for searching.
+ * @return Value of matching <code>String</code> or <code>null</code> if
+ * no matching <code>String</code> was found.
+ */
+ public Type match(final CharSequence str, final int offset) {
+ int pos = offset;
+ int strLen = str != null ? str.length() : 0;
+ Type value = null;
+ Node act = root;
+ while (pos <= strLen && act != null) {
+ if (pos == strLen && act.isFinal()) {
+ value = act.getValue();
+ }
+ if (pos < strLen) {
+ act = act.get(str.charAt(pos));
+ }
+ pos++;
+ }
+ return value;
+ }
+
+ /**
+ * Longest possible match of given cyclic buffer <code>buff</code> argument
+ * against <code>String</code>s stored in prefix tree.
+ * <p/>
+ * Search starts at <code>beg</code> index in <code>buff</code>. Next index
+ * is evaluated as <code>(<current index> + 1) % buff.length</code>.
+ * Maximum of <code>len</code> characters are compared and longest possible
+ * <code>String</code> stored in prefix tree is evaluated as matching. Zero
+ * length is evaluated as empty string.
+ * <p/>
+ * @param buff Cyclic buffer containing source string.
+ * @param len Length of string to be compared.
+ * @param beg Index of beginning of the string (1st character) in
+ * cyclic buffer.
+ * @return Value of matching <code>String</code> or <code>null</code> if
+ * no matching <code>String</code> was found.
+ */
+ public Type matchCyclicBuffer(final char[] buff, final int len,
+ final int beg) {
+ int pos = beg;
+ int count = 0;
+ Type value = null;
+ Node act = root;
+ while(count <= len && act != null) {
+ if (act.isFinal()) {
+ value = act.getValue();
+ }
+ if (count < len) {
+ act = act.get(buff[pos]);
+ }
+ count++;
+ pos = (beg + count) % buff.length;
+ }
+ return value;
+ }
+
+ /**
+ * Match longest possible <code>CharSequence</code> stored in prefix tree
+ * against given <code>String</code> argument and return value stored under
+ * this <code>String</code>.
+ * <p/>
+ * <code>null</code> value of <code>str</code> argument is considered as
+ * empty string. Matching is done from the beginning of given
+ * <code>String</code> argument.
+ * <p/>
+ * @param str <code>String</code> used to prefixMatch prefix tree against.
+ * @return Value of longest possible <code>String</code> stored in prefix
+ * tree that is matching given <code>String</code> argument prefix
+ * or <code>null</code> if no such stored <code>String</code> was
+ * found.
+ */
+ public Type prefixMatch(final CharSequence str) {
+ return prefixMatch(str, 0);
+ }
+
+ /**
+ * Match longest possible <code>CharSequence</code> stored in prefix tree
+ * against given <code>String</code> argument and return value stored under
+ * this <code>String</code>.
+ * <p/>
+ * <code>null</code> value of <code>str</code> argument is considered as
+ * empty string. Matching is done from the beginning of given
+ * <code>String</code> argument.
+ * <p/>
+ * @param offset Beginning index for searching.
+ * @param str <code>String</code> used to prefixMatch prefix tree against.
+ * @return Value of longest possible <code>String</code> stored in prefix
+ * tree that is matching given <code>String</code> argument prefix
+ * or <code>null</code> if no such stored <code>String</code> was
+ * found.
+ */
+ public Type prefixMatch(final CharSequence str, final int offset) {
+ int pos = offset;
+ int strLen = str != null ? str.length() : 0;
+ Type value = null;
+ Node act = root;
+ while (pos <= strLen && act != null) {
+ if (act.isFinal()) {
+ value = act.getValue();
+ }
+ if (pos < strLen) {
+ act = act.get(str.charAt(pos));
+ }
+ pos++;
+ }
+ return value;
+ }
+
+ /**
+ * Get number of strings stored in prefix tree.
+ * <p/>
+ * @return Number of strings stored in prefix tree.
+ */
+ public int size() {
+ return size;
+ }
+
+}
diff --git a/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Utils.java b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Utils.java
new file mode 100644
index 0000000..ae3d756
--- /dev/null
+++ b/enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/utils/Utils.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Common utilities.
+ * <p/>
+ * @author Vince Kraemer, Tomas Kraus, Peter Benedikovic
+ */
+public class Utils {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get system default line separator.
+ * <p/>
+ * @return System default line separator.
+ */
+ public static String lineSeparator() {
+ String lineSeparator = System.getProperty("line.separator");
+ if (lineSeparator == null) {
+ lineSeparator = "\n";
+ }
+ return lineSeparator;
+ }
+
+ /**
+ * Sanitize module name for use as Payara query parameter.
+ * <p/>
+ * @param name Payara module name.
+ * @return Sanitized Payara module name.
+ */
+ public static String sanitizeName(String name) {
+ if (null == name || name.matches("[\\p{L}\\p{N}_][\\p{L}\\p{N}\\-_./;#:]*")) {
+ return name;
+ }
+ // the string is bad...
+ return "_" + name.replaceAll("[^\\p{L}\\p{N}\\-_./;#:]", "_");
+ }
+
+ /**
+ * Add quotes to string if and only if it contains space characters.
+ *<p/>
+ * Note: does not handle generalized white space (tabs, localized white
+ * space, etc.)
+ *<p/>
+ * @param path File path in string form.
+ * @return Quoted path if it contains any space characters, otherwise same.
+ */
+ public static String quote(String path) {
+ return path.indexOf(' ') == -1 ? path : "\"" + path + "\"";
+ }
+
+ /**
+ * Convert classpath fragment using standard separator to a list of
+ * normalized files (nonexistent jars will be removed).
+ *
+ * @param cp classpath string
+ * @param root root folder for expanding relative path names
+ * @return list of existing jars, normalized
+ */
+ public static List<File> classPathToFileList(String cp, File root) {
+ List<File> result = new ArrayList<File>();
+ if(cp != null && cp.length() > 0) {
+ String [] jars = cp.split(File.pathSeparator);
+ for(String jar: jars) {
+ File jarFile = new File(jar);
+ if(!jarFile.isAbsolute() && root != null) {
+ jarFile = new File(root, jar);
+ }
+ if(jarFile.exists()) {
+ result.add(jarFile);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Pattern that matches strings like ${com.sun.aas.instanceRoot}
+ */
+ private static Pattern pattern = Pattern.compile("\\$\\{([^}]+)\\}"); // NOI18N
+
+ /**
+ * Utility method that finds all occurrences of variable references and
+ * replaces them with their values.
+ * Values are taken from <code>varMap</code> and escaped. If they are
+ * not present there, system properties are queried. If not found there
+ * the variable reference is replaced with the same string with special
+ * characters escaped.
+ *
+ * @param value String value where the variables have to be replaced with values
+ * @param varMap mapping of variable names to their values
+ * @return String where the all the replacement was done
+ */
+ public static String doSub(String value, Map<String, String> varMap) {
+ try {
+ Matcher matcher = pattern.matcher(value);
+ boolean result = matcher.find();
+ if (result) {
+ StringBuffer sb = new StringBuffer(value.length() * 2);
+ do {
+ String key = matcher.group(1);
+ String replacement = varMap.get(key);
+ if (replacement == null) {
+ replacement = System.getProperty(key);
+ if (replacement != null) {
+ replacement = escapePath(replacement);
+ } else {
+ replacement = "\\$\\{" + key + "\\}"; // NOI18N
+ }
+ } else {
+ replacement = escapePath(replacement);
+ }
+ matcher.appendReplacement(sb, replacement);
+ result = matcher.find();
+ } while (result);
+ matcher.appendTail(sb);
+ value = sb.toString();
+ }
+ } catch (Exception ex) {
+ Logger.getLogger("payara").log(Level.INFO, ex.getLocalizedMessage(), ex); // NOI18N
+ }
+ return value;
+ }
+
+ /**
+ * Add escape characters for backslash and dollar sign characters in
+ * path field.
+ *
+ * @param path file path in string form.
+ * @return adjusted path with backslashes and dollar signs escaped with
+ * backslash character.
+ */
+ public static String escapePath(String path) {
+ return path.replace("\\", "\\\\").replace("$", "\\$"); // NOI18N
+ }
+
+ public static String[] splitOptionsString(String optionString) {
+ return optionString.trim().split("\\s+(?=-)");
+ }
+
+ /**
+ * Concatenate elements of {@link String} array as
+ * a single <code>String</code> containing all elements separated
+ * by <code>,</code>.
+ * <p/>
+ * @param array {2see String} array containing elements
+ * to be concatenated.
+ * @return {2see String} containing all elements concatenated and separated
+ * by <code>,</code> or <code>null</code> when <code>array</code>
+ * is <code>null</code>.
+ */
+ public static String concatenate(final String[] array) {
+ if (array != null) {
+ boolean first = true;
+ StringBuilder sb = new StringBuilder();
+ for (String str : array) {
+ if (first) {
+ first = false;
+ } else {
+ sb.append(", ");
+ }
+ sb.append(str);
+ }
+ return sb.toString();
+ }
+ return null;
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/CommonTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/CommonTest.java
new file mode 100644
index 0000000..9b84eff
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/CommonTest.java
@@ -0,0 +1,400 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.regex.Pattern;
+import org.netbeans.modules.payara.tooling.admin.CommandRestoreDomain;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.data.PayaraAdminInterface;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerEntity;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+/**
+ * Common Payara IDE SDK test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommonTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommonTest.class);
+
+ /** Payara test server name property. */
+ public static final String PFPROP_NAME = "name";
+
+ /** Payara test server host property. */
+ public static final String PFPROP_HOST = "host";
+
+ /** Payara test server port property. */
+ public static final String PFPROP_PORT = "port";
+
+ /** Payara test server admin port property. */
+ public static final String PFPROP_ADMIN_PORT = "adminPort";
+
+ /** Payara test server admin user property. */
+ public static final String PFPROP_ADMIN_USER = "adminUser";
+
+ /** Payara test server admin password property. */
+ public static final String PFPROP_ADMIN_PASSWORD = "adminPassword";
+
+ /** Payara test server domains folder property. */
+ public static final String PFPROP_DOMAINS_FOLDER = "domainsFolder";
+
+ /** Payara test server domain name property. */
+ public static final String PFPROP_DOMAIN_NAME = "domainName";
+
+ /** Payara test server url property. */
+ public static final String PFPROP_URL = "url";
+
+ /** Payara test server version property. */
+ public static final String PFPROP_VERSION = "version";
+
+ /** Payara test server administration interface property. */
+ public static final String PFPROP_ADMIN_INTERFACE = "adminInterface";
+
+ /** Payara test server server home property. */
+ public static final String PFPROP_HOME = "serverHome";
+
+ /** Payara test server server JVM command line arguments. */
+ public static final String PFPROP_JAVA_ARGS = "javaArgs";
+
+ /** Payara test server server bootstrap jar command line arguments. */
+ public static final String PFPROP_PAYARA_ARGS = "payaraArgs";
+
+ /** Test JDK Java home property. */
+ public static final String JDKPROP_HOME = "javaHome";
+
+ /** Test JDK property file. */
+ private static final String JDK_PROPERTES =
+ "src/test/java/org/netbeans/modules/payara/tooling/Java.properties";
+
+ /** Backup domain property. */
+ public static final String BACKUP_DOMAIN = "backupDomain";
+
+ /** Test JDK properties. */
+ private static volatile Properties jdkProperties;
+
+ /** Name of static method to retrieve Payara test server properties.*/
+ private static final String PAYARA_PROPERTES_METHOD
+ = "getPayaraProperty";
+
+ /** Payara test server property file. */
+ private static final String PAYARA_PROPERTES
+ = "src/test/java/org/netbeans/modules/payara/tooling/Payara.properties";
+
+ /** Regex expression to find Payara log message informing about
+ * basic startup.
+ * <p/>
+ * Example: Payara Server Open Source Edition 3.1.2 (23) startup time :
+ * Felix (2,201ms), startup services(4,351ms), total(6,552ms) */
+ private static final String STARTED_MESSAGE_REGEX
+ = ".*Server.*startup time.*";
+
+ /** Regex expression to find Payara log message informing about
+ * server shutdown.
+ * <p/>
+ * Example: Server shutdown initiated */
+ private static final String SHUTDOWN_MESSAGE_REGEX
+ = ".*Server shutdown initiated.*";
+
+ /** Pattern to find Payara log message informing about basic startup. */
+ protected static final Pattern STARTED_MESSAGE_PATTERN
+ = Pattern.compile(STARTED_MESSAGE_REGEX);
+
+ /** Pattern to find Payara log message informing about server shutdown.
+ */
+ protected static final Pattern SHUTDOWN_MESSAGE_PATTERN
+ = Pattern.compile(SHUTDOWN_MESSAGE_REGEX);
+
+ /** Payara test server object. */
+ private static volatile PayaraServer payaraServer;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve integer value stored as property.
+ * <p/>
+ * @param properties <code>Properties</code> container.
+ * @param propertyName Name of property to be retrieved.
+ * @return <code>int</code> value of property or <code>-1</code> if value
+ * could not be converted.
+ */
+ private static int intProperty(Properties properties, String propertyName) {
+ final String METHOD = "intProperty";
+ String propertyString = properties.getProperty(propertyName);
+ int propertyValue;
+ if (propertyString == null) {
+ propertyValue = -1;
+ LOGGER.log(Level.WARNING, METHOD, "undefined", propertyName);
+ }
+ else {
+ try {
+ propertyValue = Integer.parseInt(propertyString);
+ } catch (NumberFormatException nfe) {
+ Logger.log(Level.WARNING,
+ "Cannot set " + propertyName + " property", nfe);
+ propertyValue = -1;
+ }
+ }
+ return propertyValue;
+ }
+
+ /**
+ * Get test JDK properties.
+ * <p>
+ * @return Test JDK properties.
+ */
+ public static Properties jdkProperties() {
+ if (jdkProperties != null) {
+ return jdkProperties;
+ }
+ else {
+ synchronized(CommonTest.class) {
+ if (jdkProperties == null) {
+ jdkProperties = readProperties(JDK_PROPERTES);
+ }
+ }
+ return jdkProperties;
+ }
+ }
+
+ /**
+ * Get JDK property for tests.
+ * <p/>
+ * If the key is not found in this property list, the default property list,
+ * and its defaults, recursively, are then checked. The method returns
+ * <code>null</code> if the property is not found.
+ * <p/>
+ * @param key Property key.
+ * @return Value in JDK property list with the specified key value.
+ */
+ public static String getJdkProperty(String key) {
+ return jdkProperties().getProperty(key);
+ }
+
+ /**
+ * Read properties from file. <p>
+ *
+ * @param propertiesFile Properties file.
+ * @return Payara test server properties.
+ */
+ public static Properties readProperties(String propertiesFile) {
+ Properties properties = new Properties();
+ try {
+ properties.load(new FileInputStream(propertiesFile));
+ } catch (IOException ioe) {
+ Logger.log(Level.WARNING,
+ "Cannot read " + propertiesFile + " file", ioe);
+ }
+ return properties;
+ }
+
+ /**
+ * Get Payara test server properties from provided super class invoking
+ * it's <code>getPayaraProperty(String key)</code> static method.
+ * <p/>
+ * @param pClass Super class containing
+ * <code>getPayaraProperty(String key)</code> static method
+ * to be invoked.
+ * @param pMeth <code>getPayaraProperty(String key)</code> method already
+ * retrieved from super class object.
+ * @param key Property key.
+ * @return Value returned by super class
+ * <code>getPayaraProperty(String key)</code> method.
+ */
+ private static String getPayaraProperty(
+ Class <? extends CommonTest> pClass, Method pMeth, String key) {
+ try {
+ return (String)pMeth.invoke(pClass, key);
+ } catch (IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException iae) {
+ Logger.log(Level.WARNING, "Getting Payara property failed: ",
+ iae);
+ return null;
+ }
+ }
+
+ /**
+ * Get Payara test server properties from provided super class invoking
+ * it's <code>getPayaraProperty(String key)</code> static method
+ * and convert it to positive integer value if possible.
+ * <p/>
+ * @param pClass Super class containing
+ * <code>getPayaraProperty(String key)</code> static method
+ * to be invoked.
+ * @param pMeth <code>getPayaraProperty(String key)</code> method already
+ * retrieved from super class object.
+ * @param key Property key.
+ * @return Value returned by super class
+ * <code>getPayaraProperty(String key)</code> method converted
+ * to positive integer value or <code>-1</code> if value
+ * could not be converted or retrieved.
+ */
+ private static int intPayaraProperty(Class <? extends CommonTest> pClass,
+ Method propertyMethod, String key) {
+ final String METHOD = "intPayaraProperty";
+ String propertyString = getPayaraProperty(pClass, propertyMethod,
+ key);
+ int propertyValue;
+ if (propertyString == null) {
+ propertyValue = -1;
+ LOGGER.log(Level.WARNING, METHOD, "undefined", key);
+ }
+ else {
+ try {
+ propertyValue = Integer.parseInt(propertyString);
+ } catch (NumberFormatException nfe) {
+ LOGGER.log(Level.WARNING, METHOD, "cantSet", key);
+ LOGGER.log(Level.WARNING, METHOD, "numberFormat", nfe);
+ propertyValue = -1;
+ }
+ }
+ return propertyValue;
+ }
+
+ /**
+ * Constructs <code>PayaraServer</code> object using Payara
+ * test server properties
+ * <p/>
+ * @param properties
+ * @return <code>PayaraServer</code> object initialized with Payara
+ * test server properties values.
+ */
+ public static PayaraServer createPayaraServer(
+ Class <? extends CommonTest> pClass) {
+ final String METHOD = "createPayaraServer";
+ Method pMeth;
+ try {
+ pMeth = pClass.getMethod(PAYARA_PROPERTES_METHOD, String.class);
+ } catch (NoSuchMethodException | SecurityException nme) {
+ LOGGER.log(Level.WARNING, METHOD, "accessorFailed", nme);
+ return null;
+ }
+ PayaraServerEntity server = new PayaraServerEntity();
+ server.setName(getPayaraProperty(pClass, pMeth, PFPROP_NAME));
+ server.setHost(getPayaraProperty(pClass, pMeth, PFPROP_HOST));
+ server.setAdminUser(getPayaraProperty(pClass, pMeth,
+ PFPROP_ADMIN_USER));
+ server.setAdminPassword(getPayaraProperty(pClass, pMeth,
+ PFPROP_ADMIN_PASSWORD));
+ server.setDomainsFolder(getPayaraProperty(pClass, pMeth,
+ PFPROP_DOMAINS_FOLDER));
+ server.setDomainName(getPayaraProperty(pClass, pMeth,
+ PFPROP_DOMAIN_NAME));
+ server.setServerHome(getPayaraProperty(pClass, pMeth, PFPROP_HOME));
+ server.setUrl(getPayaraProperty(pClass, pMeth, PFPROP_URL));
+ server.setPort(intPayaraProperty(pClass, pMeth, PFPROP_PORT));
+ server.setAdminPort(intPayaraProperty(pClass, pMeth,
+ PFPROP_ADMIN_PORT));
+ PayaraVersion version = PayaraVersion.toValue(
+ getPayaraProperty(pClass, pMeth, PFPROP_VERSION));
+ if (version == null) {
+ LOGGER.log(Level.WARNING, METHOD, "unknownVersion", PFPROP_ADMIN_PORT);
+ }
+ server.setVersion(version);
+ PayaraAdminInterface adminInterface =
+ PayaraAdminInterface.toValue(
+ getPayaraProperty(pClass, pMeth, PFPROP_ADMIN_INTERFACE));
+ if (adminInterface == null) {
+ LOGGER.log(Level.WARNING, METHOD,
+ "unknownAdminInterface", PFPROP_ADMIN_INTERFACE);
+ }
+ server.setAdminInterface(adminInterface);
+ return server;
+ }
+
+ /**
+ * Constructs <code>PayaraServer</code> object using Payara
+ * test server properties
+ * <p/>
+ * @param properties
+ * @return <code>PayaraServer</code> object initialized with Payara
+ * test server properties values.
+ */
+ public static PayaraServer createPayaraServer() {
+ return CommonTest.createPayaraServer(CommonTest.class);
+ }
+
+ /**
+ * Get Payara test server object with common values.
+ * <p>
+ * @return Payara test server object with common values.
+ */
+ protected static PayaraServer payaraServer() {
+ if (payaraServer != null) {
+ return payaraServer;
+ }
+ else {
+ synchronized(CommonTest.class) {
+ if (payaraServer == null) {
+ payaraServer = createPayaraServer();
+ }
+ }
+ return payaraServer;
+ }
+ }
+
+ public static void restoreDomain(PayaraServer server, String backupFile) {
+ File domainBackupFile = new File(backupFile);
+ if (!domainBackupFile.exists() || !domainBackupFile.isFile()) {
+ throw new IllegalArgumentException("Wrong configuration of backup archive");
+ }
+ CommandRestoreDomain command = new CommandRestoreDomain(getJdkProperty(
+ JDKPROP_HOME), domainBackupFile);
+
+ try {
+ Future<ResultString> future = ServerAdmin.<ResultString>exec(
+ server, command);
+ try {
+ ResultString result = future.get(120, TimeUnit.SECONDS);
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch (InterruptedException ex) {
+ fail("restore domain interrupted", ex);
+ } catch (ExecutionException ex) {
+ fail("restore domain failed", ex);
+ } catch (TimeoutException ex) {
+ fail("restore domain timeout", ex);
+ }
+ } catch (PayaraIdeException e) {
+ fail("restore domain failed", e);
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/ExceptionTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/ExceptionTest.java
new file mode 100644
index 0000000..bb0d6a7
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/ExceptionTest.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.SimpleFormatter;
+import java.util.logging.StreamHandler;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Common Payara IDE SDK Exception functional test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class ExceptionTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test PayaraException with no parameters specified throwing
+ * and logging.
+ */
+ @Test
+ public void testPayaraExceptionWithNothing() {
+ // this message must match PayaraIdeException() constructor
+ // log message.
+ String gfieMsg = "Caught PayaraIdeException.";
+ java.util.logging.Logger logger = Logger.getLogger();
+ Level logLevel = logger.getLevel();
+ OutputStream logOut = new ByteArrayOutputStream(256);
+ Handler handler = new StreamHandler(logOut, new SimpleFormatter());
+ handler.setLevel(Level.WARNING);
+ logger.addHandler(handler);
+ logger.setLevel(Level.WARNING);
+ try {
+ throw new PayaraIdeException();
+ } catch (PayaraIdeException gfie) {
+ handler.flush();
+ } finally {
+ logger.removeHandler(handler);
+ handler.close();
+ logger.setLevel(logLevel);
+ }
+ String logMsg = logOut.toString();
+ int contains = logMsg.indexOf(gfieMsg);
+ assertTrue(contains > -1);
+ }
+
+ /**
+ * Test PayaraException with message throwing and logging.
+ */
+ @Test
+ public void testPayaraExceptionWithMsg() {
+ String gfieMsg = "Test exception";
+ java.util.logging.Logger logger = Logger.getLogger();
+ Level logLevel = logger.getLevel();
+ OutputStream logOut = new ByteArrayOutputStream(256);
+ Handler handler = new StreamHandler(logOut, new SimpleFormatter());
+ handler.setLevel(Level.WARNING);
+ logger.addHandler(handler);
+ logger.setLevel(Level.WARNING);
+ try {
+ throw new PayaraIdeException(gfieMsg);
+ } catch (PayaraIdeException gfie) {
+ handler.flush();
+ } finally {
+ logger.removeHandler(handler);
+ handler.close();
+ logger.setLevel(logLevel);
+ }
+ String logMsg = logOut.toString();
+ int contains = logMsg.indexOf(gfieMsg);
+ assertTrue(contains > -1);
+ }
+
+ /**
+ * Test PayaraException with message and cause <code>Throwable</code>
+ * throwing and logging.
+ */
+ @Test
+ public void testPayaraExceptionWithMsgAndCause() {
+ String gfieMsg = "Test exception";
+ String causeMsg = "Cause exception";
+ java.util.logging.Logger logger = Logger.getLogger();
+ Level logLevel = logger.getLevel();
+ OutputStream logOut = new ByteArrayOutputStream(256);
+ Handler handler = new StreamHandler(logOut, new SimpleFormatter());
+ handler.setLevel(Level.WARNING);
+ logger.addHandler(handler);
+ logger.setLevel(Level.WARNING);
+ try {
+ try {
+ throw new Exception(causeMsg);
+ } catch (Exception e) {
+ throw new PayaraIdeException(gfieMsg, e);
+ }
+ } catch (PayaraIdeException gfie) {
+ handler.flush();
+ } finally {
+ logger.removeHandler(handler);
+ handler.close();
+ logger.setLevel(logLevel);
+ }
+ String logMsg = logOut.toString();
+ int containsGfieMsg = logMsg.indexOf(gfieMsg);
+ int containsCauseMsg = logMsg.indexOf(causeMsg);
+ assertTrue(containsGfieMsg > -1 && containsCauseMsg > -1);
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Java.properties b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Java.properties
new file mode 100644
index 0000000..398f396
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Java.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+javaHome=/usr/jdk/jdk1.7.0_15
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Payara.properties b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Payara.properties
new file mode 100644
index 0000000..698f568
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/Payara.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+host=localhost
+adminUser=admin
+adminPassword=admin123
+domainName=test
+payaraArgs=-domain test
+javaArgs=-XX:MaxPermSize=192m -XX:PermSize=64m -client
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraHttp.properties b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraHttp.properties
new file mode 100644
index 0000000..1c7979b
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraHttp.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=Payara Server
+serverHome=/users/tomas/WS/gfr3122/glassfish
+domainsFolder=/users/tomas/WS/gfr3122/glassfish/domains
+port=3180
+adminPort=3148
+url=[/users/tomas/WS/gfr3122/glassfish]deployer:pfv3ee6wc:prg10058.cz.oracle.com:3148
+version=3.1.2.2
+adminInterface=HTTP
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraRest.properties b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraRest.properties
new file mode 100644
index 0000000..c23fd4b
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/PayaraRest.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+name=Payara Server 4
+serverHome=/users/tomas/WS/gf4/glassfish
+domainsFolder=/users/tomas/WS/gf4/glassfish/domains
+port=4080
+adminPort=4048
+url=https://localhost:4048
+version=4
+adminInterface=REST
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV3Constants.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV3Constants.java
new file mode 100644
index 0000000..2cbdfdf9
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV3Constants.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+/**
+ *
+ * @author piotro
+ */
+public class TestDomainV3Constants {
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV4Constants.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV4Constants.java
new file mode 100644
index 0000000..04cc3ab
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/TestDomainV4Constants.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling;
+
+/**
+ * Names of objects existing in the testing domain.
+ *
+ * @author Peter Benedikovic
+ */
+public class TestDomainV4Constants {
+
+ public static final String NODE_NAME = "localhost-test-domain";
+
+ public static final String STANDALONE_INSTANCE = "test-instance";
+ public static final String CLUSTER = "test-cluster";
+ public static final String CLUSTER_INSTANCE = "test-cluster-instance";
+
+ public static final String APPLICATION = "html5";
+
+ public static final String JMS_CONNECTION_POOL = "jms/testConnectionPool";
+ public static final String JMS_CONNECTION_FACTORY = "jms/testConnectionFactory";
+ public static final String JDBC_CONNECTION_POOL = "TestPool";
+ public static final String JDBC_CONNECTION = "jdbc/testConnection";
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryTest.java
new file mode 100644
index 0000000..87e7dca
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/AdminFactoryTest.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraAdminInterface;
+import org.netbeans.modules.payara.tooling.data.PayaraServerEntity;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * <code>AdminFactory</code> functional tests.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class AdminFactoryTest extends CommandTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test factory functionality for Payara
+ * <p/>
+ * Factory should initialize HTTP <code>Runner</code> and point it to
+ * provided <code>Command</code> instance.
+ */
+ @Test
+ public void testGetInstanceforVersionPF4() {
+ PayaraServerEntity srv = new PayaraServerEntity();
+ srv.setVersion(PayaraVersion.PF_4_1_144);
+ AdminFactory af = AdminFactory.getInstance(srv.getVersion());
+ assertTrue(af instanceof AdminFactoryHttp);
+ Command cmd = new CommandVersion();
+ Runner runner;
+ try {
+ runner = af.getRunner(srv, cmd);
+ } catch (PayaraIdeException gfie) {
+ runner = null;
+ fail("Exception in Runner initialization: " + gfie.getMessage());
+ }
+ // Returned runner should be HTTP interface.
+ assertTrue(runner instanceof RunnerHttp);
+ // Stored command entity should be the one we supplied.
+ assertTrue(cmd.equals(runner.getCommand()));
+ }
+
+ /**
+ * Test factory functionality for Payara
+ * <p/>
+ * Factory should initialize REST <code>Runner</code> and point it to
+ * provided <code>Command</code> instance.
+ */
+ @Test
+ public void testGetInstanceforVersionPF5() {
+ PayaraServerEntity srv = new PayaraServerEntity();
+ srv.setVersion(PayaraVersion.PF_5_181);
+ AdminFactory af = AdminFactory.getInstance(srv.getVersion());
+ assertTrue(af instanceof AdminFactoryRest);
+ Command cmd = new CommandVersion();
+ Runner runner;
+ try {
+ runner = af.getRunner(srv, cmd);
+ } catch (PayaraIdeException gfie) {
+ runner = null;
+ fail("Exception in Runner initialization: " + gfie.getMessage());
+ }
+ // Returned runner should be REST interface.
+ assertTrue(runner instanceof RunnerRest);
+ // Stored command entity should be the one we supplied.
+ assertTrue(cmd.equals(runner.getCommand()));
+ }
+
+ /**
+ * Test factory functionality for Payara using REST administration
+ * interface.
+ * <p/>
+ * Factory should initialize REST <code>Runner</code> and point it to
+ * provided <code>Command</code> instance.
+ */
+ @Test
+ public void testGetInstanceforAdminInterfaceRest() {
+ PayaraServerEntity srv = new PayaraServerEntity();
+ srv.setAdminInterface(PayaraAdminInterface.REST);
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ assertTrue(af instanceof AdminFactoryRest);
+ Command cmd = new CommandVersion();
+ Runner runner;
+ try {
+ runner = af.getRunner(srv, cmd);
+ } catch (PayaraIdeException gfie) {
+ runner = null;
+ fail("Exception in Runner initialization: " + gfie.getMessage());
+ }
+ // Returned runner should be REST interface.
+ assertTrue(runner instanceof RunnerRest);
+ // Stored command entity should be the one we supplied.
+ assertTrue(cmd.equals(runner.getCommand()));
+ }
+
+ /**
+ * Test factory functionality for Payara using HTTP administration
+ * interface.
+ * <p/>
+ * Factory should initialize HTTP <code>Runner</code> and point it to
+ * provided <code>Command</code> instance.
+ */
+ @Test
+ public void testGetInstanceforAdminInterfaceHttp() {
+ PayaraServerEntity srv = new PayaraServerEntity();
+ srv.setAdminInterface(PayaraAdminInterface.HTTP);
+ AdminFactory af = AdminFactory.getInstance(srv.getAdminInterface());
+ assertTrue(af instanceof AdminFactoryHttp);
+ Command cmd = new CommandVersion();
+ Runner runner;
+ try {
+ runner = af.getRunner(srv, cmd);
+ } catch (PayaraIdeException gfie) {
+ runner = null;
+ fail("Exception in Runner initialization: " + gfie.getMessage());
+ }
+ // Returned runner should be HTTP interface.
+ assertTrue(runner instanceof RunnerHttp);
+ // Stored command entity should be the one we supplied.
+ assertTrue(cmd.equals(runner.getCommand()));
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandAsadminTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandAsadminTest.java
new file mode 100644
index 0000000..2e9ba18
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandAsadminTest.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import static org.netbeans.modules.payara.tooling.CommonTest.JDKPROP_HOME;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TaskState;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class CommandAsadminTest extends CommandTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandAsadminTest.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test change administrator's password command execution using
+ * local asadmin interface on Payara.
+ */
+ @Test
+ public void testCommandChangeAdminPasswordPF() {
+ final String METHOD = "testCommandChangeAdminPasswordPF";
+ Properties properties = jdkProperties();
+ PayaraServer server = CommandHttpTest.payaraServer();
+ Command command = new CommandChangeAdminPassword(
+ properties.getProperty(JDKPROP_HOME), "admin123");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ String output = result.getValue();
+ LOGGER.log(Level.INFO, METHOD, "output", output);
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Change administrator's password command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Change administrator's password command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test change administrator's password command execution using
+ * local asadmin interface on Payara v4.
+ */
+ @Test
+ public void testCommandChangeAdminPasswordGFv4() {
+ final String METHOD = "testCommandChangeAdminPasswordGFv4";
+ Properties properties = jdkProperties();
+ PayaraServer server = CommandRestTest.payaraServer();
+ Command command = new CommandChangeAdminPassword(
+ properties.getProperty(JDKPROP_HOME), "admin123");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ String output = result.getValue();
+ LOGGER.log(Level.INFO, METHOD, "output", output);
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Change administrator's password command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Change administrator's password command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandDASTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandDASTest.java
new file mode 100644
index 0000000..237ab2d
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandDASTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.regex.Matcher;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.StartupArgsEntity;
+import org.netbeans.modules.payara.tooling.server.ServerTasks;
+import org.netbeans.modules.payara.tooling.utils.StreamLinesList;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara DAS commands execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(enabled = false, groups = {"unit-tests"})
+public class CommandDASTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh start local DAS administration HTTP command execution.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Test
+ public void testCommandStartDAS() {
+ String javaArgsProperty = getPayaraProperty(PFPROP_JAVA_ARGS);
+ String payaraArgsProperty = getPayaraProperty(
+ PFPROP_PAYARA_ARGS);
+ List<String> javaArgs = javaArgsProperty != null
+ ? Arrays.asList(javaArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ List<String> payaraArgs = payaraArgsProperty != null
+ ? Arrays.asList(payaraArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ StartupArgsEntity startupArgs = new StartupArgsEntity(
+ payaraArgs,
+ javaArgs,
+ new HashMap<String, String>(),
+ getJdkProperty(JDKPROP_HOME));
+ PayaraServer server = payaraServer();
+ ResultProcess result = ServerTasks.startServer(server, startupArgs);
+
+ ValueProcess process = result.getValue();
+ StreamLinesList stdOut = new StreamLinesList(
+ process.getProcess().getInputStream());
+ boolean exit = false;
+ boolean started = false;
+ boolean shutdownOnError = false;
+ int emptyCycles = 0;
+ while (!exit && emptyCycles++ < 10) {
+ String line;
+ while ((line = stdOut.getNext()) != null) {
+ Matcher startedMessageMatcher
+ = STARTED_MESSAGE_PATTERN.matcher(line);
+ Matcher shutdownMessageMatcher
+ = SHUTDOWN_MESSAGE_PATTERN.matcher(line);
+ if (startedMessageMatcher.matches()) {
+ started = true;
+ exit = true;
+ }
+ if (shutdownMessageMatcher.matches()) {
+ shutdownOnError = true;
+ }
+ System.out.println("STDOUT: "+line);
+ emptyCycles = 0;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ fail("FetchLogData command execution failed: "
+ + ie.getMessage());
+ }
+ }
+// stdOut.close();
+// stdErr.close();
+ assertNotNull(result.getValue());
+ assertTrue(started);
+ if (shutdownOnError) {
+ System.out.println("Payara exited on error!");
+ }
+ }
+
+ /**
+ * Test GlasFissh stop DAS administration HTTP command execution.
+ */
+ @Test//(dependsOnMethods = {"testCommandStartDAS"})
+ public void testCommandStopDAS() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStopDAS();
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpEnableDisableTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpEnableDisableTest.java
new file mode 100644
index 0000000..80e0200
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpEnableDisableTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * Payara enable and disable HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpEnableDisableTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ // TODO: Deploy something real on real target.
+ /**
+ * Test GlasFissh enable administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandEnable() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandEnable("name", "target");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ // TODO: Deploy something real on real target.
+ /**
+ * Test GlasFissh disable administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandDisable() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDisable("name", "target");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpGetPropertyTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpGetPropertyTest.java
new file mode 100644
index 0000000..828185e
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpGetPropertyTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara locations HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpGetPropertyTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandGetProperty() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandGetProperty("*.server-config.*.http-listener-1.port");
+ try {
+ Future<ResultMap<String, String>> future = ServerAdmin
+ .<ResultMap<String, String>>exec(server, command);
+ try {
+ ResultMap<String, String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLifeCycleTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLifeCycleTest.java
new file mode 100644
index 0000000..0f52abd
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLifeCycleTest.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.io.File;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * Payara domain life cycle HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpLifeCycleTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ private static final String CLUSTER_NAME = "ToolingCluster";
+ private static final String INSTANCE_NAME = "ToolingInstance";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+/*
+ * TODO: Not yes implemented:
+ * http://localhost:4848/__asadmin/list-nodes
+ * http://localhost:4848/__asadmin/create-instance?DEFAULT=i&node=localhost-domain1&cluster=a
+ */
+ /**
+ * Test GlasFissh create-cluster administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCreateCluster() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateCluster(CLUSTER_NAME);
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+ /**
+ * Test GlasFissh create-cluster administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testCreateCluster"})
+ public void testCreateClusterInstance() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateInstance(INSTANCE_NAME, CLUSTER_NAME, "localhost-" + server.getDomainName());
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+ /**
+ * Test GlasFissh deploy administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testCreateClusterInstance"})
+ public void testDeployWebApplication() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeploy("Test", CLUSTER_NAME, new File("target/test/simpleWeb.war"), "simpleWeb", null, null);
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+ /**
+ * Test GlasFissh deploy administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testDeployWebApplication"})
+ public void testUndeployWebApplication() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandUndeploy("Test", CLUSTER_NAME);
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+ /**
+ * Test GlasFissh create-cluster administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, alwaysRun = true, dependsOnMethods = {"testUndeployWebApplication"})
+ public void testDeleteClusterInstance() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteInstance(INSTANCE_NAME);
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+ /**
+ * Test GlasFissh create-cluster administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, alwaysRun = true, dependsOnMethods = {"testDeleteClusterInstance"})
+ public void testDeleteCluster() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteCluster(CLUSTER_NAME);
+ ResultString result = null;
+ String value = null;
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ result = future.get();
+ value = result.getValue();
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ if (result == null || result.getState() != TaskState.COMPLETED) {
+ fail(value);
+ }
+ assertNotNull(value);
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListComponentsTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListComponentsTest.java
new file mode 100644
index 0000000..41cc539
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListComponentsTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara list components HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpListComponentsTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testListComponents() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListComponents(null);
+ try {
+ Future<ResultMap<String, List<String>>> future =
+ ServerAdmin.<ResultMap<String,
+ List<String>>>exec(server, command);
+ try {
+ ResultMap<String, List<String>> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+// This test requires some components to exist.
+// assertTrue(result.getValue().size() > 0);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("List components command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("List components command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListWebServicesTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListWebServicesTest.java
new file mode 100644
index 0000000..02e0778
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpListWebServicesTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara list web services HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpListWebServicesTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testListWebServices() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListWebServices();
+ try {
+ Future<ResultList<String>> future =
+ ServerAdmin.<ResultList<String>>exec(server, command);
+ try {
+ ResultList<String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+// assertTrue(result.getValue().size() > 0);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("List resources command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("List resources command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLocationTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLocationTest.java
new file mode 100644
index 0000000..e811496
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpLocationTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara locations HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpLocationTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandLocation() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandLocation();
+ try {
+ Future<ResultMap<String, String>> future =
+ ServerAdmin.<ResultMap<String, String>>exec(server, command);
+ try {
+ ResultMap<String, String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpResourcesTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpResourcesTest.java
new file mode 100644
index 0000000..35febfd
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpResourcesTest.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import static org.netbeans.modules.payara.tooling.admin.CommandHttpTest.payaraServer;
+
+/**
+ * Payara list resources HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpResourcesTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandCreateJdbcPool() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateJDBCConnectionPool(
+ "myJdbcConnPool", "oracle.jdbc.pool.OracleDataSource",
+ "javax.sql.DataSource", null);
+ try {
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testCommandCreateJdbcPool"})
+ public void testCommandCreateJdbcResource() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateJDBCResource("myJdbcConnPool", "jdbc/MyDatasource", null, null);
+ try {
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testCommandCreateJdbcResource"})
+ public void testListJdbcResources() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListResources(
+ CommandListResources.command("jdbc-resource"), null);
+ try {
+ Future<ResultList<String>> future
+ = ServerAdmin.<ResultList<String>>exec(server, command);
+ try {
+ ResultList<String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ assertTrue(result.getValue().size() > 0);
+ assertTrue(result.getValue().contains("jdbc/MyDatasource"));
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("List resources command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("List resources command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testListJdbcResources"},
+ alwaysRun = true)
+ public void testCommandDeleteJdbcResource() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteResource("jdbc/MyDatasource", "jdbc-resource",
+ "poolname", true);
+ try {
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"}, dependsOnMethods = {"testCommandDeleteJdbcResource"},
+ alwaysRun = true)
+ public void testCommandDeleteJdbcPool() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteResource("myJdbcConnPool", "jdbc-connection-pool",
+ "poolname", true);
+ try {
+ Future<ResultString> future
+ = ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpSetPropertyTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpSetPropertyTest.java
new file mode 100644
index 0000000..93ae478
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpSetPropertyTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara set property HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpSetPropertyTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandSetProperty() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandSetProperty("configs.config.server-config.java-config.debug-options",
+ "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("SetProperty command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("SetProperty command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpTest.java
new file mode 100644
index 0000000..a076070
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpTest.java
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import static org.netbeans.modules.payara.tooling.CommonTest.BACKUP_DOMAIN;
+import static org.netbeans.modules.payara.tooling.CommonTest.readProperties;
+import static org.netbeans.modules.payara.tooling.CommonTest.restoreDomain;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.PayaraStatus;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.StartupArgsEntity;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.FetchLog;
+import org.netbeans.modules.payara.tooling.server.FetchLogSimple;
+import org.netbeans.modules.payara.tooling.server.ServerTasks;
+import org.netbeans.modules.payara.tooling.utils.StreamLinesList;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Parameters;
+
+/**
+ * Common Payara HTTP command execution test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommandHttpTest extends CommandTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandHttpTest.class);
+
+ /** Payara test server property file. */
+ private static final String PAYARA_PROPERTES
+ = "src/test/java/org/netbeans/modules/payara/tooling/PayaraHttp.properties";
+
+ /** Payara test server properties. */
+ private static volatile Properties payaraProperties;
+
+ /** Payara test server object. */
+ private static volatile PayaraServer payaraServer;
+
+ /** Payara test server stdout lines stored in linked list. */
+ protected static volatile StreamLinesList gfStdOut = null;
+
+ /** Payara test server stderr lines stored in linked list. */
+ protected static volatile StreamLinesList gfStdErr = null;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara test server properties.
+ * <p>
+ * @return Payara test server properties.
+ */
+ @BeforeSuite
+ @Parameters({ "http-properties" })
+ public static Properties payaraProperties(String propertyFile) {
+ if (payaraProperties != null) {
+ return payaraProperties;
+ }
+ else {
+ synchronized(CommandHttpTest.class) {
+ if (payaraProperties == null) {
+ payaraProperties = readProperties(propertyFile);
+ }
+ }
+ return payaraProperties;
+ }
+ }
+
+ public static Properties payaraProperties() {
+ return payaraProperties(PAYARA_PROPERTES);
+ }
+
+ /**
+ * Get Payara test server properties for HTTP tests.
+ * <p/>
+ * If the key is not found in this property list, the default property list,
+ * and its defaults, recursively, are then checked. The method returns
+ * <code>null</code> if the property is not found.
+ * <p/>
+ * @param key Property key.
+ * @return Value in Payara test server properties property list with
+ * the specified key value.
+ */
+ public static String getPayaraProperty(String key) {
+ return CommandHttpTest.payaraProperties().getProperty(key);
+ }
+
+ /**
+ * Constructs <code>PayaraServer</code> object using Payara
+ * test server properties
+ * <p/>
+ * @param properties
+ * @return <code>PayaraServer</code> object initialized with Payara
+ * test server properties values.
+ */
+ public static PayaraServer createPayaraServer() {
+ return CommonTest.createPayaraServer(CommandHttpTest.class);
+ }
+
+ /**
+ * Get Payara test server object with HTTP test specific values.
+ * <p>
+ * @return Payara test server object with HTTP test specific values.
+ */
+ public static PayaraServer payaraServer() {
+ if (payaraServer != null) {
+ return payaraServer;
+ }
+ else {
+ synchronized(CommandHttpTest.class) {
+ if (payaraServer == null) {
+ payaraServer = createPayaraServer();
+ PayaraStatus.add(payaraServer);
+ }
+ }
+ return payaraServer;
+ }
+ }
+
+ /**
+ * Payara startup.
+ * <p/>
+ * Starts Payara server for tests.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @BeforeGroups(groups = {"http-commands"})
+ public static void startPayara() {
+ final String METHOD = "startPayara";
+ LOGGER.log(Level.INFO, METHOD, "startFrame");
+ LOGGER.log(Level.INFO, METHOD, "startText");
+ LOGGER.log(Level.INFO, METHOD, "startFrame");
+ String javaArgsProperty = getPayaraProperty(PFPROP_JAVA_ARGS);
+ String payaraArgsProperty = getPayaraProperty(
+ PFPROP_PAYARA_ARGS);
+ List<String> javaArgs = javaArgsProperty != null
+ ? Arrays.asList(javaArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ List<String> payaraArgs = payaraArgsProperty != null
+ ? Arrays.asList(payaraArgsProperty.split(" +"))
+ : new ArrayList<>();
+ StartupArgsEntity startupArgs = new StartupArgsEntity(
+ payaraArgs,
+ javaArgs,
+ new HashMap<String, String>(),
+ getJdkProperty(JDKPROP_HOME));
+ PayaraServer server = payaraServer();
+ restoreDomain(server, getPayaraProperty(BACKUP_DOMAIN));
+ ResultProcess result = ServerTasks.startServer(server, startupArgs);
+ ValueProcess process = result.getValue();
+ FetchLog stdOutLog = new FetchLogSimple(process.getProcess()
+ .getInputStream());
+ FetchLog stdErrLog = new FetchLogSimple(process.getProcess()
+ .getErrorStream());
+ gfStdOut = new StreamLinesList(stdOutLog);
+ gfStdErr = new StreamLinesList(stdErrLog);
+ boolean exit = false;
+ boolean started = false;
+ boolean shutdownOnError = false;
+ int emptyCycles = 0;
+ while (!exit && emptyCycles++ < 30) {
+ String line;
+ while ((line = gfStdOut.getNext()) != null) {
+ Matcher startedMessageMatcher
+ = STARTED_MESSAGE_PATTERN.matcher(line);
+ Matcher shutdownMessageMatcher
+ = SHUTDOWN_MESSAGE_PATTERN.matcher(line);
+ if (startedMessageMatcher.matches()) {
+ started = true;
+ exit = true;
+ }
+ if (shutdownMessageMatcher.matches()) {
+ shutdownOnError = true;
+ }
+ LOGGER.log(Level.INFO, METHOD, "stdout", line);
+ emptyCycles = 0;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ fail("FetchLogData command execution failed: "
+ + ie.getMessage());
+ }
+ }
+ assertNotNull(result.getValue());
+ assertTrue(started);
+ if (shutdownOnError) {
+ LOGGER.log(Level.SEVERE, METHOD, "failed");
+ }
+ }
+
+ /**
+ * Test cleanup
+ *
+ */
+ @AfterGroups(groups = {"http-commands"})
+ public static void stopPayara() {
+ final String METHOD = "stopPayara";
+ LOGGER.log(Level.INFO, METHOD, "stopFrame");
+ LOGGER.log(Level.INFO, METHOD, "stopText");
+ LOGGER.log(Level.INFO, METHOD, "stopFrame");
+ PayaraServer server = payaraServer();
+ Command command = new CommandStopDAS();
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ gfStdOut.close();
+ gfStdErr.close();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpVersionTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpVersionTest.java
new file mode 100644
index 0000000..104ec09
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandHttpVersionTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara version HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandHttpVersionTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"http-commands"})
+ public void testCommandVersion() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandVersion();
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestApplicationTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestApplicationTest.java
new file mode 100644
index 0000000..0f7f734
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestApplicationTest.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.io.File;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TestDomainV4Constants;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import static org.netbeans.modules.payara.tooling.admin.CommandRestTest.payaraServer;
+
+/**
+ * This test file should test commands running against deployed application.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestApplicationTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFish start cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"})
+ public void deployAppTest() {
+ PayaraServer server = payaraServer();
+ System.err.println(server.getHost() + server.getAdminPort());
+ CommandDeploy command = new CommandDeploy("Test", null, new File("target/test/simpleWeb.war"), "simpleWeb", null, null);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandStopDAS command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStopDAS command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish disable application command via REST.
+ */
+ @Test(groups = {"rest-commands"})
+ public void disableAppTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDisable(TestDomainV4Constants.APPLICATION, null);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandDisable command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandDisable command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish enable application command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"disableAppTest"})
+ public void enableAppTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandEnable(TestDomainV4Constants.APPLICATION, null);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandEnable command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandEnable command execution failed: " + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestClusterTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestClusterTest.java
new file mode 100644
index 0000000..7b2f23a
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestClusterTest.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TestDomainV4Constants;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * This test file should contain all tests of commands that talk
+ * to a cluster.
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestClusterTest extends CommandRestTest {
+
+ private static final String CLUSTER_NAME = "cluster1";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFish start cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"createClusterTest"})
+ public void startClusterTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStartCluster(CLUSTER_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandStopDAS command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStopDAS command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish stop cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"startClusterTest"})
+ public void stopClusterTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStopCluster(TestDomainV4Constants.CLUSTER);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandStopCluster command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStopCluster command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish create cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"})
+ public void createClusterTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateCluster(CLUSTER_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandCreateCluster command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandCreateCluster command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish delete cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"stopClusterTest"})
+ public void deleteClusterTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteCluster(CLUSTER_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ // assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandDeleteCluster command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandDeleteCluster command execution failed: " + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestFetchLogDataTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestFetchLogDataTest.java
new file mode 100644
index 0000000..e7bdc95
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestFetchLogDataTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * Payara view-log HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestFetchLogDataTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh view-log administration HTTP command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandFetchLogData() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandFetchLogData();
+ try {
+ Future<ResultLog> future =
+ ServerAdmin.<ResultLog>exec(server, command);
+ try {
+ ResultLog result = future.get();
+ assertNotNull(result.getValue());
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("FetchLogData command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("FetchLogData command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestInstanceTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestInstanceTest.java
new file mode 100644
index 0000000..1980f6f
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestInstanceTest.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TestDomainV4Constants;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * This test file should contain all tests of commands that talk
+ * to an instance.
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestInstanceTest extends CommandRestTest {
+
+ private static final String INSTANCE_NAME = "instance1";
+ private static final String STANDALONE_INSTANCE = "instance2";
+ private static final String NODE_NAME = "localhost-domain1";
+ private static final String CLUSTER_NAME = "cluster1";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFish start instance command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"createStandaloneInstanceTest"})
+ public void startInstanceTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStartInstance(STANDALONE_INSTANCE);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandStartInstance command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStartInstance command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish stop instance command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"startInstanceTest"})
+ public void stopInstanceTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStopInstance(STANDALONE_INSTANCE);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandStopInstance command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStopInstance command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish create standalone instance command via REST.
+ */
+ @Test(groups = {"rest-commands"})
+ public void createStandaloneInstanceTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateInstance(STANDALONE_INSTANCE, null,
+ TestDomainV4Constants.NODE_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandCreateInstance command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandCreateInstance command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish create instance in a cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"})
+ public void createClusterInstanceTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateInstance(INSTANCE_NAME, TestDomainV4Constants.CLUSTER,
+ TestDomainV4Constants.NODE_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandCreateInstance command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandCreateInstance command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFish create instance in a cluster command via REST.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"stopInstanceTest"})
+ public void deleteInstanceTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteInstance(INSTANCE_NAME);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandDeleteInstance command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandDeleteInstance command execution failed: " + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListApplicationsTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListApplicationsTest.java
new file mode 100644
index 0000000..4e7c20b
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListApplicationsTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TestDomainV4Constants;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara list applications REST command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestListApplicationsTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandListApplications() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListComponents(null);
+ try {
+ Future<ResultList<String>> future = ServerAdmin.<ResultList<String>>
+ exec(server, command);
+ try {
+ ResultList<String> result = future.get();
+ assertNotNull(result.getValue());
+ assertFalse(result.getValue().isEmpty());
+ assertTrue(containsString(result.getValue(), TestDomainV4Constants.APPLICATION));
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("CommandListComponents command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandListComponents command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ private boolean containsString(List<String> list, String value) {
+ for (String s : list) {
+ if (s.contains(value))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListWebServicesTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListWebServicesTest.java
new file mode 100644
index 0000000..94d636b
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestListWebServicesTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara list web services REST command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestListWebServicesTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testListWebServices() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListWebServices();
+ try {
+ Future<ResultList<String>> future =
+ ServerAdmin.<ResultList<String>>exec(server, command);
+ try {
+ ResultList<String> result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.getState(), TaskState.COMPLETED);
+// assertTrue(result.getValue().size() > 0);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("List resources command execution failed: "
+ + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("List resources command execution failed: "
+ + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestLocationTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestLocationTest.java
new file mode 100644
index 0000000..6402359
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestLocationTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.File;
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara locations HTTP command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestLocationTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandLocation() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandLocation();
+ try {
+ Future<ResultMap<String, String>> future =
+ ServerAdmin.<ResultMap<String, String>>exec(server, command);
+ try {
+ ResultMap<String, String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ assertEquals(result.getValue().get("Domain-Root"),
+ server.getDomainsFolder() + File.separator + server.getDomainName());
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Location command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestPropertiesTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestPropertiesTest.java
new file mode 100644
index 0000000..7456033
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestPropertiesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import static org.netbeans.modules.payara.tooling.admin.CommandRestTest.payaraServer;
+
+/**
+ * Payara get property REST command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestPropertiesTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandGetProperty() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandGetProperty("*.server-config.*.http-listener-1.port");
+ try {
+ Future<ResultMap<String, String>> future =
+ ServerAdmin.<ResultMap<String, String>>exec(server, command);
+ try {
+ ResultMap<String, String> result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ assertFalse(result.getValue().isEmpty());
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("get property command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("get property command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandSetProperty() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandSetProperty("configs.config.server-config.java-config.debug-options",
+ "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009");
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("SetProperty command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("SetProperty command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestResourcesTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestResourcesTest.java
new file mode 100644
index 0000000..5d232f5
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestResourcesTest.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.TestDomainV4Constants;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import static org.netbeans.modules.payara.tooling.admin.CommandRestTest.payaraServer;
+
+/**
+ * Tests resources commands via REST interface.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestResourcesTest extends CommandRestTest {
+
+ private static final String JMS_CONNECTOR_POOL = "pool1";
+ private static final String JMS_CONNECTION = "jms/connection2";
+ private static final String JDBC_CONNECTION_POOL = "myJdbcConnPool";
+ private static final String JDBC_CONNECTION = "jdbc/MyDatasource";
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandCreateConnectorPool() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateConnectorConnectionPool(
+ JMS_CONNECTOR_POOL, "jmsra", "javax.jms.ConnectionFactory", null);
+ try {
+ Future<ResultString> future = ServerAdmin.<ResultString>
+ exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandCreateConnector() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateConnector(JMS_CONNECTION, TestDomainV4Constants.JMS_CONNECTION_POOL, null);
+ try {
+ Future<ResultString> future = ServerAdmin.<ResultString>
+ exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandCreateJDBCConnectionPool() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateJDBCConnectionPool(JDBC_CONNECTION_POOL, "oracle.jdbc.pool.OracleDataSource", "javax.sql.DataSource", null);
+ try {
+ Future<ResultString> future = ServerAdmin.<ResultString>
+ exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandCreateJDBCResource() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCreateJDBCResource(TestDomainV4Constants.JDBC_CONNECTION_POOL, JDBC_CONNECTION, null, null);
+ try {
+ Future<ResultString> future = ServerAdmin.<ResultString>
+ exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertEquals(result.getState(), TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration REST command execution.
+ */
+ @Test(groups = {"rest-commands"}, dependsOnMethods = {"testCommandCreateJDBCResource"})
+ public void testCommandListJdbcResources() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandListResources(CommandListResources.command(
+ "jdbc-resource"), null);
+ try {
+ Future<ResultList<String>> future = ServerAdmin.<ResultList<String>>
+ exec(server, command);
+ try {
+ ResultList<String> result = future.get();
+ assertNotNull(result.getValue());
+ assertFalse(result.getValue().isEmpty());
+ assertTrue(result.getValue().contains(JDBC_CONNECTION));
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+ /**
+ * Test GlasFissh administration HTTP command execution.
+ */
+ //@Test(groups = {"rest-commands"}, dependsOnMethods = {"testCommandListJdbcResources"})
+ public void testCommandDeleteResource() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandDeleteResource(JDBC_CONNECTION, "jdbc-resource",
+ "jdbc_resource_name", true);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+
+ command = new CommandDeleteResource(JMS_CONNECTOR_POOL, "connector-connection-pool",
+ "poolname", true);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+
+ command = new CommandDeleteResource(JDBC_CONNECTION_POOL, "jdbc-connection-pool",
+ "poolname", true);
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch ( InterruptedException | ExecutionException ie) {
+ fail("DeleteResource command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("DeleteResource command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestStopDASTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestStopDASTest.java
new file mode 100644
index 0000000..181b54e
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestStopDASTest.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.regex.Matcher;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.StartupArgsEntity;
+import org.netbeans.modules.payara.tooling.server.ServerTasks;
+import org.netbeans.modules.payara.tooling.utils.StreamLinesList;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import static org.netbeans.modules.payara.tooling.admin.CommandRestTest.payaraServer;
+
+/**
+ *
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(enabled = false, groups = {"unit-tests"})
+public class CommandRestStopDASTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ @Test
+ @SuppressWarnings("SleepWhileInLoop")
+ public void startDASTest() {
+ String javaArgsProperty = getPayaraProperty(PFPROP_JAVA_ARGS);
+ String payaraArgsProperty = getPayaraProperty(
+ PFPROP_PAYARA_ARGS);
+ List<String> javaArgs = javaArgsProperty != null
+ ? Arrays.asList(javaArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ List<String> payaraArgs = payaraArgsProperty != null
+ ? Arrays.asList(payaraArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ StartupArgsEntity startupArgs = new StartupArgsEntity(
+ payaraArgs,
+ javaArgs,
+ new HashMap<String, String>(),
+ getJdkProperty(JDKPROP_HOME));
+ PayaraServer server = payaraServer();
+ ResultProcess result = ServerTasks.startServer(server, startupArgs);
+
+ ValueProcess process = result.getValue();
+ StreamLinesList stdOut = new StreamLinesList(
+ process.getProcess().getInputStream());
+ boolean exit = false;
+ boolean started = false;
+ boolean shutdownOnError = false;
+ int emptyCycles = 0;
+ while (!exit && emptyCycles++ < 10) {
+ String line;
+ while ((line = stdOut.getNext()) != null) {
+ Matcher startedMessageMatcher
+ = STARTED_MESSAGE_PATTERN.matcher(line);
+ Matcher shutdownMessageMatcher
+ = SHUTDOWN_MESSAGE_PATTERN.matcher(line);
+ if (startedMessageMatcher.matches()) {
+ started = true;
+ exit = true;
+ }
+ if (shutdownMessageMatcher.matches()) {
+ shutdownOnError = true;
+ }
+ System.out.println("STDOUT: "+line);
+ emptyCycles = 0;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ fail("FetchLogData command execution failed: "
+ + ie.getMessage());
+ }
+ }
+ assertNotNull(result.getValue());
+ assertTrue(started);
+ if (shutdownOnError) {
+ System.out.println("Payara exited on error!");
+ }
+ }
+ /**
+ * Test GlasFish stop domain command via REST.
+ */
+ @Test(dependsOnMethods = {"startDASTest"})
+ public void stopDASTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandStopDAS();
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertEquals(result.state, TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("CommandStopDAS command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandStopDAS command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestTest.java
new file mode 100644
index 0000000..a39b13a
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestTest.java
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import static org.netbeans.modules.payara.tooling.CommonTest.readProperties;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.StartupArgsEntity;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.FetchLog;
+import org.netbeans.modules.payara.tooling.server.FetchLogSimple;
+import org.netbeans.modules.payara.tooling.server.ServerTasks;
+import org.netbeans.modules.payara.tooling.utils.StreamLinesList;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+
+/**
+ * Common Payara REST command execution test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommandRestTest extends CommandTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CommandRestTest.class);
+
+ /** Payara test server property file. */
+ private static final String PAYARA_PROPERTES
+ = "src/test/java/org/netbeans/modules/payara/tooling/PayaraRest.properties";
+
+ /** Payara test server properties. */
+ private static volatile Properties payaraProperties;
+
+ /** Payara test server object. */
+ private static volatile PayaraServer payaraServer;
+
+ /** Payara test server stdout lines stored in linked list. */
+ protected static volatile StreamLinesList gfStdOut = null;
+
+ /** Payara test server stderr lines stored in linked list. */
+ protected static volatile StreamLinesList gfStdErr = null;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get Payara test server properties.
+ * <p>
+ * @return Payara test server properties.
+ */
+ @BeforeSuite
+ @Parameters({ "rest-properties" })
+ public static Properties payaraProperties(@Optional String propertyFile) {
+ if (payaraProperties != null) {
+ return payaraProperties;
+ }
+ else {
+ synchronized(CommandRestTest.class) {
+ if (payaraProperties == null) {
+ if (propertyFile == null)
+ propertyFile = PAYARA_PROPERTES;
+ payaraProperties = readProperties(propertyFile);
+ }
+ }
+ return payaraProperties;
+ }
+ }
+
+ public static Properties payaraProperties() {
+ return payaraProperties(PAYARA_PROPERTES);
+ }
+
+ /**
+ * Get Payara test server properties for HTTP tests.
+ * <p/>
+ * If the key is not found in this property list, the default property list,
+ * and its defaults, recursively, are then checked. The method returns
+ * <code>null</code> if the property is not found.
+ * <p/>
+ * @param key Property key.
+ * @return Value in Payara test server properties property list with
+ * the specified key value.
+ */
+ public static String getPayaraProperty(String key) {
+ return CommandRestTest.payaraProperties().getProperty(key);
+ }
+
+ /**
+ * Constructs <code>PayaraServer</code> object using Payara
+ * test server properties
+ * @return <code>PayaraServer</code> object initialized with Payara
+ * test server properties values.
+ */
+ public static PayaraServer createPayaraServer() {
+ return CommonTest.createPayaraServer(CommandRestTest.class);
+ }
+
+ /**
+ * Get Payara test server object with REST test specific values.
+ * <p>
+ * @return Payara test server object with REST test specific values.
+ */
+ public static PayaraServer payaraServer() {
+ if (payaraServer != null) {
+ return payaraServer;
+ }
+ else {
+ synchronized(CommandRestTest.class) {
+ if (payaraServer == null) {
+ payaraServer = createPayaraServer();
+ }
+ }
+ return payaraServer;
+ }
+ }
+
+ /**
+ * Payara startup.
+ * Starts Payara server for tests.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @BeforeGroups(groups = {"rest-commands"})
+ public static void startPayara() {
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException ex) {
+ java.util.logging.Logger.getLogger(CommandRestTest.class.getName()).
+ log(Level.SEVERE, null, ex);
+ }
+ final String METHOD = "startPayara";
+ LOGGER.log(Level.INFO, METHOD, "startFrame");
+ LOGGER.log(Level.INFO, METHOD, "startText");
+ LOGGER.log(Level.INFO, METHOD, "startFrame");
+ String javaArgsProperty = getPayaraProperty(PFPROP_JAVA_ARGS);
+ String payaraArgsProperty = getPayaraProperty(
+ PFPROP_PAYARA_ARGS);
+ List<String> javaArgs = javaArgsProperty != null
+ ? Arrays.asList(javaArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ List<String> payaraArgs = payaraArgsProperty != null
+ ? Arrays.asList(payaraArgsProperty.split(" +"))
+ : new ArrayList<String>();
+ StartupArgsEntity startupArgs = new StartupArgsEntity(
+ payaraArgs,
+ javaArgs,
+ new HashMap<String, String>(),
+ getJdkProperty(JDKPROP_HOME));
+ PayaraServer server = payaraServer();
+ // restore domain before starting server
+ restoreDomain(server, getPayaraProperty(BACKUP_DOMAIN));
+ ResultProcess result = ServerTasks.startServer(server, startupArgs);
+ ValueProcess process = result.getValue();
+ FetchLog stdOutLog = new FetchLogSimple(process.getProcess()
+ .getInputStream());
+ FetchLog stdErrLog = new FetchLogSimple(process.getProcess()
+ .getErrorStream());
+ gfStdOut = new StreamLinesList(stdOutLog);
+ gfStdErr = new StreamLinesList(stdErrLog);
+ boolean exit = false;
+ boolean started = false;
+ boolean shutdownOnError = false;
+ int emptyCycles = 0;
+ while (!exit && emptyCycles++ < 10) {
+ String line;
+ while ((line = gfStdOut.getNext()) != null) {
+ Matcher startedMessageMatcher
+ = STARTED_MESSAGE_PATTERN.matcher(line);
+ Matcher shutdownMessageMatcher
+ = SHUTDOWN_MESSAGE_PATTERN.matcher(line);
+ if (startedMessageMatcher.matches()) {
+ started = true;
+ exit = true;
+ }
+ if (shutdownMessageMatcher.matches()) {
+ shutdownOnError = true;
+ }
+ LOGGER.log(Level.INFO, METHOD, "stdout", line);
+ emptyCycles = 0;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ fail("FetchLogData command execution failed: "
+ + ie.getMessage());
+ }
+ }
+ assertNotNull(result.getValue());
+ assertTrue(started);
+ if (shutdownOnError) {
+ LOGGER.log(Level.SEVERE, METHOD, "failed");
+ }
+ }
+
+ /**
+ * Test cleanup
+ *
+ */
+ @AfterGroups(groups = {"rest-commands"}, alwaysRun = true)
+ //@Test(alwaysRun = true)
+ public static void stopPayara() {
+ final String METHOD = "stopPayara";
+ LOGGER.log(Level.INFO, METHOD, "stopFrame");
+ LOGGER.log(Level.INFO, METHOD, "stopText");
+ LOGGER.log(Level.INFO, METHOD, "stopFrame");
+ PayaraServer server = payaraServer();
+ try {
+ ResultString result = CommandStopDAS.stopDAS(server);
+ gfStdOut.close();
+ gfStdErr.close();
+ assertEquals(result.getState(), TaskState.COMPLETED);
+
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestVersionTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestVersionTest.java
new file mode 100644
index 0000000..8c63532
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandRestVersionTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Payara version REST command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class CommandRestVersionTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFissh admin REST command execution.
+ */
+ @Test(groups = {"rest-commands"})
+ public void testCommandVersion() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandVersion();
+ try {
+ Future<ResultString> future =
+ ServerAdmin.exec(server, command);
+ try {
+ ResultString result = future.get();
+ assertNotNull(result.getValue());
+ assertTrue(result.getState() == TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("Version command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("Version command execution failed: " + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandTest.java
new file mode 100644
index 0000000..d627383
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/CommandTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.CommonTest;
+
+/**
+ * Common Payara command execution test.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public abstract class CommandTest extends CommonTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs <code>CommandTest</code> object.
+ * <p/>
+ * initializes common test data.
+ */
+ CommandTest() {
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/ProcessIOTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/ProcessIOTest.java
new file mode 100644
index 0000000..ecce4af
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/ProcessIOTest.java
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+
+/**
+ * Test process IO handlers.
+ * <p/>
+ * @author Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class ProcessIOTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Inner classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Generate process IO data for test.
+ */
+ private static class DataSrc implements Runnable {
+
+ /** Process standard input. */
+ private final Reader srcIn ;
+
+ /** Process standard output. */
+ private final Writer srcOut;
+
+ /** Content of process standard output. */
+ private final String[] dataOut;
+
+ /**
+ * Create an instance of process IO data generator.
+ * <p/>
+ * @param in Process standard input (second side of pipe
+ * to connect).
+ * @param out Process standard output (second side of pipe
+ * to connect).
+ * @param dataOut Content of process standard output to be sent trough
+ * the pipe.
+ * @throws IOException When there is an issue with connecting pipes
+ * or opening local {@link Reader}s and {@link Writer}s.
+ */
+ private DataSrc(final PipedOutputStream in, final PipedInputStream out,
+ final String[] dataOut) throws IOException {
+ try {
+ srcIn = new InputStreamReader(new PipedInputStream(in));
+ srcOut = new OutputStreamWriter(new PipedOutputStream(out));
+ this.dataOut = dataOut != null ? dataOut : new String[0];
+ } catch (IOException ex) {
+ close();
+ throw ex;
+ }
+
+ }
+
+ /**
+ * Thread main method.
+ */
+ @Override
+ public void run() {
+ final String METHOD = "run";
+ int len = dataOut.length;
+ try {
+ for (int i = 0; i < len; i++) {
+ if (i < dataOut.length) {
+ srcOut.write(dataOut[i]);
+ }
+ }
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "io", ioe.getLocalizedMessage());
+ } finally {
+ close();
+ }
+ }
+
+ /**
+ * Close {@link Reader}s and {@link Writer}s.
+ */
+ private void close() {
+ final String METHOD = "threadClose";
+ try {
+ if (srcIn != null) {
+ srcIn.close();
+ }
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "in", ioe.getLocalizedMessage());
+ } try {
+ if (srcOut != null) {
+ srcOut.close();
+ }
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "out", ioe.getLocalizedMessage());
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(ProcessIOTest.class);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Close process IO streams.
+ * <p/>
+ * @param in Process input stream {@link Writer}.
+ * @param out Process output stream {@link Reader}.
+ * @param err Process error output stream {@link Reader}.
+ */
+ private void close(final Writer in, final Reader out) {
+ final String METHOD = "close";
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "in", ioe.getLocalizedMessage());
+ }
+ try {
+ if (out != null) {
+ out.close();
+ }
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "out", ioe.getLocalizedMessage());
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test change administrator's password command execution using
+ * local asadmin interface on Payara.
+ */
+ @Test
+ public void testProcessIOSuccess() {
+ final String METHOD = "testProcessIOSuccess";
+ final PayaraServer server = CommandRestTest.payaraServer();
+ final PipedOutputStream in = new PipedOutputStream();
+ final PipedInputStream out = new PipedInputStream();
+ final Writer wIn = new OutputStreamWriter(in);
+ final Reader rOut = new InputStreamReader(out);
+ final ProcessIOContent content = new ProcessIOContent();
+ content.addOutput(
+ new String[] {"Command", "successfully"},
+ new String[] {"failed", "error"});
+ ProcessIOResult result = ProcessIOResult.UNKNOWN;
+ try {
+ final DataSrc dataSrc = new DataSrc(in, out, new String[] {
+ "Command executed successfully."});
+ final Thread dataThread = new Thread(dataSrc);
+ dataThread.start();
+ final ProcessIOParser parser
+ = new ProcessIOParser(wIn, rOut, content);
+ result = parser.verify();
+ String output = parser.getOutput();
+ LOGGER.log(Level.INFO, METHOD, "output", output);
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "thread", ioe.getLocalizedMessage());
+ } finally {
+ close(wIn, rOut);
+ }
+ assertTrue(result == ProcessIOResult.SUCCESS,
+ "Expected result: SUCCESS");
+ }
+
+ /**
+ * Test change administrator's password command execution using
+ * local asadmin interface on Payara.
+ */
+ @Test(dependsOnMethods = "testProcessIOSuccess")
+ public void testProcessIOFailure() {
+ final String METHOD = "testProcessIOFailure";
+ final PayaraServer server = CommandRestTest.payaraServer();
+ final PipedOutputStream in = new PipedOutputStream();
+ final PipedInputStream out = new PipedInputStream();
+ final Writer wIn = new OutputStreamWriter(in);
+ final Reader rOut = new InputStreamReader(out);
+ final ProcessIOContent content = new ProcessIOContent();
+ content.addOutput(
+ new String[] {"Command", "successfully"},
+ new String[] {"failed", "error"});
+ ProcessIOResult result = ProcessIOResult.UNKNOWN;
+ try {
+ final DataSrc dataSrc = new DataSrc(in, out, new String[] {
+ "Command execution failed."});
+ final Thread dataThread = new Thread(dataSrc);
+ dataThread.start();
+ final ProcessIOParser parser
+ = new ProcessIOParser(wIn, rOut, content);
+ result = parser.verify();
+ String output = parser.getOutput();
+ LOGGER.log(Level.INFO, METHOD, "output", output);
+ } catch (IOException ioe) {
+ LOGGER.log(Level.INFO,
+ METHOD, "thread", ioe.getLocalizedMessage());
+ } finally {
+ close(wIn, rOut);
+ }
+ assertTrue(result == ProcessIOResult.ERROR,
+ "Expected result: ERROR");
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/TaskStateTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/TaskStateTest.java
new file mode 100644
index 0000000..d3522d0
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/TaskStateTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin;
+
+import org.netbeans.modules.payara.tooling.TaskState;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Common Payara IDE SDK Exception functional test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class TaskStateTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test that <code>toString</code> handles all <code>enum</code> values.
+ */
+ @Test
+ public void testToString() {
+ for (TaskState state : TaskState.values()) {
+ assertTrue(state.toString() != null);
+ }
+ }
+
+ /**
+ * Test that <code>toValue</code> handles all <code>enum</code> values
+ * and that sequence of <code>toString</code> and <code>toValue</code>
+ * calls ends up with supplied <code>TaskState</code> value.
+ */
+ @Test
+ public void testToValue() {
+ for (TaskState state : TaskState.values()) {
+ String stringValue = state.toString();
+ TaskState finalState = TaskState.toValue(stringValue);
+ assertTrue(state == finalState);
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeployTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeployTest.java
new file mode 100644
index 0000000..a78bb74
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/cloud/CommandCloudDeployTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.cloud;
+
+import java.io.File;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.modules.payara.tooling.PayaraIdeException;
+import org.netbeans.modules.payara.tooling.admin.Command;
+import org.netbeans.modules.payara.tooling.admin.CommandRestTest;
+import org.netbeans.modules.payara.tooling.admin.ResultString;
+import org.netbeans.modules.payara.tooling.admin.ServerAdmin;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+
+/**
+ * Test deploy command against cpas (cloud).
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class CommandCloudDeployTest extends CommandRestTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test GlasFish start cluster command via REST.
+ */
+ @Test(groups = {"cloud-commands"})
+ public void deployAppTest() {
+ PayaraServer server = payaraServer();
+ Command command = new CommandCloudDeploy(null, new File("/home/piotro/workspaces/basic_paas_sample.war"));
+ try {
+ Future<ResultString> future =
+ ServerAdmin.<ResultString>exec(server, command);
+ try {
+ ResultString result = future.get();
+ //assertNotNull(result.getValue());
+ //assertEquals(result.state, TaskState.COMPLETED);
+ } catch (InterruptedException | ExecutionException ie) {
+ fail("CommandCloudDeploy command execution failed: " + ie.getMessage());
+ }
+ } catch (PayaraIdeException gfie) {
+ fail("CommandCloudDeploy command execution failed: " + gfie.getMessage());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserTest.java
new file mode 100644
index 0000000..40cfb38
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/ResponseParserTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.admin.response;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for REST parsers.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class ResponseParserTest {
+
+ public static final String PATH = System.getProperty("user.dir") + "/src/test/java/org/netbeans/modules/payara/tooling/admin/response/";
+
+ @Test
+ public void restXmlParserSimpleMessage() throws FileNotFoundException, IOException {
+ File f = new File(PATH + "version.xml");
+ RestXMLResponseParser p = new RestXMLResponseParser();
+ FileInputStream input = new FileInputStream(f);
+ RestActionReport report = p.parse(input);
+ input.close();
+
+ assertTrue(report.getExitCode().equals(ActionReport.ExitCode.SUCCESS));
+ assertTrue(report.getCommand().equals("version AdminCommand"));
+ assertTrue(report.getMessage().equals("Payara Server Open Source Edition 3.1.1 (build 12)"));
+
+ assertNull(report.topMessagePart.getChildren());
+ }
+
+ @Test
+ public void restXmlParserComplexMessage() throws FileNotFoundException, IOException {
+ File f = new File(PATH + "list-jdbc-resources.xml");
+ RestXMLResponseParser p = new RestXMLResponseParser();
+ FileInputStream input = new FileInputStream(f);
+ RestActionReport report = p.parse(input);
+ input.close();
+
+ assertTrue(report.getExitCode().equals(ActionReport.ExitCode.SUCCESS));
+ assertTrue(report.getCommand().equals("list-jdbc-resources AdminCommand"));
+ assertTrue(report.getMessage().equals(""));
+
+ assertNotNull(report.topMessagePart.getChildren());
+ assertTrue(report.topMessagePart.getChildren().size() == 3);
+
+ for (MessagePart msg : report.topMessagePart.getChildren()) {
+ assertNotNull(msg.getMessage());
+ assertFalse("".equals(msg.getMessage()));
+ assertTrue((msg.getProperties() == null) || msg.getProperties().isEmpty());
+ }
+ }
+
+ @Test
+ public void testJSONParserSimpleMessage() throws FileNotFoundException, IOException {
+ File f = new File(PATH + "location.json");
+ RestJSONResponseParser p = new RestJSONResponseParser();
+ FileInputStream input = new FileInputStream(f);
+ RestActionReport report = p.parse(input);
+ input.close();
+
+ assertTrue(report.getExitCode().equals(ActionReport.ExitCode.SUCCESS));
+ assertTrue(report.getCommand().equals("__locations AdminCommand"));
+ assertTrue(report.getMessage().equals("/home/piotro/software/ogs/glassfish3/glassfish/domains/domain1"));
+
+ assertNull(report.topMessagePart.getChildren());
+ }
+
+ @Test
+ public void restJSONParserComplexMessage() throws FileNotFoundException, IOException {
+ File f = new File(PATH + "list-jdbc-resources.json");
+ RestJSONResponseParser p = new RestJSONResponseParser();
+ FileInputStream input = new FileInputStream(f);
+ RestActionReport report = p.parse(input);
+ input.close();
+
+ assertTrue(report.getExitCode().equals(ActionReport.ExitCode.SUCCESS));
+ assertTrue(report.getCommand().equals("list-jdbc-resources AdminCommand"));
+ assertTrue(report.getMessage().equals(""));
+
+ assertNotNull(report.topMessagePart.getChildren());
+ assertTrue(report.topMessagePart.getChildren().size() == 2);
+
+ for (MessagePart msg : report.topMessagePart.getChildren()) {
+ assertNotNull(msg.getMessage());
+ assertFalse("".equals(msg.getMessage()));
+ assertTrue((msg.getProperties() == null) || msg.getProperties().isEmpty());
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.json b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.json
new file mode 100644
index 0000000..78d26eb
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.json
@@ -0,0 +1,12 @@
+{
+ "message": "",
+ "command": "list-jdbc-resources AdminCommand",
+ "exit_code": "SUCCESS",
+ "children": [{
+ "message": "jdbc\/__TimerPool",
+ "properties": {}
+ }, {
+ "message": "jdbc\/__default",
+ "properties": {}
+ }]
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.xml b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.xml
new file mode 100644
index 0000000..15df7d0
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/list-jdbc-resources.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<map>
+ <entry key="extraProperties">
+ <map>
+ <entry key="methods">
+ <list>
+ <map>
+ <entry key="name" value="GET"/>
+ </map>
+ <map>
+ <entry key="messageParameters">
+ <map>
+ <entry key="targetName">
+ <map>
+ <entry key="acceptableValues" value=""/>
+ <entry key="optional" value="true"/>
+ <entry key="defaultValue" value="server"/>
+ <entry key="type" value="string"/>
+ </map>
+ </entry>
+ </map>
+ </entry>
+ </map>
+ </list>
+ </entry>
+ </map>
+ </entry>
+ <entry key="message" value=""/>
+ <entry key="exit_code" value="SUCCESS"/>
+ <entry key="command" value="list-jdbc-resources AdminCommand"/>
+ <entry key="children">
+ <list>
+ <map>
+ <entry key="message" value="jdbc/sample"/>
+ <entry key="properties">
+ <map/>
+ </entry>
+ </map>
+ <map>
+ <entry key="message" value="jdbc/__TimerPool"/>
+ <entry key="properties">
+ <map/>
+ </entry>
+ </map>
+ <map>
+ <entry key="message" value="jdbc/__default"/>
+ <entry key="properties">
+ <map/>
+ </entry>
+ </map>
+ </list>
+ </entry>
+</map>
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/location.json b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/location.json
new file mode 100644
index 0000000..3e8a2f8
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/location.json
@@ -0,0 +1,13 @@
+{
+ "message": "\/home\/piotro\/software\/ogs\/glassfish3\/glassfish\/domains\/domain1",
+ "command": "__locations AdminCommand",
+ "exit_code": "SUCCESS",
+ "properties": {
+ "Instance-Root": "\/home\/piotro\/software\/ogs\/glassfish3\/glassfish\/domains\/domain1",
+ "Domain-Root": "\/home\/piotro\/software\/ogs\/glassfish3\/glassfish\/domains\/domain1",
+ "Uptime": "2561406",
+ "Base-Root": "\/home\/piotro\/software\/ogs\/glassfish3\/glassfish",
+ "Restart-Required": "false",
+ "Pid": "5744"
+ }
+}
\ No newline at end of file
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/version.xml b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/version.xml
new file mode 100644
index 0000000..6a4ed5b
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/admin/response/version.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<map>
+ <entry key="extraProperties">
+ <map>
+ <entry key="methods">
+ <list>
+ <map>
+ <entry key="name" value="GET"/>
+ </map>
+ <map>
+ <entry key="messageParameters">
+ <map>
+ <entry key="verbose">
+ <map>
+ <entry key="acceptableValues" value=""/>
+ <entry key="optional" value="true"/>
+ <entry key="defaultValue" value="false"/>
+ <entry key="type" value="boolean"/>
+ </map>
+ </entry>
+ </map>
+ </entry>
+ </map>
+ </list>
+ </entry>
+ </map>
+ </entry>
+ <entry key="message" value="Payara Server Open Source Edition 3.1.1 (build 12)"/>
+ <entry key="exit_code" value="SUCCESS"/>
+ <entry key="command" value="version AdminCommand"/>
+</map>
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/data/PayaraVersionTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/data/PayaraVersionTest.java
new file mode 100644
index 0000000..183cb31
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/data/PayaraVersionTest.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.data;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+
+/**
+ * Common Payara IDE SDK Exception functional test.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class PayaraVersionTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Static methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test that <code>toValue</code> handles addition values for given version
+ * and additional values array.
+ */
+ public static void verifyToValueFromAdditionalArray(
+ PayaraVersion version, String[] values) {
+ for (String value : values) {
+ PayaraVersion pfVersion = PayaraVersion.toValue(value);
+ assertTrue(pfVersion == version);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test that <code>toString</code> handles all <code>enum</code> values.
+ */
+ @Test
+ public void testToString() {
+ for (PayaraVersion version : PayaraVersion.values()) {
+ assertTrue(version.toString() != null);
+ }
+ }
+
+ /**
+ * Test that <code>toValue</code> handles all <code>enum</code> values
+ * and that sequence of <code>toString</code> and <code>toValue</code>
+ * calls ends up with supplied <code>PayaraVersion</code> version.
+ */
+ @Test
+ public void testToValue() {
+ for (PayaraVersion version : PayaraVersion.values()) {
+ String stringValue = version.toString();
+ PayaraVersion finalVersion = PayaraVersion.toValue(stringValue);
+ assertTrue(version == finalVersion);
+ }
+ verifyToValueFromAdditionalArray(PayaraVersion.PF_4_1_144,
+ PayaraVersion.PF_4_1_144_STR_NEXT);
+ verifyToValueFromAdditionalArray(PayaraVersion.PF_4_1_1_154,
+ PayaraVersion.PF_4_1_1_154_STR_NEXT);
+ verifyToValueFromAdditionalArray(PayaraVersion.PF_4_1_2_181,
+ PayaraVersion.PF_4_1_2_181_STR_NEXT);
+ verifyToValueFromAdditionalArray(PayaraVersion.PF_5_183,
+ PayaraVersion.PF_5_183_STR_NEXT);
+ }
+
+ /**
+ * Verify some incomplete <code>toValue</code> resolutions.
+ */
+ @Test
+ public void testToValueIncomplete() {
+ PayaraVersion versions[] = {
+ PayaraVersion.PF_4_1_144,
+ PayaraVersion.PF_4_1_1_154,
+ PayaraVersion.PF_4_1_2_181,
+ PayaraVersion.PF_5_183
+ };
+ String strings[] = {
+ "4.1.144",
+ "4.1.1.154",
+ "4.1.2.181",
+ "5.183"
+ };
+ for (int i = 0; i < versions.length; i++) {
+ PayaraVersion version = PayaraVersion.toValue(strings[i]);
+ assertTrue(versions[i].equals(version));
+ }
+ }
+
+ /**
+ * Verify <code>toFullString</code> method.
+ */
+ @Test
+ public void testToFullString() {
+ for (PayaraVersion version : PayaraVersion.values()) {
+ String fullVersion = version.toFullString();
+ String[] numbers
+ = fullVersion.split(PayaraVersion.SEPARATOR_PATTERN);
+ assertTrue(numbers != null && numbers.length == 4,
+ "Invalid count of version numbers");
+ short major, minor, update, build;
+ try {
+ major = Short.parseShort(numbers[0]);
+ minor = Short.parseShort(numbers[1]);
+ update = Short.parseShort(numbers[2]);
+ build = Short.parseShort(numbers[3]);
+ assertTrue(major == version.getMajor()
+ && minor == version.getMinor()
+ && update == version.getUpdate()
+ && build == version.getBuild());
+ } catch (NumberFormatException nfe) {
+ fail("Could not parse version number");
+ }
+
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/FetchLogTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/FetchLogTest.java
new file mode 100644
index 0000000..a06f053
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/FetchLogTest.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.*;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraServerEntity;
+import org.netbeans.modules.payara.tooling.utils.OsUtils;
+import org.netbeans.modules.payara.tooling.utils.ServerUtils;
+import org.netbeans.modules.payara.tooling.utils.StreamLinesList;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Test Payara server log fetcher.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class FetchLogTest extends CommandHttpTest {
+
+ /**
+ * Test Payara server log fetcher against local server.
+ */
+ @Test(groups = {"http-commands"})
+ public void testLocalFetchLog() {
+ PayaraServer server = payaraServer();
+ if (server.getDomainsFolder() == null
+ || server.getDomainName() == null) {
+ fail("Payara server cannot be used as local");
+ }
+ FetchLog log = FetchLogPiped.create(server, false);
+ StreamLinesList list = new StreamLinesList(log.getInputStream());
+ try {
+ Thread.sleep(2 * FetchLogRemote.LOG_REFRESH_DELAY);
+ } catch (InterruptedException ex) {
+ fail("Waiting for server log was interrupted");
+ }
+ log.close();
+ list.close();
+ assertFalse(list.isEmpty(), "No log lines found");
+ }
+
+ /** Log messages to test local fetcher. */
+ private static final String[] testLog = {
+ "A big black bug bit a big black bear,",
+ "then a big black bear bit the big black bug.",
+ "And when the big black bear bit the big black bug,",
+ "then the big black bug bit the big black bear.",
+ "",
+ "How much wood would a woodchuck chuck,",
+ "if a woodchuck could chuck wood?",
+ "As much wood as a woodchuck would,",
+ "if a woodchuck could chuck wood."
+ };
+
+ /**
+ * Test local log rotation.
+ */
+ @Test(groups = {"http-commands"})
+ public void testLocalFetchLogRotation() {
+ PayaraServerEntity server = new PayaraServerEntity();
+ String ts = Long.toString(System.currentTimeMillis() / 1000l);
+ server.setServerHome(File.separator + "tmp"
+ + File.separator + "gf" + ts);
+ server.setDomainName("domainL");
+ server.setDomainsFolder(server.getServerHome() + File.separator
+ + "domains");
+ String serverDomainDir = ServerUtils.getDomainPath(server);
+ String serverLogDir = serverDomainDir
+ + File.separator + ServerUtils.PF_LOG_DIR_NAME;
+ String serverLogFileTs = serverLogDir
+ + File.separator + ts + "_" + ServerUtils.PF_LOG_FILE_NAME;
+ File logDir = new File(serverLogDir);
+ File logFile = ServerUtils.getServerLogFile(server);
+ File logFileTs = new File(serverLogFileTs);
+ File tmpGfHome = new File(server.getServerHome());
+ if (tmpGfHome.exists()) {
+ if (!OsUtils.rmDir(tmpGfHome)) {
+ fail("Cannot remove old temporary Payara log directory: "
+ + tmpGfHome.getAbsolutePath());
+ }
+ }
+ if (logDir.mkdirs()) {
+ List<String> linesIn = new LinkedList<String>();
+ try {
+ if (!logFile.createNewFile()) {
+ fail("Cannot create empty log file: "
+ + logFile.getAbsolutePath());
+ }
+ FetchLog log = FetchLogPiped.create(server);
+ FileWriter out = new FileWriter(logFile);
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(log.getInputStream()));
+ int i, j;
+ for (i = 0 ; i < 4 ; i++) {
+ out.write(testLog[i]);
+ out.write(OsUtils.LINES_SEPARATOR);
+ }
+ out.close();
+ // We need at least 2 sec delay.
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {
+ fail("Caught InterruptedException: " + ex.getMessage());
+ }
+ if (!logFile.renameTo(logFileTs)) {
+ fail("Cannot rename log file to: "
+ + logFileTs.getAbsoluteFile());
+ }
+ if (!logFile.createNewFile()) {
+ fail("Cannot create empty log file: "
+ + logFile.getAbsolutePath());
+ }
+ for (j = 0 ; j < 4 ; j++) {
+ linesIn.add(in.readLine());
+ }
+ out = new FileWriter(logFile);
+ for (; i < testLog.length ; i++) {
+ out.write(testLog[i]);
+ out.write(OsUtils.LINES_SEPARATOR);
+ }
+ out.close();
+ for (; j < testLog.length ; j++) {
+ linesIn.add(in.readLine());
+ }
+
+ } catch (IOException ex) {
+ fail("Caught IOException: " + ex.getMessage());
+ }
+ if (!OsUtils.rmDir(tmpGfHome)) {
+ fail("Cannot clean up temporary Payara log directory: "
+ + tmpGfHome.getAbsolutePath());
+ }
+ assertTrue(linesIn.size() == testLog.length);
+ Iterator<String> k = linesIn.iterator();
+ int i = 0;
+ while (k.hasNext() && i < testLog.length) {
+ String line = k.next();
+ assertTrue(line.equals(testLog[i]));
+ System.out.println(line + " :: " + line.length());
+ i += 1;
+ }
+ } else {
+ fail("Cannot create temporary Payara log directory: "
+ + logDir.getAbsolutePath());
+ }
+
+ }
+
+ /**
+ * Test Payara server log fetcher against remote server.
+ */
+ @SuppressWarnings("SleepWhileInLoop")
+ @Test
+ public void testRemoteFetchLog() {
+ PayaraServer server = payaraServer();
+ ((PayaraServerEntity)server).setDomainsFolder(null);
+ FetchLog log = FetchLogPiped.create(server, false);
+ try {
+ while (0 == log.getInputStream().available()) {
+ Thread.sleep(FetchLogRemote.LOG_REFRESH_DELAY);
+ }
+ } catch (IOException ex) {
+ fail("Cannot read log data from remote server");
+ } catch (InterruptedException ex) {
+ fail("Waiting for server log was interrupted");
+ }
+ StreamLinesList list = new StreamLinesList(log.getInputStream());
+ try {
+ Thread.sleep(FetchLogRemote.LOG_REFRESH_DELAY);
+ } catch (InterruptedException ex) {
+ fail("Waiting for server log was interrupted");
+ }
+ log.close();
+ list.close();
+ assertFalse(list.isEmpty(), "No log lines found");
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/HttpPostTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/HttpPostTest.java
new file mode 100644
index 0000000..75d96c3
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/HttpPostTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test Payara server HTTP post request.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class HttpPostTest extends CommandHttpTest {
+
+ @Test(enabled = false)
+ public void testHttpPost() {
+ try {
+ String urlString = "http://localhost:4848/management/domain/stop";
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+ conn.setRequestMethod("POST");
+ conn.addRequestProperty("Host", "127.0.0.1:4848");
+ conn.addRequestProperty("X-Requested-By", "Payara REST HTML interface");
+ conn.connect();
+ System.out.println("Reply: " + conn.getResponseCode() + ": " + conn.getResponseMessage());
+ } catch (IOException ex) {
+ Logger.getLogger(HttpPostTest.class.getName()).
+ log(Level.SEVERE, null, ex);
+ }
+
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/ServerStatusTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/ServerStatusTest.java
new file mode 100644
index 0000000..8e600e5
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/ServerStatusTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server;
+
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.testng.annotations.Test;
+
+/**
+ * server status check test.
+ * <p/>
+ * @author Tomas Kraus
+ */
+public class ServerStatusTest extends CommandHttpTest {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+ @Test(groups = {"http-commands"})
+ public void testServerStatus() {
+ PayaraServer server = payaraServer();
+ try (ServerStatus serverStatus = new ServerStatus(server, false)) {
+ serverStatus.check();
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderTest.java
new file mode 100644
index 0000000..755f116
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/ConfigBuilderTest.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.admin.CommandRestTest;
+import org.netbeans.modules.payara.tooling.data.PayaraLibrary;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class ConfigBuilderTest extends CommonTest {
+
+ public static final String PATH = "file://"
+ + System.getProperty("user.dir")
+ + "/src/main/java/org/netbeans/modules/payara/tooling/server/config/";
+
+ /** Library builder configuration. */
+ private static Config libraryConfig;
+
+ // Initialize ConfigBuilder class
+ static {
+ try {
+ URL configFileV3 = new URL(PATH + "PayaraV3.xml");
+ URL configFileV4 = new URL(PATH + "PayaraV4.xml");
+ libraryConfig = new Config(configFileV3,
+ new Config.Next(
+ PayaraVersion.PF_4_1_144, configFileV4));
+ } catch (MalformedURLException mue) {
+ fail("Cannot initialize library builder");
+ }
+ }
+
+ /**
+ * Test library builder with Payara.
+ */
+ @Test
+ public void testLibraryBuilderPF() {
+ PayaraServer server = CommandHttpTest.payaraServer();
+ File home = new File(server.getServerHome());
+ ConfigBuilder lb = new ConfigBuilder(libraryConfig, home, home, home);
+ List<PayaraLibrary> lib = lb.getLibraries(
+ PayaraVersion.PF_4_1_144);
+ assertNotNull(lib);
+ try {
+ lb.getLibraries(PayaraVersion.PF_4_1_151);
+ fail("Library builder could not work for more than one Payara"
+ + " version with a single server instance.");
+ } catch (ServerConfigException sce) {}
+ }
+
+ /**
+ * Test library builder with Payara v4.
+ */
+ @Test
+ public void testLibraryBuilderGFv4() {
+ PayaraServer server = CommandRestTest.payaraServer();
+ File home = new File(server.getServerHome());
+ ConfigBuilder lb = new ConfigBuilder(libraryConfig, home, home, home);
+ List<PayaraLibrary> lib = lb.getLibraries(
+ PayaraVersion.PF_4_1_144);
+ assertNotNull(lib);
+ try {
+ lb.getLibraries(PayaraVersion.PF_4_1_151);
+ fail("Library builder could not work for more than one Payara"
+ + " version with a single server instance.");
+ } catch (ServerConfigException sce) {}
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/DomainConfigReadersTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/DomainConfigReadersTest.java
new file mode 100644
index 0000000..f67801a
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/DomainConfigReadersTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import java.io.File;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.server.parser.HttpData;
+import org.netbeans.modules.payara.tooling.server.parser.HttpListenerReader;
+import org.netbeans.modules.payara.tooling.server.parser.NetworkListenerReader;
+import org.netbeans.modules.payara.tooling.server.parser.TargetConfigNameReader;
+import org.netbeans.modules.payara.tooling.server.parser.TreeParser;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class DomainConfigReadersTest {
+
+ private static final String DOMAIN_CONFIG_FILE = System.getProperty("user.dir")
+ + "/src/test/java/org/netbeans/modules/payara/tooling/server/config/domain.xml";
+
+ @Test
+ public void testReadAdminPort() {
+ File domainXML = new File(DOMAIN_CONFIG_FILE);
+ TargetConfigNameReader configNameReader = new TargetConfigNameReader();
+ TreeParser.readXml(domainXML, configNameReader);
+ String targetConfigName = configNameReader.getTargetConfigName();
+ HttpListenerReader httpReader = new HttpListenerReader(targetConfigName);
+ NetworkListenerReader networkReader = new NetworkListenerReader(targetConfigName);
+ TreeParser.readXml(domainXML, httpReader, networkReader);
+ Map<String, HttpData> result = httpReader.getResult();
+ result.putAll(networkReader.getResult());
+ HttpData adminData = result.get("admin-listener");
+ assertTrue(adminData.getPort() == 4848);
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigTest.java
new file mode 100644
index 0000000..612bd43
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/config/PayaraConfigTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.config;
+
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.admin.CommandRestTest;
+import org.netbeans.modules.payara.tooling.data.PayaraConfig;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.ToolsConfig;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Benedikovic, Tomas Kraus
+ */
+public class PayaraConfigTest extends CommonTest {
+
+ PayaraServer serverHttp = CommandHttpTest.payaraServer();
+ PayaraServer serverRest = CommandRestTest.payaraServer();
+
+ @Test
+ public void testPayaraConfigXMLTools() {
+ // Payara configured for HTTP (v3)
+ PayaraConfig config = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(
+ serverHttp.getVersion()));
+ ToolsConfig toolsConfig = config.getTools();
+ assertNotNull(toolsConfig);
+ assertNotNull(toolsConfig.getAsadmin());
+ // Payara configured for REST (v4)
+ config = PayaraConfigManager.getConfig(
+ ConfigBuilderProvider.getBuilderConfig(
+ serverRest.getVersion()));
+ toolsConfig = config.getTools();
+ assertNotNull(toolsConfig);
+ assertNotNull(toolsConfig.getAsadmin());
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusTest.java
new file mode 100644
index 0000000..821e08d
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/server/state/PayaraStatusTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.server.state;
+
+import java.util.Properties;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.testng.annotations.Test;
+
+/**
+ * Test Payara server status check.
+ * <p/>
+ * @author Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class PayaraStatusTest extends CommonTest {
+
+ @Test
+ public void testPayaraStatusOffline() {
+ Properties properties = jdkProperties();
+ PayaraServer server = CommandHttpTest.payaraServer();
+
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBufferTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBufferTest.java
new file mode 100644
index 0000000..15e9e84
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/CyclicStringBufferTest.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Test Cyclic <code>String</code> buffer functionality.
+ * <p/>
+ * @author Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class CyclicStringBufferTest extends CommonTest{
+ ////////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(CyclicStringBufferTest.class);
+
+ /** String data for testing. */
+ private static final String DATA
+ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Test cyclic buffer appends and {@link CyclicStringBuffer#toString()}.
+ */
+ @Test
+ public void testAppend() {
+ for (int size = 1; size < 20; size++) {
+ CyclicStringBuffer buff = new CyclicStringBuffer(size);
+ // Filling buffer.
+ for (int i = 0; i < size; i++) {
+ buff.append(DATA.charAt(i));
+ String template = DATA.substring(0, i + 1);
+ String buffStr = buff.toString();
+ assertEquals(template, buffStr,
+ "Strings "+template+" and "+buffStr+" are not equal");
+ }
+ // Overwritting buffer.
+ for (int i = size; i < 2 * size; i++) {
+ buff.append(DATA.charAt(i));
+ String template = DATA.substring(i - size + 1, i + 1);
+ String buffStr = buff.toString();
+ assertEquals(template, buffStr,
+ "Strings "+template+" and "+buffStr+" are not equal");
+ }
+ }
+ }
+
+ /**
+ * Test cyclic buffer prepends {@link CyclicStringBuffer#toString()}.
+ */
+ @Test
+ public void testPrepend() {
+ for (int size = 1; size < 20; size++) {
+ CyclicStringBuffer buff = new CyclicStringBuffer(size);
+ int dataLen = DATA.length();
+ // Filling buffer.
+ for (int i = 0; i < size; i++) {
+ buff.prepend(DATA.charAt(dataLen - i - 1));
+ String template = DATA.substring(dataLen - i - 1, dataLen);
+ String buffStr = buff.toString();
+ assertEquals(template, buffStr,
+ "Strings "+template+" and "+buffStr+" are not equal");
+ }
+ // Overwritting buffer.
+ for (int i = size; i < 2 * size; i++) {
+ buff.prepend(DATA.charAt(dataLen - i - 1));
+ String template = DATA.substring(
+ dataLen - i - 1, dataLen + size - i - 1);
+ String buffStr = buff.toString();
+ assertEquals(template, buffStr,
+ "Strings "+template+" and "+buffStr+" are not equal");
+ }
+ }
+ }
+
+ /**
+ * Test cyclic buffer {@link CyclicStringBuffer#equals(String)}.
+ */
+ @Test
+ public void testEquals() {
+ for (int size = 1; size < 20; size++) {
+ CyclicStringBuffer buff = new CyclicStringBuffer(size);
+ int dataLen = DATA.length();
+ for (int i = 0; i < size; i++) {
+ buff.append(DATA.charAt(i));
+ String equal = DATA.substring(0, i + 1);
+ String differs = DATA.substring(1, i + 2);
+ assertTrue(buff.equals(equal),
+ "Strings "+equal+" and "+buff.toString()
+ +" are equal.");
+ assertFalse(buff.equals(differs),
+ "Strings "+differs+" and "+buff.toString()
+ +" are not equal.");
+ }
+ }
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/EnumUtilsTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/EnumUtilsTest.java
new file mode 100644
index 0000000..f9f2712
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/EnumUtilsTest.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import static org.netbeans.modules.payara.tooling.data.PayaraVersion.PF_4_1_144;
+import static org.netbeans.modules.payara.tooling.data.PayaraVersion.PF_5_181;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Test enumeration utilities.
+ * <p>
+ * @author Tomas Kraus
+ */
+@Test(groups = {"unit-tests"})
+public class EnumUtilsTest {
+
+
+ /**
+ * Test equals method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: false</li>
+ * <li>{@code a == b}: true</li>
+ * <li>{@code a < b}: false</li>
+ * <li>{@code a, null}: false</li>
+ * <li>{@code null, b}: false</li>
+ * <li>{@code null, null}: true</li></ul>
+ */
+ @Test
+ public void testEq() {
+ assertFalse(EnumUtils.eq(PF_5_181, PF_4_1_144), "Equals for a > b shall be false.");
+ assertTrue(EnumUtils.eq(PF_5_181, PF_5_181), "Equals for a == b shall be true.");
+ assertFalse(EnumUtils.eq(PF_4_1_144, PF_5_181), "Equals for a < b shall be false.");
+ assertFalse(EnumUtils.eq(PF_4_1_144, null), "Equals for a, null shall be false.");
+ assertFalse(EnumUtils.eq(null, PF_4_1_144), "Equals for null, b shall be false.");
+ assertTrue(EnumUtils.eq(null, null), "Equals for null, null shall be true.");
+ }
+
+ /**
+ * Test not equals method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: true</li>
+ * <li>{@code a == b}: false</li>
+ * <li>{@code a < b}: true</li>
+ * <li>{@code a, null}: true</li>
+ * <li>{@code null, b}: true</li>
+ * <li>{@code null, null}: false</li></ul>
+ */
+ @Test
+ public void testNe() {
+ assertTrue(EnumUtils.ne(PF_5_181, PF_4_1_144), "Not equals for a > b shall be true.");
+ assertFalse(EnumUtils.ne(PF_5_181, PF_5_181), "Not equals for a == b shall be false.");
+ assertTrue(EnumUtils.ne(PF_4_1_144, PF_5_181), "Not equals for a < b shall be true.");
+ assertTrue(EnumUtils.ne(PF_4_1_144, null), "Not equals for a, null shall be true.");
+ assertTrue(EnumUtils.ne(null, PF_4_1_144), "Not equals for null, b shall be true.");
+ assertFalse(EnumUtils.ne(null, null), "Not equals for null, null shall be false.");
+ }
+
+ /**
+ * Test less than method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: false</li>
+ * <li>{@code a == b}: false</li>
+ * <li>{@code a < b}: true</li>
+ * <li>{@code a, null}: false</li>
+ * <li>{@code null, b}: true</li>
+ * <li>{@code null, null}: false</li></ul>
+ */
+ @Test
+ public void testLt() {
+ assertFalse(EnumUtils.lt(PF_5_181, PF_4_1_144), "Less than for a > b shall be false.");
+ assertFalse(EnumUtils.lt(PF_5_181, PF_5_181), "Less than for a == b shall be false.");
+ assertTrue(EnumUtils.lt(PF_4_1_144, PF_5_181), "Less than for a < b shall be true.");
+ assertFalse(EnumUtils.lt(PF_4_1_144, null), "Less than for a, null shall be false.");
+ assertTrue(EnumUtils.lt(null, PF_4_1_144), "Less than for null, b shall be true.");
+ assertFalse(EnumUtils.lt(null, null), "Less than for null, null shall be false.");
+ }
+
+ /**
+ * Test less than or equal method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: false</li>
+ * <li>{@code a == b}: true</li>
+ * <li>{@code a < b}: true</li>
+ * <li>{@code a, null}: false</li>
+ * <li>{@code null, b}: true</li>
+ * <li>{@code null, null}: true</li></ul>
+ */
+ @Test
+ public void testLe() {
+ assertFalse(EnumUtils.le(PF_5_181, PF_4_1_144), "Less than or equal for a > b shall be false.");
+ assertTrue(EnumUtils.le(PF_5_181, PF_5_181), "Less than or equal for a == b shall be true.");
+ assertTrue(EnumUtils.le(PF_4_1_144, PF_5_181), "Less than or equal for a < b shall be true.");
+ assertFalse(EnumUtils.le(PF_4_1_144, null), "Less than or equal for a, null shall be false.");
+ assertTrue(EnumUtils.le(null, PF_4_1_144), "Less than or equal for null, b shall be true.");
+ assertTrue(EnumUtils.le(null, null), "Less than or equal for null, null shall be true.");
+ }
+
+ /**
+ * Test greater than method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: true</li>
+ * <li>{@code a == b}: false</li>
+ * <li>{@code a < b}: false</li>
+ * <li>{@code a, null}: true</li>
+ * <li>{@code null, b}: false</li>
+ * <li>{@code null, null}: false</li></ul>
+ */
+ @Test
+ public void testGt() {
+ assertTrue(EnumUtils.gt(PF_5_181, PF_4_1_144), "Greater than for a > b shall be true.");
+ assertFalse(EnumUtils.gt(PF_5_181, PF_5_181), "Greater than for a == b shall be false.");
+ assertFalse(EnumUtils.gt(PF_4_1_144, PF_5_181), "Greater than for a < b shall be false.");
+ assertTrue(EnumUtils.gt(PF_4_1_144, null), "Greater than for a, null shall be true.");
+ assertFalse(EnumUtils.gt(null, PF_4_1_144), "Greater than for null, b shall be false.");
+ assertFalse(EnumUtils.gt(null, null), "Greater than for null, null shall be false.");
+ }
+
+ /**
+ * Test greater than or equal method.
+ * Expected results:<ul>
+ * <li>{@code a > b}: true</li>
+ * <li>{@code a == b}: true</li>
+ * <li>{@code a < b}: false</li>
+ * <li>{@code a, null}: true</li>
+ * <li>{@code null, b}: false</li>
+ * <li>{@code null, null}: true</li></ul>
+ */
+ @Test
+ public void testGe() {
+ assertTrue(EnumUtils.ge(PF_5_181, PF_4_1_144), "Greater than or equal for a > b shall be true.");
+ assertTrue(EnumUtils.ge(PF_5_181, PF_5_181), "Greater than or equal for a == b shall be true.");
+ assertFalse(EnumUtils.ge(PF_4_1_144, PF_5_181), "Greater than or equal for a < b shall be false.");
+ assertTrue(EnumUtils.ge(PF_4_1_144, null), "Greater than or equal for a, null shall be true.");
+ assertFalse(EnumUtils.ge(null, PF_4_1_144), "Greater than or equal for null, b shall be false.");
+ assertTrue(EnumUtils.ge(null, null), "Greater than or equal for null, null shall be true.");
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JarTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JarTest.java
new file mode 100644
index 0000000..50b16ef
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JarTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.admin.CommandRestTest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+
+/**
+ * Test JAR file utilities.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class JarTest extends CommonTest {
+
+ /**
+ * Test Manifest reading from JAR file.
+ * <p/>
+ * @param server Payara server to be tested.
+ */
+ public void doTestJavaVersionCompareTo(final PayaraServer server) {
+ File jersey = ServerUtils.getJerseyCommonJarInModules(
+ server.getServerHome());
+ if (jersey != null) {
+ Jar jar = new Jar(jersey);
+ String version = jar.getBundleVersion();
+ jar.close();
+ assertNotNull(version);
+ } else {
+ fail("Jersey JAR file does not exist.");
+ }
+ }
+
+ /**
+ * Test Manifest reading from JAR file on Payara.
+ */
+ @Test
+ public void testJavaVersionCompareToPF() {
+ doTestJavaVersionCompareTo(CommandHttpTest.payaraServer());
+ }
+
+ /**
+ * Test Manifest reading from JAR file on Payara v4.
+ */
+ @Test
+ public void testJavaVersionCompareToGFv4() {
+ doTestJavaVersionCompareTo(CommandRestTest.payaraServer());
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JavaUtilTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JavaUtilTest.java
new file mode 100644
index 0000000..0a35120
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/JavaUtilTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.File;
+import java.util.Properties;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+
+/**
+ * Test Java related utilities.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class JavaUtilTest extends CommonTest {
+
+ /**
+ * Test <code>JavaVersion.comapreTo</code> functionality.
+ */
+ @Test
+ public void testJavaVersionCompareTo() {
+ JavaUtils.JavaVersion version = new JavaUtils.JavaVersion(1, 4, 2, 22);
+ // Differs on major numbers.
+ assertEquals( 1, version.comapreTo(new JavaUtils.JavaVersion(0, 4, 2, 22)));
+ assertEquals(-1, version.comapreTo(new JavaUtils.JavaVersion(2, 4, 2, 22)));
+ // Differs on minor numbers.
+ assertEquals( 1, version.comapreTo(new JavaUtils.JavaVersion(1, 3, 2, 22)));
+ assertEquals(-1, version.comapreTo(new JavaUtils.JavaVersion(1, 5, 2, 22)));
+ // Differs on revision numbers.
+ assertEquals( 1, version.comapreTo(new JavaUtils.JavaVersion(1, 4, 1, 22)));
+ assertEquals(-1, version.comapreTo(new JavaUtils.JavaVersion(1, 4, 3, 22)));
+ // Differs on patch numbers.
+ assertEquals( 1, version.comapreTo(new JavaUtils.JavaVersion(1, 4, 2, 21)));
+ assertEquals(-1, version.comapreTo(new JavaUtils.JavaVersion(1, 4, 2, 23)));
+ // Equal values
+ assertEquals( 0, version.comapreTo(new JavaUtils.JavaVersion(1, 4, 2, 22)));
+ }
+
+ /**
+ * Test that <code>javaVmVersion</code> is able to parse Java version
+ * output.
+ */
+ @Test
+ public void testJavaVersion() {
+ Properties properties = jdkProperties();
+ File javaVm = new File(JavaUtils.javaVmExecutableFullPath(
+ properties.getProperty(JDKPROP_HOME)));
+ Properties p = System.getProperties();
+ JavaUtils.JavaVersion version = JavaUtils.javaVmVersion(javaVm);
+ assertTrue(version.major > 0);
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/ServerUtilTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/ServerUtilTest.java
new file mode 100644
index 0000000..9565e85
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/ServerUtilTest.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.netbeans.modules.payara.tooling.admin.CommandHttpTest;
+import org.netbeans.modules.payara.tooling.admin.CommandRestTest;
+import org.netbeans.modules.payara.tooling.data.PayaraServer;
+import org.netbeans.modules.payara.tooling.data.PayaraVersion;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ * Test Payara server related utilities.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class ServerUtilTest extends CommonTest {
+
+ /**
+ * Helper method to test <code>ServerUtils.getServerVersion</code>
+ * functionality.
+ * <p/>
+ * @param server Payara server instance to be tested.
+ */
+ public void doTestGetServerVersion(final PayaraServer server) {
+ PayaraVersion version = ServerUtils.getServerVersion(
+ server.getServerHome());
+ assertNotNull(version);
+ }
+
+ /**
+ * Test <code>ServerUtils.getServerVersion</code> functionality
+ * on Payara.
+ */
+ @Test
+ public void testGetServerVersionPF() {
+ doTestGetServerVersion(CommandHttpTest.payaraServer());
+ }
+
+ /**
+ * Test <code>ServerUtils.getServerVersion</code> functionality
+ * on Payara.
+ */
+ @Test
+ public void testGetServerVersionPFv4() {
+ doTestGetServerVersion(CommandRestTest.payaraServer());
+ }
+
+ /**
+ * Test <code>ServerUtils.addComponentToMap</code> functionality.
+ */
+ @Test
+ public void testAddComponentToMap() {
+ String[] components = {
+ "application1 <ejb>",
+ "library1 <appclient, connector, web, ejb>",
+ "application2 <connector, ejb>"
+ };
+ Map<String, List<String>> map = new HashMap<>();
+ for (String component : components) {
+ ServerUtils.addComponentToMap(map, component);
+ }
+ List listEjb = map.get("ejb");
+ List listWeb = map.get("web");
+ assertTrue(listEjb.contains("application1"));
+ assertTrue(listEjb.contains("application2"));
+ assertTrue(listWeb.contains("library1"));
+ }
+
+ /**
+ * Helper method to test Jersey version string retrieving method.
+ * <p/>
+ * @param server Payara server instance to be tested.
+ */
+ private void doTestGetJerseyVersion(final PayaraServer server) {
+ String version = ServerUtils.getJerseyVersion(server.getServerHome());
+ assertNotNull(version);
+ String[] items = version.split("\\.");
+ assertTrue(items != null && items.length > 0);
+ for (String item : items) {
+ try {
+ Integer.parseInt(item);
+ } catch (NumberFormatException nfe) {
+ fail("Version component is not a number.");
+ }
+ }
+ }
+
+ /**
+ * Test Jersey version string retrieving method on Payara.
+ */
+ @Test
+ public void testGetJerseyVersionPF() {
+ doTestGetJerseyVersion(CommandHttpTest.payaraServer());
+ }
+
+ /**
+ * Test Jersey version string retrieving method on Payara v4.
+ */
+ @Test
+ public void testGetJerseyVersionGFv4() {
+ doTestGetJerseyVersion(CommandRestTest.payaraServer());
+ }
+
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StreamLinesList.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StreamLinesList.java
new file mode 100644
index 0000000..a4bd351
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StreamLinesList.java
@@ -0,0 +1,288 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.logging.Level;
+import org.netbeans.modules.payara.tooling.logging.Logger;
+import org.netbeans.modules.payara.tooling.server.FetchLog;
+
+/**
+ * Read data from stream and store them as linked list of lines.
+ * <p/>
+ * Allows to read Payara server log from process <code>stdout</code>
+ * and/or <code>stderr</code> after server is started.
+ * Log lines are stored into internal linked list and can be retrieved by test
+ * to analyze them.
+ * <p/>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+public class StreamLinesList {
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Internal classes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Internal thread used to read lines from provided stream and store them
+ * into list.
+ */
+ private static class LinesReader implements Runnable {
+
+ ////////////////////////////////////////////////////////////////////////
+ // Class attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Logger instance for this class. */
+ private static final Logger LOGGER = new Logger(LinesReader.class);
+
+ ////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////
+
+ /** Stream from which data should be read. */
+ private final BufferedReader in;
+
+ /** List containing lines read from stream. */
+ private final LinkedList<String> lines;
+
+ /** Store IOException if there is a problem with reading stream. */
+ IOException exception;
+
+ /** Trigger reader thread to stop execution. */
+ private boolean exit;
+
+ /** Stream was already closed notification. */
+ private boolean closedStream;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of stream reader class.
+ * <p/>
+ * @param in Stream from which data should be read.
+ * @param lines List where to store lines read from stream.
+ */
+ LinesReader(InputStream in, LinkedList<String> lines) {
+ this.in = new BufferedReader(new InputStreamReader(in));
+ this.lines = lines;
+ this.exception = null;
+ this.exit = false;
+ this.closedStream = false;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reads lines from stream and stores them into <code>List</code>
+ * provided in constructor.
+ * <p/>
+ * Lines are added with <code>List</code> instance lock because this
+ * producer thread is different one than consumer thread.
+ * Will not close stream on exit.
+ */
+ @Override
+ public void run() {
+ final String METHOD = "run";
+ String line;
+ try {
+ while (!exit && (line = in.readLine()) != null) {
+ if (line.length() > 0) synchronized(lines) {
+ lines.addLast(line);
+ }
+ }
+ } catch (IOException ioe) {
+ exception = ioe;
+ LOGGER.log(Level.WARNING, METHOD,
+ "exception", ioe.getMessage());
+ close();
+ }
+ }
+
+ /**
+ * Request this thread to stop execution (exit <code>run()</code>
+ * method).
+ */
+ void stop() {
+ this.exit = true;
+ }
+
+ /**
+ * Clean internal structures to free memory.
+ * <p/>
+ * Closes internal <code>BufferedReader</code> containing stream
+ * provided by constructor.
+ */
+ void close() {
+ // Closing the stream should be atomic to avoid multiple calls.
+ synchronized (in) {
+ if (!closedStream) {
+ try {
+ in.close();
+ closedStream = true;
+ } catch (IOException ioe) {
+ this.exception = ioe;
+ }
+ }
+ }
+ }
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Instance attributes //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** List containing lines read from stream. */
+ private final LinkedList<String> lines;
+
+ /** Internal thread used to read lines from provided stream and store them
+ * into list. */
+ private LinesReader linesReader;
+
+ /** Lines reader thread holder. */
+ private Thread linesReaderThread;
+
+ /**
+ ////////////////////////////////////////////////////////////////////////////
+ // Constructors //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Constructs an instance of log lines storage.
+ * <p/>
+ * @param in Stream from which server log data should be read.
+ */
+ @SuppressWarnings("CallToThreadStartDuringObjectConstruction")
+ public StreamLinesList(InputStream in) {
+ this.lines = new LinkedList<String>();
+ this.linesReader = new LinesReader(in, lines);
+ this.linesReaderThread = new Thread(this.linesReader);
+ this.linesReaderThread.start();
+ }
+
+ /**
+ * Constructs an instance of log lines storage.
+ * <p/>
+ * @param in Log fetcher from which server log data should be read.
+ */
+ public StreamLinesList(FetchLog fetchLog) {
+ this(fetchLog.getInputStream());
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods //
+ ////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check if there is next line in the incoming log lines.
+ * <p/>
+ * @return <code>true</code> if there is next line in the incoming log lines
+ * or <code>false</code> otherwise.
+ */
+ public boolean hasNext() {
+ synchronized(lines) {
+ return lines.isNext();
+ }
+ }
+
+ /**
+ * Move current log line to the next one in incoming log lines.
+ * <p/>
+ * @return <code>true</code> if current log line was moved to next one
+ * in incoming log lines or <code>false</code> if no next line
+ * is available.
+ */
+ public boolean next() {
+ synchronized(lines) {
+ return lines.next();
+ }
+ }
+
+ /**
+ * Get current log line from incoming log lines.
+ * <p/>
+ * @return Current log line from incoming log lines or <code>null</code>
+ * if no incoming log lines are available.
+ */
+ public String get() {
+ synchronized(lines) {
+ return lines.getCurrent();
+ }
+ }
+
+ /**
+ * Attempt to get next log line from incoming log lines.
+ * <p/>
+ * @return Next log line from incoming log lines or <code>null</code>
+ * if current log line is the last one available or there are
+ * no incoming log lines available.
+ */
+ public String getNext() {
+ synchronized(lines) {
+ if (lines.next()) {
+ return lines.getCurrent();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Check if there are at least some lines stored from log.
+ * <p/>
+ * @return <code>true</code> when list is empty (contains no elements)
+ * or <code>false</code> otherwise.
+ */
+ public boolean isEmpty() {
+ return lines.isEmpty();
+ }
+
+ /**
+ * Get string representation of all stored log lines.
+ * </P>
+ * @return <code>String</code> representation of all lines currently stored.
+ */
+ @Override
+ public String toString() {
+ return lines.toString(); }
+
+ /**
+ * Stop internal thread used to read lines from provided stream and clean
+ * internal structures to help freeing memory.
+ */
+ public void close() {
+ if (linesReader != null) {
+ try {
+ linesReader.stop();
+ linesReader.close();
+ linesReaderThread.join();
+ } catch (InterruptedException ex) {
+ // Thread won't be interrupted.
+ }
+ }
+ }
+}
diff --git a/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTreeTest.java b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTreeTest.java
new file mode 100644
index 0000000..b970b72
--- /dev/null
+++ b/enterprise/payara.tooling/test/unit/src/org/netbeans/modules/payara/tooling/utils/StringPrefixTreeTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.payara.tooling.utils;
+
+import org.netbeans.modules.payara.tooling.CommonTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Test String prefix tree.
+ * <p>
+ * @author Tomas Kraus, Peter Benedikovic
+ */
+@Test(groups = {"unit-tests"})
+public class StringPrefixTreeTest extends CommonTest {
+
+ /**
+ * Test <code>StringPrefixTree</code> adding and prefix matching.
+ */
+ @Test
+ public void testStringPrefixMatch() {
+ StringPrefixTree<Integer> pt = new StringPrefixTree<Integer>(false);
+ pt.add("ABC", new Integer(1));
+ pt.add("ABCDE", new Integer(2));
+ pt.add("ABE", new Integer(3));
+ Integer v1 = pt.prefixMatch("abc");
+ Integer v2 = pt.prefixMatch("abcde");
+ Integer v3 = pt.prefixMatch("abe");
+ Integer v4 = pt.prefixMatch("abcd");
+ Integer v5 = pt.prefixMatch("abcdef");
+ Integer v6 = pt.prefixMatch("bcdef");
+ assertTrue(v1.compareTo(1) == 0);
+ assertTrue(v2.compareTo(2) == 0);
+ assertTrue(v3.compareTo(3) == 0);
+ assertTrue(v4.compareTo(1) == 0);
+ assertTrue(v5.compareTo(2) == 0);
+ assertTrue(v6 == null);
+ }
+
+ /**
+ * Test <code>StringPrefixTree</code> adding and full matching.
+ */
+ @Test
+ public void testStringExactMatch() {
+ StringPrefixTree<Integer> pt = new StringPrefixTree<Integer>(true);
+ pt.add("ABC", new Integer(1));
+ pt.add("ABCDE", new Integer(2));
+ pt.add("ABE", new Integer(3));
+ Integer v1 = pt.match("ABC");
+ Integer v2 = pt.match("ABCDE");
+ Integer v3 = pt.match("ABE");
+ Integer v4 = pt.match("ABCD");
+ Integer v5 = pt.match("ABCDEF");
+ Integer v6 = pt.match("BCDEF");
+ Integer v7 = pt.prefixMatch("abc");
+ Integer v8 = pt.prefixMatch("abcde");
+ Integer v9 = pt.prefixMatch("abe");
+ assertTrue(v1.compareTo(1) == 0);
+ assertTrue(v2.compareTo(2) == 0);
+ assertTrue(v3.compareTo(3) == 0);
+ assertTrue(v4 == null);
+ assertTrue(v5 == null);
+ assertTrue(v6 == null);
+ assertTrue(v7 == null);
+ assertTrue(v8 == null);
+ assertTrue(v9 == null);
+ }
+
+ /**
+ * Test <code>StringPrefixTree</code> removal.
+ */
+ @Test
+ public void testStringRemoval() {
+ StringPrefixTree<Integer> pt = new StringPrefixTree<Integer>(false);
+ pt.add("HelloKitty", new Integer(1));
+ pt.add("HelloPuppy", new Integer(2));
+ pt.add("Hello", new Integer(3));
+ pt.add("HelpWhales", new Integer(4));
+ pt.add("HelpDolphins", new Integer(5));
+ Integer r1 = pt.remove("HelpWhales");
+ Integer r2 = pt.remove("HelpDolphins");
+ Integer r3 = pt.remove("Hello");
+ Integer r4 = pt.remove("HelloKitty");
+ Integer r5 = pt.remove("HelloPuppy");
+ Integer v1 = pt.match("Hello");
+ assertTrue(r1.compareTo(4) == 0);
+ assertTrue(r2.compareTo(5) == 0);
+ assertTrue(r3.compareTo(3) == 0);
+ assertTrue(r4.compareTo(1) == 0);
+ assertTrue(r5.compareTo(2) == 0);
+ assertTrue(v1 == null);
+ }
+
+ /**
+ * Test <code>StringPrefixTree</code> removal.
+ */
+ @Test
+ public void testClear() {
+ StringPrefixTree<Integer> pt = new StringPrefixTree<Integer>(false);
+ pt.add("HelloKitty", new Integer(1));
+ pt.add("HelloPuppy", new Integer(2));
+ pt.add("Hello", new Integer(3));
+ pt.add("HelpWhales", new Integer(4));
+ pt.add("HelpDolphins", new Integer(5));
+ pt.clear();
+ assertTrue(pt.size() == 0);
+ }
+
+}
diff --git a/enterprise/web.el/manifest.mf b/enterprise/web.el/manifest.mf
index 47c9054..3f6a343 100644
--- a/enterprise/web.el/manifest.mf
+++ b/enterprise/web.el/manifest.mf
@@ -3,4 +3,4 @@
OpenIDE-Module: org.netbeans.modules.web.el
OpenIDE-Module-Layer: org/netbeans/modules/web/el/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/el/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.56
+OpenIDE-Module-Specification-Version: 1.57
diff --git a/enterprise/web.el/test/unit/src/org/netbeans/modules/web/el/ELTestBase.java b/enterprise/web.el/test/unit/src/org/netbeans/modules/web/el/ELTestBase.java
index b23b3f3..a8e623c 100644
--- a/enterprise/web.el/test/unit/src/org/netbeans/modules/web/el/ELTestBase.java
+++ b/enterprise/web.el/test/unit/src/org/netbeans/modules/web/el/ELTestBase.java
@@ -610,7 +610,7 @@
}
public Profile getJ2eeProfile() {
- return Profile.JAVA_EE_6_FULL;
+ return Profile.JAVA_EE_8_FULL;
}
public FileObject getWebInf() {
diff --git a/enterprise/web.jsf/licenseinfo.xml b/enterprise/web.jsf/licenseinfo.xml
index 9c2ed73..2c12664 100644
--- a/enterprise/web.jsf/licenseinfo.xml
+++ b/enterprise/web.jsf/licenseinfo.xml
@@ -90,6 +90,7 @@
<file>src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_0.xsd</file>
<file>src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_1.xsd</file>
<file>src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_2.xsd</file>
+ <file>src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_3.xsd</file>
<license ref="CDDL-1.1" />
<comment type="CATEGORY_B" />
</fileset>
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFCatalog.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFCatalog.java
index e9ac5bd..9170cf5 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFCatalog.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFCatalog.java
@@ -47,18 +47,22 @@
private static final String JSF_2_0_XSD="web-facesconfig_2_0.xsd"; // NOI18N
private static final String JSF_2_1_XSD="web-facesconfig_2_1.xsd"; // NOI18N
private static final String JSF_2_2_XSD="web-facesconfig_2_2.xsd"; // NOI18N
+ private static final String JSF_2_3_XSD="web-facesconfig_2_3.xsd"; // NOI18N
private static final String JSF_1_2=JAVAEE_NS+"/"+JSF_1_2_XSD; // NOI18N
private static final String JSF_2_0=JAVAEE_NS+"/"+JSF_2_0_XSD; // NOI18N
private static final String JSF_2_1=JAVAEE_NS+"/"+JSF_2_1_XSD; // NOI18N
private static final String JSF_2_2=JAVAEE_NS+"/"+JSF_2_2_XSD; // NOI18N
+ private static final String JSF_2_3=JAVAEE_NS+"/"+JSF_2_3_XSD; // NOI18N
public static final String JSF_ID_1_2="SCHEMA:"+JSF_1_2; // NOI18N
public static final String JSF_ID_2_0="SCHEMA:"+JSF_2_0; // NOI18N
public static final String JSF_ID_2_1="SCHEMA:"+JSF_2_1; // NOI18N
public static final String JSF_ID_2_2="SCHEMA:"+JSF_2_2; // NOI18N
+ public static final String JSF_ID_2_3="SCHEMA:"+JSF_2_3; // NOI18N
private static final String URL_JSF_1_2="nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_1_2.xsd"; // NOI18N
private static final String URL_JSF_2_0="nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_0.xsd"; // NOI18N
private static final String URL_JSF_2_1="nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_1.xsd"; // NOI18N
private static final String URL_JSF_2_2="nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_2.xsd"; // NOI18N
+ private static final String URL_JSF_2_3="nbres:/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_3.xsd"; // NOI18N
// faces-config resources
public static final String RES_FACES_CONFIG_DEFAULT = "faces-config.xml";
@@ -66,18 +70,23 @@
public static final String RES_FACES_CONFIG_2_0 = "faces-config_2_0.xml";
public static final String RES_FACES_CONFIG_2_1 = "faces-config_2_1.xml";
public static final String RES_FACES_CONFIG_2_2 = "faces-config_2_2.xml";
+ public static final String RES_FACES_CONFIG_2_3 = "faces-config_2_3.xml";
//facelets
+ private static final String FILE_FACELETS_TAGLIB_SCHAMA_23="web-facelettaglibrary_2_3.xsd"; //NOI18N
private static final String FILE_FACELETS_TAGLIB_SCHAMA_22="web-facelettaglibrary_2_2.xsd"; //NOI18N
private static final String FILE_FACELETS_TAGLIB_SCHAMA_20="web-facelettaglibrary_2_0.xsd"; //NOI18N
private static final String FILE_FACELETS_TAGLIB_DTD_10="facelet-taglib_1_0.dtd"; //NOI18N
+ private static final String URL_FACELETS_TAGLIB_SCHEMA_23 = JAVAEE_NS + "/" + FILE_FACELETS_TAGLIB_SCHAMA_23; // NOI18N
+ private static final String ID_FACELETS_TAGLIB_SCHEMA_23 ="SCHEMA:" + URL_FACELETS_TAGLIB_SCHEMA_23;
private static final String URL_FACELETS_TAGLIB_SCHEMA_22 = JAVAEE_NS + "/" + FILE_FACELETS_TAGLIB_SCHAMA_22; // NOI18N
private static final String ID_FACELETS_TAGLIB_SCHEMA_22 ="SCHEMA:" + URL_FACELETS_TAGLIB_SCHEMA_22;
private static final String URL_FACELETS_TAGLIB_SCHEMA_20 = JAVAEE_NS + "/" + FILE_FACELETS_TAGLIB_SCHAMA_20; // NOI18N
private static final String ID_FACELETS_TAGLIB_SCHEMA_20 ="SCHEMA:" + URL_FACELETS_TAGLIB_SCHEMA_20;
private static final String ID_FACELETS_TAGLIB_DTD_10 = "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"; //NOI18N
+ private static final String RESOURCE_URL_FACELETS_TAGLIB_SCHEMA_23 ="nbres:/org/netbeans/modules/web/jsf/resources/" + FILE_FACELETS_TAGLIB_SCHAMA_23; // NOI18N
private static final String RESOURCE_URL_FACELETS_TAGLIB_SCHEMA_22 ="nbres:/org/netbeans/modules/web/jsf/resources/" + FILE_FACELETS_TAGLIB_SCHAMA_22; // NOI18N
private static final String RESOURCE_URL_FACELETS_TAGLIB_SCHEMA_20 ="nbres:/org/netbeans/modules/web/jsf/resources/" + FILE_FACELETS_TAGLIB_SCHAMA_20; // NOI18N
private static final String RESOURCE_URL_FACELETS_TAGLIB_DTD_10 ="nbres:/org/netbeans/modules/web/jsf/resources/" + FILE_FACELETS_TAGLIB_DTD_10; // NOI18N
@@ -99,6 +108,7 @@
list.add(JSF_ID_2_0);
list.add(JSF_ID_2_1);
list.add(JSF_ID_2_2);
+ list.add(JSF_ID_2_3);
list.add(ID_FACELETS_TAGLIB_DTD_10);
list.add(ID_FACELETS_TAGLIB_SCHEMA_20);
return list.listIterator();
@@ -121,6 +131,8 @@
return URL_JSF_2_1;
else if (JSF_ID_2_2.equals(publicId))
return URL_JSF_2_2;
+ else if (JSF_ID_2_3.equals(publicId))
+ return URL_JSF_2_3;
else if (ID_FACELETS_TAGLIB_DTD_10.equals(publicId))
return RESOURCE_URL_FACELETS_TAGLIB_DTD_10;
else if(ID_FACELETS_TAGLIB_SCHEMA_20.equals(publicId))
@@ -200,6 +212,8 @@
return new org.xml.sax.InputSource(URL_JSF_2_1);
} else if (JSF_2_2.equals(systemId)) {
return new org.xml.sax.InputSource(URL_JSF_2_2);
+ } else if (JSF_2_3.equals(systemId)) {
+ return new org.xml.sax.InputSource(URL_JSF_2_3);
} else if (URL_FACELETS_TAGLIB_SCHEMA_20.equals(systemId)) {
return new org.xml.sax.InputSource(RESOURCE_URL_FACELETS_TAGLIB_SCHEMA_20);
} else if (URL_FACELETS_TAGLIB_SCHEMA_22.equals(systemId)) {
@@ -212,6 +226,8 @@
return new org.xml.sax.InputSource(URL_JSF_2_1);
} else if (systemId!=null && systemId.endsWith(JSF_2_2_XSD)) {
return new org.xml.sax.InputSource(URL_JSF_2_2);
+ } else if (systemId!=null && systemId.endsWith(JSF_2_3_XSD)) {
+ return new org.xml.sax.InputSource(URL_JSF_2_3);
} else if (systemId!=null && systemId.endsWith(FILE_FACELETS_TAGLIB_SCHAMA_20)) {
return new org.xml.sax.InputSource(RESOURCE_URL_FACELETS_TAGLIB_SCHEMA_20);
} else {
@@ -252,6 +268,8 @@
value = JSFVersion.JSF_2_1;
} else if (JSF_ID_2_2.equals(dt.getPublicId())) {
value = JSFVersion.JSF_2_2;
+ } else if (JSF_ID_2_3.equals(dt.getPublicId())) {
+ value = JSFVersion.JSF_2_3;
}
}
return value;
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFFrameworkProvider.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFFrameworkProvider.java
index 8fb6ea8..a13382b 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFFrameworkProvider.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFFrameworkProvider.java
@@ -575,7 +575,9 @@
if (ddRoot != null) {
Profile profile = webModule.getJ2eeProfile();
if (profile != null && profile.isAtLeast(Profile.JAVA_EE_5) && jsfVersion != null) {
- if (jsfVersion.isAtLeast(JSFVersion.JSF_2_2)) {
+ if (jsfVersion.isAtLeast(JSFVersion.JSF_2_3)) {
+ facesConfigTemplate = JSFCatalog.RES_FACES_CONFIG_2_3;
+ } else if (jsfVersion.isAtLeast(JSFVersion.JSF_2_2)) {
facesConfigTemplate = JSFCatalog.RES_FACES_CONFIG_2_2;
} else if (jsfVersion.isAtLeast(JSFVersion.JSF_2_1)) {
facesConfigTemplate = JSFCatalog.RES_FACES_CONFIG_2_1;
@@ -739,7 +741,7 @@
String shortName;
try {
shortName = Deployment.getDefault().getServerInstance(serverInstanceID).getServerID();
- if ("gfv3ee6".equals(shortName) || "gfv3".equals(shortName)) {
+ if ("gfv5ee8".equals(shortName) || "gfv5".equals(shortName) || "gfv3ee6".equals(shortName) || "gfv3".equals(shortName)) {
return true;
}
} catch (InstanceRemovedException ex) {
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFUtils.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFUtils.java
index e2016ae..0627d23 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFUtils.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/JSFUtils.java
@@ -78,6 +78,7 @@
public static final String JSF_2_0__API_SPECIFIC_CLASS = "javax.faces.application.ProjectStage"; //NOI18N
public static final String JSF_2_1__API_SPECIFIC_CLASS = "javax.faces.component.TransientStateHelper"; //NOI18N
public static final String JSF_2_2__API_SPECIFIC_CLASS = "javax.faces.flow.Flow"; //NOI18N
+ public static final String JSF_2_3__API_SPECIFIC_CLASS = "javax.faces.push.PushContext"; //NOI18N
public static final String MYFACES_SPECIFIC_CLASS = "org.apache.myfaces.webapp.StartupServletContextListener"; //NOI18N
//constants for web.xml
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFVersion.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFVersion.java
index 35e6ea0..56d9095 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFVersion.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/api/facesmodel/JSFVersion.java
@@ -65,11 +65,13 @@
JSF_1_2("JSF 1.2"),
JSF_2_0("JSF 2.0"),
JSF_2_1("JSF 2.1"),
- JSF_2_2("JSF 2.2");
+ JSF_2_2("JSF 2.2"),
+ JSF_2_3("JSF 2.3");
private static final LinkedHashMap<JSFVersion, String> SPECIFIC_CLASS_NAMES = new LinkedHashMap<JSFVersion, String>();
static {
+ SPECIFIC_CLASS_NAMES.put(JSFVersion.JSF_2_3, JSFUtils.JSF_2_3__API_SPECIFIC_CLASS);
SPECIFIC_CLASS_NAMES.put(JSFVersion.JSF_2_2, JSFUtils.JSF_2_2__API_SPECIFIC_CLASS);
SPECIFIC_CLASS_NAMES.put(JSFVersion.JSF_2_1, JSFUtils.JSF_2_1__API_SPECIFIC_CLASS);
SPECIFIC_CLASS_NAMES.put(JSFVersion.JSF_2_0, JSFUtils.JSF_2_0__API_SPECIFIC_CLASS);
@@ -209,7 +211,9 @@
public static JSFVersion forServerLibrary(@NonNull ServerLibrary lib) {
Parameters.notNull("serverLibrary", lib); //NOI18N
if ("JavaServer Faces".equals(lib.getSpecificationTitle())) { // NOI18N
- if (Version.fromJsr277NotationWithFallback("2.2").equals(lib.getSpecificationVersion())) { //NOI18N
+ if (Version.fromJsr277NotationWithFallback("2.3").equals(lib.getSpecificationVersion())) { //NOI18N
+ return JSFVersion.JSF_2_3;
+ } else if (Version.fromJsr277NotationWithFallback("2.2").equals(lib.getSpecificationVersion())) { //NOI18N
return JSFVersion.JSF_2_2;
} else if (Version.fromJsr277NotationWithFallback("2.1").equals(lib.getSpecificationVersion())) { //NOI18N
return JSFVersion.JSF_2_1;
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/Bundle.properties b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/Bundle.properties
index bce29b2..2b7f7ce 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/Bundle.properties
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/Bundle.properties
@@ -42,7 +42,7 @@
Templates/JSF/JSF_From_Entity_Snippets/JSF/view.ftl=JSF Form From Entity (View)
Templates/JSF/JSF_From_Entity_Snippets/JSF/edit.ftl=JSF Form From Entity (Create/Edit)
Templates/JSF/compositeComponent=Custom Composite Component
-Templates/JSF/JSFManagedBean.java=JSF Managed Bean
+Templates/JSF/JSFManagedBean.java=JSF CDI Bean
Templates/JSF/faces-config.xml=JSF Faces Configuration
Templates/JSF/out.xhtml=JSF Composite Component
Templates/JSF/JSP.jsp=JSF Page
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/faces-config_2_3.xml b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/faces-config_2_3.xml
new file mode 100644
index 0000000..e6f0c69
--- /dev/null
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/faces-config_2_3.xml
@@ -0,0 +1,27 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<faces-config version="2.3"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">
+
+</faces-config>
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_3.xsd b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_3.xsd
new file mode 100644
index 0000000..031d0a10
--- /dev/null
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/resources/web-facesconfig_2_3.xsd
@@ -0,0 +1,3703 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<xsd:schema xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.jcp.org/xml/ns/javaee" version="2.3" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:include schemaLocation="javaee_8.xsd" />
+ <xsd:annotation>
+ <xsd:documentation>
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 2011 - 2013 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ <p>The XML Schema for the JavaServer Faces Application
+ Configuration File (Version 2.3).</p>
+
+ <p>All JavaServer Faces configuration files must indicate
+ the JavaServer Faces schema by indicating the JavaServer
+ Faces namespace:</p>
+
+ <p>http://xmlns.jcp.org/xml/ns/javaee</p>
+
+ <p>and by indicating the version of the schema by
+ using the version element as shown below:</p>
+
+ <pre><faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="..."
+ version="2.3">
+ ...
+ </faces-config></pre>
+
+ <p>The instance documents may indicate the published
+ version of the schema using xsi:schemaLocation attribute
+ for javaee namespace with the following location:</p>
+
+ <p>http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+
+
+<!-- **************************************************** -->
+
+ <xsd:element name="faces-config"
+ type="javaee:faces-configType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The "faces-config" element is the root of the configuration
+ information hierarchy, and contains nested elements for all
+ of the other configuration settings.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:unique name="faces-config-behavior-ID-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>Behavior IDs must be unique within a document.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:behavior"/>
+ <xsd:field xpath="javaee:behavior-id"/>
+ </xsd:unique>
+ <xsd:unique name="faces-config-converter-ID-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>Converter IDs must be unique within a document.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:converter"/>
+ <xsd:field xpath="javaee:converter-id"/>
+ </xsd:unique>
+ <xsd:unique name="faces-config-converter-for-class-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>'converter-for-class' element values must be unique
+ within a document.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:converter"/>
+ <xsd:field xpath="javaee:converter-for-class"/>
+ </xsd:unique>
+ <xsd:unique name="faces-config-validator-ID-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Validator IDs must be unique within a document.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:validator"/>
+ <xsd:field xpath="javaee:validator-id"/>
+ </xsd:unique>
+ <xsd:unique name="faces-config-managed-bean-name-uniqueness">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Managed bean names must be unique within a document.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:selector xpath="javaee:managed-bean"/>
+ <xsd:field xpath="javaee:managed-bean-name"/>
+ </xsd:unique>
+ </xsd:element>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-configType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "faces-config" element is the root of the configuration
+ information hierarchy, and contains nested elements for all
+ of the other configuration settings.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="application"
+ type="javaee:faces-config-applicationType"/>
+ <xsd:element name="ordering"
+ type="javaee:faces-config-orderingType"/>
+ <xsd:element name="absolute-ordering"
+ type="javaee:faces-config-absoluteOrderingType"
+ minOccurs="0"
+ />
+ <xsd:element name="factory"
+ type="javaee:faces-config-factoryType"/>
+ <xsd:element name="component"
+ type="javaee:faces-config-componentType"/>
+ <xsd:element name="converter"
+ type="javaee:faces-config-converterType"/>
+ <xsd:element name="managed-bean"
+ type="javaee:faces-config-managed-beanType"/>
+ <xsd:element name="flow-definition"
+ type="javaee:faces-config-flow-definitionType"/>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> <span class="changed_modified_2_2">The</span> "name" element
+ within the top level "faces-config"
+ element declares the name of this application
+ configuration resource. Such names are used
+ in the document ordering scheme specified in section
+ JSF.11.4.6.</p>
+
+ <p class="changed_added_2_2">This value is taken to be the
+ defining document id of any <flow-definition> elements
+ defined in this Application Configuration Resource file. If this
+ element is not specified, the runtime must take the empty string
+ as its value.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="navigation-rule"
+ type="javaee:faces-config-navigation-ruleType"/>
+ <xsd:element name="protected-views"
+ type="javaee:faces-config-protected-viewsType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="referenced-bean"
+ type="javaee:faces-config-referenced-beanType"/>
+ <xsd:element name="render-kit"
+ type="javaee:faces-config-render-kitType"/>
+ <xsd:element name="lifecycle"
+ type="javaee:faces-config-lifecycleType"/>
+ <xsd:element name="validator"
+ type="javaee:faces-config-validatorType"/>
+ <xsd:element name="behavior"
+ type="javaee:faces-config-behaviorType"/>
+ <xsd:element name="faces-config-extension"
+ type="javaee:faces-config-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:choice>
+ <xsd:attribute name="metadata-complete"
+ type="xsd:boolean"
+ use="optional">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ The metadata-complete attribute defines whether this
+ JavaServer Faces application is complete, or whether
+ the class files available to this module and packaged with
+ this application should be examined for annotations
+ that specify configuration information.
+
+ This attribute is only inspected on the application
+ configuration resource file located at "WEB-INF/faces-config.xml".
+ The presence of this attribute on any application configuration
+ resource other than the one located at "WEB-INF/faces-config.xml",
+ including any files named using the javax.faces.CONFIG_FILES
+ attribute, must be ignored.
+
+ If metadata-complete is set to "true", the JavaServer Faces
+ runtime must ignore any annotations that specify configuration
+ information, which might be present in the class files
+ of the application.
+
+ If metadata-complete is not specified or is set to
+ "false", the JavaServer Faces runtime must examine the class
+ files of the application for annotations, as specified by
+ the specification.
+
+ If "WEB-INF/faces-config.xml" is not present, the JavaServer
+ Faces runtime will assume metadata-complete to be "false".
+
+ The value of this attribute will have no impact on
+ runtime annotations such as @ResourceDependency or
+ @ListenerFor.
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ <xsd:attribute name="version"
+ type="javaee:faces-config-versionType"
+ use="required"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for faces-config. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-orderingType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Please see section JSF.11.4.6 for the specification of this element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="after"
+ type="javaee:faces-config-ordering-orderingType"
+ minOccurs="0"
+ />
+ <xsd:element name="before"
+ type="javaee:faces-config-ordering-orderingType"
+ minOccurs="0"
+ />
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-ordering-orderingType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> This element contains a sequence of "id" elements, each of which
+ refers to an application configuration resource by the "id"
+ declared on its faces-config element. This element can also contain
+ a single "others" element which specifies that this document comes
+ before or after other documents within the application.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="others"
+ type="javaee:faces-config-ordering-othersType"
+ minOccurs="0"
+ />
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-ordering-othersType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> This element indicates that the ordering sub-element in which
+ it was placed should take special action regarding the ordering
+ of this application resource relative to other
+ application configuration resources. See section JSF.11.4.6
+ for the complete specification.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-absoluteOrderingType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Only relevant if this is placed within the /WEB-INF/faces-config.xml.
+ Please see section JSF.11.4.6 for the specification for details.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="others"
+ type="javaee:faces-config-ordering-othersType"
+ minOccurs="0"
+ />
+ </xsd:choice>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-applicationType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "application" element provides a mechanism to define the
+ various per-application-singleton implementation artifacts for
+ a particular web application that is utilizing
+ JavaServer Faces. For nested elements that are not specified,
+ the JSF implementation must provide a suitable default.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="action-listener"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "action-listener" element contains the fully
+ qualified class name of the concrete
+ ActionListener implementation class that will be
+ called during the Invoke Application phase of the
+ request processing lifecycle.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="default-render-kit-id"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "default-render-kit-id" element allows the
+ application to define a renderkit to be used other
+ than the standard one.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="message-bundle"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The base name of a resource bundle representing
+ the message resources for this application. See
+ the JavaDocs for the "java.util.ResourceBundle"
+ class for more information on the syntax of
+ resource bundle names.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="navigation-handler"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "navigation-handler" element contains the
+ fully qualified class name of the concrete
+ NavigationHandler implementation class that will
+ be called during the Invoke Application phase
+ of the request processing lifecycle, if the
+ default ActionListener (provided by the JSF
+ implementation) is used.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="view-handler"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "view-handler" element contains the fully
+ qualified class name of the concrete ViewHandler
+ implementation class that will be called during
+ the Restore View and Render Response phases of the
+ request processing lifecycle. The faces
+ implementation must provide a default
+ implementation of this class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="state-manager"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "state-manager" element contains the fully
+ qualified class name of the concrete StateManager
+ implementation class that will be called during
+ the Restore View and Render Response phases of the
+ request processing lifecycle. The faces
+ implementation must provide a default
+ implementation of this class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="el-resolver"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "el-resolver" element contains the fully
+ qualified class name of the concrete
+ javax.el.ELResolver implementation class
+ that will be used during the processing of
+ EL expressions.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property-resolver"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property-resolver" element contains the fully
+ qualified class name of the concrete
+ PropertyResolver implementation class that will
+ be used during the processing of value binding
+ expressions.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="variable-resolver"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "variable-resolver" element contains the fully
+ qualified class name of the concrete
+ VariableResolver implementation class that will
+ be used during the processing of value binding
+ expressions.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-handler"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "resource-handler" element contains the
+ fully qualified class name of the concrete
+ ResourceHandler implementation class that
+ will be used during rendering and decoding
+ of resource requests The standard
+ constructor based decorator pattern used for
+ other application singletons will be
+ honored.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="resource-library-contracts"
+ type="javaee:faces-config-application-resource-library-contractsType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The "resource-library-contracts" element
+ specifies the mappings between views in the application and resource
+ library contracts that, if present in the application, must be made
+ available for use as templates of the specified views.
+ </p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="system-event-listener"
+ type="javaee:faces-config-system-event-listenerType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="locale-config"
+ type="javaee:faces-config-locale-configType"/>
+ <xsd:element name="resource-bundle"
+ type="javaee:faces-config-application-resource-bundleType"/>
+ <xsd:element name="application-extension"
+ type="javaee:faces-config-application-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="default-validators"
+ type="javaee:faces-config-default-validatorsType"/>
+ </xsd:choice>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-application-resource-bundleType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The resource-bundle element inside the application element
+ references a java.util.ResourceBundle instance by name
+ using the var element. ResourceBundles referenced in this
+ manner may be returned by a call to
+ Application.getResourceBundle() passing the current
+ FacesContext for this request and the value of the var
+ element below.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="base-name"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The fully qualified class name of the
+ java.util.ResourceBundle instance.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="var"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The name by which this ResourceBundle instance
+ is retrieved by a call to
+ Application.getResourceBundle().</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-application-resource-library-contractsType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The "resource-library-contracts" element
+ specifies the mappings between views in the application and resource
+ library contracts that, if present in the application, must be made
+ available for use as templates of the specified views.
+ </p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="contract-mapping"
+ type="javaee:faces-config-application-resource-library-contracts-contract-mappingType"
+
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p classes="changed_added_2_2">Declare a mapping between a collection
+ of views in the application and the list of contracts (if present in the application)
+ that may be used as a source for templates and resources for those views.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-application-resource-library-contracts-contract-mappingType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The "contract-mapping" element
+ specifies the mappings between a collection of views in the application and resource
+ library contracts that, if present in the application, must be made
+ available for use as templates of the specified views.
+ </p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="url-pattern"
+ type="javaee:url-patternType"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The "url-pattern" element
+ specifies the collection of views in this application that
+ are allowed to use the corresponding contracts.
+ </p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="contracts"
+ type="javaee:string"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The "contracts" element
+ is a comma separated list of resource library contracts that,
+ if available to the application, may be used by the views
+ matched by the corresponding "url-pattern"
+ </p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-application-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for application. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-factoryType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "factory" element provides a mechanism to define the
+ various Factories that comprise parts of the implementation
+ of JavaServer Faces. For nested elements that are not
+ specified, the JSF implementation must provide a suitable
+ default.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="application-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "application-factory" element contains the
+ fully qualified class name of the concrete
+ ApplicationFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(APPLICATION_FACTORY) is
+ called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="exception-handler-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "exception-handler-factory" element contains the
+ fully qualified class name of the concrete
+ ExceptionHandlerFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(EXCEPTION_HANDLER_FACTORY)
+ is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="external-context-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "external-context-factory" element contains the
+ fully qualified class name of the concrete
+ ExternalContextFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(EXTERNAL_CONTEXT_FACTORY)
+ is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="faces-context-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "faces-context-factory" element contains the
+ fully qualified class name of the concrete
+ FacesContextFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(FACES_CONTEXT_FACTORY)
+ is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="facelet-cache-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "facelet-cache-factory" element contains the
+ fully qualified class name of the concrete
+ FaceletCacheFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(FACELET_CACHE_FACTORY)
+ is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="partial-view-context-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "partial-view-context-factory" element contains the
+ fully qualified class name of the concrete
+ PartialViewContextFactory implementation class that will
+ be called when FactoryFinder.getFactory
+ (FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY) is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="lifecycle-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "lifecycle-factory" element contains the fully
+ qualified class name of the concrete LifecycleFactory
+ implementation class that will be called when
+ FactoryFinder.getFactory(LIFECYCLE_FACTORY) is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="view-declaration-language-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "view-declaration-language-factory" element contains
+ the fully qualified class name of the concrete
+ ViewDeclarationLanguageFactory
+ implementation class that will be called when
+ FactoryFinder.getFactory(VIEW_DECLARATION_FACTORY) is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="tag-handler-delegate-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "tag-handler-delegate-factory" element contains
+ the fully qualified class name of the concrete
+ ViewDeclarationLanguageFactory
+ implementation class that will be called when
+ FactoryFinder.getFactory(TAG_HANDLER_DELEGATE_FACTORY) is called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="render-kit-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "render-kit-factory" element contains the fully
+ qualified class name of the concrete RenderKitFactory
+ implementation class that will be called when
+ FactoryFinder.getFactory(RENDER_KIT_FACTORY) is
+ called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="visit-context-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "visit-context-factory" element contains the fully
+ qualified class name of the concrete VisitContextFactory
+ implementation class that will be called when
+ FactoryFinder.getFactory(VISIT_CONTEXT_FACTORY) is
+ called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="flash-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "flash-factory" element contains the
+ fully qualified class name of the concrete
+ FaceletFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(FLASH_FACTORY) is
+ called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="flow-handler-factory"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "flow-handler-factory" element contains the
+ fully qualified class name of the concrete
+ FlowHandlerFactory implementation class that will
+ be called when
+ FactoryFinder.getFactory(FLOW_HANDLER_FACTORY) is
+ called.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="factory-extension"
+ type="javaee:faces-config-factory-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:choice>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-factory-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for factory. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-attributeType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "attribute" element represents a named, typed, value
+ associated with the parent UIComponent via the generic
+ attributes mechanism.</p>
+
+ <p>Attribute names must be unique within the scope of the parent
+ (or related) component.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="attribute-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "attribute-name" element represents the name under
+ which the corresponding value will be stored, in the
+ generic attributes of the UIComponent we are related
+ to.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="attribute-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "attribute-class" element represents the Java type
+ of the value associated with this attribute name.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="default-value"
+ type="javaee:faces-config-default-valueType"
+ minOccurs="0"/>
+ <xsd:element name="suggested-value"
+ type="javaee:faces-config-suggested-valueType"
+ minOccurs="0"/>
+ <xsd:element name="attribute-extension"
+ type="javaee:faces-config-attribute-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-attribute-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for attribute. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-componentType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "component" element represents a concrete UIComponent
+ implementation class that should be registered under the
+ specified type identifier, along with its associated
+ properties and attributes. Component types must be unique
+ within the entire web application.</p>
+
+ <p>Nested "attribute" elements identify generic attributes that
+ are recognized by the implementation logic of this component.
+ Nested "property" elements identify JavaBeans properties of
+ the component class that may be exposed for manipulation
+ via tools.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="component-type"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "component-type" element represents the name under
+ which the corresponding UIComponent class should be
+ registered.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="component-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "component-class" element represents the fully
+ qualified class name of a concrete UIComponent
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="facet"
+ type="javaee:faces-config-facetType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="attribute"
+ type="javaee:faces-config-attributeType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="property"
+ type="javaee:faces-config-propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="component-extension"
+ type="javaee:faces-config-component-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-component-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for component. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-default-localeType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "default-locale" element declares the default locale
+ for this application instance.</p>
+
+ <p>It must be specified as :language:[_:country:[_:variant:]]
+ without the colons, for example "ja_JP_SJIS". The
+ separators between the segments may be '-' or '_'.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-localeType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-default-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "default-value" contains the value for the property or
+ attribute in which this element resides. This value differs
+ from the "suggested-value" in that the property or attribute
+ must take the value, whereas in "suggested-value" taking the
+ value is optional.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:simpleType name="faces-config-el-expressionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> EL expressions present within a faces config file
+ must start with the character sequence of '#{' and
+ end with '}'.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="#\{.*\}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-facetType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Define the name and other design-time information for a facet
+ that is associated with a renderer or a component.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="facet-name"
+ type="javaee:java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "facet-name" element represents the facet name
+ under which a UIComponent will be added to its parent.
+ It must be of type "Identifier".</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="facet-extension"
+ type="javaee:faces-config-facet-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-facet-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for facet. It may contain implementation
+ specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-from-view-idType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p><span class="changed_modified_2_2">The</span>
+ value of from-view-id must contain one of the following
+ values:</p>
+
+ <ul>
+
+ <li><p>The exact match for a view identifier that is recognized
+ by the the ViewHandler implementation being used (such as
+ "/index.jsp" if you are using the default ViewHandler).</p></li>
+
+ <li><p class="changed_added_2_2">The exact match of a flow node id
+ in the current flow, or a flow id of another flow.</p></li>
+
+ <li><p> A proper prefix of a view identifier, plus a trailing
+ "*" character. This pattern indicates that all view
+ identifiers that match the portion of the pattern up to the
+ asterisk will match the surrounding rule. When more than one
+ match exists, the match with the longest pattern is selected.
+ </p></li>
+
+ <li><p>An "*" character, which means that this pattern applies
+ to all view identifiers. </p></li>
+
+ </ul>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-from-actionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "from-action" element contains an action reference
+ expression that must have been executed (by the default
+ ActionListener for handling application level events)
+ in order to select the navigation rule. If not specified,
+ this rule will be relevant no matter which action reference
+ was executed (or if no action reference was executed).</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-ifType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The "if" element defines a condition that must resolve
+ to true in order for the navigation case on which it is
+ defined to be matched, with the existing match criteria
+ (action method and outcome) as a prerequiste, if present.
+ The condition is defined declaratively using a value
+ expression in the body of this element. The expression is
+ evaluated at the time the navigation case is being matched.
+ If the "from-outcome" is omitted and this element is
+ present, the navigation handler will match a null outcome
+ and use the condition return value to determine if the
+ case should be considered a match.</p>
+
+<div class="changed_added_2_2">
+
+<p>When used in a <code><switch></code> within a flow, if the
+expresion returns <code>true</code>, the
+<code><from-outcome></code> sibling element's outcome is used as
+the id of the node in the flow graph to which control must be
+passed.</p>
+
+</div>
+
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-flow-definition-parameter-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"></p>
+
+<div class="changed_added_2_2">
+
+
+
+</div>
+
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-converterType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "converter" element represents a concrete Converter
+ implementation class that should be registered under the
+ specified converter identifier. Converter identifiers must
+ be unique within the entire web application.</p>
+
+ <p>Nested "attribute" elements identify generic attributes that
+ may be configured on the corresponding UIComponent in order
+ to affect the operation of the Converter. Nested "property"
+ elements identify JavaBeans properties of the Converter
+ implementation class that may be configured to affect the
+ operation of the Converter. "attribute" and "property"
+ elements are intended to allow component developers to
+ more completely describe their components to tools and users.
+ These elements have no required runtime semantics.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:choice>
+ <xsd:element name="converter-id"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "converter-id" element represents the
+ identifier under which the corresponding
+ Converter class should be registered.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="converter-for-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "converter-for-class" element represents the
+ fully qualified class name for which a Converter
+ class will be registered.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
+ <xsd:element name="converter-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "converter-class" element represents the fully
+ qualified class name of a concrete Converter
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="attribute"
+ type="javaee:faces-config-attributeType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "attribute" elements identify generic
+ attributes that may be configured on the
+ corresponding UIComponent in order to affect the
+ operation of the Converter. This attribute is
+ primarily for design-time tools and is not
+ specified to have any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:faces-config-propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "property" elements identify JavaBeans
+ properties of the Converter implementation class
+ that may be configured to affect the operation of
+ the Converter. This attribute is primarily for
+ design-time tools and is not specified to have
+ any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="converter-extension"
+ type="javaee:faces-config-converter-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-converter-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for converter. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-lifecycleType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "lifecycle" element provides a mechanism to specify
+ modifications to the behaviour of the default Lifecycle
+ implementation for this web application.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="phase-listener"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "phase-listener" element contains the fully
+ qualified class name of the concrete PhaseListener
+ implementation class that will be registered on
+ the Lifecycle.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="lifecycle-extension"
+ type="javaee:faces-config-lifecycle-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-lifecycle-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for lifecycle. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="faces-config-localeType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The localeType defines valid locale defined by ISO-639-1
+ and ISO-3166.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="([a-z]{2})[_|\-]?([\p{L}]{2})?[_|\-]?(\w+)?"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-locale-configType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "locale-config" element allows the app developer to
+ declare the supported locales for this application.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="default-locale"
+ type="javaee:faces-config-default-localeType"
+ minOccurs="0"/>
+ <xsd:element name="supported-locale"
+ type="javaee:faces-config-supported-localeType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-default-validatorsType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "default-validators" element allows the app developer to
+ register a set of validators, referenced by identifier, that
+ are automatically assigned to any EditableValueHolder component
+ in the application, unless overridden or disabled locally.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="validator-id"
+ type="javaee:string"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "validator-id" element represents the identifier
+ of a registered validator.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-managed-beanType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "managed-bean" element represents a JavaBean, of a
+ particular class, that will be dynamically instantiated
+ at runtime (by the default VariableResolver implementation)
+ if it is referenced as the first element of a value binding
+ expression, and no corresponding bean can be identified in
+ any scope. In addition to the creation of the managed bean,
+ and the optional storing of it into the specified scope,
+ the nested managed-property elements can be used to
+ initialize the contents of settable JavaBeans properties of
+ the created instance.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="managed-bean-name"
+ type="javaee:java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "managed-bean-name" element represents the
+ attribute name under which a managed bean will
+ be searched for, as well as stored (unless the
+ "managed-bean-scope" value is "none").</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="managed-bean-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "managed-bean-class" element represents the fully
+ qualified class name of the Java class that will be
+ used`to instantiate a new instance if creation of the
+ specified`managed bean is requested.</p>
+
+ <p>The specified class must conform to standard JavaBeans
+ conventions. In particular, it must have a public
+ zero-arguments constructor, and zero or more public
+ property setters.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="managed-bean-scope"
+ type="javaee:faces-config-managed-bean-scopeOrNoneType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "managed-bean-scope" element represents the scope
+ into which a newly created instance of the specified
+ managed bean will be stored (unless the value is
+ "none").</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:choice>
+ <xsd:element name="managed-property"
+ type="javaee:faces-config-managed-propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="map-entries"
+ type="javaee:faces-config-map-entriesType"/>
+ <xsd:element name="list-entries"
+ type="javaee:faces-config-list-entriesType"/>
+ </xsd:choice>
+ <xsd:element name="managed-bean-extension"
+ type="javaee:faces-config-managed-bean-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="eager"
+ type="xsd:boolean"
+ use="optional">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> This attribute is only considered when associated with
+ an application-scoped managed bean. If the value of the eager
+ attribute is true the runtime must instantiate this class
+ and store the instance within the application scope when the
+ application starts.</p>
+
+ <p>If eager is unspecified or is false, the default "lazy"
+ instantiation and scoped storage of the managed bean
+ will occur.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-flow-definitionType">
+ <xsd:annotation>
+ <xsd:documentation>
+<![CDATA[
+
+ <p class="changed_added_2_2">Top level element for a flow
+ definition.</p>
+
+<div class="changed_added_2_2">
+
+<p>If there is no <code><start-node></code> element declared, it
+is assumed to be <code><flowName>.xhtml</code>.</p>
+
+</div>
+
+]]>
+</xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="start-node"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Declare the id of the starting node in the
+flow graph. The start node may be any of the node types mentioned in
+the class javadocs for <code><a target="_"
+href="javax/faces/flow/FlowHandler.html">FlowHandler</a></code>.</p>
+
+]]>
+
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="view"
+ type="javaee:faces-config-flow-definition-viewType"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="switch"
+ type="javaee:faces-config-flow-definition-switchType"
+ minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="flow-return"
+ type="javaee:faces-config-flow-definition-flow-returnType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="navigation-rule"
+ type="javaee:faces-config-navigation-ruleType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="flow-call"
+ type="javaee:faces-config-flow-definition-flow-callType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="method-call"
+ type="javaee:faces-config-flow-definition-faces-method-callType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="initializer"
+ type="javaee:faces-config-flow-definition-initializerType"
+ minOccurs="0"
+ />
+ <xsd:element name="finalizer"
+ type="javaee:faces-config-flow-definition-finalizerType"
+ minOccurs="0"
+ />
+ <xsd:element name="inbound-parameter"
+ type="javaee:faces-config-flow-definition-inbound-parameterType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">The id of this flow. The id
+ must be unique within the Application configuration Resource
+ file in which this flow is defined. The value of this attribute,
+ combined with the value of the <faces-config><name> element
+ must globally identify the flow within the application.<p> ]]>
+
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-faces-method-callType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
+
+ <p class="changed_added_2_2">Invoke a method, passing parameters if necessary.
+ The return from the method is used as the outcome for where to go next in the
+ flow. If the method is a void method, the default outcome is used.<p> ]]>
+
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="method"
+ type="javaee:faces-config-flow-definition-faces-method-call-methodType"
+
+ />
+ <xsd:element name="default-outcome"
+ type="javaee:string"
+
+ />
+ <xsd:element name="parameter"
+ type="javaee:faces-config-flow-definition-flow-call-parameterType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A parameter to pass when calling the method
+ identified in the "method" element that is a sibling of this element.<p>
+
+ ]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-faces-method-call-methodType">
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-flow-call-parameterType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A parameter to pass when calling the method
+ identified in the "method" element that is a sibling of this element.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="class"
+ type="javaee:string"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The optional "class" element within a "parameter" element
+ will be interpreted as the fully qualified class name for the type
+ of the "value" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:faces-config-flow-definition-parameter-valueType"
+
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "value" element within an "parameter"
+ must be a literal string or an EL Expression whose "get" will be called when the "method"
+ associated with this element is invoked.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="faces-config-flow-definition-viewType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Define a view node in a flow graph.</p>
+
+<p>This element must contain exactly one
+<code><vdl-document></code> element.</p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="vdl-document"
+ type="javaee:java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">Define the vdl-document for the enclosing view.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+<![CDATA[
+
+ <p class="changed_added_2_2">The id of this view. It must be
+ unique within the flow.</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-switchType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Define a switch node in a flow graph.</p>
+
+<div class="changed_added_2_2">
+
+<p>This element must contain one or more
+<code><case></code> elements. When control passes to the
+<code><switch></code> node, each of the cases must be considered
+in order and control must past to the <code><from-outcome></code>
+of the first one whose <code><if></code> expression evaluates to
+<code>true</code>.</p>
+
+</div>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="case"
+ type="javaee:faces-config-flow-definition-switch-caseType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">Defines a case that must be
+ considered in the list of cases in the
+ <code><switch></code>.</p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="default-outcome"
+ type="javaee:string"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">Defines the default case that will
+ be taken if none of the other cases in the
+ <code><switch></code> are taken.</p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+<![CDATA[
+
+ <p class="changed_added_2_2">The id of this switch. It must be
+ unique within the flow.</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-switch-caseType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">Defines a case that will
+ be considered in the <code><switch></code>.</p>
+
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="if"
+ type="javaee:faces-config-ifType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">If this EL expression evaluates to
+ <code>true</code>, the corresponding <code>from-outcome</code> will
+ be the outcome taken by the enclosing <code><switch></code></p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="from-outcome"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The "from-outcome" element contains a logical outcome
+ string returned by the execution of an application
+ action method selected via an "actionRef" property
+ (or a literal value specified by an "action" property)
+ of a UICommand component. If specified, this rule
+ will be relevant only if the outcome value matches
+ this element's value. If not specified, this rule
+ will be relevant if the outcome value is non-null
+ or, if the "if" element is present, will be relevant
+ for any outcome value, with the assumption that the
+ condition specified in the "if" element ultimately
+ determines if this rule is a match.</p>
+
+<p class="changed_added_2_2">If used in a faces flow, this element
+represents the node id to which control will be passed.</p>
+
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID">
+ </xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-flow-returnType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Define a return node in a flow graph.</p>
+
+<div class="changed_added_2_2">
+
+<p>This element must contain exactly one <code><from-outcome></code> element.</p>
+</div>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="from-outcome"
+ type="javaee:string"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+<p class="changed_added_2_2">This element
+represents the node id to which control will be passed.</p>
+
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+
+ <xsd:attribute name="id"
+ type="xsd:ID"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+<![CDATA[
+
+ <p class="changed_added_2_2">The id of this flow-return.</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-flow-callType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Define a call node in a flow graph.</p>
+
+<div class="changed_added_2_2">
+
+<p>This element must contain exactly one <code><flow-reference></code> element,
+which must contain exactly one <code><flow-id></code> element.</p>
+</div>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:sequence>
+ <xsd:element name="flow-reference"
+ type="javaee:faces-config-flow-definition-flow-call-flow-referenceType"
+ >
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">The flow id of the called flow.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="outbound-parameter"
+ type="javaee:faces-config-flow-definition-flow-call-outbound-parameterType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A parameter to pass when calling the flow
+ identified in the "flow-reference" element that is a sibling of this element.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+
+ <xsd:attribute name="id"
+ type="xsd:ID"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+<![CDATA[
+
+ <p class="changed_added_2_2">The id of this flow-return.</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-flow-call-flow-referenceType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+<p class="changed_added_2_2">Identifiy the called flow.</p>
+
+<div class="changed_added_2_2">
+
+</div>
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="flow-document-id"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The document id of the called flow.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ <xsd:element name="flow-id"
+ type="javaee:java-identifierType"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The id of the called flow.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-initializerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A <code>MethodExpression</code> that will be invoked when the flow is entered.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-finalizerType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A <code>MethodExpression</code> that will be invoked when the flow is exited.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-el-expressionType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-inbound-parameterType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A named parameter whose value will be populated
+ with a correspondingly named parameter within an "outbound-parameter" element.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "name" element within an "inbound-parameter"
+ element declares the name of this parameter
+ to be passed into a flow. There must be
+ a sibling "value" element in the same parent as this element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:faces-config-flow-definition-parameter-valueType"
+
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "value" element within an "inbound-parameter"
+ must be an EL Expression whose value will be set with the correspondingly
+ named "outbound-parameter" when this flow is entered, if such a
+ parameter exists.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="faces-config-flow-definition-flow-call-outbound-parameterType">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ <![CDATA[
+
+ <p class="changed_added_2_2">A named parameter whose value will be
+ passed to a correspondingly named parameter within an "inbound-parameter" element
+ on the target flow.<p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:java-identifierType"
+
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "name" element within an "outbound-parameter" element
+ declares the name of this parameter to be passed out of a flow. There must be
+ a sibling "value" element in the same parent as this element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="value"
+ type="javaee:faces-config-flow-definition-parameter-valueType"
+
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2"> The "value" element within an "outbound-parameter"
+ must be a literal string or an EL Expression whose "get" will be called when the "flow-call"
+ containing this element is traversed to go to a new flow.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-managed-bean-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for managed-bean. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-managed-bean-scopeOrNoneType">
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[[
+
+ <p> Defines the legal values for the <managed-bean-scope>
+ element's body content, which includes all of the scopes
+ normally used in a web application, plus the "none" value
+ indicating that a created bean should not be stored into
+ any scope. Alternatively, an EL expression may be used
+ as the value of this element. The result of evaluating this
+ expression must by of type java.util.Map.</p>
+
+ ]]>
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string">
+ <xsd:pattern value="view|request|session|application|none|#\{.*\}"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-managed-propertyType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "managed-property" element represents an individual
+ property of a managed bean that will be configured to the
+ specified value (or value set) if the corresponding
+ managed bean is automatically created.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="property-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property-name" element represents the JavaBeans
+ property name under which the corresponding value may
+ be stored.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property-class"
+ type="javaee:java-typeType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property-class" element represents the Java type
+ of the value associated with this property name.
+ If not specified, it can be inferred from existing
+ classes; however, this element should be specified
+ if the configuration file is going to be the source
+ for generating the corresponding classes.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:choice>
+ <xsd:element name="map-entries"
+ type="javaee:faces-config-map-entriesType"/>
+ <xsd:element name="null-value"
+ type="javaee:faces-config-null-valueType"/>
+ <xsd:element name="value"
+ type="javaee:faces-config-valueType"/>
+ <xsd:element name="list-entries"
+ type="javaee:faces-config-list-entriesType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-map-entryType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "map-entry" element reprsents a single key-entry pair
+ that will be added to the computed value of a managed
+ property of type java.util.Map.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="key"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "key" element is the String representation of a
+ map key that will be stored in a managed property of
+ type java.util.Map.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:choice>
+ <xsd:element name="null-value"
+ type="javaee:faces-config-null-valueType"/>
+ <xsd:element name="value"
+ type="javaee:faces-config-valueType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-map-entriesType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "map-entries' element represents a set of key-entry pairs
+ that will be added to the computed value of a managed property
+ of type java.util.Map. In addition, the Java class types
+ of the key and entry values may be optionally declared.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="key-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "key-class" element defines the Java type to which
+ each "key" element in a set of "map-entry" elements
+ will be converted to. If omitted, "java.lang.String"
+ is assumed.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="value-class"
+ type="javaee:faces-config-value-classType"
+ minOccurs="0"/>
+ <xsd:element name="map-entry"
+ type="javaee:faces-config-map-entryType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-navigation-caseType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> <span class="changed_modified_2_2">The</span>
+ "navigation-case" element describes a particular
+ combination of conditions that must match for this case to
+ be executed, and the view id of the component tree that
+ should be selected next.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="from-action"
+ type="javaee:faces-config-from-actionType"
+ minOccurs="0"/>
+ <xsd:element name="from-outcome"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p>The "from-outcome" element contains a logical outcome
+ string returned by the execution of an application
+ action method selected via an "actionRef" property
+ (or a literal value specified by an "action" property)
+ of a UICommand component. If specified, this rule
+ will be relevant only if the outcome value matches
+ this element's value. If not specified, this rule
+ will be relevant if the outcome value is non-null
+ or, if the "if" element is present, will be relevant
+ for any outcome value, with the assumption that the
+ condition specified in the "if" element ultimately
+ determines if this rule is a match.</p>
+
+]]>
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="if"
+ type="javaee:faces-config-ifType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Please see section JSF.7.4.2 for the specification of this element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="to-view-id"
+ type="javaee:faces-config-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p><span class="changed_modified_2_2">The "to-view-id" element
+ contains the view identifier (<span class="changed_added_2_2">or
+ flow node id, or flow id</span>)
+ of the next view (<span class="changed_added_2_2">or flow node or
+ flow</span>) that should be displayed if this
+ navigation rule is matched. If the contents is a
+ value expression, it should be resolved by the
+ navigation handler to obtain the view (
+ <span class="changed_added_2_2">or flow node or flow</span>)
+ identifier.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="to-flow-document-id"
+ type="javaee:java-identifierType"
+ minOccurs="0"
+ >
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">The document id of the called flow.
+ If this element appears in a <navigation-case> nested within
+ a <flow-definition>, it must be ignored because navigation
+ cases within flows may only navigate among the view nodes of that
+ flow.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="redirect"
+ type="javaee:faces-config-redirectType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-navigation-ruleType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "navigation-rule" element represents an individual
+ decision rule that will be utilized by the default
+ NavigationHandler implementation to make decisions on
+ what view should be displayed next, based on the
+ view id being processed.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="from-view-id"
+ type="javaee:faces-config-from-view-idType"
+ />
+ <xsd:element name="navigation-case"
+ type="javaee:faces-config-navigation-caseType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="navigation-rule-extension"
+ type="javaee:faces-config-navigation-rule-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-navigation-rule-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for navigation-rule. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-null-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "null-value" element indicates that the managed
+ property in which we are nested will be explicitly
+ set to null if our managed bean is automatically
+ created. This is different from omitting the managed
+ property element entirely, which will cause no
+ property setter to be called for this property.</p>
+
+ <p>The "null-value" element can only be used when the
+ associated "property-class" identifies a Java class,
+ not a Java primitive.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-propertyType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property" element represents a JavaBean property of the
+ Java class represented by our parent element.</p>
+
+ <p>Property names must be unique within the scope of the Java
+ class that is represented by the parent element, and must
+ correspond to property names that will be recognized when
+ performing introspection against that class via
+ java.beans.Introspector.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="property-name"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property-name" element represents the JavaBeans
+ property name under which the corresponding value
+ may be stored.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property-class"
+ type="javaee:java-typeType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "property-class" element represents the Java type
+ of the value associated with this property name.
+ If not specified, it can be inferred from existing
+ classes; however, this element should be specified if
+ the configuration file is going to be the source for
+ generating the corresponding classes.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="default-value"
+ type="javaee:faces-config-default-valueType"
+ minOccurs="0"/>
+ <xsd:element name="suggested-value"
+ type="javaee:faces-config-suggested-valueType"
+ minOccurs="0"/>
+ <xsd:element name="property-extension"
+ type="javaee:faces-config-property-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-protected-viewsType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p class="changed_added_2_2">Any view that matches any of the
+ url-patterns in this element may only be reached from another JSF
+ view in the same web application. Because the runtime is aware of
+ which views are protected, any navigation from an unprotected
+ view to a protected view is automatically subject to
+ protection.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="url-pattern"
+ type="javaee:url-patternType"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-property-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for property. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-redirectType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "redirect" element indicates that navigation to the
+ specified "to-view-id" should be accomplished by
+ performing an HTTP redirect rather than the usual
+ ViewHandler mechanisms.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="redirect-param"
+ type="javaee:faces-config-redirect-redirectParamType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ <xsd:attribute name="include-view-params"
+ type="xsd:boolean"
+ use="optional"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-redirect-viewParamType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> This element was introduced due to a specification
+ error, and is now deprecated. The correct name for
+ this element is "redirect-param" and its meaning is
+ documented therein. The "view-param" element is
+ maintained to preserve backwards compatibility.
+ Implementations must treat this element the same as
+ "redirect-param".</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:string"
+
+ />
+ <xsd:element name="value"
+ type="javaee:string"
+
+ />
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-redirect-redirectParamType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "redirect-param" element, only valid within
+ a "redirect" element, contains child "name"
+ and "value" elements that must be included in the
+ redirect url when the redirect is performed.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="name"
+ type="javaee:string"
+
+ />
+ <xsd:element name="value"
+ type="javaee:string"
+
+ />
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-referenced-beanType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "referenced-bean" element represents at design time the
+ promise that a Java object of the specified type will exist at
+ runtime in some scope, under the specified key. This can be
+ used by design time tools to construct user interface dialogs
+ based on the properties of the specified class. The presence
+ or absence of a referenced bean element has no impact on the
+ JavaServer Faces runtime environment inside a web application.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="referenced-bean-name"
+ type="javaee:java-identifierType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "referenced-bean-name" element represents the
+ attribute name under which the corresponding
+ referenced bean may be assumed to be stored, in one
+ of 'request', 'session', 'view', 'application'
+ or a custom scope.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="referenced-bean-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "referenced-bean-class" element represents the
+ fully qualified class name of the Java class
+ (either abstract or concrete) or Java interface
+ implemented by the corresponding referenced bean.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-render-kitType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "render-kit" element represents a concrete RenderKit
+ implementation that should be registered under the specified
+ render-kit-id. If no render-kit-id is specified, the
+ identifier of the default RenderKit
+ (RenderKitFactory.DEFAULT_RENDER_KIT) is assumed.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="render-kit-id"
+ type="javaee:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "render-kit-id" element represents an identifier
+ for the RenderKit represented by the parent
+ "render-kit" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="render-kit-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "render-kit-class" element represents the fully
+ qualified class name of a concrete RenderKit
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="renderer"
+ type="javaee:faces-config-rendererType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="client-behavior-renderer"
+ type="javaee:faces-config-client-behavior-rendererType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="render-kit-extension"
+ type="javaee:faces-config-render-kit-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-client-behavior-rendererType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "client-behavior-renderer" element represents a concrete
+ ClientBehaviorRenderer implementation class that should be
+ registered under the specified behavior renderer type identifier,
+ in the RenderKit associated with the parent "render-kit"
+ element. Client Behavior renderer type must be unique within the RenderKit
+ associated with the parent "render-kit" element.</p>
+
+ <p>Nested "attribute" elements identify generic component
+ attributes that are recognized by this renderer.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="client-behavior-renderer-type"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "client-behavior-renderer-type" element represents a renderer type
+ identifier for the Client Behavior Renderer represented by the parent
+ "client-behavior-renderer" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="client-behavior-renderer-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "client-behavior-renderer-class" element represents the fully
+ qualified class name of a concrete Client Behavior Renderer
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-rendererType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "renderer" element represents a concrete Renderer
+ implementation class that should be registered under the
+ specified component family and renderer type identifiers,
+ in the RenderKit associated with the parent "render-kit"
+ element. Combinations of component family and
+ renderer type must be unique within the RenderKit
+ associated with the parent "render-kit" element.</p>
+
+ <p>Nested "attribute" elements identify generic component
+ attributes that are recognized by this renderer.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="component-family"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "component-family" element represents the
+ component family for which the Renderer represented
+ by the parent "renderer" element will be used.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="renderer-type"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "renderer-type" element represents a renderer type
+ identifier for the Renderer represented by the parent
+ "renderer" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="renderer-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "renderer-class" element represents the fully
+ qualified class name of a concrete Renderer
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="facet"
+ type="javaee:faces-config-facetType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="attribute"
+ type="javaee:faces-config-attributeType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ <xsd:element name="renderer-extension"
+ type="javaee:faces-config-renderer-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-renderer-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for renderer. It may contain implementation
+ specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-render-kit-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for render-kit. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-suggested-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "suggested-value" contains the value for the property or
+ attribute in which this element resides. This value is
+ advisory only and is intended for tools to use when
+ populating pallettes.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-supported-localeType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "supported-locale" element allows authors to declare
+ which locales are supported in this application instance.</p>
+
+ <p>It must be specified as :language:[_:country:[_:variant:]]
+ without the colons, for example "ja_JP_SJIS". The
+ separators between the segments may be '-' or '_'.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:extension base="javaee:faces-config-localeType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-behaviorType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "behavior" element represents a concrete Behavior
+ implementation class that should be registered under the
+ specified behavior identifier. Behavior identifiers must
+ be unique within the entire web application.</p>
+
+ <p>Nested "attribute" elements identify generic attributes that
+ may be configured on the corresponding UIComponent in order
+ to affect the operation of the Behavior. Nested "property"
+ elements identify JavaBeans properties of the Behavior
+ implementation class that may be configured to affect the
+ operation of the Behavior. "attribute" and "property"
+ elements are intended to allow component developers to
+ more completely describe their components to tools and users.
+ These elements have no required runtime semantics.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="behavior-id"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "behavior-id" element represents the identifier
+ under which the corresponding Behavior class should
+ be registered.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="behavior-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "behavior-class" element represents the fully
+ qualified class name of a concrete Behavior
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="attribute"
+ type="javaee:faces-config-attributeType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "attribute" elements identify generic
+ attributes that may be configured on the
+ corresponding UIComponent in order to affect the
+ operation of the Behavior. This attribute is
+ primarily for design-time tools and is not
+ specified to have any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:faces-config-propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "property" elements identify JavaBeans
+ properties of the Behavior implementation class
+ that may be configured to affect the operation of
+ the Behavior. This attribute is primarily for
+ design-time tools and is not specified to have
+ any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="behavior-extension"
+ type="javaee:faces-config-behavior-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-behavior-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for behavior. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-validatorType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "validator" element represents a concrete Validator
+ implementation class that should be registered under the
+ specified validator identifier. Validator identifiers must
+ be unique within the entire web application.</p>
+
+ <p>Nested "attribute" elements identify generic attributes that
+ may be configured on the corresponding UIComponent in order
+ to affect the operation of the Validator. Nested "property"
+ elements identify JavaBeans properties of the Validator
+ implementation class that may be configured to affect the
+ operation of the Validator. "attribute" and "property"
+ elements are intended to allow component developers to
+ more completely describe their components to tools and users.
+ These elements have no required runtime semantics.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:group ref="javaee:descriptionGroup"/>
+ <xsd:element name="validator-id"
+ type="javaee:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "validator-id" element represents the identifier
+ under which the corresponding Validator class should
+ be registered.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="validator-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "validator-class" element represents the fully
+ qualified class name of a concrete Validator
+ implementation class.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="attribute"
+ type="javaee:faces-config-attributeType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "attribute" elements identify generic
+ attributes that may be configured on the
+ corresponding UIComponent in order to affect the
+ operation of the Validator. This attribute is
+ primarily for design-time tools and is not
+ specified to have any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="property"
+ type="javaee:faces-config-propertyType"
+ minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Nested "property" elements identify JavaBeans
+ properties of the Validator implementation class
+ that may be configured to affect the operation of
+ the Validator. This attribute is primarily for
+ design-time tools and is not specified to have
+ any meaning at runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="validator-extension"
+ type="javaee:faces-config-validator-extensionType"
+ minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-validator-extensionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> Extension element for validator. It may contain
+ implementation specific content.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0"
+ maxOccurs="unbounded"
+ namespace="##any"
+ processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="faces-config-valueType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "value" element is the String representation of
+ a literal value to which a scalar managed property
+ will be set, or a value binding expression ("#{...}")
+ that will be used to calculate the required value.
+ It will be converted as specified for the actual
+ property type.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:union memberTypes="javaee:faces-config-el-expressionType xsd:string"/>
+ </xsd:simpleType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-value-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "value-class" element defines the Java type to which each
+ "value" element's value will be converted to, prior to adding
+ it to the "list-entries" list for a managed property that is
+ a java.util.List, or a "map-entries" map for a managed
+ property that is a java.util.Map.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleContent>
+ <xsd:restriction base="javaee:fully-qualified-classType">
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-list-entriesType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "list-entries" element represents a set of initialization
+ elements for a managed property that is a java.util.List or an
+ array. In the former case, the "value-class" element can
+ optionally be used to declare the Java type to which each
+ value should be converted before adding it to the Collection.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="value-class"
+ type="javaee:faces-config-value-classType"
+ minOccurs="0"/>
+ <xsd:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xsd:element name="null-value"
+ type="javaee:faces-config-null-valueType"/>
+ <xsd:element name="value"
+ type="javaee:faces-config-valueType"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+
+<!-- **************************************************** -->
+
+ <xsd:complexType name="faces-config-system-event-listenerType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The presence of this element within the "application" element in
+ an application configuration resource file indicates the
+ developer wants to add an SystemEventListener to this
+ application instance. Elements nested within this element allow
+ selecting the kinds of events that will be delivered to the
+ listener instance, and allow selecting the kinds of classes that
+ can be the source of events that are delivered to the listener
+ instance.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="system-event-listener-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "system-event-listener-class" element contains
+ the fully qualified class name of the concrete
+ SystemEventListener implementation class that will be
+ called when events of the type specified by the
+ "system-event-class" are sent by the runtime.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="system-event-class"
+ type="javaee:fully-qualified-classType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "system-event-class" element contains the fully
+ qualified class name of the SystemEvent subclass for
+ which events will be delivered to the class whose fully
+ qualified class name is given by the
+ "system-event-listener-class" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="source-class"
+ type="javaee:fully-qualified-classType"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> The "source-class" element, if present, contains the
+ fully qualified class name of the class that will be the
+ source for the event to be delivered to the class whose
+ fully qualified class name is given by the
+ "system-event-listener-class" element.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="id"
+ type="xsd:ID"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="faces-config-versionType">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ <p> This type contains the recognized versions of
+ faces-config supported.</p>
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="2.3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/FacesConfigIterator.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/FacesConfigIterator.java
index 62bf3d6..e2c26de 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/FacesConfigIterator.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/FacesConfigIterator.java
@@ -189,7 +189,9 @@
J2eePlatform j2eePlatform = ProjectUtil.getPlatform(project);
if (j2eePlatform != null) {
Set<Profile> serverProfiles = j2eePlatform.getSupportedProfiles();
- if (serverProfiles.contains(Profile.JAVA_EE_7_WEB) || serverProfiles.contains(Profile.JAVA_EE_7_FULL)) {
+ if (serverProfiles.contains(Profile.JAVA_EE_8_WEB) || serverProfiles.contains(Profile.JAVA_EE_8_FULL)) {
+ return JSFCatalog.RES_FACES_CONFIG_2_3;
+ } else if (serverProfiles.contains(Profile.JAVA_EE_7_WEB) || serverProfiles.contains(Profile.JAVA_EE_7_FULL)) {
return JSFCatalog.RES_FACES_CONFIG_2_2;
} else if (serverProfiles.contains(Profile.JAVA_EE_5) || serverProfiles.contains(Profile.JAVA_EE_6_WEB) || serverProfiles.contains(Profile.JAVA_EE_6_FULL)) {
return JSFCatalog.RES_FACES_CONFIG_2_1;
@@ -203,7 +205,7 @@
cpUrls.add(entry.getURL());
}
jsfVersion = JSFVersion.forClasspath(cpUrls);
- jsfVersion = jsfVersion == null ? JSFVersion.JSF_2_2 : jsfVersion;
+ jsfVersion = jsfVersion == null ? JSFVersion.JSF_2_3 : jsfVersion;
return facesConfigForVersion(jsfVersion);
}
}
@@ -214,6 +216,8 @@
private static String facesConfigForVersion(JSFVersion jsfVersion) {
switch (jsfVersion) {
+ case JSF_2_3:
+ return JSFCatalog.RES_FACES_CONFIG_2_3;
case JSF_2_2:
return JSFCatalog.RES_FACES_CONFIG_2_2;
case JSF_2_1:
diff --git a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.java b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.java
index c968b68..ba4c21e 100644
--- a/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.java
+++ b/enterprise/web.jsf/src/org/netbeans/modules/web/jsf/wizards/JSFConfigurationPanelVisual.java
@@ -1043,7 +1043,7 @@
private Profile getProfile() {
Properties properties = panel.getController().getProperties();
String j2eeLevel = (String)properties.getProperty("j2eeLevel"); // NOI18N
- return j2eeLevel == null ? Profile.JAVA_EE_7_FULL : Profile.fromPropertiesString(j2eeLevel);
+ return j2eeLevel == null ? Profile.JAVA_EE_8_FULL : Profile.fromPropertiesString(j2eeLevel);
}
void update() {
diff --git a/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/MavenWebProjectValidation.java b/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/MavenWebProjectValidation.java
index c64989e..4824291 100644
--- a/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/MavenWebProjectValidation.java
+++ b/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/MavenWebProjectValidation.java
@@ -70,7 +70,7 @@
@Override
protected String getEEVersion() {
- return JAVA_EE_7;
+ return JAVA_EE_8;
}
public void testNewMavenWebProject() throws IOException {
@@ -96,6 +96,8 @@
serverStep.cboJavaEEVersion().selectItem("1.6-web");
} else if (JAVA_EE_7.equals(getEEVersion())) {
serverStep.cboJavaEEVersion().selectItem("1.7-web");
+ } else if (JAVA_EE_8.equals(getEEVersion())) {
+ serverStep.cboJavaEEVersion().selectItem("1.8-web");
}
serverStep.finish();
// need to increase time to wait for project node
diff --git a/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/WebProjectValidation.java b/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/WebProjectValidation.java
index df7bbac..f0c576e 100644
--- a/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/WebProjectValidation.java
+++ b/enterprise/web.kit/test/qa-functional/src/org/netbeans/test/web/WebProjectValidation.java
@@ -89,6 +89,7 @@
public static final String JAVA_EE_5 = "Java EE 5";
public static final String JAVA_EE_6 = "Java EE 6";
public static final String JAVA_EE_7 = "Java EE 7";
+ public static final String JAVA_EE_8 = "Java EE 8";
// location of sample project
protected static String PROJECT_LOCATION;
// name of sample project
diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java b/enterprise/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
index 9a7660c..b2c039e 100644
--- a/enterprise/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
+++ b/enterprise/web.project/src/org/netbeans/modules/web/project/ProjectWebModule.java
@@ -558,7 +558,9 @@
public String getModuleVersion () {
// return a version based on the Java EE version
Profile platformVersion = getJ2eeProfile();
- if (Profile.JAVA_EE_7_FULL.equals(platformVersion) || Profile.JAVA_EE_7_WEB.equals(platformVersion)) {
+ if (Profile.JAVA_EE_8_FULL.equals(platformVersion) || Profile.JAVA_EE_8_WEB.equals(platformVersion)) {
+ return WebApp.VERSION_4_0;
+ } else if (Profile.JAVA_EE_7_FULL.equals(platformVersion) || Profile.JAVA_EE_7_WEB.equals(platformVersion)) {
return WebApp.VERSION_3_1;
} else if (Profile.JAVA_EE_6_FULL.equals(platformVersion) || Profile.JAVA_EE_6_WEB.equals(platformVersion)) {
return WebApp.VERSION_3_0;
diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/WebProject.java b/enterprise/web.project/src/org/netbeans/modules/web/project/WebProject.java
index 315d89f..25e0c23 100644
--- a/enterprise/web.project/src/org/netbeans/modules/web/project/WebProject.java
+++ b/enterprise/web.project/src/org/netbeans/modules/web/project/WebProject.java
@@ -2426,7 +2426,8 @@
lookups.add(base);
Profile profile = Profile.fromPropertiesString(project.evaluator().getProperty(WebProjectProperties.J2EE_PLATFORM));
if (Profile.JAVA_EE_6_FULL.equals(profile) || Profile.JAVA_EE_6_WEB.equals(profile) ||
- Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile)){
+ Profile.JAVA_EE_7_FULL.equals(profile) || Profile.JAVA_EE_7_WEB.equals(profile) ||
+ Profile.JAVA_EE_8_FULL.equals(profile) || Profile.JAVA_EE_8_WEB.equals(profile)){
lookups.add(ee6);
}
if ("true".equals(project.evaluator().getProperty(WebProjectProperties.DISPLAY_BROWSER))) {
diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java
index 1ab7c0c..3901564 100644
--- a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java
+++ b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSClientSupport.java
@@ -118,6 +118,10 @@
return JAVA_EE_VERSION_17;
} else if (Profile.JAVA_EE_7_FULL.equals(webModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_17;
+ } else if (Profile.JAVA_EE_8_WEB.equals(webModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
+ } else if (Profile.JAVA_EE_8_FULL.equals(webModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
} else if (Profile.JAVA_EE_5.equals(webModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_15;
}
diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java
index 17c960c..156461c 100644
--- a/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java
+++ b/enterprise/web.project/src/org/netbeans/modules/web/project/jaxws/WebProjectJAXWSSupport.java
@@ -603,6 +603,10 @@
return JAVA_EE_VERSION_17;
} else if (Profile.JAVA_EE_7_FULL.equals(webModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_17;
+ } else if (Profile.JAVA_EE_8_WEB.equals(webModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
+ } else if (Profile.JAVA_EE_8_FULL.equals(webModule.getJ2eeProfile())) {
+ return JAVA_EE_VERSION_18;
} else if (Profile.JAVA_EE_5.equals(webModule.getJ2eeProfile())) {
return JAVA_EE_VERSION_15;
}
diff --git a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java
index d5efb7f..a40d48d 100644
--- a/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java
+++ b/enterprise/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebProjectProperties.java
@@ -381,6 +381,8 @@
minimalSourceLevel = new SpecificationVersion("1.5");
} else if (Profile.JAVA_EE_7_FULL.equals(profile)) {
minimalSourceLevel = new SpecificationVersion("1.7");
+ } else if (Profile.JAVA_EE_8_FULL.equals(profile)) {
+ minimalSourceLevel = new SpecificationVersion("1.8");
}
JAVAC_SOURCE_MODEL = PlatformUiSupport.createSourceLevelComboBoxModel (PLATFORM_MODEL, evaluator.getProperty(JAVAC_SOURCE), evaluator.getProperty(JAVAC_TARGET), minimalSourceLevel);
JAVAC_SOURCE_RENDERER = PlatformUiSupport.createSourceLevelListCellRenderer ();
diff --git a/enterprise/web.project/test/unit/src/org/netbeans/modules/web/project/WebProjectTest.java b/enterprise/web.project/test/unit/src/org/netbeans/modules/web/project/WebProjectTest.java
index 256574d..5ad7d35 100644
--- a/enterprise/web.project/test/unit/src/org/netbeans/modules/web/project/WebProjectTest.java
+++ b/enterprise/web.project/test/unit/src/org/netbeans/modules/web/project/WebProjectTest.java
@@ -104,6 +104,9 @@
JavaEEProjectSettings.setProfile(webProject, Profile.JAVA_EE_7_WEB);
obtainedProfile = JavaEEProjectSettings.getProfile(webProject);
assertEquals(Profile.JAVA_EE_7_WEB, obtainedProfile);
+ JavaEEProjectSettings.setProfile(webProject, Profile.JAVA_EE_8_WEB);
+ Profile obtainedProfileEE8 = JavaEEProjectSettings.getProfile(webProject);
+ assertEquals(Profile.JAVA_EE_8_WEB, obtainedProfileEE8);
}
/**
diff --git a/enterprise/websocket/manifest.mf b/enterprise/websocket/manifest.mf
index 6f59454..2f896b6 100644
--- a/enterprise/websocket/manifest.mf
+++ b/enterprise/websocket/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.netbeans.modules.websocket
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/websocket/Bundle.properties
OpenIDE-Module-Layer: org/netbeans/modules/websocket/layer.xml
-OpenIDE-Module-Specification-Version: 1.11
+OpenIDE-Module-Specification-Version: 1.12
AutoUpdate-Show-In-Client: false
diff --git a/enterprise/websocket/src/org/netbeans/modules/websocket/editor/WebSocketMethodsTask.java b/enterprise/websocket/src/org/netbeans/modules/websocket/editor/WebSocketMethodsTask.java
index 478abba..d3d7d10 100644
--- a/enterprise/websocket/src/org/netbeans/modules/websocket/editor/WebSocketMethodsTask.java
+++ b/enterprise/websocket/src/org/netbeans/modules/websocket/editor/WebSocketMethodsTask.java
@@ -125,7 +125,9 @@
}
Profile profile = webModule.getJ2eeProfile();
if (!Profile.JAVA_EE_7_WEB.equals(profile)
- && !Profile.JAVA_EE_7_FULL.equals(profile)) {
+ && !Profile.JAVA_EE_7_FULL.equals(profile)
+ && !Profile.JAVA_EE_8_WEB.equals(profile)
+ && !Profile.JAVA_EE_8_FULL.equals(profile)) {
return false;
}
return true;
diff --git a/enterprise/websocket/src/org/netbeans/modules/websocket/wizard/WebSocketPanel.java b/enterprise/websocket/src/org/netbeans/modules/websocket/wizard/WebSocketPanel.java
index af81ebb..a0bcd7f 100644
--- a/enterprise/websocket/src/org/netbeans/modules/websocket/wizard/WebSocketPanel.java
+++ b/enterprise/websocket/src/org/netbeans/modules/websocket/wizard/WebSocketPanel.java
@@ -79,7 +79,9 @@
if (webModule != null) {
Profile profile = webModule.getJ2eeProfile();
if ( !Profile.JAVA_EE_7_FULL.equals(profile) &&
- !Profile.JAVA_EE_7_WEB.equals(profile))
+ !Profile.JAVA_EE_7_WEB.equals(profile) &&
+ !Profile.JAVA_EE_8_FULL.equals(profile) &&
+ !Profile.JAVA_EE_8_WEB.equals(profile))
{
setErrorMessage(NbBundle.getMessage(WebSocketPanel.class,
"MSG_NoJEE7Profile")); // NOI18N
diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java
index dfc5e1a..1ba0162 100644
--- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java
+++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java
@@ -81,6 +81,7 @@
protected static final String JAVA_EE_VERSION_15="java-ee-version-15"; //NOI18N
protected static final String JAVA_EE_VERSION_16="java-ee-version-16"; //NOI18N
protected static final String JAVA_EE_VERSION_17="java-ee-version-17"; //NOI18N
+ protected static final String JAVA_EE_VERSION_18="java-ee-version-18";
Project project;
private AntProjectHelper helper;
diff --git a/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java b/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java
index ef80e44..711a251 100644
--- a/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java
+++ b/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java
@@ -77,6 +77,7 @@
protected static final String JAVA_EE_VERSION_15="java-ee-version-15"; //NOI18N
protected static final String JAVA_EE_VERSION_16="java-ee-version-16"; //NOI18N
protected static final String JAVA_EE_VERSION_17="java-ee-version-17"; //NOI18N
+ protected static final String JAVA_EE_VERSION_18="java-ee-version-18"; //NOI18N
private Project project;
private AntProjectHelper antProjectHelper;
diff --git a/enterprise/websvc.kit/test/qa-functional/src/org/netbeans/modules/ws/qaf/WebServicesTestBase.java b/enterprise/websvc.kit/test/qa-functional/src/org/netbeans/modules/ws/qaf/WebServicesTestBase.java
index 17385c0..c89deb6 100644
--- a/enterprise/websvc.kit/test/qa-functional/src/org/netbeans/modules/ws/qaf/WebServicesTestBase.java
+++ b/enterprise/websvc.kit/test/qa-functional/src/org/netbeans/modules/ws/qaf/WebServicesTestBase.java
@@ -185,7 +185,8 @@
J2EE14,
JAVAEE5,
JAVAEE6,
- JAVAEE7;
+ JAVAEE7,
+ JAVAEE8;
@Override
public String toString() {
@@ -202,6 +203,9 @@
case JAVAEE7:
//Java EE 7
return "Java EE 7";
+ case JAVAEE8:
+ //Java EE 8
+ return "Java EE 8";
}
throw new AssertionError("Unknown type: " + this); //NOI18N
}
@@ -475,7 +479,9 @@
jcboVersion.selectItem(javaeeVersion.toString());
} else {
// cannot use display name for Maven project
- if (JavaEEVersion.JAVAEE7.equals(javaeeVersion)) {
+ if (JavaEEVersion.JAVAEE8.equals(javaeeVersion)) {
+ jcboVersion.selectItem("1.8");
+ } else if (JavaEEVersion.JAVAEE7.equals(javaeeVersion)) {
jcboVersion.selectItem("1.7");
} else if (JavaEEVersion.JAVAEE6.equals(javaeeVersion)) {
jcboVersion.selectItem("1.6");
diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/editor/AsyncConverter.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/editor/AsyncConverter.java
index 5533101..9522c08 100644
--- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/editor/AsyncConverter.java
+++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/editor/AsyncConverter.java
@@ -96,7 +96,9 @@
}
Profile profile = webModule.getJ2eeProfile();
if (!Profile.JAVA_EE_7_WEB.equals(profile)
- && !Profile.JAVA_EE_7_FULL.equals( profile))
+ && !Profile.JAVA_EE_7_FULL.equals( profile)
+ && !Profile.JAVA_EE_8_WEB.equals(profile)
+ && !Profile.JAVA_EE_8_FULL.equals(profile))
{
return false;
}
diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/InterceptorPanel.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/InterceptorPanel.java
index b6853b5..d1f6d6f 100644
--- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/InterceptorPanel.java
+++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/InterceptorPanel.java
@@ -81,7 +81,9 @@
if (webModule != null) {
Profile profile = webModule.getJ2eeProfile();
if ( !Profile.JAVA_EE_7_FULL.equals(profile) &&
- !Profile.JAVA_EE_7_WEB.equals(profile))
+ !Profile.JAVA_EE_7_WEB.equals(profile) &&
+ !Profile.JAVA_EE_8_FULL.equals(profile) &&
+ !Profile.JAVA_EE_8_WEB.equals(profile))
{
setErrorMessage(NbBundle.getMessage(InterceptorPanel.class,
"MSG_NoJEE7Profile")); // NOI18N
diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/JaxRsFilterPanel.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/JaxRsFilterPanel.java
index f42e7c9..17b191d 100644
--- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/JaxRsFilterPanel.java
+++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/wizard/JaxRsFilterPanel.java
@@ -89,7 +89,9 @@
WebModule webModule = WebModule.getWebModule(project.getProjectDirectory());
if (webModule != null) {
Profile profile = webModule.getJ2eeProfile();
- if ( !Profile.JAVA_EE_7_FULL.equals(profile) &&
+ if ( !Profile.JAVA_EE_8_FULL.equals(profile) &&
+ !Profile.JAVA_EE_8_WEB.equals(profile) &&
+ !Profile.JAVA_EE_7_FULL.equals(profile) &&
!Profile.JAVA_EE_7_WEB.equals(profile))
{
setErrorMessage(NbBundle.getMessage(JaxRsFilterPanel.class,
diff --git a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/MiscUtilities.java b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/MiscUtilities.java
index 31af0ea..c01fd0e 100644
--- a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/MiscUtilities.java
+++ b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/MiscUtilities.java
@@ -526,7 +526,9 @@
if (Profile.JAVA_EE_6_WEB == profile ||
Profile.JAVA_EE_6_FULL == profile ||
Profile.JAVA_EE_7_WEB == profile ||
- Profile.JAVA_EE_7_FULL == profile )
+ Profile.JAVA_EE_7_FULL == profile ||
+ Profile.JAVA_EE_8_WEB == profile ||
+ Profile.JAVA_EE_8_FULL == profile )
{
return true;
}
diff --git a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/RestSupport.java b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/RestSupport.java
index 33f2e6a..71a9aa9 100644
--- a/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/RestSupport.java
+++ b/enterprise/websvc.restapi/src/org/netbeans/modules/websvc/rest/spi/RestSupport.java
@@ -495,11 +495,26 @@
Profile.JAVA_EE_6_FULL.equals(profile);
boolean isJee7 = Profile.JAVA_EE_7_WEB.equals(profile) ||
Profile.JAVA_EE_7_FULL.equals(profile);
+ boolean isJee8 = Profile.JAVA_EE_8_WEB.equals(profile) ||
+ Profile.JAVA_EE_8_FULL.equals(profile);
// Fix for BZ#216345: JAVA_EE_6_WEB profile doesn't contain JAX-RS API
return (isJee6 && MiscPrivateUtilities.supportsTargetProfile(project, Profile.JAVA_EE_6_FULL)) || isJee7;
}
/**
+ * Is this EE8 profile project?
+ */
+ public boolean isEE8(){
+ WebModule webModule = WebModule.getWebModule(project.getProjectDirectory());
+ if ( webModule == null ){
+ return false;
+ }
+ Profile profile = webModule.getJ2eeProfile();
+ return Profile.JAVA_EE_8_WEB.equals(profile) ||
+ Profile.JAVA_EE_8_FULL.equals(profile);
+ }
+
+ /**
* Is this EE7 profile project?
*/
public boolean isEE7(){
diff --git a/harness/apisupport.harness/build.xml b/harness/apisupport.harness/build.xml
index 256442d..548620f 100644
--- a/harness/apisupport.harness/build.xml
+++ b/harness/apisupport.harness/build.xml
@@ -32,6 +32,20 @@
<zipfileset src="${nbantext.jar}" includes="${bundled.tasks}"/>
<zipfileset file="taskdefs.properties" fullpath="org/netbeans/nbbuild/taskdefs.properties"/>
</nb-ext-jar>
+
+ <!-- verify that the DownloadBinaries task is properly functional -->
+ <taskdef name="TestDownload" classname="org.netbeans.nbbuild.extlibs.DownloadBinaries">
+ <classpath>
+ <pathelement location="${cluster}/tasks.jar"></pathelement>
+ </classpath>
+ </taskdef>
+ <echo file="build/binaries-list">2F7553F50B0D14ED811B849C282DA8C1FFC32AAE org.ow2.asm:asm-all:5.0.1</echo>
+ <TestDownload>
+ <manifest dir="build">
+ <include name="binaries-list"/>
+ </manifest>
+ </TestDownload>
+ <delete file="build/asm-all-5.0.1.jar"/>
</target>
<target name="compile-jnlp-launcher" depends="init,compile">
diff --git a/harness/apisupport.harness/nbproject/project.properties b/harness/apisupport.harness/nbproject/project.properties
index 4f50462..7db6d57 100644
--- a/harness/apisupport.harness/nbproject/project.properties
+++ b/harness/apisupport.harness/nbproject/project.properties
@@ -89,7 +89,8 @@
org/netbeans/nbbuild/VerifyClassLinkage*.class,\
org/netbeans/nbbuild/VerifyJNLP*.class,\
org/netbeans/nbbuild/XMLUtil*.class,\
- org/netbeans/nbbuild/extlibs/DownloadBinaries*.class
+ org/netbeans/nbbuild/extlibs/DownloadBinaries*.class,\
+ org/netbeans/nbbuild/extlibs/ConfigureProxy*.class
test.unit.cp.extra=${netbeans.dest.dir}/harness/jnlp/jnlp-launcher.jar
javadoc.arch=${basedir}/arch.xml
diff --git a/ide/api.debugger/manifest.mf b/ide/api.debugger/manifest.mf
index b79a637..c5aa95a 100644
--- a/ide/api.debugger/manifest.mf
+++ b/ide/api.debugger/manifest.mf
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.api.debugger/1
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.59
+OpenIDE-Module-Specification-Version: 1.60
OpenIDE-Module-Layer: org/netbeans/api/debugger/layer.xml
diff --git a/ide/api.debugger/src/org/netbeans/api/debugger/DebuggerInfo.java b/ide/api.debugger/src/org/netbeans/api/debugger/DebuggerInfo.java
index 87de5c4..1ad3c5a 100644
--- a/ide/api.debugger/src/org/netbeans/api/debugger/DebuggerInfo.java
+++ b/ide/api.debugger/src/org/netbeans/api/debugger/DebuggerInfo.java
@@ -38,7 +38,7 @@
/**
- * Creates a new instance of DebuggerInfo.
+ * Creates a new instance of DebuggerInfo. Takes varargs since version 1.60.
*
* @param typeID identification of DebuggerInfo type. Is used for
* registration of external services.
@@ -48,7 +48,7 @@
*/
public static DebuggerInfo create (
String typeID,
- Object[] services
+ Object... services
) {
return new DebuggerInfo (
typeID,
diff --git a/ide/derby/nbproject/project.xml b/ide/derby/nbproject/project.xml
index d09a655..9ea4ae5 100644
--- a/ide/derby/nbproject/project.xml
+++ b/ide/derby/nbproject/project.xml
@@ -215,6 +215,7 @@
<friend>org.netbeans.modules.db.kit</friend>
<friend>org.netbeans.modules.derby.bundled</friend>
<friend>org.netbeans.modules.glassfish.common</friend>
+ <friend>org.netbeans.modules.payara.common</friend>
<friend>org.netbeans.modules.j2ee.blueprints</friend>
<friend>org.netbeans.modules.j2ee.samples</friend>
<friend>org.netbeans.modules.j2ee.sun.appsrv81</friend>
diff --git a/ide/editor.lib2/apichanges.xml b/ide/editor.lib2/apichanges.xml
index 03211f4..62f76c5 100644
--- a/ide/editor.lib2/apichanges.xml
+++ b/ide/editor.lib2/apichanges.xml
@@ -93,7 +93,7 @@
<p>If AttributeSet returned from HighlightsSequence contains key "virtual-text-prepend"
with a value of type String, the UI may optionally render the value as a
virtual text before the text of the highlight. It is recommended to make the
- span of length 1, to avoid problems when the AttributeSet with "virtual-test-prepend"
+ span of length 1, to avoid problems when the AttributeSet with "virtual-text-prepend"
is merged with other AttributeSets, which could lead to duplication.</p>
</description>
<class name="HighlightsSequence" package="org.netbeans.spi.editor.highlighting"/>
diff --git a/ide/swing.validation/nbproject/project.xml b/ide/swing.validation/nbproject/project.xml
index 9014d91..5ee5b02 100644
--- a/ide/swing.validation/nbproject/project.xml
+++ b/ide/swing.validation/nbproject/project.xml
@@ -67,6 +67,7 @@
<friend>org.netbeans.modules.maven.apisupport</friend>
<friend>org.netbeans.modules.maven.j2ee</friend>
<friend>org.netbeans.modules.nodejs</friend>
+ <friend>org.netbeans.modules.payara.micro</friend>
<package>org.netbeans.api.validation.adapters</package>
<package>org.netbeans.validation.api</package>
<package>org.netbeans.validation.api.builtin.indexvalidation</package>
diff --git a/ide/usersguide/pdf_source/shortcuts.odt b/ide/usersguide/pdf_source/shortcuts.odt
index 2659acf..b56ba3b 100644
--- a/ide/usersguide/pdf_source/shortcuts.odt
+++ b/ide/usersguide/pdf_source/shortcuts.odt
Binary files differ
diff --git a/ide/usersguide/pdf_source/shortcuts_mac.odt b/ide/usersguide/pdf_source/shortcuts_mac.odt
index f25fc9d..e10bfa1 100644
--- a/ide/usersguide/pdf_source/shortcuts_mac.odt
+++ b/ide/usersguide/pdf_source/shortcuts_mac.odt
Binary files differ
diff --git a/ide/xml.multiview/nbproject/project.xml b/ide/xml.multiview/nbproject/project.xml
index 72189a6..5d8db6e 100644
--- a/ide/xml.multiview/nbproject/project.xml
+++ b/ide/xml.multiview/nbproject/project.xml
@@ -197,6 +197,7 @@
<friend>de.genomatix.jasperreporteditor</friend>
<friend>org.netbeans.modules.hibernate</friend>
<friend>org.netbeans.modules.hibernateweb</friend>
+ <friend>org.netbeans.modules.payara.eecommon</friend>
<friend>org.netbeans.modules.identity.profile.ui</friend>
<friend>org.netbeans.modules.j2ee.ddloaders</friend>
<friend>org.netbeans.modules.j2ee.persistence</friend>
diff --git a/java/api.debugger.jpda/apichanges.xml b/java/api.debugger.jpda/apichanges.xml
index 59c5e30..04027fe 100644
--- a/java/api.debugger.jpda/apichanges.xml
+++ b/java/api.debugger.jpda/apichanges.xml
@@ -53,6 +53,19 @@
<changes>
<change>
<api name="JPDADebuggerAPI"/>
+ <summary>Randomly select listening port</summary>
+ <version major="3" minor="12"/>
+ <date day="15" month="6" year="2019"/>
+ <author login="jtulach"/>
+ <compatibility addition="yes"/>
+ <description>
+ Enhanced behavior of
+ <a href="@TOP@/org/netbeans/api/debugger/jpda/ListeningDICookie.html">ListeningDICookie.create(-1)</a>
+ method.
+ </description>
+ </change>
+ <change>
+ <api name="JPDADebuggerAPI"/>
<summary>JPDADebugger.getException() method added.</summary>
<date day="20" month="4" year="2004"/>
<author login="jjancura"/>
diff --git a/java/api.debugger.jpda/manifest.mf b/java/api.debugger.jpda/manifest.mf
index 77fcd72..f2350a7 100644
--- a/java/api.debugger.jpda/manifest.mf
+++ b/java/api.debugger.jpda/manifest.mf
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
-OpenIDE-Module-Specification-Version: 3.11
+OpenIDE-Module-Specification-Version: 3.12
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
diff --git a/java/api.debugger.jpda/nbproject/project.properties b/java/api.debugger.jpda/nbproject/project.properties
index e45c7d6..5fbdca8 100644
--- a/java/api.debugger.jpda/nbproject/project.properties
+++ b/java/api.debugger.jpda/nbproject/project.properties
@@ -18,7 +18,7 @@
is.autoload=true
cp.extra=${tools.jar}
javac.compilerargs=-Xlint:unchecked
-javac.source=1.6
+javac.source=1.8
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml
diff --git a/java/api.debugger.jpda/nbproject/project.xml b/java/api.debugger.jpda/nbproject/project.xml
index 85eab3d..2b11eb1 100644
--- a/java/api.debugger.jpda/nbproject/project.xml
+++ b/java/api.debugger.jpda/nbproject/project.xml
@@ -22,7 +22,7 @@
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
- <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>org.netbeans.api.debugger.jpda</code-name-base>
<module-dependencies>
<dependency>
@@ -31,7 +31,7 @@
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
- <specification-version>1.35</specification-version>
+ <specification-version>1.60</specification-version>
</run-dependency>
</dependency>
<dependency>
@@ -77,6 +77,20 @@
</run-dependency>
</dependency>
</module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <recursive></recursive>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
<public-packages>
<package>org.netbeans.api.debugger.jpda</package>
<package>org.netbeans.api.debugger.jpda.event</package>
diff --git a/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ListeningDICookie.java b/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ListeningDICookie.java
index 6c01eb5..d552d9f 100644
--- a/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ListeningDICookie.java
+++ b/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/ListeningDICookie.java
@@ -36,17 +36,8 @@
*
* <br><br>
* <b>How to use it:</b>
- * <pre style="background-color: rgb(255, 255, 153);">
- * DebuggerInfo di = DebuggerInfo.create (
- * "My First Listening Debugger Info",
- * new Object [] {
- * ListeningDICookie.create (
- * 1234
- * )
- * }
- * );
- * DebuggerManager.getDebuggerManager ().startDebugging (di);</pre>
- *
+ * {@codesnippet org.netbeans.api.debugger.jpda.StartListeningTest}
+ *
* @author Jan Jancura
*/
public final class ListeningDICookie extends AbstractDICookie {
@@ -86,9 +77,13 @@
}
/**
- * Creates a new instance of ListeningDICookie for given parameters.
+ * Creates a new instance of ListeningDICookie for given parameters. Example
+ * showing how to tell the IDE to start listening on a random port:
+ *
+ * {@codesnippet org.netbeans.api.debugger.jpda.StartListeningTest}
*
- * @param portNumber a number of port to listen on
+ * @param portNumber a number of port to listen on, use {@code -1} to
+ * let the system select a random port since 3.12
* @return a new instance of ListeningDICookie for given parameters
*/
public static ListeningDICookie create (
@@ -137,7 +132,7 @@
int portNumber
) {
Map<String, ? extends Argument> args = listeningConnector.defaultArguments ();
- args.get ("port").setValue ("" + portNumber);
+ args.get ("port").setValue (portNumber > 0 ? "" + portNumber : "");
return args;
}
diff --git a/java/api.debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/StartListeningTest.java b/java/api.debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/StartListeningTest.java
new file mode 100644
index 0000000..9faff7b
--- /dev/null
+++ b/java/api.debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/StartListeningTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.debugger.jpda;
+
+import java.util.concurrent.Executor;
+import org.netbeans.api.debugger.DebuggerInfo;
+import org.netbeans.api.debugger.DebuggerManager;
+import org.netbeans.junit.NbTestCase;
+import org.openide.util.RequestProcessor;
+
+public class StartListeningTest extends NbTestCase {
+
+ public StartListeningTest(String name) {
+ super(name);
+ }
+
+ public void testStartListeningOnRandomPort() throws Exception {
+ startListening();
+ }
+
+ // BEGIN: org.netbeans.api.debugger.jpda.StartListeningTest
+ private static final Executor LISTENING = new RequestProcessor("Listening");
+
+ int startListening() throws Exception {
+ ListeningDICookie config = ListeningDICookie.create(-1);
+ DebuggerInfo info = DebuggerInfo.create(ListeningDICookie.ID, config);
+ LISTENING.execute(() -> {
+ DebuggerManager.getDebuggerManager().startDebugging(info);
+ });
+ int port = config.getPortNumber();
+ assertNotSame("Listening on a real port", -1, port);
+ return port;
+ }
+ // END: org.netbeans.api.debugger.jpda.StartListeningTest
+}
diff --git a/java/debugger.jpda/nbproject/project.xml b/java/debugger.jpda/nbproject/project.xml
index 14cbb11..95445e7 100644
--- a/java/debugger.jpda/nbproject/project.xml
+++ b/java/debugger.jpda/nbproject/project.xml
@@ -168,6 +168,12 @@
<compile-dependency/>
</test-dependency>
<test-dependency>
+ <code-name-base>org.netbeans.api.debugger.jpda</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ <test/>
+ </test-dependency>
+ <test-dependency>
<code-name-base>org.netbeans.modules.debugger.jpda.projects</code-name-base>
<recursive/>
</test-dependency>
diff --git a/java/debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/ListeningDICookieTest.java b/java/debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/ListeningDICookieTest.java
new file mode 100644
index 0000000..c4064e4
--- /dev/null
+++ b/java/debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/ListeningDICookieTest.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.debugger.jpda;
+
+public class ListeningDICookieTest extends StartListeningTest {
+ public ListeningDICookieTest(String name) {
+ super(name);
+ }
+}
diff --git a/java/java.j2seplatform/nbproject/project.xml b/java/java.j2seplatform/nbproject/project.xml
index 7808adb..29a4bfb 100644
--- a/java/java.j2seplatform/nbproject/project.xml
+++ b/java/java.j2seplatform/nbproject/project.xml
@@ -334,6 +334,7 @@
<friend-packages>
<friend>org.netbeans.modules.debugger.jpda.trufflenode</friend>
<friend>org.netbeans.modules.glassfish.common</friend>
+ <friend>org.netbeans.modules.payara.common</friend>
<friend>org.netbeans.modules.javafx2.platform</friend>
<friend>org.netbeans.modules.projectimport.eclipse.core</friend>
<friend>org.netbeans.modules.projectimport.jbuilder</friend>
diff --git a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
index 6adc428..8f00c7b 100644
--- a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
+++ b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
@@ -57,7 +57,12 @@
OFFICIAL_JAVADOC.put("1.6", "https://docs.oracle.com/javase/6/docs/api/"); // NOI18N
OFFICIAL_JAVADOC.put("1.7", "https://docs.oracle.com/javase/7/docs/api/"); // NOI18N
OFFICIAL_JAVADOC.put("1.8", "https://docs.oracle.com/javase/8/docs/api/"); // NOI18N
- OFFICIAL_JAVADOC.put("9", null); //Does not exist for now
+ OFFICIAL_JAVADOC.put("9", "https://docs.oracle.com/javase/9/docs/api/"); // NOI18N
+ OFFICIAL_JAVADOC.put("10", "https://docs.oracle.com/javase/10/docs/api/"); // NOI18N
+ OFFICIAL_JAVADOC.put("11", "https://docs.oracle.com/en/java/javase/11/docs/api/"); // NOI18N
+ OFFICIAL_JAVADOC.put("12", "https://docs.oracle.com/en/java/javase/12/docs/api/"); // NOI18N
+ OFFICIAL_JAVADOC.put("13", "https://download.java.net/java/early_access/jdk13/docs/api/"); // NOI18N Early access
+ OFFICIAL_JAVADOC.put("14", "https://download.java.net/java/early_access/jdk14/docs/api/"); // NOI18N Early access
}
@Override
diff --git a/java/java.project/apichanges.xml b/java/java.project/apichanges.xml
index c294918..f01dda4 100644
--- a/java/java.project/apichanges.xml
+++ b/java/java.project/apichanges.xml
@@ -85,6 +85,18 @@
<!-- ACTUAL CHANGES BEGIN HERE: -->
<changes>
+ <change id="ProjectPlatformNoPE">
+ <api name="java_project"/>
+ <summary>Added support for per-project platform for projects which don't use PropertyEvaluator.</summary>
+ <version major="1" minor="77"/>
+ <date day="19" month="6" year="2019"/>
+ <author login="tzezula"/>
+ <compatibility addition="yes"/>
+ <description>
+ Added support for per-project platform for projects which don't use <code>PropertyEvaluator</code>.
+ </description>
+ <class package="org.netbeans.spi.java.project.support" name="ProjectPlatform"/>
+ </change>
<change id="ProjectModulesModifier">
<api name="java_project"/>
<summary>Added a SPI to manipulate with project's <code>module-info.java</code> declarations</summary>
diff --git a/java/java.project/manifest.mf b/java/java.project/manifest.mf
index 91206db..ea9059a 100644
--- a/java/java.project/manifest.mf
+++ b/java/java.project/manifest.mf
@@ -2,6 +2,6 @@
OpenIDE-Module: org.netbeans.modules.java.project/1
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/project/Bundle.properties
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
-OpenIDE-Module-Specification-Version: 1.76
+OpenIDE-Module-Specification-Version: 1.77
AutoUpdate-Show-In-Client: false
diff --git a/java/java.project/src/org/netbeans/spi/java/project/support/ProjectPlatform.java b/java/java.project/src/org/netbeans/spi/java/project/support/ProjectPlatform.java
index 68b6f90..93fc643 100644
--- a/java/java.project/src/org/netbeans/spi/java/project/support/ProjectPlatform.java
+++ b/java/java.project/src/org/netbeans/spi/java/project/support/ProjectPlatform.java
@@ -60,7 +60,6 @@
private ProjectPlatform() {
throw new IllegalStateException("No instance allowed"); //NOI18N
}
-
/**
* Creates a transient {@link JavaPlatform} defined in given {@link Project}.
* @param owner the project to return the {@link JavaPlatform} for
@@ -76,8 +75,8 @@
@NonNull final String platformType) {
Parameters.notNull("owner", owner); //NOI18N
Parameters.notNull("eval", eval); //NOI18N
- Parameters.notNull("platformType", platformType); //NOI18N
- final String platformName = eval.getProperty(PLATFORM_ACTIVE);
+ Parameters.notNull("platformType", platformType); //NOI18N
+ final String platformName = eval.getProperty(PLATFORM_ACTIVE);
final FileObject jdkHome = resolvePlatformHome(
platformName,
owner.getProjectDirectory(),
@@ -85,19 +84,44 @@
if (jdkHome == null) {
return null;
}
+ return forProject(owner, jdkHome, platformName, platformType);
+ }
+
+ /**
+ * Creates a transient {@link JavaPlatform} defined in given {@link Project}.
+ * @param owner the project to return the {@link JavaPlatform} for
+ * @param platformHome the {@link JavaPlatform} install folder
+ * @param platformName the {@link JavaPlatform} system name uniquely identifying the platform.
+ * The name has to be valid property name, use the {@link PropertyUtils#getUsablePropertyName(java.lang.String)} to create the name.
+ * For the Ant based project the platform name is a value of {@code platform.active} property.
+ * @param platformType the type of the platform, eg. "j2se"
+ * @return a {@link JavaPlatform} for given project or null when platform cannot
+ * be created
+ * @since 1.77
+ */
+ @CheckForNull
+ public static JavaPlatform forProject(
+ @NonNull final Project owner,
+ @NonNull final FileObject platformHome,
+ @NonNull final String platformName,
+ @NonNull final String platformType) {
+ Parameters.notNull("owner", owner); //NOI18N
+ Parameters.notNull("platformHome", platformHome); //NOI18N
+ Parameters.notNull("platformName", platformName); //NOI18N
+ Parameters.notNull("platformType", platformType); //NOI18N
JavaPlatform res;
- JavaPlatform delegate;
+ JavaPlatform delegate;
synchronized (platformsByProject) {
- res = platformsByProject.get(jdkHome);
+ res = platformsByProject.get(platformHome);
delegate = res == null ?
- platformsByHome.get(jdkHome) :
+ platformsByHome.get(platformHome) :
null;
}
if (res == null) {
boolean newDelegate = false;
if (delegate == null) {
- delegate = Optional.ofNullable(findJavaPlatform(jdkHome, platformType))
- .orElseGet(() -> createJavaPlatform(jdkHome, platformType));
+ delegate = Optional.ofNullable(findJavaPlatform(platformHome, platformType))
+ .orElseGet(() -> createJavaPlatform(platformHome, platformType));
newDelegate = true;
}
if (delegate != null) {
@@ -118,16 +142,16 @@
@Override
public String getDisplayName() {
return platformName;
- }
- };
+ }
+ };
}
if (res != null) {
synchronized (platformsByProject) {
platformsByProject.put(owner, res);
assert delegate != null;
if (newDelegate) {
- homesByProject.put(owner, jdkHome);
- platformsByHome.put(jdkHome, delegate);
+ homesByProject.put(owner, platformHome);
+ platformsByHome.put(platformHome, delegate);
}
}
}
diff --git a/java/java.source.base/src/org/netbeans/api/java/source/TypeUtilities.java b/java/java.source.base/src/org/netbeans/api/java/source/TypeUtilities.java
index 7093b93..a2b892a 100644
--- a/java/java.source.base/src/org/netbeans/api/java/source/TypeUtilities.java
+++ b/java/java.source.base/src/org/netbeans/api/java/source/TypeUtilities.java
@@ -38,6 +38,7 @@
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.ErrorType;
import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.IntersectionType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;
@@ -460,6 +461,18 @@
}
@Override
+ public StringBuilder visitIntersection(IntersectionType t, Boolean p) {
+ Iterator<? extends TypeMirror> it = t.getBounds().iterator();
+ while (it.hasNext()) {
+ visit(it.next(), p);
+ if (it.hasNext()) {
+ DEFAULT_VALUE.append(" & ");
+ }
+ }
+ return DEFAULT_VALUE;
+ }
+
+ @Override
public StringBuilder visitError(ErrorType t, Boolean p) {
Element e = t.asElement();
if (e instanceof TypeElement) {
diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/APTUtils.java b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/APTUtils.java
index 425b520..5da0008 100644
--- a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/APTUtils.java
+++ b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/APTUtils.java
@@ -105,6 +105,7 @@
private static final boolean DISABLE_CLASSLOADER_CACHE = Boolean.getBoolean("java.source.aptutils.disable.classloader.cache");
private static final int SLIDING_WINDOW = 1000; //1s
private static final RequestProcessor RP = new RequestProcessor(APTUtils.class);
+ private static final RequestProcessor ROOT_CHANGE_RP = new RequestProcessor(APTUtils.class);
private final FileObject root;
private volatile ClassPath bootPath;
private volatile ClassPath compilePath;
@@ -298,9 +299,11 @@
public void propertyChange(PropertyChangeEvent evt) {
if (ClassPath.PROP_ROOTS.equals(evt.getPropertyName())) {
classLoaderCache = null;
- if (verifyProcessorPath(root, usedRoots, PROCESSOR_MODULE_PATH) || verifyProcessorPath(root, usedRoots, PROCESSOR_PATH)) {
- slidingRefresh.schedule(SLIDING_WINDOW);
- }
+ ROOT_CHANGE_RP.execute(()-> {
+ if (verifyProcessorPath(root, usedRoots, PROCESSOR_MODULE_PATH) || verifyProcessorPath(root, usedRoots, PROCESSOR_PATH)) {
+ slidingRefresh.schedule(SLIDING_WINDOW);
+ }
+ });
}
}
diff --git a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TypeUtilitiesTest.java b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TypeUtilitiesTest.java
index 79d64ae..2aa1900 100644
--- a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TypeUtilitiesTest.java
+++ b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TypeUtilitiesTest.java
@@ -18,6 +18,12 @@
*/
package org.netbeans.api.java.source;
+import com.sun.source.tree.BlockTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.ExpressionStatementTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MemberSelectTree;
+import com.sun.source.tree.MethodInvocationTree;
import java.io.File;
import java.io.IOException;
import java.net.URL;
@@ -125,7 +131,7 @@
public void testTypeName() throws Exception {
FileObject root = FileUtil.createMemoryFileSystem().getRoot();
FileObject src = root.createData("Test.java");
- TestUtilities.copyStringToFile(src, "package test; public class Test {}");
+ TestUtilities.copyStringToFile(src, "package test; public class Test { { get().run(); } private <Z extends Exception&Runnable> Z get() { return null; } }");
JavaSource js = JavaSource.create(ClasspathInfo.create(ClassPathSupport.createClassPath(SourceUtilsTestUtil.getBootClassPath().toArray(new URL[0])), ClassPathSupport.createClassPath(new URL[0]), ClassPathSupport.createClassPath(new URL[0])), src);
js.runUserActionTask(new Task<CompilationController>() {
@@ -136,6 +142,12 @@
assertEquals("List<String>[]", info.getTypeUtilities().getTypeName(info.getTreeUtilities().parseType("java.util.List<java.lang.String>[]", context)));
assertEquals("java.util.List<java.lang.String>...", info.getTypeUtilities().getTypeName(info.getTreeUtilities().parseType("java.util.List<java.lang.String>[]", context), TypeUtilities.TypeNameOptions.PRINT_FQN, TypeUtilities.TypeNameOptions.PRINT_AS_VARARG));
assertEquals("List<String>...", info.getTypeUtilities().getTypeName(info.getTreeUtilities().parseType("java.util.List<java.lang.String>[]", context), TypeUtilities.TypeNameOptions.PRINT_AS_VARARG));
+ ClassTree clazz = (ClassTree) info.getCompilationUnit().getTypeDecls().get(0);
+ BlockTree init = (BlockTree) clazz.getMembers().get(1);
+ ExpressionStatementTree var = (ExpressionStatementTree) init.getStatements().get(0);
+ ExpressionTree getInvocation = ((MemberSelectTree) ((MethodInvocationTree) var.getExpression()).getMethodSelect()).getExpression();
+ TypeMirror intersectionType = info.getTrees().getTypeMirror(info.getTrees().getPath(info.getCompilationUnit(), getInvocation));
+ assertEquals("Exception & Runnable", info.getTypeUtilities().getTypeName(intersectionType));
}
}, true);
diff --git a/java/maven.embedder/nbproject/project.xml b/java/maven.embedder/nbproject/project.xml
index 9838dbe..5fa877f 100644
--- a/java/maven.embedder/nbproject/project.xml
+++ b/java/maven.embedder/nbproject/project.xml
@@ -169,6 +169,7 @@
<friend>org.netbeans.modules.android.maven</friend>
<!-- danis@netbeans.org -->
<friend>org.vaadin.netbeans.maven</friend>
+ <friend>org.netbeans.modules.payara.micro</friend>
<!-- NetBeans support for Google App Engine -->
<friend>org.netbeans.modules.j2ee.appengine</friend>
<friend>org.netbeans.modules.maven.util</friend>
diff --git a/java/maven.model/nbproject/project.xml b/java/maven.model/nbproject/project.xml
index f350bb3..4f5d1e0 100644
--- a/java/maven.model/nbproject/project.xml
+++ b/java/maven.model/nbproject/project.xml
@@ -231,6 +231,7 @@
<friend>org.netbeans.modules.testng.maven</friend>
<!-- danis@netbeans.org -->
<friend>org.vaadin.netbeans.maven</friend>
+ <friend>org.netbeans.modules.payara.micro</friend>
<!-- NetBeans support for Google App Engine -->
<friend>org.netbeans.modules.j2ee.appengine</friend>
<friend>org.netbeans.modules.maven.util</friend>
diff --git a/java/maven/nbproject/project.xml b/java/maven/nbproject/project.xml
index 8dfbd33..301791c 100644
--- a/java/maven/nbproject/project.xml
+++ b/java/maven/nbproject/project.xml
@@ -622,6 +622,7 @@
<friend>org.netbeans.modules.scala.maven</friend>
<!-- danis@netbeans.org -->
<friend>org.vaadin.netbeans.maven</friend>
+ <friend>org.netbeans.modules.payara.micro</friend>
<!-- NetBeans support for Google App Engine -->
<friend>org.netbeans.modules.j2ee.appengine</friend>
<friend>org.netbeans.modules.maven.util</friend>
@@ -635,6 +636,7 @@
<package>org.netbeans.modules.maven.api.execute</package>
<package>org.netbeans.modules.maven.api.output</package>
<package>org.netbeans.modules.maven.api.problem</package>
+ <package>org.netbeans.modules.maven.execute</package>
<package>org.netbeans.modules.maven.execute.model</package>
<package>org.netbeans.modules.maven.execute.model.io.jdom</package>
<package>org.netbeans.modules.maven.execute.model.io.xpp3</package>
diff --git a/nb/ide.branding/release/shortcuts.pdf b/nb/ide.branding/release/shortcuts.pdf
index 6ae3d2a..41e5be6 100644
--- a/nb/ide.branding/release/shortcuts.pdf
+++ b/nb/ide.branding/release/shortcuts.pdf
Binary files differ
diff --git a/nb/ide.branding/release/shortcuts_mac.pdf b/nb/ide.branding/release/shortcuts_mac.pdf
index 7942f29..fd7b790 100644
--- a/nb/ide.branding/release/shortcuts_mac.pdf
+++ b/nb/ide.branding/release/shortcuts_mac.pdf
Binary files differ
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
index c6f1363..ae33e1c2 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
@@ -31,20 +31,12 @@
import java.io.OutputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
index 91ce103..961f74c 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
@@ -40,6 +40,8 @@
# javax.annotation-api is used by multiple modules.
enterprise/websvc.restlib/external/javax.annotation-api-1.2.jar java/maven.indexer/external/javax.annotation-api-1.2.jar
enterprise/javaee.api/external/javax.annotation-api-1.2.jar java/maven.indexer/external/javax.annotation-api-1.2.jar
+enterprise/javaee7.api/external/javax.annotation-api-1.2.jar enterprise/javaee8.api/external/javax.annotation-api-1.2.jar
+enterprise/javaee8.api/external/javax.annotation-api-1.2.jar enterprise/websvc.restlib/external/javax.annotation-api-1.2.jar
#Struts taglib is used by both web.core.syntax and web.struts
enterprise/web.core.syntax/external/struts-taglib-1.3.10.jar enterprise/web.struts/external/struts-taglib-1.3.10.jar
diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties
index 3523ff0..d16330a 100644
--- a/nbbuild/cluster.properties
+++ b/nbbuild/cluster.properties
@@ -777,6 +777,7 @@
javaee.resources,\
javaee.specs.support,\
javaee7.api,\
+ javaee8.api,\
jellytools.enterprise,\
jsp.lexer,\
libs.amazon,\
@@ -786,6 +787,11 @@
libs.jstl,\
maven.j2ee,\
maven.jaxws,\
+ payara.common,\
+ payara.eecommon,\
+ payara.jakartaee,\
+ payara.micro,\
+ payara.tooling,\
performance.javaee,\
performance.scripting,\
performance.web,\