Repository navigation
feat: ConsoleService strategy pattern POC for zowex SSH and z/OSMF REST - #627
chaitanyakatore wants to merge 1 commit into
Conversation
chaitanyakatore
commented
Aug 23, 2026
- Extract ConsoleService strategy interface for z/OS console operations
- Update ConsoleCmd to implement ConsoleService for z/OSMF REST transport
- Add ZowexConsoleService strategy implementation for zowex SSH transport
- Add ConsoleServiceFactory for connection-based strategy selection
- Add ConsoleServiceTest validating polymorphic execution and strategy switching
|
Do you have the ability to convert this to a draft PR. This is not something to merge in the near future, but experimental for now not be merged until further notice. |
|
I was able to convert to DRAFT PR status. Thanks for the PR. I will review soon. Let's discussed on discord further. |
|
I reviewed the code, see my comments. Can you try to implement the actual ssh connection and command execution? I can test it. You can create a RemoteClient.java and add it to the console class like: private final RemoteSshClient remoteSshClient; and call it in the issueCommon method. Initialize the remoteSshClient if null and reuse it. BTW zowex naming convention has changed. See: https://medium.com/zowe/technical-preview-zowe-remote-ssh-zrs-507a405fbc05 |
frankgiordano
left a comment
There was a problem hiding this comment.
see comments, can you tweak the PR further thanks.
|
model the SSH setup/error handling after UssCmd, but not reuse its "wait until remote process exits" execution model. try (ManagedSession session =
new ManagedSession(connection, timeout);
ManagedRemoteChannel channel =
new ManagedRemoteChannel(session.get(), timeout)) {
BufferedReader reader = channel.getReader();
OutputStream writer = channel.getWriter();
// 1. Wait for zo server ready banner
final String readyLine = reader.readLine();
if (readyLine == null) {
throw new IllegalStateException(
"Zowe Remote SSH server closed before becoming ready"
);
}
final JsonNode ready = mapper.readTree(readyLine);
if (!"ready".equals(ready.path("status").asText())) {
throw new IllegalStateException(
"Unexpected Zowe Remote SSH startup response: " + readyLine
);
}
// 2. Send JSON-RPC request
writer.write((payload + "\n").getBytes(StandardCharsets.UTF_8));
writer.flush();
// 3. Read matching response
String response = reader.readLine();
// 4. Parse result.data
} |
|
Hi @frankgiordano I have made the changes please review and let me know if it looks good or any changes require |
|
Nice updates to summarize:
I would like to make one additional structural change before we move this POC further. Please extract the common Zowe Remote SSH communication logic from
The intended flow should look roughly like:
I also recommend that Please also make sure the For now, it is fine for Add the new class in the core package. Seeing that this PR is getting cluttered with tweaks/changes. Can you open a new PR request with the latest changes and then close this PR. Make sure to rebase your fork with the latest from mainline. |
- Add ConsoleCmdProvider interface defining console command execution contract - Update ConsoleCmd to implement ConsoleCmdProvider for z/OSMF REST transport - Add generic RemoteSshClient in core package for JSON-RPC communication with zo server over SSH - Add RemoteConsoleCmd implementing ConsoleCmdProvider via RemoteSshClient - Add comprehensive unit tests in RemoteSshClientTest and RemoteConsoleCmdTest Signed-off-by: chaitanya <chaitanyakatore@gmail.com>
3c83391 to
540e643
Compare
|
Hi @frankgiordano, I have updated this PR based on your feedback:
|