-
Notifications
You must be signed in to change notification settings - Fork 35
Login and client command line refactoring #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mgaffigan
wants to merge
5
commits into
OpenIntegrationEngine:main
Choose a base branch
from
mgaffigan:maint/refactor-client-login
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e4fe9e6
Extracted client command line parsing to tested class
mgaffigan b5c3de3
Simplified checks for login status isSuccess
mgaffigan 993b615
Moved handleSuccess to Mirth.java - boots app, not related to panel
mgaffigan 7be7ed7
Removed duplicated error handling logic to separate method, avoid rel…
mgaffigan 37fe874
Remove LoginPanel singleton to separate class to allow other implemen…
mgaffigan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
client/src/com/mirth/connect/client/ui/AbstractLoginPanel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.mirth.connect.client.ui; | ||
|
|
||
| /** | ||
| * Public interface for the login panel so alternative implementations can be provided. | ||
| */ | ||
| public abstract class AbstractLoginPanel extends javax.swing.JFrame { | ||
|
|
||
| /** | ||
| * Initialize and show the login UI. | ||
| */ | ||
| public abstract void initialize(String mirthServer, String version, String user, String pass); | ||
|
|
||
| /** | ||
| * Update the status text shown on the login UI. | ||
| */ | ||
| public abstract void setStatus(String status); | ||
| } |
100 changes: 100 additions & 0 deletions
100
client/src/com/mirth/connect/client/ui/CommandLineOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| package com.mirth.connect.client.ui; | ||
|
|
||
| import org.apache.commons.lang3.StringUtils; | ||
|
|
||
| /** | ||
| * Immutable holder for command line options used by the Mirth client. | ||
| */ | ||
| public class CommandLineOptions { | ||
| private final String server; | ||
| private final String version; | ||
| private final String username; | ||
| private final String password; | ||
| private final String protocols; | ||
| private final String cipherSuites; | ||
|
|
||
| /** | ||
| * Parse command line arguments for Mirth client. | ||
| */ | ||
| public CommandLineOptions(String[] args) { | ||
| String server = "https://localhost:8443"; | ||
| String version = ""; | ||
| String username = ""; | ||
| String password = ""; | ||
| String protocols = ""; | ||
| String cipherSuites = ""; | ||
|
|
||
| if (args == null) { | ||
| args = new String[0]; | ||
| } | ||
|
|
||
| if (args.length > 0) { | ||
| server = args[0]; | ||
| } | ||
| if (args.length > 1) { | ||
| version = args[1]; | ||
| } | ||
| if (args.length > 2) { | ||
| if (StringUtils.equalsIgnoreCase(args[2], "-ssl")) { | ||
| // <server> <version> -ssl [<protocols> [<ciphersuites> [<username> [<password>]]]] | ||
| if (args.length > 3) { | ||
| protocols = args[3]; | ||
| } | ||
| if (args.length > 4) { | ||
| cipherSuites = args[4]; | ||
| } | ||
| if (args.length > 5) { | ||
| username = args[5]; | ||
| } | ||
| if (args.length > 6) { | ||
| password = args[6]; | ||
| } | ||
| } else { | ||
| // <server> <version> <username> [<password> [-ssl [<protocols> [<ciphersuites>]]]] | ||
| username = args[2]; | ||
| if (args.length > 3) { | ||
| password = args[3]; | ||
| } | ||
| if (args.length > 4 && StringUtils.equalsIgnoreCase(args[4], "-ssl")) { | ||
| if (args.length > 5) { | ||
| protocols = args[5]; | ||
| } | ||
| if (args.length > 6) { | ||
| cipherSuites = args[6]; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| this.server = server; | ||
| this.version = version; | ||
| this.username = username; | ||
| this.password = password; | ||
| this.protocols = protocols; | ||
| this.cipherSuites = cipherSuites; | ||
| } | ||
|
|
||
| public String getServer() { | ||
| return server; | ||
| } | ||
|
|
||
| public String getVersion() { | ||
| return version; | ||
| } | ||
|
|
||
| public String getUsername() { | ||
| return username; | ||
| } | ||
|
|
||
| public String getPassword() { | ||
| return password; | ||
| } | ||
|
|
||
| public String getProtocols() { | ||
| return protocols; | ||
| } | ||
|
|
||
| public String getCipherSuites() { | ||
| return cipherSuites; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.