diff -r 6fa0d51b7a56 glassfish.common/nbproject/project.xml
--- a/glassfish.common/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/nbproject/project.xml Mon Dec 19 21:55:24 2011 +0100
@@ -54,7 +54,7 @@
0
- 1.2
+ 1.18
diff -r 6fa0d51b7a56 glassfish.common/src/org/netbeans/modules/glassfish/common/CommonServerSupport.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/common/CommonServerSupport.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/CommonServerSupport.java Mon Dec 19 21:55:24 2011 +0100
@@ -85,7 +85,6 @@
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.ChangeSupport;
-import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
@@ -367,17 +366,6 @@
return task;
}
- @Override
- public Future startServer(final OperationStateListener stateListener, FileObject jdkRoot, String[] jvmArgs) {
- Logger.getLogger("glassfish").log(Level.FINEST, "CSS.startServer called on thread \"{0}\"", Thread.currentThread().getName()); // NOI18N
- OperationStateListener startServerListener = new StartOperationStateListener(GlassfishModule.ServerState.STOPPED_JVM_PROFILER);
- VMIntrospector vmi = Lookups.forPath(Util.GF_LOOKUP_PATH).lookup(VMIntrospector.class);
- FutureTask task = new FutureTask(
- new StartTask(this, getRecognizers(), vmi, jdkRoot, jvmArgs, startServerListener, stateListener));
- RP.post(task);
- return task;
- }
-
private List getRecognizers() {
List recognizers;
Collection extends RecognizerCookie> cookies = lookup.lookupAll(RecognizerCookie.class);
diff -r 6fa0d51b7a56 glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java Mon Dec 19 21:55:24 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.StartupArguments;
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,26 @@
throw new ProcessCreationException(ioe,
"MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
}
+
+ for (StartupArguments args : StartupArguments.getStartupArguments(
+ support.getInstanceProvider().getInstance(ip.get("url")), getMode(ip.get(GlassfishModule.JVM_MODE)))) {
+ for (String singleArg : args.getArguments()) {
+ argumentBuf.append(' ').append(singleArg);
+ }
+ }
return argumentBuf;
}
+ private static StartupArguments.StartMode getMode(String gfMode) {
+ if (GlassfishModule.PROFILE_MODE.equals(gfMode)) {
+ return StartupArguments.StartMode.PROFILE;
+ } else if (GlassfishModule.DEBUG_MODE.equals(gfMode)) {
+ return StartupArguments.StartMode.DEBUG;
+ } else {
+ return StartupArguments.StartMode.NORMAL;
+ }
+ }
+
private String selectDebugPort() throws IOException {
int debugPort = 9009;
ServerSocket t = null;
diff -r 6fa0d51b7a56 glassfish.common/src/org/netbeans/modules/glassfish/common/actions/ProfileAction.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/common/actions/ProfileAction.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/actions/ProfileAction.java Mon Dec 19 21:55:24 2011 +0100
@@ -47,7 +47,6 @@
import org.netbeans.modules.glassfish.common.Util;
import org.netbeans.modules.glassfish.spi.GlassfishModule;
import org.netbeans.modules.glassfish.spi.GlassfishModule.ServerState;
-import org.netbeans.modules.glassfish.spi.ProfilerCookie;
import org.openide.filesystems.FileObject;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
@@ -73,15 +72,8 @@
private static void performActionImpl(final GlassfishModule commonSupport, Node node) {
commonSupport.setEnvironmentProperty(GlassfishModule.JVM_MODE, GlassfishModule.PROFILE_MODE, true);
- // get the cookie
- ProfilerCookie pc = node.getLookup().lookup(ProfilerCookie.class);
- if (null != pc) {
- Object[] pcData = pc.getData();
- FileObject jdkHome = (FileObject) pcData[0];
- String[] jvmArgs = (String[]) pcData[1];
- if (jvmArgs != null && jvmArgs.length > 0)
- commonSupport.startServer(null,jdkHome,jvmArgs);
- }
+
+ commonSupport.startServer(null);
}
protected boolean enable(Node[] activatedNodes) {
@@ -104,8 +96,7 @@
}
private static boolean enableImpl(GlassfishModule commonSupport, Node node) {
- ProfilerCookie pc = node.getLookup().lookup(ProfilerCookie.class);
- return null != pc && commonSupport.getServerState() == ServerState.STOPPED &&
+ return commonSupport.getServerState() == ServerState.STOPPED &&
null != commonSupport.getInstanceProperties().get(GlassfishModule.DOMAINS_FOLDER_ATTR) &&
Util.isDefaultOrServerTarget(commonSupport.getInstanceProperties());
}
diff -r 6fa0d51b7a56 glassfish.common/src/org/netbeans/modules/glassfish/spi/GlassfishModule.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/spi/GlassfishModule.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/spi/GlassfishModule.java Mon Dec 19 21:55:24 2011 +0100
@@ -185,17 +185,6 @@
public Future startServer(OperationStateListener stateListener);
/**
- * Start the server with a specific JDK.
- *
- * @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 startServer(OperationStateListener stateListener,FileObject jdkRoot, String[] jvmArgs);
-
- /**
* Stop the server.
*
* XXX returned Future instance shouldn't "finish" until server vm has
diff -r 6fa0d51b7a56 glassfish.common/src/org/netbeans/modules/glassfish/spi/ProfilerCookie.java
--- a/glassfish.common/src/org/netbeans/modules/glassfish/spi/ProfilerCookie.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.common/src/org/netbeans/modules/glassfish/spi/ProfilerCookie.java Mon Dec 19 21:55:24 2011 +0100
@@ -1,63 +0,0 @@
-//
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2010 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 2008 Sun Microsystems, Inc.
- */
-//
-
-package org.netbeans.modules.glassfish.spi;
-
-/**
- *
- * @author vkraemer
- */
-public interface ProfilerCookie {
- /**
- * This is a conduit for data that the we need to get from the profiler that
- * is buried in org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler
- * as org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings
- *
- * @return a two element array. Object[0] is a FileObject that is the root
- * directory of the JDK to use for running the app server. Object[0] is a
- * String[] of extra arguments that need to be used to start the JVM in
- * profiled mode.
- */
- public Object[] getData();
-}
diff -r 6fa0d51b7a56 glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2StartServer.java
--- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2StartServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2StartServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -72,12 +72,10 @@
import org.netbeans.modules.glassfish.spi.GlassfishModule;
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
import org.netbeans.modules.glassfish.spi.OperationStateListener;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
-import org.openide.filesystems.FileObject;
import org.openide.util.NbBundle;
/**
@@ -431,7 +429,7 @@
}
@Override
- public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) {
+ public ProgressObject startProfiling(Target target) {
if (ProfilerSupport.getState() == ProfilerSupport.STATE_BLOCKING) {
fireHandleProgressEvent(null, new Hk2DeploymentStatus(
CommandType.START, StateType.RUNNING, ActionType.EXECUTE,
@@ -453,11 +451,6 @@
// String domainLocation = commonSupport.getInstanceProperties().get(GlassfishModule.DOMAINS_FOLDER_ATTR);
// String domainName = commonSupport.getInstanceProperties().get(GlassfishModule.DOMAIN_NAME_ATTR);
commonSupport.setEnvironmentProperty(GlassfishModule.JVM_MODE, GlassfishModule.PROFILE_MODE, true);
- Iterator iter = settings.getJavaPlatform().getInstallFolders().iterator();
- FileObject jdkRoot = null;
- if (iter.hasNext()) {
- jdkRoot = iter.next();
- }
commonSupport.startServer(new OperationStateListener() {
@Override
@@ -486,7 +479,7 @@
CommandType.START, translateState(newState), ActionType.EXECUTE,
message));
}
- }, jdkRoot, settings.getJvmArgs());
+ });
}
return this;
}
diff -r 6fa0d51b7a56 glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java
--- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java Mon Dec 19 07:32:04 2011 +0100
+++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java Mon Dec 19 21:55:24 2011 +0100
@@ -44,15 +44,11 @@
import java.util.Collection;
import java.util.Collections;
-import org.netbeans.api.java.platform.JavaPlatform;
import org.netbeans.modules.glassfish.eecommon.api.LogHyperLinkSupport;
-import org.netbeans.modules.glassfish.spi.ProfilerCookie;
import org.netbeans.modules.glassfish.spi.Recognizer;
import org.netbeans.modules.glassfish.spi.RecognizerCookie;
import org.netbeans.modules.glassfish.spi.RemoveCookie;
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
-import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
import org.openide.util.Lookup;
import org.openide.windows.OutputListener;
@@ -61,7 +57,7 @@
*
* @author Peter Williams
*/
-public class JavaEEServerModule implements RemoveCookie, ProfilerCookie, RecognizerCookie {
+public class JavaEEServerModule implements RemoveCookie, RecognizerCookie {
private final InstanceProperties instanceProperties;
private final LogHyperLinkSupport.AppServerLogSupport logSupport;
@@ -83,26 +79,6 @@
}
// ------------------------------------------------------------------------
- // ProfilerCookie support
- // ------------------------------------------------------------------------
- public Object[] getData() {
- Profiler profiler = Lookup.getDefault().lookup(Profiler.class);
- Object[] retVal = new Object[2];
- retVal[0] = JavaPlatform.getDefault().getInstallFolders().iterator().next();
- retVal[1] = new String[0];
- if (profiler == null) {
- return retVal;
- }
- final ProfilerServerSettings settings = profiler.getSettings(instanceProperties.getProperty(InstanceProperties.URL_ATTR));
- if (settings == null) {
- return retVal;
- }
- retVal[0] = settings.getJavaPlatform().getInstallFolders().iterator().next();
- retVal[1] = settings.getJvmArgs();
- return retVal;
- }
-
- // ------------------------------------------------------------------------
// RecognizerCookie support
// ------------------------------------------------------------------------
public Collection extends Recognizer> getRecognizers() {
diff -r 6fa0d51b7a56 j2ee.ant/antsrc/org/netbeans/modules/j2ee/ant/StartProfiledServer.java
--- a/j2ee.ant/antsrc/org/netbeans/modules/j2ee/ant/StartProfiledServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.ant/antsrc/org/netbeans/modules/j2ee/ant/StartProfiledServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -53,7 +53,6 @@
import org.netbeans.api.java.platform.JavaPlatformManager;
import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
import org.openide.filesystems.*;
import org.netbeans.api.project.FileOwnerQuery;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
@@ -102,15 +101,11 @@
if (envvar == null) {
envvar = new String[0];
}
- ProfilerServerSettings settings = new ProfilerServerSettings(
- platform,
- jvmarg.getVmCommand().getArguments(),
- envvar);
FileObject fo = FileUtil.toFileObject(getProject().getBaseDir());
fo.refresh(); // without this the "build" directory is not found in filesystems
J2eeModuleProvider jmp = (J2eeModuleProvider)FileOwnerQuery.getOwner(fo).getLookup().lookup(J2eeModuleProvider.class);
ServerInstance si = ServerRegistry.getInstance().getServerInstance(jmp.getServerInstanceID());
- if (!si.startProfile(settings, forceRestart, this)) {
+ if (!si.startProfile(forceRestart, this)) {
String msg = NbBundle.getMessage(StartProfiledServer.class, "MSG_StartupFailed");
throw new BuildException(msg);
}
diff -r 6fa0d51b7a56 j2ee.jboss4/nbproject/project.xml
--- a/j2ee.jboss4/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.jboss4/nbproject/project.xml Mon Dec 19 21:55:24 2011 +0100
@@ -134,7 +134,7 @@
4
- 1.72
+ 1.88
@@ -162,6 +162,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 6fa0d51b7a56 j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java
--- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java Mon Dec 19 21:55:24 2011 +0100
@@ -62,9 +62,10 @@
import javax.enterprise.deploy.shared.CommandType;
import javax.enterprise.deploy.shared.StateType;
import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.server.StartupArguments;
+import org.netbeans.modules.j2ee.deployment.plugins.api.CommonBridge;
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;
import org.netbeans.modules.j2ee.jboss4.JBDeploymentManager;
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils;
@@ -120,13 +121,11 @@
private JBDeploymentManager dm;
private String instanceName;
private JBStartServer startServer;
- private ProfilerServerSettings profilerSettings;
- JBStartRunnable(ProfilerServerSettings profilerSettings, JBDeploymentManager dm, JBStartServer startServer) {
+ JBStartRunnable(JBDeploymentManager dm, JBStartServer startServer) {
this.dm = dm;
this.instanceName = dm.getInstanceProperties().getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
this.startServer = startServer;
- this.profilerSettings = profilerSettings;
}
public void run() {
@@ -205,7 +204,7 @@
}
// get Java platform that will run the server
- JavaPlatform platform = (startServer.getMode() != JBStartServer.MODE.PROFILE ? properties.getJavaPlatform() : profilerSettings.getJavaPlatform());
+ JavaPlatform platform = properties.getJavaPlatform();
if (startServer.getMode() == JBStartServer.MODE.DEBUG && javaOptsBuilder.toString().indexOf("-Xdebug") == -1) { // NOI18N
// if in debug mode and the debug options not specified manually
@@ -217,18 +216,19 @@
append(",server=y,suspend=n"); // NOI18N
} else if (startServer.getMode() == JBStartServer.MODE.PROFILE) {
-
- // get JVM arguments used for starting the server
- String[] profJvmArgs = profilerSettings.getJvmArgs();
- for (int i = 0; i < profJvmArgs.length; i++) {
- javaOptsBuilder.append(" ").append(profJvmArgs[i]); // NOI18N
- }
if (properties.isVersion(JBPluginUtils.JBOSS_6_0_0)) {
javaOptsBuilder.append(" ").append("-Djboss.platform.mbeanserver")
.append(" ").append("-Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl");
}
}
+ for (StartupArguments args : StartupArguments.getStartupArguments(
+ CommonBridge.getCommonInstance(ip.getProperty("url")), 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 +241,17 @@
};
return envp;
}
-
+
+ private static StartupArguments.StartMode getMode(JBStartServer.MODE jbMode) {
+ if (JBStartServer.MODE.PROFILE.equals(jbMode)) {
+ return StartupArguments.StartMode.PROFILE;
+ } else if (JBStartServer.MODE.DEBUG.equals(jbMode)) {
+ return StartupArguments.StartMode.DEBUG;
+ } else {
+ return StartupArguments.StartMode.NORMAL;
+ }
+ }
+
private boolean checkPorts(final InstanceProperties ip) {
try {
diff -r 6fa0d51b7a56 j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java
--- a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -45,7 +45,6 @@
import java.net.URISyntaxException;
import java.util.Collections;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
import org.netbeans.modules.j2ee.jboss4.JBDeploymentManager;
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
import java.io.IOException;
@@ -117,7 +116,7 @@
String serverName = dm.getInstanceProperties().getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
fireHandleProgressEvent(null, new JBDeploymentStatus(ActionType.EXECUTE, CommandType.START, StateType.RUNNING, NbBundle.getMessage(JBStartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName))); //NOI18N
mode = MODE.DEBUG;
- RequestProcessor.getDefault().post(new JBStartRunnable(null, dm, this), 0, Thread.NORM_PRIORITY);
+ RequestProcessor.getDefault().post(new JBStartRunnable(dm, this), 0, Thread.NORM_PRIORITY);
addDebugModeUri();
return this;
}
@@ -151,11 +150,11 @@
/**
* Starts the server in profiling mode.
*/
- public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) {
+ public ProgressObject startProfiling(Target target) {
String serverName = dm.getInstanceProperties().getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
fireHandleProgressEvent(null, new JBDeploymentStatus(ActionType.EXECUTE, CommandType.START, StateType.RUNNING, NbBundle.getMessage(JBStartServer.class, "MSG_START_PROFILED_SERVER_IN_PROGRESS", serverName))); //NOI18N
mode = MODE.PROFILE;
- RequestProcessor.getDefault().post(new JBStartRunnable(settings, dm, this), 0, Thread.NORM_PRIORITY);
+ RequestProcessor.getDefault().post(new JBStartRunnable(dm, this), 0, Thread.NORM_PRIORITY);
removeDebugModeUri();
return this;
}
@@ -188,7 +187,7 @@
String serverName = dm.getInstanceProperties().getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
fireHandleProgressEvent(null, new JBDeploymentStatus(ActionType.EXECUTE, CommandType.START, StateType.RUNNING, NbBundle.getMessage(JBStartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName)));//NOI18N
mode = MODE.RUN;
- RequestProcessor.getDefault().post(new JBStartRunnable(null, dm, this), 0, Thread.NORM_PRIORITY);
+ RequestProcessor.getDefault().post(new JBStartRunnable(dm, this), 0, Thread.NORM_PRIORITY);
removeDebugModeUri();
return this;
}
diff -r 6fa0d51b7a56 j2ee.weblogic9/nbproject/project.xml
--- a/j2ee.weblogic9/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.weblogic9/nbproject/project.xml Mon Dec 19 21:55:24 2011 +0100
@@ -149,7 +149,7 @@
4
- 1.78
+ 1.88
@@ -204,6 +204,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 6fa0d51b7a56 j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java
--- a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -69,18 +69,16 @@
import org.netbeans.api.extexecution.input.InputProcessors;
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.StartupArguments;
+import org.netbeans.modules.j2ee.deployment.plugins.api.CommonBridge;
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;
import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
import org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager;
import org.netbeans.modules.j2ee.weblogic9.WLDeploymentFactory;
import org.netbeans.modules.j2ee.weblogic9.WLPluginProperties;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.InputOutput;
@@ -202,8 +200,7 @@
* @see org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer#startProfiling(javax.enterprise.deploy.spi.Target, org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings)
*/
@Override
- public ProgressObject startProfiling( Target target,
- ProfilerServerSettings settings )
+ public ProgressObject startProfiling( Target target )
{
LOGGER.log(Level.FINER, "Starting server in profiling mode"); // NOI18N
@@ -215,7 +212,7 @@
NbBundle.getMessage(WLStartServer.class, "MSG_START_SERVER_IN_PROGRESS", serverName));
String uri = dm.getUri();
- service.submit(new WLProfilingStartTask(uri, serverProgress, dm, settings));
+ service.submit(new WLProfilingStartTask(uri, serverProgress, dm));
removeServerInDebug(uri);
return serverProgress;
@@ -364,13 +361,10 @@
private class WLProfilingStartTask extends WLStartTask {
- private final ProfilerServerSettings mySettings;
-
public WLProfilingStartTask(String uri, WLServerProgress serverProgress,
- WLDeploymentManager dm, ProfilerServerSettings settings) {
+ WLDeploymentManager dm) {
super( uri , serverProgress, dm );
- mySettings = settings;
}
/* (non-Javadoc)
@@ -409,20 +403,23 @@
}*/
StringBuilder javaOptsBuilder = new StringBuilder();
- String[] profJvmArgs = getSettings().getJvmArgs();
- for (int i = 0; i < profJvmArgs.length; i++) {
- javaOptsBuilder.append(" ").append(profJvmArgs[i]); // NOI18N
- }
String javaOpts = dm.getInstanceProperties().getProperty(
WLPluginProperties.JAVA_OPTS);
if ( javaOpts!= null && javaOpts.trim().length() >0 ){
javaOptsBuilder.append( " " ); // NOI18N
javaOptsBuilder.append( javaOpts.trim() );
}
-
- if ( profJvmArgs.length >0 ){
+
+ for (StartupArguments args : StartupArguments.getStartupArguments(
+ CommonBridge.getCommonInstance(dm.getUri()), StartupArguments.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;
}
@@ -438,15 +435,6 @@
}
return super.isRunning();
}
-
- private String getJavaHome(JavaPlatform platform) {
- FileObject fo = (FileObject)platform.getInstallFolders().iterator().next();
- return FileUtil.toFile(fo).getAbsolutePath();
- }
-
- private ProfilerServerSettings getSettings() {
- return mySettings;
- }
}
private class WLDebugStartTask extends WLStartTask {
@@ -476,6 +464,12 @@
javaOptsBuilder.append("-Xdebug -Xnoagent -Djava.compiler=none "); // NOI18N
javaOptsBuilder.append("-Xrunjdwp:server=y,suspend=n,transport=dt_socket,address=");// NOI18N
javaOptsBuilder.append( debugPort );
+ for (StartupArguments args : StartupArguments.getStartupArguments(
+ CommonBridge.getCommonInstance(dm.getUri()), StartupArguments.StartMode.DEBUG)) {
+ for (String singleArg : args.getArguments()) {
+ javaOptsBuilder.append(' ').append(singleArg);
+ }
+ }
ExternalProcessBuilder result = builder.addEnvironmentVariable(
JAVA_OPTIONS_VARIABLE,
javaOptsBuilder.toString());
@@ -657,9 +651,17 @@
{
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 (StartupArguments args : StartupArguments.getStartupArguments(
+ CommonBridge.getCommonInstance(dm.getUri()), StartupArguments.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 6fa0d51b7a56 j2eeserver/apichanges.xml
--- a/j2eeserver/apichanges.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/apichanges.xml Mon Dec 19 21:55:24 2011 +0100
@@ -116,6 +116,24 @@
+
+
+
+ Added CommonBridge utility class to provide mapping of
+ instance url to common api server instance.
+
+
+
+
+
+
+
+ Added CommonBridge utility class to provide mapping of
+ instance url to common api server instance.
+
+
+
+
diff -r 6fa0d51b7a56 j2eeserver/nbproject/project.properties
--- a/j2eeserver/nbproject/project.properties Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/nbproject/project.properties Mon Dec 19 21:55:24 2011 +0100
@@ -42,7 +42,7 @@
is.autoload=true
javac.source=1.6
-spec.version.base=1.87.0
+spec.version.base=1.88.0
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/ServerManager.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/ServerManager.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/ServerManager.java Mon Dec 19 21:55:24 2011 +0100
@@ -53,6 +53,7 @@
import org.netbeans.modules.j2ee.deployment.impl.bridge.BridgingServerInstanceProvider;
import org.netbeans.modules.j2ee.deployment.impl.bridge.ServerInstanceProviderLookup;
import org.netbeans.modules.j2ee.deployment.impl.ui.wizard.AddServerInstanceWizard;
+import org.netbeans.modules.j2ee.deployment.plugins.api.CommonBridge;
/**
* ServerManager class provides access to the Server Manager dialog.
@@ -80,20 +81,7 @@
*/
public static void showCustomizer(String serverInstanceID) {
// bridge to new infrastructure (common server)
- ServerInstance bridgingInstance = null;
- org.netbeans.modules.j2ee.deployment.impl.ServerInstance j2eeInstance =
- ServerRegistry.getInstance().getServerInstance(serverInstanceID);
- if (j2eeInstance != null) {
- Collection extends org.netbeans.spi.server.ServerInstanceProvider> providers = ServerInstanceProviderLookup.getInstance().lookupAll(org.netbeans.spi.server.ServerInstanceProvider.class);
- for (org.netbeans.spi.server.ServerInstanceProvider provider : providers) {
- if (provider instanceof BridgingServerInstanceProvider) {
- bridgingInstance = ((BridgingServerInstanceProvider) provider).getBridge(j2eeInstance);
- if (bridgingInstance != null) {
- break;
- }
- }
- }
- }
+ ServerInstance bridgingInstance = CommonBridge.getCommonInstance(serverInstanceID);
CommonServerUIs.showCustomizer(bridgingInstance);
}
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java Mon Dec 19 21:55:24 2011 +0100
@@ -66,7 +66,6 @@
import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.ArtifactListener.Artifact;
import org.netbeans.modules.j2ee.deployment.plugins.spi.JDBCDriverDeployer;
-import org.openide.filesystems.*;
import java.util.*;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
@@ -94,7 +93,6 @@
import org.netbeans.modules.j2ee.deployment.plugins.spi.MessageDestinationDeployment;
import org.netbeans.modules.j2ee.deployment.plugins.spi.ServerInstanceDescriptor;
import org.netbeans.modules.j2ee.deployment.plugins.spi.ServerLibraryManager;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
import org.openide.nodes.Node;
@@ -180,7 +178,6 @@
private final ChangeSupport managerChangeSupport = new ChangeSupport(this);
private volatile static ServerInstance profiledServerInstance;
- private ProfilerServerSettings profilerSettings;
private final DebuggerStateListener debuggerStateListener;
@@ -1113,11 +1110,10 @@
}
/** Start the admin server in the profile mode. Show UI feedback.
- * @param settings settings that will be used to start the server
*
* @throws ServerException if the server cannot be started.
*/
- public void startProfile(ProfilerServerSettings settings, boolean forceRestart, ProgressUI ui)
+ public void startProfile(boolean forceRestart, ProgressUI ui)
throws ServerException {
// check whether another server not already running in profile mode
// and ask whether it is ok to stop it
@@ -1137,7 +1133,7 @@
try {
setServerState(STATE_WAITING);
// target == null - admin server
- _startProfile(null, settings, forceRestart, ui);
+ _startProfile(null, forceRestart, ui);
} finally {
refresh();
}
@@ -1161,7 +1157,7 @@
if (stopped) {
// restart in the mode the server was running in before
if (inProfile) {
- _startProfile(null, profilerSettings, true, ui);
+ _startProfile(null, true, ui);
} else if (inDebug) {
startDebugTarget(null, ui);
} else {
@@ -1267,12 +1263,12 @@
*
* @throws ServerException if the server cannot be started.
*/
- public boolean startProfile(final ProfilerServerSettings settings, boolean forceRestart, Deployment.Logger logger) {
+ public boolean startProfile(boolean forceRestart, Deployment.Logger logger) {
String title = NbBundle.getMessage(ServerInstance.class, "LBL_StartServerInProfileMode", getDisplayName());
ProgressUI ui = new ProgressUI(title, false, logger);
try {
ui.start();
- startProfile(settings, forceRestart, ui);
+ startProfile(forceRestart, ui);
return true;
} catch (ServerException ex) {
return false;
@@ -1500,15 +1496,10 @@
/** start server in the profile mode */
private void _startProfile(
Target target,
- ProfilerServerSettings settings,
boolean forceRestart,
ProgressUI ui) throws ServerException {
- ProfilerServerSettings tmpProfilerSettings;
- synchronized (this) {
- tmpProfilerSettings = profilerSettings;
- }
ServerInstance tmpProfiledServerInstance = profiledServerInstance;
- if (tmpProfiledServerInstance == this && !forceRestart && settings.equals(tmpProfilerSettings)) {
+ if (tmpProfiledServerInstance == this && !forceRestart) {
return; // server is already runnning in profile mode, no need to restart the server
}
if (tmpProfiledServerInstance != null && tmpProfiledServerInstance != this) {
@@ -1528,7 +1519,7 @@
throw new ServerException(NbBundle.getMessage(ServerInstance.class, "MSG_ProfilerNotRegistered"));
}
profiler.notifyStarting();
- ProgressObject po = getStartServer().startProfiling(target, settings);
+ ProgressObject po = getStartServer().startProfiling(target);
try {
boolean completedSuccessfully = ProgressObjectUtil.trackProgressObject(ui, po, DEFAULT_TIMEOUT);
if (!completedSuccessfully) {
@@ -1540,7 +1531,6 @@
}
profiledServerInstance = this;
synchronized (this) {
- profilerSettings = settings;
managerStartedByIde = true;
// coTarget = null;
// targets = null;
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/TargetServer.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/TargetServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/TargetServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -93,10 +93,7 @@
import org.netbeans.modules.j2ee.deployment.plugins.spi.IncrementalDeployment2;
import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfiguration;
import org.netbeans.modules.j2ee.deployment.plugins.spi.TargetModuleIDResolver;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
-import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
import org.openide.util.Exceptions;
-import org.openide.util.Lookup;
/**
* Encapsulates a set of ServerTarget(s), provides a wrapper for deployment
@@ -519,7 +516,6 @@
break;
}
case PROFILE: {
- ProfilerServerSettings settings = Lookup.getDefault().lookup(Profiler.class).getSettings(instance.getUrl(), false);
final CountDownLatch latch = new CountDownLatch(1);
ServerInstance.StateListener sl = new ServerInstance.StateListener() {
@@ -534,7 +530,7 @@
instance.addStateListener(sl);
try {
- instance.startProfile(settings, false, ui);
+ instance.startProfile(false, ui);
try {
// need to wait for profiler to load the agent etc.
// 60 seconds timeout; instrumentation may slow down the startup significantly
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/bridge/BridgingServerInstance.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/bridge/BridgingServerInstance.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/bridge/BridgingServerInstance.java Mon Dec 19 21:55:24 2011 +0100
@@ -52,20 +52,24 @@
import org.netbeans.modules.j2ee.deployment.impl.ui.actions.CustomizerAction;
import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer;
import org.netbeans.spi.server.ServerInstanceFactory;
-import org.netbeans.spi.server.ServerInstanceImplementation;
import org.netbeans.api.server.CommonServerUIs;
+import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
+import org.netbeans.modules.j2ee.deployment.plugins.spi.support.LookupProviderSupport;
+import org.netbeans.spi.server.ServerInstanceImplementation2;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
+import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;
import org.openide.util.actions.SystemAction;
+import org.openide.util.lookup.Lookups;
/**
*
* @author Petr Hejl
*/
-public class BridgingServerInstance implements ServerInstanceImplementation, Node.Cookie {
+public class BridgingServerInstance implements ServerInstanceImplementation2, Node.Cookie {
private final org.netbeans.modules.j2ee.deployment.impl.ServerInstance instance;
@@ -135,6 +139,12 @@
instance.remove();
}
+ @Override
+ public Lookup getLookup() {
+ J2eePlatform platform = instance.getJ2eePlatform();
+ return Lookups.fixed(Lookups.proxy(platform), platform);
+ }
+
public ServerInstance getCommonInstance() {
synchronized (this) {
return commonInstance;
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ui/actions/ProfileAction.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ui/actions/ProfileAction.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ui/actions/ProfileAction.java Mon Dec 19 21:55:24 2011 +0100
@@ -47,10 +47,7 @@
import org.netbeans.modules.j2ee.deployment.impl.ServerException;
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;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
-import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.nodes.Node;
@@ -92,21 +89,21 @@
}
final ServerInstance si = (ServerInstance)nodes[0].getCookie(ServerInstance.class);
if (si != null) {
- Profiler profiler = ServerRegistry.getProfiler();
- if (profiler == null) {
- return;
- }
- final ProfilerServerSettings settings = profiler.getSettings(si.getUrl());
- if (settings == null) {
- return;
- }
+// Profiler profiler = ServerRegistry.getProfiler();
+// if (profiler == null) {
+// return;
+// }
+// final ProfilerServerSettings settings = profiler.getSettings(si.getUrl());
+// if (settings == null) {
+// return;
+// }
RP.post(new Runnable() {
public void run() {
String title = NbBundle.getMessage(DebugAction.class, "LBL_Profiling", si.getDisplayName());
ProgressUI progressUI = new ProgressUI(title, false);
try {
progressUI.start();
- si.startProfile(settings, false, progressUI);
+ si.startProfile(false, progressUI);
} catch (ServerException ex) {
String msg = ex.getLocalizedMessage();
NotifyDescriptor desc = new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE);
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/CommonBridge.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/CommonBridge.java Mon Dec 19 21:55:24 2011 +0100
@@ -0,0 +1,100 @@
+/*
+ * 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.j2ee.deployment.plugins.api;
+
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry;
+import org.netbeans.modules.j2ee.deployment.impl.bridge.BridgingServerInstanceProvider;
+import org.netbeans.modules.j2ee.deployment.impl.bridge.ServerInstanceProviderLookup;
+import org.netbeans.spi.server.ServerInstanceProvider;
+import org.openide.util.Parameters;
+
+/**
+ * The utility class providing bridge to API classes of the common server.
+ *
+ * @author Petr Hejl
+ * @since 1.88
+ */
+public final class CommonBridge {
+
+ private CommonBridge() {
+ super();
+ }
+
+ private static final Logger LOGGER = Logger.getLogger(CommonBridge.class.getName());
+
+ /**
+ * Returns the {@link ServerInstance} corresponding to the server instance
+ * identified by the given url.
+ *
+ * @param instanceUrl the server instance url
+ * @return the {@link ServerInstance} corresponding to the server instance
+ * identified by the given url
+ */
+ @NonNull
+ public static ServerInstance getCommonInstance(@NonNull String instanceUrl) {
+ Parameters.notNull("instanceUrl", instanceUrl);
+
+ org.netbeans.modules.j2ee.deployment.impl.ServerInstance instance =
+ ServerRegistry.getInstance().getServerInstance(instanceUrl);
+ ServerInstance bridgingInstance = null;
+ Collection extends ServerInstanceProvider> providers =
+ ServerInstanceProviderLookup.getInstance().lookupAll(ServerInstanceProvider.class);
+ for (ServerInstanceProvider provider : providers) {
+ if (provider instanceof BridgingServerInstanceProvider) {
+ bridgingInstance = ((BridgingServerInstanceProvider) provider).getBridge(instance);
+ if (bridgingInstance != null) {
+ break;
+ }
+ }
+ }
+ if (bridgingInstance == null) {
+ LOGGER.log(Level.INFO, "No bridging instance for {0}", instance);
+ throw new IllegalStateException("Instance registered without UI. No common instance available.");
+ }
+ return bridgingInstance;
+ }
+}
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java Mon Dec 19 21:55:24 2011 +0100
@@ -48,7 +48,6 @@
import javax.enterprise.deploy.spi.Target;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
-import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
/**
* Server lifecycle services from the IDE. J2eeserver will use these
@@ -247,13 +246,12 @@
*
* @param target the target server in question, null target implies
* the admin server.
- * @param settings profiler server settings.
*
* @return ServerProgress object to monitor progress on start operation.
*
* @since 1.9
*/
- public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) {
+ public ProgressObject startProfiling(Target target) {
throw new UnsupportedOperationException("Starting in profile mode is not supported by this server."); // NIO18N
}
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/api/ProfilerServerSettings.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/api/ProfilerServerSettings.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/api/ProfilerServerSettings.java Mon Dec 19 21:55:24 2011 +0100
@@ -54,7 +54,10 @@
* Settings that will be used for profiled server startup.
*
* @author sherold
+ *
+ * @deprecated
*/
+@Deprecated
public final class ProfilerServerSettings {
private JavaPlatform javaPlatform;
diff -r 6fa0d51b7a56 j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/spi/Profiler.java
--- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/spi/Profiler.java Mon Dec 19 07:32:04 2011 +0100
+++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/profiler/spi/Profiler.java Mon Dec 19 21:55:24 2011 +0100
@@ -81,7 +81,10 @@
*
* @return required settings or null
if user cancelled starting
* the server.
+ *
+ * @deprecated
*/
+ @Deprecated
ProfilerServerSettings getSettings(String serverInstanceID);
/**
@@ -94,7 +97,10 @@
*
* @return required settings or null
if user cancelled starting
* the server.
+ *
+ * @deprecated
*/
+ @Deprecated
ProfilerServerSettings getSettings(String serverInstanceID, boolean verbose);
/**
diff -r 6fa0d51b7a56 profiler.j2ee/nbproject/project.xml
--- a/profiler.j2ee/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/profiler.j2ee/nbproject/project.xml Mon Dec 19 21:55:24 2011 +0100
@@ -260,6 +260,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.awt
diff -r 6fa0d51b7a56 profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProfilerSPI.java
--- a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProfilerSPI.java Mon Dec 19 07:32:04 2011 +0100
+++ b/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProfilerSPI.java Mon Dec 19 21:55:24 2011 +0100
@@ -170,8 +170,6 @@
private boolean refreshServerInstance = false;
private boolean serverStartedFromIDE = false;
private /*static final*/ int STARTING_STATE_TIMEOUT = 20000; // timeout for starting the agent [ms]
- private int profilerAgentID = -111; // should differ from default J2EEProjectTypeProfiler.getLastAgentID()
- private int profilerAgentPort = 0; // should differ from default J2EEProjectTypeProfiler.getLastAgentPort()
private long profilerAgentStartingTime = -1;
//~ Constructors -------------------------------------------------------------------------------------------------------------
@@ -349,6 +347,8 @@
* @return state of Profiler agent instance.
*/
public synchronized int getState() {
+ int profilerAgentID = J2EEProjectProfilingSupportProvider.getLastAgentID();
+ int profilerAgentPort = J2EEProjectProfilingSupportProvider.getLastAgentPort();
int agentState = checkState();
ProfilerLogger.log(">>> Profiler agent [port=" + profilerAgentPort + ", id=" + profilerAgentID + "]: "
+ getPublicAgentStateString(agentState)); // NOI18N
@@ -418,9 +418,7 @@
* allows the Profiler to correctly detect STATE_STARTING.
*/
public void notifyStarting() {
- profilerAgentID = J2EEProjectProfilingSupportProvider.getLastAgentID();
- profilerAgentPort = J2EEProjectProfilingSupportProvider.getLastAgentPort();
-
+ int profilerAgentPort = J2EEProjectProfilingSupportProvider.getLastAgentPort();
NetBeansProfiler.getDefaultNB().cleanForProfilingOnPort(profilerAgentPort); // try to kill an agent on port if some exists
profilerAgentStartingTime = System.currentTimeMillis();
@@ -491,6 +489,8 @@
// we only stop the agent if in STATE_BLOCKING state
if (getState() == ProfilerSupport.STATE_BLOCKING) {
+ int profilerAgentID = J2EEProjectProfilingSupportProvider.getLastAgentID();
+ int profilerAgentPort = J2EEProjectProfilingSupportProvider.getLastAgentPort();
Profiler.getDefault().shutdownBlockedAgent("localhost", profilerAgentPort, profilerAgentID); // NOI18N
for (int i = 0; i < 60; i++) { // 30sec timeout on profiled application shutdown (thread sleeps 500ms)
@@ -517,6 +517,7 @@
} finally {
// reset the shutdown progress flag
profilerAgentShutdownProgress = false;
+ J2EEProjectProfilingSupportProvider.resetLastValues();
}
}
};
@@ -614,6 +615,8 @@
// --- Private implementation ------------------------------------------------
private int checkState() {
+ int profilerAgentID = J2EEProjectProfilingSupportProvider.getLastAgentID();
+ int profilerAgentPort = J2EEProjectProfilingSupportProvider.getLastAgentPort();
int currentAgentState = NetBeansProfiler.getDefault().getAgentState("localhost", profilerAgentPort, profilerAgentID); // NOI18N
//System.err.println(">>> Detected internal agent state: " + getInternalAgentStateString(currentAgentState));
diff -r 6fa0d51b7a56 profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectProfilingSupportProvider.java
--- a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectProfilingSupportProvider.java Mon Dec 19 07:32:04 2011 +0100
+++ b/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectProfilingSupportProvider.java Mon Dec 19 21:55:24 2011 +0100
@@ -179,6 +179,11 @@
public static int getLastAgentPort() {
return lastAgentPort;
}
+
+ public static void resetLastValues() {
+ lastAgentID = -1;
+ lastAgentPort = -1;
+ }
public static String getServerInstanceID(final Project project) {
J2eeModuleProvider serverInstanceModuleProvider = project.getLookup().lookup(J2eeModuleProvider.class);
diff -r 6fa0d51b7a56 profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/impl/ProfilerArgsProvider.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/impl/ProfilerArgsProvider.java Mon Dec 19 21:55:24 2011 +0100
@@ -0,0 +1,74 @@
+/*
+ * 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.profiler.j2ee.impl;
+
+import java.util.Collections;
+import java.util.List;
+import org.netbeans.api.server.ServerInstance;
+import org.netbeans.api.server.StartupArguments.StartMode;
+import org.netbeans.modules.j2ee.deployment.profiler.spi.Profiler;
+import org.netbeans.spi.server.StartupArgumentsProvider;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author Jaroslav Bachorik
+ */
+@StartupArgumentsProvider.Registration
+public class ProfilerArgsProvider implements StartupArgumentsProvider {
+ @Override
+ public List getArguments(ServerInstance instance, StartMode mode) {
+ if (mode == StartMode.PROFILE) {
+ Profiler p = Lookup.getDefault().lookup(Profiler.class);
+ //FIXME get ProfilerServerSettings or JavaPlatform from Lookup
+ // ie ProfilerServerSettings ps instance.getLookup().lookup(ProfilerServerSettings.class);
+
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override
+ public String getDescription() {
+ return "NetBeans Profiler";
+ }
+
+}
diff -r 6fa0d51b7a56 profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/mf-layer.xml
--- a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/mf-layer.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/mf-layer.xml Mon Dec 19 21:55:24 2011 +0100
@@ -253,4 +253,12 @@
+
+
+
+
+
+
+
+
diff -r 6fa0d51b7a56 server/apichanges.xml
--- a/server/apichanges.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/server/apichanges.xml Mon Dec 19 21:55:24 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 6fa0d51b7a56 server/arch.xml
--- a/server/arch.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/server/arch.xml Mon Dec 19 21:55:24 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/StartupArgumentsProviders
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 arguments
+ for the server in a standardized way. In order to do so it will register
+ a implementation of
+ StartupArgumentsProvider
+ to the layer folder Servers/VMArgumentProviders. The annotation
+ StartupArgumentsProvider.Registration
+ can be used for that.
+
+
+ The clients (server plugin implementations) may query the providers via the
+ API class
+ StartupArguments
+ and use the additional arguments for the server.
+
+
diff -r 6fa0d51b7a56 server/manifest.mf
--- a/server/manifest.mf Mon Dec 19 07:32:04 2011 +0100
+++ b/server/manifest.mf Mon Dec 19 21:55:24 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 6fa0d51b7a56 server/nbproject/project.xml
--- a/server/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/server/nbproject/project.xml Mon Dec 19 21:55:24 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 6fa0d51b7a56 server/src/org/netbeans/api/server/Bundle.properties
--- a/server/src/org/netbeans/api/server/Bundle.properties Mon Dec 19 07:32:04 2011 +0100
+++ b/server/src/org/netbeans/api/server/Bundle.properties Mon Dec 19 21:55:24 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 6fa0d51b7a56 server/src/org/netbeans/api/server/ServerInstance.java
--- a/server/src/org/netbeans/api/server/ServerInstance.java Mon Dec 19 07:32:04 2011 +0100
+++ b/server/src/org/netbeans/api/server/ServerInstance.java Mon Dec 19 21:55:24 2011 +0100
@@ -45,7 +45,9 @@
import javax.swing.JComponent;
import org.netbeans.spi.server.ServerInstanceFactory;
import org.netbeans.spi.server.ServerInstanceImplementation;
+import org.netbeans.spi.server.ServerInstanceImplementation2;
import org.openide.nodes.Node;
+import org.openide.util.Lookup;
/**
* The API representation of the single server instance. Class describes
@@ -56,7 +58,7 @@
*
* @author Petr Hejl
*/
-public final class ServerInstance {
+public final class ServerInstance implements Lookup.Provider {
static {
ServerInstanceFactory.Accessor.DEFAULT = new ServerInstanceFactory.Accessor() {
@@ -142,5 +144,16 @@
public boolean isRemovable() {
return delegate.isRemovable();
}
-
+
+ /**
+ *
+ * @return
+ * @since 1.18
+ */
+ public Lookup getLookup() {
+ if (delegate instanceof ServerInstanceImplementation2) {
+ return ((ServerInstanceImplementation2) delegate).getLookup();
+ }
+ return Lookup.EMPTY;
+ }
}
diff -r 6fa0d51b7a56 server/src/org/netbeans/api/server/StartupArguments.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/api/server/StartupArguments.java Mon Dec 19 21:55:24 2011 +0100
@@ -0,0 +1,172 @@
+/*
+ * 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.StartupArgumentsRegistrationProcessor;
+import org.netbeans.spi.server.StartupArgumentsProvider;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.Parameters;
+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 StartupArgumentsProvider
+ */
+public final class StartupArguments {
+
+ private final String description;
+
+ private final List arguments;
+
+ private StartupArguments(String description, List arguments) {
+ this.description = description;
+ this.arguments = arguments;
+ }
+
+ /**
+ * Returns the groups of arguments provided by all registered
+ * {@link StartupArgumentsProvider} for the given start mode.
+ *
+ * @param instance the server instance being started
+ * @param mode the VM mode the client is going to use
+ * @return the groups of arguments provided by all registered
+ * {@link StartupArgumentsProvider}
+ */
+ @NonNull
+ public static List getStartupArguments(
+ @NonNull ServerInstance instance, @NonNull StartMode mode) {
+ Parameters.notNull("instance", instance);
+ Parameters.notNull("mode", mode);
+
+ Lookup lkp = Lookups.forPath(StartupArgumentsRegistrationProcessor.PATH);
+ List res = new ArrayList();
+ for (StartupArgumentsProvider prov : lkp.lookupAll(StartupArgumentsProvider.class)) {
+ res.add(new StartupArguments(prov.getDescription(), prov.getArguments(instance, 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(StartupArguments.class, "StartMode_Normal"));
+
+ /**
+ * The debug startup mode.
+ */
+ public static final StartMode DEBUG = new StartMode(
+ NbBundle.getMessage(StartupArguments.class, "StartMode_Debug"));
+
+ /**
+ * The profile startup mode.
+ */
+ public static final StartMode PROFILE = new StartMode(
+ NbBundle.getMessage(StartupArguments.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 6fa0d51b7a56 server/src/org/netbeans/modules/server/annotations/StartupArgumentsRegistrationProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/modules/server/annotations/StartupArgumentsRegistrationProcessor.java Mon Dec 19 21:55:24 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.StartupArgumentsProvider;
+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.StartupArgumentsProvider.Registration")
+@ServiceProvider(service = Processor.class)
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+public class StartupArgumentsRegistrationProcessor extends LayerGeneratingProcessor {
+
+ public static final String PATH = "Servers/StartupArgumentProviders";
+
+ @Override
+ protected boolean handleProcess(Set extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
+ for (Element element : roundEnv.getElementsAnnotatedWith(
+ StartupArgumentsProvider.Registration.class)) {
+
+ File f = layer(element).instanceFile(PATH, null, StartupArgumentsProvider.class)
+ .intvalue("position", element.getAnnotation(StartupArgumentsProvider.Registration.class).position());
+ f.write();
+ }
+ return true;
+ }
+
+}
diff -r 6fa0d51b7a56 server/src/org/netbeans/spi/server/ServerInstanceImplementation2.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/spi/server/ServerInstanceImplementation2.java Mon Dec 19 21:55:24 2011 +0100
@@ -0,0 +1,64 @@
+/*
+ * 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 org.netbeans.api.annotations.common.NonNull;
+import org.openide.util.Lookup;
+
+/**
+ * Representation of the single server instance enhanced with {@link Lookup}.
+ *
+ * @author Petr Hejl
+ * @since 1.18
+ * @see ServerInstanceProvider
+ */
+public interface ServerInstanceImplementation2 extends ServerInstanceImplementation, Lookup.Provider {
+
+ /**
+ * Returns the {@link Lookup} associated with this instance.
+ *
+ * @return the {@link Lookup} associated with this instance.
+ */
+ @NonNull
+ Lookup getLookup();
+
+}
diff -r 6fa0d51b7a56 server/src/org/netbeans/spi/server/StartupArgumentsProvider.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/org/netbeans/spi/server/StartupArgumentsProvider.java Mon Dec 19 21:55:24 2011 +0100
@@ -0,0 +1,98 @@
+/*
+ * 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.ServerInstance;
+import org.netbeans.api.server.StartupArguments;
+
+/**
+ * Provides the additional arguments to server VM. Typically the server plugin
+ * implementor will query the arguments via API counterpart {@link StartupArguments}.
+ * 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 StartupArguments
+ */
+public interface StartupArgumentsProvider {
+
+ /**
+ * 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 instance the server instance being started
+ * @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(@NonNull ServerInstance instance, @NonNull StartupArguments.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 6fa0d51b7a56 tomcat5/nbproject/project.xml
--- a/tomcat5/nbproject/project.xml Mon Dec 19 07:32:04 2011 +0100
+++ b/tomcat5/nbproject/project.xml Mon Dec 19 21:55:24 2011 +0100
@@ -176,7 +176,7 @@
4
- 1.66
+ 1.88
@@ -213,6 +213,15 @@
+ org.netbeans.modules.server
+
+
+
+ 0-1
+ 1.18
+
+
+
org.openide.actions
diff -r 6fa0d51b7a56 tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java
--- a/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Mon Dec 19 07:32:04 2011 +0100
+++ b/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java Mon Dec 19 21:55:24 2011 +0100
@@ -69,6 +69,8 @@
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.StartupArguments;
+import org.netbeans.modules.j2ee.deployment.plugins.api.CommonBridge;
import org.netbeans.modules.tomcat5.progress.ProgressEventSupport;
import org.netbeans.modules.tomcat5.progress.Status;
import org.netbeans.modules.tomcat5.util.LogManager;
@@ -78,7 +80,6 @@
import org.openide.util.RequestProcessor;
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.ProfilerServerSettings;
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
import org.netbeans.modules.tomcat5.TomcatManager;
import org.netbeans.modules.tomcat5.util.TomcatProperties;
@@ -164,7 +165,7 @@
public ProgressObject startDeploymentManager () {
LOGGER.log(Level.FINE, "StartTomcat.startDeploymentManager called on " + tm); // NOI18N
pes.fireHandleProgressEvent (null, new Status (ActionType.EXECUTE, CommandType.START, "", StateType.RUNNING));
- SERVER_CONTROL_RP.post(new StartRunnable(MODE_RUN, CommandType.START, null),
+ SERVER_CONTROL_RP.post(new StartRunnable(MODE_RUN, CommandType.START),
0, Thread.NORM_PRIORITY);
isDebugModeUri.remove(tm.getUri());
return this;
@@ -227,7 +228,7 @@
public ProgressObject stopDeploymentManager() {
LOGGER.log(Level.FINE, "StartTomcat.stopDeploymentManager called on " + tm); // NOI18N
pes.fireHandleProgressEvent (null, new Status (ActionType.EXECUTE, CommandType.STOP, "", StateType.RUNNING));
- SERVER_CONTROL_RP.post(new StartRunnable(MODE_RUN, CommandType.STOP, null),
+ SERVER_CONTROL_RP.post(new StartRunnable(MODE_RUN, CommandType.STOP),
0, Thread.NORM_PRIORITY);
isDebugModeUri.remove(tm.getUri());
return this;
@@ -243,19 +244,19 @@
public ProgressObject startDebugging(Target target) {
LOGGER.log(Level.FINE, "StartTomcat.startDebugging called on " + tm); // NOI18N
pes.fireHandleProgressEvent (null, new Status (ActionType.EXECUTE, CommandType.START, "", StateType.RUNNING));
- SERVER_CONTROL_RP.post(new StartRunnable(MODE_DEBUG, CommandType.START, null),
+ SERVER_CONTROL_RP.post(new StartRunnable(MODE_DEBUG, CommandType.START),
0, Thread.NORM_PRIORITY);
return this;
}
- public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) {
+ public ProgressObject startProfiling(Target target) {
LOGGER.log(Level.FINE, "StartTomcat.startProfiling called on " + tm); // NOI18N
pes.fireHandleProgressEvent(null, new Status(
ActionType.EXECUTE,
CommandType.START,
"", // NOI18N
StateType.RUNNING));
- SERVER_CONTROL_RP.post(new StartRunnable(MODE_PROFILE, CommandType.START, settings),
+ SERVER_CONTROL_RP.post(new StartRunnable(MODE_PROFILE, CommandType.START),
0, Thread.NORM_PRIORITY);
return this;
}
@@ -275,12 +276,10 @@
private int mode;
private CommandType command = CommandType.START;
- private ProfilerServerSettings profilerSettings;
- public StartRunnable(int mode, CommandType command, ProfilerServerSettings profilerSettings) {
+ public StartRunnable(int mode, CommandType command) {
this.mode = mode;
this.command = command;
- this.profilerSettings = profilerSettings;
}
public synchronized void run () {
@@ -398,11 +397,18 @@
}
}
}
+
+
+ for (StartupArguments args : StartupArguments.getStartupArguments(
+ CommonBridge.getCommonInstance(tm.getUri()), getMode(mode))) {
+ for (String singleArg : args.getArguments()) {
+ sb.append(' ').append(singleArg);
+ }
+ }
javaOpts = sb.toString();
}
- JavaPlatform platform = mode == MODE_PROFILE ? profilerSettings.getJavaPlatform()
- : getJavaPlatform();
+ JavaPlatform platform = getJavaPlatform();
String jdkVersion = platform.getSpecification().getVersion().toString();
if (tm.isBundledTomcat()) {
@@ -460,54 +466,6 @@
startupScript.getAbsolutePath(), StateType.FAILED);
return;
}
- } else if ((mode == MODE_PROFILE) && (command == CommandType.START)) {
- NbProcessDescriptor pd = null;
- if (tp.getSecManager()) {
- pd = defaultExecDesc(TAG_EXEC_CMD, TAG_EXEC_STARTUP, TAG_SECURITY_OPT);
- } else {
- pd = defaultExecDesc(TAG_EXEC_CMD, TAG_EXEC_STARTUP);
- }
- try {
- fireCmdExecProgressEvent("MSG_StartingInProfileMode", StateType.RUNNING);
- Process p = null;
-
- String[] profJvmArgs = profilerSettings.getJvmArgs();
- // TODO solve conflicts between profiler and tomcat vm args
- StringBuffer catalinaOpts = new StringBuffer();
- for (int i = 0; i < profJvmArgs.length; i++) {
- catalinaOpts.append(profJvmArgs[i]).append(" "); // NOI18N
- }
- String[] defaultEnv = new String[] {
- "JAVA_HOME=" + getJavaHome(platform), // NOI18N
- "JRE_HOME=", // NOI18N ensure that JRE_HOME system property won't be used instead of JAVA_HOME
- "JAVA_OPTS=" + javaOpts, // NOI18N
- "CATALINA_OPTS=" + catalinaOpts.toString(), // NOI18N
- "CATALINA_HOME=" + homeDir.getAbsolutePath(), // NOI18N
- "CATALINA_BASE=" + baseDir.getAbsolutePath(), // NOI18N
- // this is used in the setclasspath.sb/bat script for work-arounding
- // problems caused by the compatibility pack when running on 1.5
- "NB_TOMCAT_JDK=" + jdkVersion, // NOI18N
- TomcatManager.KEY_UUID + "=" + tm.getUri()
- };
- String[] profEnv = profilerSettings.getEnv();
- // merge Tomcat and profiler env properties
- String[] envp = new String[defaultEnv.length + profEnv.length];
- System.arraycopy(profEnv, 0, envp, 0, profEnv.length);
- System.arraycopy(defaultEnv, 0, envp, profEnv.length, defaultEnv.length);
- p = pd.exec(
- new TomcatFormat(startupScript, homeDir),
- envp,
- true,
- new File(homeDir, "bin") // NOI18N
- );
- tm.setTomcatProcess(p);
- openLogs();
- } catch (java.io.IOException ioe) {
- LOGGER.log(Level.FINE, null, ioe);
- fireCmdExecProgressEvent(command == CommandType.START ? "MSG_StartFailedIOE" : "MSG_StopFailedIOE",
- startupScript.getAbsolutePath(), StateType.FAILED);
- return;
- }
} else {
NbProcessDescriptor pd = null;
if (command == CommandType.START) {
@@ -573,7 +531,18 @@
StateType.FAILED);
}
}
-
+
+ private StartupArguments.StartMode getMode(int mode) {
+ switch (mode) {
+ case MODE_PROFILE:
+ return StartupArguments.StartMode.PROFILE;
+ case MODE_DEBUG:
+ return StartupArguments.StartMode.DEBUG;
+ default:
+ return StartupArguments.StartMode.NORMAL;
+ }
+ }
+
/** Open JULI log and server output */
private void openLogs() {
LogManager logManager = tm.logManager();