--- a/glassfish.common/nbproject/project.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/glassfish.common/nbproject/project.xml Thu Dec 15 13:28:42 2011 +0100
@@ -54,7 +54,7 @@
0
- 1.2
+ 1.18
--- a/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Thu Dec 15 13:27:37 2011 +0400
+++ a/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Thu Dec 15 13:28:42 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,6 +697,14 @@
throw new ProcessCreationException(ioe,
"MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
}
+
+ if (!GlassfishModule.PROFILE_MODE.equals(ip.get(GlassfishModule.JVM_MODE))) {
+ for (VMArguments args : VMArguments.getVMArguments()) {
+ for (String singleArg : args.getArguments()) {
+ argumentBuf.append(' ').append(singleArg);
+ }
+ }
+ }
return argumentBuf;
}
--- a/j2ee.jboss4/nbproject/project.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/j2ee.jboss4/nbproject/project.xml Thu Dec 15 13:28:42 2011 +0100
@@ -162,6 +162,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
--- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Thu Dec 15 13:27:37 2011 +0400
+++ a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Thu Dec 15 13:28:42 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,14 @@
}
}
+ if (startServer.getMode() != JBStartServer.MODE.PROFILE) {
+ for (VMArguments args : VMArguments.getVMArguments()) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
+ }
+
// create new environment for server
javaOpts = javaOptsBuilder.toString();
String javaHome = getJavaHome(platform);
--- a/j2ee.weblogic9/nbproject/project.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/j2ee.weblogic9/nbproject/project.xml Thu Dec 15 13:28:42 2011 +0100
@@ -204,6 +204,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
--- a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Thu Dec 15 13:27:37 2011 +0400
+++ a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Thu Dec 15 13:28:42 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;
@@ -476,6 +477,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()) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
ExternalProcessBuilder result = builder.addEnvironmentVariable(
JAVA_OPTIONS_VARIABLE,
javaOptsBuilder.toString());
@@ -657,9 +663,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()) {
+ for (String singleArg : args.getArguments()) {
+ sb.append(' ').append(singleArg);
+ }
+ }
+ if (sb.length() > 0) {
+ result = builder.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,
+ sb.toString());
}
return result;
}
--- a/server/apichanges.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/server/apichanges.xml Thu Dec 15 13:28:42 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
--- a/server/arch.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/server/arch.xml Thu Dec 15 13:28:42 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.
+
+
--- a/server/manifest.mf Thu Dec 15 13:27:37 2011 +0400
+++ a/server/manifest.mf Thu Dec 15 13:28:42 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
--- a/server/nbproject/project.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/server/nbproject/project.xml Thu Dec 15 13:28:42 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ 0dc0caf347b4 Thu Dec 15 13:28:42 2011 +0100
@@ -0,0 +1,107 @@
+/*
+ * 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.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}.
+ *
+ * @return the groups of arguments provided by all registered
+ * {@link VMArgumentsProvider}
+ */
+ @NonNull
+ public static List getVMArguments() {
+ 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()));
+ }
+ 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;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ 0dc0caf347b4 Thu Dec 15 13:28:42 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;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ 0dc0caf347b4 Thu Dec 15 13:28:42 2011 +0100
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ * @return the list of arguments to pass to the server VM
+ */
+ @NonNull
+ List getArguments();
+
+ /**
+ * 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;
+
+ }
+}
--- a/tomcat5/nbproject/project.xml Thu Dec 15 13:27:37 2011 +0400
+++ a/tomcat5/nbproject/project.xml Thu Dec 15 13:28:42 2011 +0100
@@ -213,6 +213,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
--- a/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Thu Dec 15 13:27:37 2011 +0400
+++ a/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Thu Dec 15 13:28:42 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,13 @@
}
}
}
+ if (mode != MODE_PROFILE) {
+ for (VMArguments args : VMArguments.getVMArguments()) {
+ for (String singleArg : args.getArguments()) {
+ sb.append(' ').append(singleArg);
+ }
+ }
+ }
javaOpts = sb.toString();
}