Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/src/com/mirth/connect/client/ui/AbstractLoginPanel.java
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 client/src/com/mirth/connect/client/ui/CommandLineOptions.java
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;
}
}
8 changes: 4 additions & 4 deletions client/src/com/mirth/connect/client/ui/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public void eventDispatched(AWTEvent e)
*/
public void setupFrame(Client mirthClient) throws ClientException {

LoginPanel login = LoginPanel.getInstance();
AbstractLoginPanel login = LoginPanelFactory.getInstance();

// Initialize the send message dialog
editMessageDialog = new EditMessageDialog();
Expand Down Expand Up @@ -1524,7 +1524,7 @@ public void alertThrowable(Component parentComponent, Throwable t, String custom
}
mirthClient.close();
this.dispose();
LoginPanel.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
LoginPanelFactory.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
return;
} else if (t.getCause() != null && t.getCause() instanceof HttpHostConnectException && (StringUtils.contains(t.getCause().getMessage(), "Connection refused") || StringUtils.contains(t.getCause().getMessage(), "Host is down"))) {
connectionError = true;
Expand All @@ -1542,7 +1542,7 @@ public void alertThrowable(Component parentComponent, Throwable t, String custom
}
mirthClient.close();
this.dispose();
LoginPanel.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
LoginPanelFactory.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
return;
}
}
Expand Down Expand Up @@ -2292,7 +2292,7 @@ public boolean logout(boolean quit, boolean confirmFirst) {
this.dispose();

if (!quit) {
LoginPanel.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
LoginPanelFactory.getInstance().initialize(PlatformUI.SERVER_URL, PlatformUI.CLIENT_VERSION, "", "");
}

return true;
Expand Down
Loading