Skip to content
Snippets Groups Projects
Commit 6e79bbf2 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Merge branch 'credentialsAsInput' into 'master'

credentialsAsInput: adding credentials as input parameters

See merge request fiji/haas-java-client!1
parents 7c3f35ac 1ee97ce2
No related branches found
No related tags found
1 merge request!1credentialsAsInput: adding credentials as input parameters
...@@ -2,40 +2,46 @@ package cz.it4i.fiji.haas_spim_benchmark.commands; ...@@ -2,40 +2,46 @@ package cz.it4i.fiji.haas_spim_benchmark.commands;
import java.nio.file.Path; import java.nio.file.Path;
import cz.it4i.fiji.haas_java_client.Configuration;
import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkSPIMParameters; import cz.it4i.fiji.haas_spim_benchmark.core.BenchmarkSPIMParameters;
class BenchmarkSPIMParametersImpl extends Configuration implements BenchmarkSPIMParameters{ class BenchmarkSPIMParametersImpl implements BenchmarkSPIMParameters{
private String userName;
private String password;
private String phone;
private String email;
private Path workingDirectory; private Path workingDirectory;
public BenchmarkSPIMParametersImpl(Path workingDirectory) { public BenchmarkSPIMParametersImpl(String userName, String password, String phone, String email, Path workingDirectory) {
super("configuration.properties"); this.userName = userName;
this.password = password;
this.phone = phone;
this.email = email;
this.workingDirectory = workingDirectory; this.workingDirectory = workingDirectory;
} }
@Override
public Path workingDirectory() {
return workingDirectory;
}
@Override @Override
public String username() { public String username() {
return getValue("USER_NAME"); return userName;
} }
@Override @Override
public String password() { public String password() {
return getValue("PASSWORD"); return password;
} }
@Override @Override
public String phone() { public String phone() {
return getValue("PHONE"); return phone;
} }
@Override @Override
public String email() { public String email() {
return getValue("EMAIL"); return email;
}
@Override
public Path workingDirectory() {
return workingDirectory;
} }
} }
...@@ -13,6 +13,8 @@ import org.scijava.plugin.Parameter; ...@@ -13,6 +13,8 @@ import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin; import org.scijava.plugin.Plugin;
import org.scijava.ui.ApplicationFrame; import org.scijava.ui.ApplicationFrame;
import org.scijava.ui.UIService; import org.scijava.ui.UIService;
import org.scijava.widget.FileWidget;
import org.scijava.widget.TextWidget;
import org.scijava.widget.UIComponent; import org.scijava.widget.UIComponent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -32,21 +34,33 @@ public class ManageSPIMBenchmark implements Command { ...@@ -32,21 +34,33 @@ public class ManageSPIMBenchmark implements Command {
private static Logger log = LoggerFactory private static Logger log = LoggerFactory
.getLogger(cz.it4i.fiji.haas_spim_benchmark.commands.ManageSPIMBenchmark.class); .getLogger(cz.it4i.fiji.haas_spim_benchmark.commands.ManageSPIMBenchmark.class);
@Parameter(label = "Work directory", persist = true, style = "directory")
private File workDirectory;
@Parameter @Parameter
private UIService uiService; private UIService uiService;
@Parameter @Parameter
private Context context; private Context context;
@Parameter(style = TextWidget.FIELD_STYLE)
private String userName;
@Parameter(style = TextWidget.PASSWORD_STYLE)
private String password;
@Parameter(style = TextWidget.FIELD_STYLE)
private String phone;
@Parameter(style = TextWidget.FIELD_STYLE)
private String email;
@Parameter(label = "Work directory", persist = true, style = FileWidget.DIRECTORY_STYLE)
private File workDirectory;
@Override @Override
public void run() { public void run() {
try { try {
ModalDialogs.doModal( ModalDialogs.doModal(
new BenchmarkSPIMWindow(getFrame(), new BenchmarkSPIMParametersImpl(Paths.get(workDirectory.getPath()))), new BenchmarkSPIMWindow(getFrame(), new BenchmarkSPIMParametersImpl(
WindowConstants.DISPOSE_ON_CLOSE); userName, password, phone, email, Paths.get(workDirectory.getPath()))), WindowConstants.DISPOSE_ON_CLOSE);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -3,9 +3,9 @@ package cz.it4i.fiji.haas_spim_benchmark.core; ...@@ -3,9 +3,9 @@ package cz.it4i.fiji.haas_spim_benchmark.core;
import java.nio.file.Path; import java.nio.file.Path;
public interface BenchmarkSPIMParameters { public interface BenchmarkSPIMParameters {
Path workingDirectory();
String username(); String username();
String password(); String password();
String phone(); String phone();
String email(); String email();
Path workingDirectory();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment