Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • DM/dm-docs
  • hammonds/dm-docs
  • hparraga/dm-docs
3 results
Show changes
package gov.anl.dm.esafsync.serviceconn;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
public class StorageServiceConnection extends ServiceConnection{
class Keyword {
static final String EXPERIMENT_NAME = "name";
static final String EXPERIMENT_DESCRIPTION = "description";
static final String EXPERIMENT_TYPE_ID = "experimentTypeId";
static final String EXPERIMENT_START_DATE = "startDate";
static final String EXPERIMENT_END_DATE = "endDate";
}
class StorageServUrl {
static final String EXPERIMENT = "/experiments";
static final String EXPERIMENT_USER = "/usersByExperiment";
static final String START_EXPERIMENT = "/experiments/start";
}
public int addExperiment(String name, String description, String startDate, String endDate) {
Map<String, String> data = new HashMap<>();
if (name == null) {
JOptionPane.showMessageDialog(null, "The experiment name is null", "Error",JOptionPane.ERROR_MESSAGE);
return ServiceConnection.ServiceConnectionStatus.ERROR;
} else {
data.put(Keyword.EXPERIMENT_NAME, encode(name));
}
if (description != null) {
data.put(Keyword.EXPERIMENT_DESCRIPTION, encode(description));
}
if (startDate != null) {
data.put(Keyword.EXPERIMENT_START_DATE, encode(startDate));
}
if (endDate != null) {
data.put(Keyword.EXPERIMENT_END_DATE, encode(endDate));
}
data.put(Keyword.EXPERIMENT_TYPE_ID, ESAF_EXPERIMENT_TYPE);
return invokeSessionPostRequest(StorageServUrl.EXPERIMENT, data);
}
public int addExperimentUser(String userName, String experimentName, String role) {
Map<String, String> data = new HashMap<>();
return invokeSessionPostRequest(StorageServUrl.EXPERIMENT_USER + "/" + userName + "/" + experimentName + "/" + role, data);
}
public int startExperiment(String name) {
Map<String, String> data = new HashMap<>();
if (name == null) {
JOptionPane.showMessageDialog(null, "The experiment name is null", "Error",JOptionPane.ERROR_MESSAGE);
return ServiceConnection.ServiceConnectionStatus.ERROR;
} else {
data.put(Keyword.EXPERIMENT_NAME, encode(name));
}
return invokeSessionPutRequest(StorageServUrl.START_EXPERIMENT, data);
}
}
all:
for d in $(SUBDIRS); do $(MAKE) -C $$d $(ARCH); done
dist:
for d in $(SUBDIRS); do $(MAKE) -C $$d $(ARCH); done
clean:
for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
distclean:
for d in $(SUBDIRS); do $(MAKE) -C $$d distclean; done
for d in $(SUBDIRS); do rm -f `find $$d -name 'RELEASE.local'`; done
tidy: distclean