Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Powell2010-06-08 10:35:11 -0400
committerSteve Powell2010-06-08 10:35:11 -0400
commitf5bf514e0c79bd300c14edd1bda87bfdbbd598e0 (patch)
tree289d59178f86a85515117fa2320780b37a9aecb9
parentf5fa8ecc2bf3bb57af4721172bb7f04838f878cb (diff)
downloadorg.eclipse.virgo.kernel-f5bf514e0c79bd300c14edd1bda87bfdbbd598e0.tar.gz
org.eclipse.virgo.kernel-f5bf514e0c79bd300c14edd1bda87bfdbbd598e0.tar.xz
org.eclipse.virgo.kernel-f5bf514e0c79bd300c14edd1bda87bfdbbd598e0.zip
Disable remote shells properties (shell.port, shell.enabled); give warning if used.
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.properties2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/configTimeout/org.eclipse.virgo.kernel.properties3
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManager.java20
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/ShellLogEvents.java3
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/resources/EventLogMessages.properties1
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManagerTests.java6
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.properties2
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/sit-config/kernel.properties2
8 files changed, 24 insertions, 15 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
index ef6d516f..9d192332 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
@@ -1,5 +1,3 @@
deployer.timeout= 300
deployer.pickupDirectory= target/pickup
deployer.systemArtifacts=
-shell.enabled= true
-shell.port= 2401
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configTimeout/org.eclipse.virgo.kernel.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configTimeout/org.eclipse.virgo.kernel.properties
index 6d752a49..c224801f 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configTimeout/org.eclipse.virgo.kernel.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configTimeout/org.eclipse.virgo.kernel.properties
@@ -2,8 +2,7 @@ deployer.timeout= 0
deployer.pickupDirectory= target/pickup
io.workDirectory= target/work
io.dumpDirectory= target/serviceability/dump
-shell.enabled= false
-shell.port= 2401
+
profile.name = deployer integration tests
profile.subsystems=
profile.optionalSubsystems=
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManager.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManager.java
index 1cc01794..1f76fdfe 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManager.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManager.java
@@ -72,12 +72,19 @@ class RemoteShellsManager {
private final int port;
- private final String portEnabled;
+ private final boolean portEnabled;
private SshServer sshd = null;
RemoteShellsManager(LocalShellFactory shellFactory, Properties configuration, EventLogger eventLogger) {
- this.portEnabled = configuration.getProperty(PROPERTY_SHELL_ENABLED);
+
+ String portEnabled = configuration.getProperty(PROPERTY_SHELL_ENABLED);
+ // Remote Shells are unsupported until we can create a LocalShell implementation.
+ if (portEnabled != null && TRUE.equals(portEnabled)) {
+ eventLogger.log(ShellLogEvents.SERVER_SHELL_UNSUPPORTED);
+ }
+ this.portEnabled = false;
+
String portString = configuration.getProperty(PROPERTY_SHELL_PORT);
int initialisingPort = -1;
try {
@@ -90,6 +97,7 @@ class RemoteShellsManager {
}
this.port = initialisingPort;
+
this.shellFactory = new SshdShellFactory(shellFactory);
this.eventLogger = eventLogger;
}
@@ -99,11 +107,11 @@ class RemoteShellsManager {
* port then no server will be started.
*/
final void start() {
- if (this.sshd == null && portEnabled != null && TRUE.equals(portEnabled) && this.port != -1) {
- if (NetUtils.isPortAvailable(port)) {
- doStart(port);
+ if (this.sshd == null && portEnabled && this.port != -1) {
+ if (NetUtils.isPortAvailable(this.port)) {
+ doStart(this.port);
} else {
- this.eventLogger.log(ShellLogEvents.SERVER_SHELL_PORT_IN_USE, String.valueOf(port));
+ this.eventLogger.log(ShellLogEvents.SERVER_SHELL_PORT_IN_USE, String.valueOf(this.port));
callShutdownMBean();
}
}
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/ShellLogEvents.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/ShellLogEvents.java
index c670e3a3..80dfcb29 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/ShellLogEvents.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/ShellLogEvents.java
@@ -27,7 +27,8 @@ import org.eclipse.virgo.medic.eventlog.LogEvent;
public enum ShellLogEvents implements LogEvent {
SERVER_CONSOLE_PORT(1, Level.INFO),
- SERVER_SHELL_PORT_IN_USE(2, Level.ERROR);
+ SERVER_SHELL_PORT_IN_USE(2, Level.ERROR),
+ SERVER_SHELL_UNSUPPORTED(3, Level.WARNING);
private static final String PREFIX = "SH";
diff --git a/org.eclipse.virgo.kernel.shell/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.shell/src/main/resources/EventLogMessages.properties
index 7e68e66d..fe55649f 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/resources/EventLogMessages.properties
+++ b/org.eclipse.virgo.kernel.shell/src/main/resources/EventLogMessages.properties
@@ -1,2 +1,3 @@
SH0001I=Kernel ssh shell available on port {}.
SH0002E=Kernel ssh shell port {} already in use, shutting down.
+SH0003W=Kernel ssh shell port not supported.
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManagerTests.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManagerTests.java
index 80330cbc..ef4c1095 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManagerTests.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/internal/RemoteShellsManagerTests.java
@@ -29,6 +29,7 @@ import org.apache.sshd.client.future.OpenFuture;
import org.apache.sshd.common.future.CloseFuture;
import org.apache.sshd.server.PasswordAuthenticator;
import org.apache.sshd.server.session.ServerSession;
+import org.junit.Ignore;
import org.junit.Test;
import org.eclipse.virgo.kernel.shell.internal.RemoteShellsManager;
@@ -75,6 +76,7 @@ public class RemoteShellsManagerTests {
}
@Test
+ @Ignore("Remote shells disabled until LocalShell implementation supplied.")
public void testRemoteShellEnabled() throws Exception {
int port = NetUtils.getFreePort();
Properties configuration = new Properties();
@@ -95,7 +97,9 @@ public class RemoteShellsManagerTests {
}
}
+
@Test
+ @Ignore("Remote shells disabled until LocalShell implementation supplied.")
public void testRemoteShellEnabledPortClash() throws Exception {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName shutdownName = ObjectName.getInstance(DEFAULT_KERNEL_DOMAIN, MBEAN_KEY_TYPE, MBEAN_VALUE_SHUTDOWN);
@@ -116,6 +120,7 @@ public class RemoteShellsManagerTests {
}
@Test
+ @Ignore("Remote shells disabled until LocalShell implementation supplied.")
public void testRemoteShellEnabledBadUser() throws Exception {
int port = NetUtils.getFreePort();
Properties configuration = new Properties();
@@ -144,6 +149,7 @@ public class RemoteShellsManagerTests {
}
@Test
+ @Ignore("Remote shells disabled until LocalShell implementation supplied.")
public void testRemoteShellEnabledConnect() throws Exception {
int port = NetUtils.getFreePort();
Properties configuration = new Properties();
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.properties b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
index 60ece6be..0ed5a6ba 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.properties
@@ -1,5 +1,3 @@
deployer.timeout= 300
deployer.pickupDirectory= pickup
deployer.systemArtifacts=
-shell.enabled= true
-shell.port= 2403
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/sit-config/kernel.properties b/org.eclipse.virgo.kernel.test/src/test/resources/sit-config/kernel.properties
index dcdf9f8e..9412c860 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/sit-config/kernel.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/sit-config/kernel.properties
@@ -2,8 +2,6 @@ deployer.timeout= 300
deployer.pickupDirectory= target/pickup
io.workDirectory= target/work
io.dumpDirectory= target/serviceability/dump
-shell.enabled= false
-shell.port= 2401
profile.name= subsystem installation test
profile.subsystems= subsystem.installation.test
profile.optionalSubsystems=

Back to the top