Skip to content
Snippets Groups Projects
Commit 1ee97ce2 authored by Unknown's avatar Unknown
Browse files

credentialsAsInput: adding credentials as input parameters

From now onwards, user credentials and contact info are going to be harvested as input parameters.
parent c8a91c81
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;
import java.nio.file.Path;
import cz.it4i.fiji.haas_java_client.Configuration;
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;
public BenchmarkSPIMParametersImpl(Path workingDirectory) {
super("configuration.properties");
public BenchmarkSPIMParametersImpl(String userName, String password, String phone, String email, Path workingDirectory) {
this.userName = userName;
this.password = password;
this.phone = phone;
this.email = email;
this.workingDirectory = workingDirectory;
}
@Override
public Path workingDirectory() {
return workingDirectory;
}
@Override
public String username() {
return getValue("USER_NAME");
return userName;
}
@Override
public String password() {
return getValue("PASSWORD");
return password;
}
@Override
public String phone() {
return getValue("PHONE");
return phone;
}
@Override
public String email() {
return getValue("EMAIL");
return email;
}
@Override
public Path workingDirectory() {
return workingDirectory;
}
}
......@@ -13,6 +13,8 @@ import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import org.scijava.ui.ApplicationFrame;
import org.scijava.ui.UIService;
import org.scijava.widget.FileWidget;
import org.scijava.widget.TextWidget;
import org.scijava.widget.UIComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -32,21 +34,33 @@ public class ManageSPIMBenchmark implements Command {
private static Logger log = LoggerFactory
.getLogger(cz.it4i.fiji.haas_spim_benchmark.commands.ManageSPIMBenchmark.class);
@Parameter(label = "Work directory", persist = true, style = "directory")
private File workDirectory;
@Parameter
private UIService uiService;
@Parameter
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
public void run() {
try {
ModalDialogs.doModal(
new BenchmarkSPIMWindow(getFrame(), new BenchmarkSPIMParametersImpl(Paths.get(workDirectory.getPath()))),
WindowConstants.DISPOSE_ON_CLOSE);
new BenchmarkSPIMWindow(getFrame(), new BenchmarkSPIMParametersImpl(
userName, password, phone, email, Paths.get(workDirectory.getPath()))), WindowConstants.DISPOSE_ON_CLOSE);
} catch (IOException e) {
// TODO Auto-generated catch block
log.error(e.getMessage(), e);
......
......@@ -3,9 +3,9 @@ package cz.it4i.fiji.haas_spim_benchmark.core;
import java.nio.file.Path;
public interface BenchmarkSPIMParameters {
Path workingDirectory();
String username();
String password();
String phone();
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