Skip to content
Merged
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>life.qbic</groupId>
<artifactId>postman-cli</artifactId>
<version>1.3.0</version>
<name>Postman cli</name>
<url>http://github.com/qbicsoftware/postman-cli</url>
<url>https://github.com/qbicsoftware/postman-cli</url>
<description>A client software written in Java for dataset downloads from QBiC's data management system openBIS </description>
<packaging>jar</packaging>

Expand Down
19 changes: 14 additions & 5 deletions src/main/java/life/qbic/App.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package life.qbic;

import java.io.File;
import java.io.IOException;
import java.util.Optional;
import life.qbic.io.commandline.OpenBISPasswordParser;
import life.qbic.io.commandline.PostmanCommandLineOptions;
import life.qbic.model.Configuration;
import life.qbic.model.download.Authentication;
import life.qbic.model.download.AuthenticationException;
import life.qbic.model.download.ConnectionException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import picocli.CommandLine;

import java.io.File;
import java.util.Optional;

/**
* postman for staging data from openBIS
*/
public class App {

private static final Logger LOG = LogManager.getLogger(App.class);

public static void main(String[] args) throws IOException {
public static void main(String[] args) {

CommandLine cmd = new CommandLine(new PostmanCommandLineOptions());
int exitCode = cmd.execute(args);
Expand Down Expand Up @@ -67,7 +68,15 @@ public static Authentication loginToOpenBIS(
}

// Ensure 'logs' folder is created
new File(System.getProperty("user.dir") + File.separator + "logs").mkdirs();
File logFolder = new File(Configuration.LOG_PATH.toAbsolutePath().toString());
if (!logFolder.exists()) {
boolean logFolderCreated = logFolder.mkdirs();
if (!logFolderCreated) {
LOG.error("Could not create log folder '" + logFolder.getAbsolutePath() + "'");
System.exit(1);
}
}

Authentication authentication =
new Authentication(
user,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/life/qbic/io/parser/IdentifierParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IdentifierParser {
* Retrieve the identifiers from provided file
*
* @return Identifiers for which datasets will be retrieved
* @throws IOException
* @throws IOException if the file could not be read successfully
*/
public static List<String> readProvidedIdentifiers(File file) throws IOException {
List<String> identifiers = new ArrayList<>();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/life/qbic/model/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
*/
public class Configuration {

public static long MAX_DOWNLOAD_ATTEMPTS = 3;
public static Path LOG_PATH = Paths.get(System.getProperty("user.dir"),"logs");
public static final long MAX_DOWNLOAD_ATTEMPTS = 3;
public static final Path LOG_PATH = Paths.get(System.getProperty("user.dir"),"logs");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Authentication(
/**
* Login method for openBIS authentication
*
* returns 0 if successful, 1 else
* @throws AuthenticationException in case the authentication failed
*/
public void login() throws ConnectionException, AuthenticationException {
try {
Expand Down
17 changes: 7 additions & 10 deletions src/main/java/life/qbic/model/download/QbicDataDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@
import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
import ch.systemsx.cisd.common.spring.HttpInvokerUtils;
import life.qbic.model.files.FileSize;
import life.qbic.model.files.FileSizeFormatter;

import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import life.qbic.model.files.FileSize;
import life.qbic.model.files.FileSizeFormatter;

/**
* Lists information about requested datasets and their files
*/
public class QbicDataDisplay {

String sessionToken;
final String sessionToken;

DateTimeFormatter utcDateTimeFormatterIso8601 = new DateTimeFormatterBuilder()
private final static DateTimeFormatter utcDateTimeFormatterIso8601 = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'hh:mm:ss")
.appendZoneId()
.toFormatter()
Expand All @@ -38,7 +35,7 @@ public class QbicDataDisplay {
* Constructor for a QbicDataDisplay instance
*
* @param AppServerUri The openBIS application server URL (AS)
* @param DataServerUri The openBIS datastore server URL (DSS)
* @param dataServerUris The openBIS datastore server URLs (DSS)
* @param sessionToken The session token for the datastore & application servers
*/
public QbicDataDisplay(
Expand Down