--- a/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java
+++ b/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java
@@ -269,7 +269,7 @@
public void process(boolean remote) throws EditException, OpenDataflowException, InvalidOptionException,
InvalidDataflowException, TokenOrderException, ReadInputException, DatabaseConfigurationException,
- CMException, IOException, DeserializationException, IterationTypeMismatchException {
+ CMException, IOException, DeserializationException, IterationTypeMismatchException, TavernaExtractorException {
LOGGER.info( "Start Taverna Extractor ...");
@@ -277,7 +277,10 @@
TavernaExtractor.setTavernaHomeLib(TavernaExtractor.getTavernaHome().resolve("lib"));
TavernaExtractor.setTavernaHomeRepo(TavernaExtractor.getTavernaHome().resolve("repository"));
- //validateDirectories(TavernaExtractor.getTavernaHome(), TavernaExtractor.getTavernaHomeLib(), TavernaExtractor.getTavernaHomeRepo());
+ if(remote)
+ validateRemoteDirectories(TavernaExtractor.getTavernaHome(), TavernaExtractor.getTavernaHomeLib(), TavernaExtractor.getTavernaHomeRepo());
+ else
+ validateDirectories(TavernaExtractor.getTavernaHome(), TavernaExtractor.getTavernaHomeLib(), TavernaExtractor.getTavernaHomeRepo());
LOGGER.info( "TavernaHome is set to [" + TavernaExtractor.getTavernaHome() + "].");
LOGGER.info( "TavernaHomeLib is set to [" + TavernaExtractor.getTavernaHomeLib() + "].");
@@ -1912,13 +1915,22 @@
}
}
- // TODO valdiate dirs of remote machine
- private void validateDirectories(Path... dirs) throws IOException{
+ private void validateDirectories(Path... dirs) throws TavernaExtractorException{
for(Path path : dirs) {
if (path == null || Files.notExists(path) || !Files.isDirectory(path) || !Files.isReadable(path)) {
- throw new IOException("Directory '" + path + "' does not exists or is invalid.");
- }
+ throw new TavernaExtractorException("Directory '" + path + "' does not exists or is invalid.");
+ }
+ }
+ }
+
+ private void validateRemoteDirectories(Path... dirs) throws TavernaExtractorException{
+ try {
+ for(Path path : dirs)
+ sshManager.directoryExists(sshManager.createSession(15000), path);
+ }
+ catch(SSHManagerException sshME){
+ throw new TavernaExtractorException(sshME.getLocalizedMessage());
}
}