You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2013/03/25 19:59:55 UTC
svn commit: r1460849 - in /geronimo/devtools/eclipse-plugin/trunk/plugins:
org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/
org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/
Author: gawor
Date: Mon Mar 25 18:59:55 2013
New Revision: 1460849
URL: http://svn.apache.org/r1460849
Log:
GERONIMODEVTOOLS-795: Another take. Tell the server which ports to use (via system properties) instead of updating config-substitutions.properties file
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoLaunchConfigurationDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoLaunchConfigurationDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoLaunchConfigurationDelegate.java?rev=1460849&r1=1460848&r2=1460849&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoLaunchConfigurationDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoLaunchConfigurationDelegate.java Mon Mar 25 18:59:55 2013
@@ -17,14 +17,18 @@
package org.apache.geronimo.st.v30.core;
import java.io.File;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.geronimo.st.v30.core.internal.Messages;
import org.apache.geronimo.st.v30.core.internal.Trace;
+import org.apache.geronimo.st.v30.core.util.ConfigSubstitutionsHelper;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -139,35 +143,34 @@ public class GeronimoLaunchConfiguration
boolean managedApplicationStart = server.getServerDelegate().isManageApplicationStart();
Trace.trace(Trace.INFO, "GeronimoLaunchConfigurationDelegate: manageApplicationStart:=" + managedApplicationStart, Activator.traceCore);
- int params = 0;
+ List<String> params = new ArrayList<String>(6);
+
+ GeronimoServerDelegate serverDelegate = server.getServerDelegate();
+
+ params.add("-Dorg.apache.geronimo.config.substitution.prefix=gep.");
+ params.add("-Dgep." + ConfigSubstitutionsHelper.PORT_OFFSET + "=" + serverDelegate.getPortOffset());
+ params.add("-Dgep." + ConfigSubstitutionsHelper.HTTP_PORT + "=" + serverDelegate.getHTTPPort());
+ params.add("-Dgep." + ConfigSubstitutionsHelper.NAMING_PORT + "=" + serverDelegate.getRMINamingPort());
+
Set<String> deletedConfigs = server.getDeletedConfigIds();
if (!deletedConfigs.isEmpty()) {
- params++;
+ params.add(toString("-Dgeronimo.removedArtifactList=", deletedConfigs));
}
- Set<String> modifiedConfigs = null;
if (managedApplicationStart) {
- modifiedConfigs = server.getModifiedConfigIds();
+ Set<String> modifiedConfigs = server.getModifiedConfigIds();
if (!modifiedConfigs.isEmpty()) {
- params++;
+ params.add(toString("-Dgeronimo.loadOnlyConfigList=", modifiedConfigs));
}
- } else {
- modifiedConfigs = Collections.emptySet();
}
-
- if (params > 0) {
- String[] newJvmArguments = new String[jvmArguments.length + params];
- System.arraycopy(jvmArguments, 0, newJvmArguments, 0, jvmArguments.length);
- int index = jvmArguments.length;
- if (!modifiedConfigs.isEmpty()) {
- newJvmArguments[index] = toString("-Dgeronimo.loadOnlyConfigList=", modifiedConfigs);
- index++;
- }
- if (!deletedConfigs.isEmpty()) {
- newJvmArguments[index] = toString("-Dgeronimo.removedArtifactList=", deletedConfigs);
- }
- jvmArguments = newJvmArguments;
+
+ int size = params.size();
+ String[] newJvmArguments = new String[jvmArguments.length + size];
+ System.arraycopy(jvmArguments, 0, newJvmArguments, 0, jvmArguments.length);
+ for (int i = 0; i < size; i++) {
+ newJvmArguments[jvmArguments.length + i] = params.get(i);
}
+ jvmArguments = newJvmArguments;
return jvmArguments;
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java?rev=1460849&r1=1460848&r2=1460849&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoRuntimeDelegate.java Mon Mar 25 18:59:55 2013
@@ -23,9 +23,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -51,8 +49,6 @@ public class GeronimoRuntimeDelegate ext
private static final String PROP_VM_INSTALL_ID = "vm-install-id";
- public static final String SERVER_INSTANCE_PROPERTIES = "geronimo_server_instance_properties";
-
public static final String RUNTIME_SOURCE= "runtime.source";
public static final int NO_IMAGE = 0;
@@ -164,15 +160,12 @@ public class GeronimoRuntimeDelegate ext
* @see org.apache.geronimo.st.v30.core.IGeronimoRuntime#getRuntimeSourceLocation()
*/
public IPath getRuntimeSourceLocation() {
- String source = (String) getServerInstanceProperties().get(RUNTIME_SOURCE);
- if (source != null) {
- return new Path(source);
- }
- return null;
+ String source = getAttribute(RUNTIME_SOURCE, (String) null);
+ return (source != null) ? new Path(source) : null;
}
public void setRuntimeSourceLocation(String path) {
- setInstanceProperty(RUNTIME_SOURCE, path);
+ setAttribute(RUNTIME_SOURCE, path);
}
/**
@@ -285,38 +278,6 @@ public class GeronimoRuntimeDelegate ext
}
/**
- * @return
- */
- public Map getServerInstanceProperties() {
- return getAttribute(SERVER_INSTANCE_PROPERTIES, new HashMap());
- }
-
- /**
- * @param map
- */
- public void setServerInstanceProperties(Map map) {
- setAttribute(SERVER_INSTANCE_PROPERTIES, map);
- }
-
- /**
- * @param name
- * @return
- */
- public String getInstanceProperty(String name) {
- return(String) getServerInstanceProperties().get(name);
- }
-
- /**
- * @param name
- * @param value
- */
- public void setInstanceProperty(String name, String value) {
- Map map = getServerInstanceProperties();
- map.put(name, value);
- setServerInstanceProperties(map);
- }
-
- /**
* @param vmInstall
*/
public void setVMInstall(IVMInstall vmInstall) {
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1460849&r1=1460848&r2=1460849&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java Mon Mar 25 18:59:55 2013
@@ -1260,10 +1260,6 @@ public class GeronimoServerBehaviourDele
return true;
}
- public Map getServerInstanceProperties() {
- return getRuntimeDelegate().getServerInstanceProperties();
- }
-
protected GeronimoRuntimeDelegate getRuntimeDelegate() {
GeronimoRuntimeDelegate rd = (GeronimoRuntimeDelegate) getServer().getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
if (rd == null)
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java?rev=1460849&r1=1460848&r2=1460849&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerDelegate.java Mon Mar 25 18:59:55 2013
@@ -40,7 +40,6 @@ import org.apache.geronimo.st.v30.core.i
import org.apache.geronimo.st.v30.core.internal.Trace;
import org.apache.geronimo.st.v30.core.osgi.AriesHelper;
import org.apache.geronimo.st.v30.core.osgi.OsgiConstants;
-import org.apache.geronimo.st.v30.core.util.ConfigSubstitutionsHelper;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -53,7 +52,6 @@ import org.eclipse.jst.server.core.inter
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerPort;
import org.eclipse.wst.server.core.ServerUtil;
@@ -566,43 +564,14 @@ public class GeronimoServerDelegate exte
setRunFromWorkspace(false);
setSelectClasspathContainers(false);
- IServer server = getServer();
- if (server != null) {
- IRuntime runtime = server.getRuntime();
- if (runtime != null) {
- ConfigSubstitutionsHelper configSubstitutions = new ConfigSubstitutionsHelper(runtime.getLocation());
- configSubstitutions.load();
- setAttribute(configSubstitutions, ConfigSubstitutionsHelper.PORT_OFFSET, PROPERTY_PORT_OFFSET);
- setAttribute(configSubstitutions, ConfigSubstitutionsHelper.HTTP_PORT, PROPERTY_HTTP_PORT);
- setAttribute(configSubstitutions, ConfigSubstitutionsHelper.NAMING_PORT, PROPERTY_RMI_PORT);
- }
- }
-
resumeArgUpdates();
Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.setDefaults", monitor);
}
- private void setAttribute(ConfigSubstitutionsHelper configSubstitutions, String substProperty, String property) {
- String value = configSubstitutions.getProperty(substProperty);
- if (value != null) {
- setAttribute(property, value);
- }
- }
-
@Override
public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
Trace.tracePoint("Enter", Activator.traceCore, "GeronimoServerDelegate.saveConfiguration", monitor);
super.saveConfiguration(monitor);
-
- if (SocketUtil.isLocalhost(getServer().getHost())) {
- ConfigSubstitutionsHelper configSubstitutions = new ConfigSubstitutionsHelper(getServer().getRuntime().getLocation());
- configSubstitutions.load();
- configSubstitutions.setProperty(ConfigSubstitutionsHelper.PORT_OFFSET, String.valueOf(getPortOffset()));
- configSubstitutions.setProperty(ConfigSubstitutionsHelper.HTTP_PORT, getHTTPPort());
- configSubstitutions.setProperty(ConfigSubstitutionsHelper.NAMING_PORT, getRMINamingPort());
- configSubstitutions.store();
- }
-
Trace.tracePoint("Exit", Activator.traceCore, "GeronimoServerDelegate.saveConfiguration", monitor);
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java?rev=1460849&r1=1460848&r2=1460849&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/internal/GeronimoRuntimeWizardFragment.java Mon Mar 25 18:59:55 2013
@@ -317,7 +317,6 @@ public class GeronimoRuntimeWizardFragme
}
IRuntimeWorkingCopy runtimeWC = getRuntimeDelegate().getRuntimeWorkingCopy();
- getRuntimeDelegate().setInstanceProperty("serverRootDirectory", installDir.getText());
if (installDir.getText() == null || installDir.getText().length() == 0) {
// installDir field has not been entered