Author: adietish
Date: 2011-07-07 10:29:38 -0400 (Thu, 07 Jul 2011)
New Revision: 32717
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
Log:
[JBIDE-9215] added abstract super class for RSELaunchDelegate
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java 2011-07-07
14:29:38 UTC (rev 32717)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * TODO: Logging and Progress Monitors
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.rse.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
+import org.eclipse.rse.services.shells.IHostOutput;
+import org.eclipse.rse.services.shells.IHostShell;
+import org.eclipse.rse.services.shells.IHostShellChangeEvent;
+import org.eclipse.rse.services.shells.IHostShellOutputListener;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration.IStartLaunchSetupParticipant;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchDelegate;
+import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
+
+public abstract class AbstractRSELaunchDelegate implements IStartLaunchDelegate,
IStartLaunchSetupParticipant {
+
+ protected void executeRemoteCommand(String command, DelegatingServerBehavior behavior)
+ throws CoreException {
+ try {
+ ServerShellModel model =
RSEHostShellModel.getInstance().getModel(behavior.getServer());
+ IHostShell shell = model.createStartupShell("/", command, new String[] {},
new NullProgressMonitor());
+ addShellOutputListener(shell);
+ } catch (SystemMessageException sme) {
+ behavior.setServerStopped(); // Not sure when this comes, but we should
+ // try to keep track
+ throw new CoreException(new Status(IStatus.ERROR,
+ org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
+ sme.getMessage(), sme));
+ }
+ }
+
+ // Only for debugging
+ private void addShellOutputListener(IHostShell shell) {
+ IHostShellOutputListener listener = null;
+ listener = new IHostShellOutputListener() {
+ public void shellOutputChanged(IHostShellChangeEvent event) {
+ IHostOutput[] out = event.getLines();
+ for (int i = 0; i < out.length; i++) {
+ // TODO listen here for obvious exceptions or failures
+ // System.out.println(out[i]);
+ }
+ }
+ };
+ // shell.addOutputListener(listener);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/AbstractRSELaunchDelegate.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-07
13:48:32 UTC (rev 32716)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-07
14:29:38 UTC (rev 32717)
@@ -23,11 +23,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.shells.IHostOutput;
-import org.eclipse.rse.services.shells.IHostShell;
-import org.eclipse.rse.services.shells.IHostShellChangeEvent;
-import org.eclipse.rse.services.shells.IHostShellOutputListener;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
@@ -38,8 +33,6 @@
import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
-import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration.IStartLaunchSetupParticipant;
-import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchDelegate;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.JBossLaunchConfigProperties;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
@@ -50,8 +43,7 @@
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
-public class RSELaunchDelegate implements IStartLaunchDelegate,
IStartLaunchSetupParticipant {
-
+public class RSELaunchDelegate extends AbstractRSELaunchDelegate {
public void actualLaunch(
DelegatingStartLaunchConfiguration launchConfig,
ILaunchConfiguration configuration, String mode, ILaunch launch,
@@ -62,43 +54,17 @@
beh.setServerStarted();
return;
}
-
String command = RSELaunchConfigProperties.getStartupCommand(configuration);
- try {
- ServerShellModel model = RSEHostShellModel.getInstance().getModel(beh.getServer());
- IHostShell shell = model.createStartupShell("/", command, new String[] {},
new NullProgressMonitor());
- addShellOutputListener(shell);
- launchPingThread(beh);
- } catch (SystemMessageException sme) {
- beh.setServerStopped(); // Not sure when this comes, but we should
- // try to keep track
- throw new CoreException(new Status(IStatus.ERROR,
- org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
- sme.getMessage(), sme));
- }
+ executeRemoteCommand(command, beh);
+ launchPingThread(beh);
}
-
+
private void launchPingThread(DeployableServerBehavior beh) {
// TODO do it properly here
RSEHostShellModel.delay(30000);
beh.setServerStarted();
}
- // Only for debugging
- private void addShellOutputListener(IHostShell shell) {
- IHostShellOutputListener listener = null;
- listener = new IHostShellOutputListener() {
- public void shellOutputChanged(IHostShellChangeEvent event) {
- IHostOutput[] out = event.getLines();
- for (int i = 0; i < out.length; i++) {
- // TODO listen here for obvious exceptions or failures
- // System.out.println(out[i]);
- }
- }
- };
- // shell.addOutputListener(listener);
- }
-
/**
*
* @deprecated
@@ -149,6 +115,7 @@
String mode, IProgressMonitor monitor) throws CoreException {
// ping if up
final DelegatingServerBehavior beh =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ // TODO: use configured polelr
boolean started = WebPortPoller.onePing(beh.getServer());
if (started) {
beh.setServerStarting();