diff -r 88a51a56d238 glassfish.common/nbproject/project.xml
--- a/glassfish.common/nbproject/project.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/glassfish.common/nbproject/project.xml Thu Dec 15 21:20:32 2011 +0100
@@ -54,7 +54,7 @@
0
- 1.2
+ 1.18
diff -r 88a51a56d238 glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Thu Dec 15 15:24:05 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Thu Dec 15 21:20:32 2011 +0100
@@ -62,6 +62,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
+import org.netbeans.api.server.VMArguments;
import org.netbeans.modules.glassfish.spi.RegisteredDerbyServer;
import org.netbeans.modules.glassfish.spi.GlassfishModule;
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
@@ -696,9 +697,25 @@
throw new ProcessCreationException(ioe,
"MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
}
+
+ for (VMArguments args : VMArguments.getVMArguments(getMode(ip.get(GlassfishModule.JVM_MODE)))) {
+ for (String singleArg : args.getArguments()) {
+ argumentBuf.append(' ').append(singleArg);
+ }
+ }
return argumentBuf;
}
+ private static VMArguments.StartMode getMode(String gfMode) {
+ if (GlassfishModule.PROFILE_MODE.equals(gfMode)) {
+ return VMArguments.StartMode.PROFILE;
+ } else if (GlassfishModule.DEBUG_MODE.equals(gfMode)) {
+ return VMArguments.StartMode.DEBUG;
+ } else {
+ return VMArguments.StartMode.NORMAL;
+ }
+ }
+
private String selectDebugPort() throws IOException {
int debugPort = 9009;
ServerSocket t = null;
diff -r 88a51a56d238 j2ee.jboss4/nbproject/project.xml
--- a/j2ee.jboss4/nbproject/project.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/j2ee.jboss4/nbproject/project.xml Thu Dec 15 21:20:32 2011 +0100
@@ -162,6 +162,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 88a51a56d238 j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java
--- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Thu Dec 15 15:24:05 2011 +0100
+++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Thu Dec 15 21:20:32 2011 +0100
@@ -62,6 +62,7 @@
import javax.enterprise.deploy.shared.CommandType;
import javax.enterprise.deploy.shared.StateType;
import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.server.VMArguments;
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
@@ -229,6 +230,12 @@
}
}
+ for (VMArguments args : VMArguments.getVMArguments(getMode(startServer.getMode()))) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
+
// create new environment for server
javaOpts = javaOptsBuilder.toString();
String javaHome = getJavaHome(platform);
@@ -241,7 +248,17 @@
};
return envp;
}
-
+
+ private static VMArguments.StartMode getMode(JBStartServer.MODE jbMode) {
+ if (JBStartServer.MODE.PROFILE.equals(jbMode)) {
+ return VMArguments.StartMode.PROFILE;
+ } else if (JBStartServer.MODE.DEBUG.equals(jbMode)) {
+ return VMArguments.StartMode.DEBUG;
+ } else {
+ return VMArguments.StartMode.NORMAL;
+ }
+ }
+
private boolean checkPorts(final InstanceProperties ip) {
try {
diff -r 88a51a56d238 j2ee.weblogic9/nbproject/project.xml
--- a/j2ee.weblogic9/nbproject/project.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/j2ee.weblogic9/nbproject/project.xml Thu Dec 15 21:20:32 2011 +0100
@@ -204,6 +204,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 88a51a56d238 j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java
--- a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Thu Dec 15 15:24:05 2011 +0100
+++ b/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Thu Dec 15 21:20:32 2011 +0100
@@ -70,6 +70,7 @@
import org.netbeans.api.extexecution.input.InputReaderTask;
import org.netbeans.api.extexecution.input.InputReaders;
import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.server.VMArguments;
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.api.UISupport;
@@ -419,10 +420,16 @@
javaOptsBuilder.append( " " ); // NOI18N
javaOptsBuilder.append( javaOpts.trim() );
}
-
- if ( profJvmArgs.length >0 ){
+
+ for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.PROFILE)) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
+ String toAdd = javaOptsBuilder.toString().trim();
+ if (!toAdd.isEmpty()){
result = result.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,
- javaOptsBuilder.toString());
+ toAdd);
}
return result;
}
@@ -476,6 +483,11 @@
javaOptsBuilder.append("-Xdebug -Xnoagent -Djava.compiler=none "); // NOI18N
javaOptsBuilder.append("-Xrunjdwp:server=y,suspend=n,transport=dt_socket,address=");// NOI18N
javaOptsBuilder.append( debugPort );
+ for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.DEBUG)) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
ExternalProcessBuilder result = builder.addEnvironmentVariable(
JAVA_OPTIONS_VARIABLE,
javaOptsBuilder.toString());
@@ -657,9 +669,16 @@
{
ExternalProcessBuilder result = builder;
String javaOpts = dm.getInstanceProperties().getProperty(WLPluginProperties.JAVA_OPTS);
- if ( javaOpts!= null && javaOpts.trim().length() >0 ){
- result = builder.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,
- javaOpts.trim());
+ StringBuilder sb = new StringBuilder((javaOpts!= null && javaOpts.trim().length() > 0)
+ ? javaOpts.trim() : "");
+ for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.NORMAL)) {
+ for (String singleArg : args.getArguments()) {
+ sb.append(' ').append(singleArg);
+ }
+ }
+ if (sb.length() > 0) {
+ result = builder.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,
+ sb.toString());
}
return result;
}
diff -r 88a51a56d238 server/apichanges.xml
--- a/server/apichanges.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/server/apichanges.xml Thu Dec 15 21:20:32 2011 +0100
@@ -110,6 +110,22 @@
+
+
+ SPI to allow passing additional arguments to server VM
+
+
+
+
+
+ This API/SPI allow third party plugins (such as JRebel) to
+ register providers of VM arguments. The server plugin may
+ optionaly query such arguments and pass them to server VM.
+
+
+
+
+
Establish layer to register cloud providers
diff -r 88a51a56d238 server/arch.xml
--- a/server/arch.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/server/arch.xml Thu Dec 15 21:20:32 2011 +0100
@@ -60,7 +60,8 @@
Clients can provide its instances through the SPI. They can also provide
- wizards to define UI way for the server or cloud instance addition. It is done with
+ wizards to define UI way for the server or cloud instance addition. There
+ is also provider of VM arguments which can be registered in layer. It is done with
where the SPIs implementation must be registered.
@@ -81,6 +82,10 @@
can extend the list of popup actions on Cloud node in
Services tab.
+
+ By registering providers to Servers/VMArgumentsProviders
you
+ can register your additional VM arguments provider.
+
If the action registered in Servers/Actions
or Cloud/Actions
folder
has getValue("serverNodeHidden") == Boolean.TRUE
, then
@@ -236,7 +241,24 @@
can be used. It provides a way how to store and retrieve properties of
the server instance.
-
+
+
+
+ The third party plugin may want to be able provide additional VM arguments
+ for the server VM in a standardized way. In order to do so it will register
+ a implementation of
+ VMArgumentsProvider
+ to the layer folder Servers/VMArgumentProviders. The annotation
+ VMArgumentsProvider.Registration
+ can be used for that.
+
+
+ The clients (server plugin implementations) may query the providers via the
+ API class
+ VMArguments
+ and use the additional arguments for the VM.
+
+
diff -r 88a51a56d238 server/manifest.mf
--- a/server/manifest.mf Thu Dec 15 15:24:05 2011 +0100
+++ b/server/manifest.mf Thu Dec 15 21:20:32 2011 +0100
@@ -2,7 +2,7 @@
OpenIDE-Module: org.netbeans.modules.server/0
OpenIDE-Module-Layer: org/netbeans/modules/server/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/server/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.17
+OpenIDE-Module-Specification-Version: 1.18
AutoUpdate-Show-In-Client: false
OpenIDE-Module-Provides: org.netbeans.modules.server
diff -r 88a51a56d238 server/nbproject/project.xml
--- a/server/nbproject/project.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/server/nbproject/project.xml Thu Dec 15 21:20:32 2011 +0100
@@ -50,6 +50,24 @@
org.netbeans.modules.server
+ org.netbeans.api.annotations.common
+
+
+
+ 1
+ 1.13
+
+
+
+ org.netbeans.core.ide
+
+
+
+ 1
+ 1.15
+
+
+
org.openide.awt
@@ -98,15 +116,6 @@
- org.netbeans.core.ide
-
-
-
- 1
- 1.15
-
-
-
org.openide.util
diff -r 88a51a56d238 server/src/org/netbeans/api/server/Bundle.properties
--- a/server/src/org/netbeans/api/server/Bundle.properties Thu Dec 15 15:24:05 2011 +0100
+++ b/server/src/org/netbeans/api/server/Bundle.properties Thu Dec 15 21:20:32 2011 +0100
@@ -43,3 +43,7 @@
TXT_ServerManager=Servers
CTL_Close=Close
AD_Close=Close
+
+StartMode_Normal=Normal
+StartMode_Debug=Debug
+StartMode_Profile=Profile
diff -r 88a51a56d238 server/src/org/netbeans/api/server/VMArguments.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/api/server/VMArguments.java Thu Dec 15 21:20:32 2011 +0100
@@ -0,0 +1,166 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. 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
+ * nbbuild/licenses/CDDL-GPL-2-CP. 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. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * 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 do not 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.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.api.server;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.server.annotations.VMArgumentsRegistrationProcessor;
+import org.netbeans.spi.server.VMArgumentsProvider;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.lookup.Lookups;
+
+/**
+ * The API class allowing clients, typically server plugins, to query additional
+ * groups of arguments it may pass to VM.
+ *
+ * @author Petr Hejl
+ * @since 1.18
+ * @see VMArgumentsProvider
+ */
+public final class VMArguments {
+
+ private final String description;
+
+ private final List arguments;
+
+ private VMArguments(String description, List arguments) {
+ this.description = description;
+ this.arguments = arguments;
+ }
+
+ /**
+ * Returns the groups of arguments provided by all registered
+ * {@link VMArgumentsProvider} for the given start mode.
+ *
+ * @param mode the VM mode the client is going to use
+ * @return the groups of arguments provided by all registered
+ * {@link VMArgumentsProvider}
+ */
+ @NonNull
+ public static List getVMArguments(StartMode mode) {
+ Lookup lkp = Lookups.forPath(VMArgumentsRegistrationProcessor.PATH);
+ List res = new ArrayList();
+ for (VMArgumentsProvider prov : lkp.lookupAll(VMArgumentsProvider.class)) {
+ res.add(new VMArguments(prov.getDescription(), prov.getArguments(mode)));
+ }
+ return res;
+ }
+
+ /**
+ * Returns the description of group of arguments.
+ *
+ * @return the description of group of arguments
+ */
+ @NonNull
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * The list of the VM arguments.
+ *
+ * @return list of the VM arguments
+ */
+ @NonNull
+ public List getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Class representing the startup mode of the VM.
+ */
+ public static final class StartMode {
+
+ /**
+ * The normal startup mode.
+ */
+ public static final StartMode NORMAL = new StartMode(
+ NbBundle.getMessage(VMArguments.class, "StartMode_Normal"));
+
+ /**
+ * The debug startup mode.
+ */
+ public static final StartMode DEBUG = new StartMode(
+ NbBundle.getMessage(VMArguments.class, "StartMode_Debug"));
+
+ /**
+ * The profile startup mode.
+ */
+ public static final StartMode PROFILE = new StartMode(
+ NbBundle.getMessage(VMArguments.class, "StartMode_Profile"));
+
+ private final String mode;
+
+ private StartMode(String mode) {
+ this.mode = mode;
+ }
+
+ @Override
+ public String toString() {
+ return mode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final StartMode other = (StartMode) obj;
+ if ((this.mode == null) ? (other.mode != null) : !this.mode.equals(other.mode)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 29 * hash + (this.mode != null ? this.mode.hashCode() : 0);
+ return hash;
+ }
+ }
+}
diff -r 88a51a56d238 server/src/org/netbeans/modules/server/annotations/VMArgumentsRegistrationProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/modules/server/annotations/VMArgumentsRegistrationProcessor.java Thu Dec 15 21:20:32 2011 +0100
@@ -0,0 +1,82 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. 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
+ * nbbuild/licenses/CDDL-GPL-2-CP. 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. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * 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 do not 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.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.server.annotations;
+
+import java.util.Set;
+import javax.annotation.processing.Processor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+import org.netbeans.spi.server.VMArgumentsProvider;
+import org.openide.filesystems.annotations.LayerBuilder.File;
+import org.openide.filesystems.annotations.LayerGeneratingProcessor;
+import org.openide.filesystems.annotations.LayerGenerationException;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Petr Hejl
+ */
+@SupportedAnnotationTypes("org.netbeans.spi.server.VMArgumentsProvider.Registration")
+@ServiceProvider(service = Processor.class)
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+public class VMArgumentsRegistrationProcessor extends LayerGeneratingProcessor {
+
+ public static final String PATH = "Servers/VmArgumentProviders";
+
+ @Override
+ protected boolean handleProcess(Set extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
+ for (Element element : roundEnv.getElementsAnnotatedWith(
+ VMArgumentsProvider.Registration.class)) {
+
+ File f = layer(element).instanceFile(PATH, null, VMArgumentsProvider.class)
+ .intvalue("position", element.getAnnotation(VMArgumentsProvider.Registration.class).position());
+ f.write();
+ }
+ return true;
+ }
+
+}
diff -r 88a51a56d238 server/src/org/netbeans/spi/server/VMArgumentsProvider.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/spi/server/VMArgumentsProvider.java Thu Dec 15 21:20:32 2011 +0100
@@ -0,0 +1,96 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * 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
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. 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
+ * nbbuild/licenses/CDDL-GPL-2-CP. 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. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * 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 do not 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.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.spi.server;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.List;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.server.VMArguments;
+
+/**
+ * Provides the additional arguments to server VM. Typically the server plugin
+ * implementor will query the arguments via API counterpart {@link VMArguments}.
+ * Of course it is not mandatary for server plugin to use such arguments and
+ * there is no way to force it.
+ *
+ * @author Petr Hejl
+ * @since 1.18
+ * @see VMArguments
+ */
+public interface VMArgumentsProvider {
+
+ /**
+ * Returns the description of the provider. For example this might be
+ * "JRebel", "Profiler" etc.
+ *
+ * @return the description of the provider
+ */
+ @NonNull
+ String getDescription();
+
+ /**
+ * Returns the list of arguments to pass to the server VM for the given
+ * start mode.
+ *
+ * @param mode the VM mode the client is going to use
+ * @return the list of arguments to pass to the server VM
+ */
+ @NonNull
+ List getArguments(VMArguments.StartMode mode);
+
+ /**
+ * Annotation used to properly register the SPI implementations.
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @Target({ElementType.TYPE, ElementType.METHOD})
+ public @interface Registration {
+
+ /**
+ * Position of the provider in the list of providers.
+ */
+ int position() default Integer.MAX_VALUE;
+
+ }
+}
diff -r 88a51a56d238 tomcat5/nbproject/project.xml
--- a/tomcat5/nbproject/project.xml Thu Dec 15 15:24:05 2011 +0100
+++ b/tomcat5/nbproject/project.xml Thu Dec 15 21:20:32 2011 +0100
@@ -213,6 +213,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 88a51a56d238 tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java
--- a/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Thu Dec 15 15:24:05 2011 +0100
+++ b/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Thu Dec 15 21:20:32 2011 +0100
@@ -54,6 +54,7 @@
import java.io.InputStream;
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;
@@ -69,6 +70,7 @@
import javax.enterprise.deploy.spi.status.ProgressListener;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.server.VMArguments;
import org.netbeans.modules.tomcat5.progress.ProgressEventSupport;
import org.netbeans.modules.tomcat5.progress.Status;
import org.netbeans.modules.tomcat5.util.LogManager;
@@ -398,6 +400,12 @@
}
}
}
+
+ for (VMArguments args : VMArguments.getVMArguments(getMode(mode))) {
+ for (String singleArg : args.getArguments()) {
+ sb.append(' ').append(singleArg);
+ }
+ }
javaOpts = sb.toString();
}
@@ -573,7 +581,18 @@
StateType.FAILED);
}
}
-
+
+ private VMArguments.StartMode getMode(int mode) {
+ switch (mode) {
+ case MODE_PROFILE:
+ return VMArguments.StartMode.PROFILE;
+ case MODE_DEBUG:
+ return VMArguments.StartMode.DEBUG;
+ default:
+ return VMArguments.StartMode.NORMAL;
+ }
+ }
+
/** Open JULI log and server output */
private void openLogs() {
LogManager logManager = tm.logManager();