-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
124 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2018 Databases and Information Systems Research Group, University of Basel, Switzerland | ||
Copyright (c) 2018-2022 The Chronos Project | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -45,7 +45,6 @@ of this software and associated documentation files (the "Software"), to deal | |
import java.util.TimerTask; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.TimeUnit; | ||
import kong.unirest.json.JSONObject; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.lingala.zip4j.ZipFile; | ||
import net.lingala.zip4j.model.ZipParameters; | ||
|
@@ -59,10 +58,7 @@ of this software and associated documentation files (the "Software"), to deal | |
* uploading of the results of a job provided by a Chronos HTTP API. | ||
* | ||
* If problems with SSL occur: https://confluence.atlassian.com/kb/connecting-to-ssl-services-802171215.html | ||
* Or use non secure connections. | ||
* | ||
* @author Marco Vogt ([email protected]) | ||
* @author Alexander Stiemer ([email protected]) | ||
* Or use non-secure connections. | ||
*/ | ||
@Slf4j | ||
public abstract class AbstractChronosAgent extends Thread { | ||
|
@@ -524,20 +520,7 @@ protected abstract Object clean( | |
*/ | ||
protected void saveResults( final Properties executionResults, final File outputDirectory ) throws IllegalStateException { | ||
final File resultsJsonFile = new File( outputDirectory, "results.json" ); | ||
|
||
JSONObject resultsJsonObject = new JSONObject(); | ||
for ( Map.Entry<Object, Object> result : executionResults.entrySet() ) { | ||
resultsJsonObject.put( result.getKey().toString(), result.getValue().toString() ); | ||
} | ||
|
||
try ( PrintWriter out = new PrintWriter( resultsJsonFile, UTF_8.name() ) ) { | ||
out.println( resultsJsonObject.toString() ); | ||
out.flush(); | ||
} catch ( FileNotFoundException ex ) { | ||
throw new IllegalStateException( ex ); | ||
} catch ( UnsupportedEncodingException ex ) { | ||
throw new RuntimeException( ex ); | ||
} | ||
Utils.saveResults( executionResults, resultsJsonFile ); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2018 Databases and Information Systems Research Group, University of Basel, Switzerland | ||
Copyright (c) 2018-2022 The Chronos Project | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -53,10 +53,6 @@ of this software and associated documentation files (the "Software"), to deal | |
import org.apache.commons.validator.routines.InetAddressValidator; | ||
|
||
|
||
/** | ||
* @author Alexander Stiemer ([email protected]) | ||
* @author Marco Vogt ([email protected]) | ||
*/ | ||
@Slf4j | ||
public class ChronosHttpClient { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2018 Databases and Information Systems Research Group, University of Basel, Switzerland | ||
Copyright (c) 2018-2022 The Chronos Project | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -48,9 +48,6 @@ of this software and associated documentation files (the "Software"), to deal | |
|
||
/** | ||
* Representation of a Job of the Chronos System. | ||
* | ||
* @author Alexander Stiemer ([email protected]) | ||
* @author Marco Vogt ([email protected]) | ||
*/ | ||
public class ChronosJob implements Serializable { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2018-2022 The Chronos Project | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
package ch.unibas.dmi.dbis.chronos.agent; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.PrintWriter; | ||
import java.io.UnsupportedEncodingException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
import kong.unirest.json.JSONObject; | ||
|
||
class Utils { | ||
|
||
static void saveResults( final Properties executionResults, final File resultsJsonFile ) throws IllegalStateException { | ||
JSONObject resultsJsonObject = new JSONObject(); | ||
for ( Map.Entry<Object, Object> result : executionResults.entrySet() ) { | ||
resultsJsonObject.put( result.getKey().toString(), result.getValue().toString() ); | ||
} | ||
|
||
try ( PrintWriter out = new PrintWriter( resultsJsonFile, StandardCharsets.UTF_8.name() ) ) { | ||
out.println( resultsJsonObject ); | ||
out.flush(); | ||
} catch ( FileNotFoundException ex ) { | ||
throw new IllegalStateException( ex ); | ||
} catch ( UnsupportedEncodingException ex ) { | ||
throw new RuntimeException( ex ); | ||
} | ||
} | ||
|
||
} |