From 166d8cca8688b975ad1ddf8a55883bb3e06c45b1 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 29 Jan 2024 12:49:28 +0100 Subject: [PATCH] Updated pom.xml to include configuration resources [#26192] --- CHANGELOG.md | 3 +- changelog.xml | 4 +- pom.xml | 19 +++++++++ .../ClientConfigurationCache.java | 8 ++-- .../configuration/ConfigurationImpl.java | 17 -------- .../DMPMClientConfiguratorManager.java | 27 ++++++------ .../util/SVNRepositoryManager.java | 3 +- .../poolmanager/util/SVNUpdater.java | 42 +++++++++---------- src/main/resources/service.properties | 2 +- .../gcube-algorithm-installer/meta/main.yaml | 2 +- .../tasks/main.yaml | 4 +- src/main/webapp/WEB-INF/.gitignore | 1 + .../dataminerpoolmanager/SVNTests.java | 2 +- 13 files changed, 67 insertions(+), 67 deletions(-) rename src/main/resources/static/{os-java-1.7.0 => os-java-1.8.0}/tasks/main.yaml (50%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5944841..ed2e79b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,7 @@ ## [v2.8.0-SNAPSHOT] -- Updated to gcube-smartgears-bom.2.5.0 - +- Updated pom.xml to include configuration resources [#26192] ## [v2.7.1] - 2022-04-06 diff --git a/changelog.xml b/changelog.xml index 05236a1..d05c182 100755 --- a/changelog.xml +++ b/changelog.xml @@ -1,6 +1,6 @@ - - Updated to gcube-smartgears-bom.2.5.0 + + Updated pom.xml to include configuration resources [#26192] Updated to gcube-smartgears-bom.2.2.0 [#23133] diff --git a/pom.xml b/pom.xml index 581edb9..8bb061d 100755 --- a/pom.xml +++ b/pom.xml @@ -191,6 +191,25 @@ + + copy-config + + copy-resources + + process-resources + + ${webappDirectory}/classes + + + ${project.basedir}/src/main/resources/ + true + + */** + + + + + diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ClientConfigurationCache.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ClientConfigurationCache.java index 774a33d..1b69849 100755 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ClientConfigurationCache.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ClientConfigurationCache.java @@ -97,16 +97,16 @@ public class ClientConfigurationCache if (repositoryPassword != null && repositoryPassword.trim() == "") repositoryPassword = null; - this.logger.debug("Repository username "+repositoryUsername); - this.logger.debug("Repository password "+repositoryPassword); + logger.debug("Repository username "+repositoryUsername); + logger.debug("Repository password "+repositoryPassword); } catch (Exception e) { this.logger.debug("SVN Username and password not present"); } - this.logger.debug("SVN Repository URL: "+repositoryURL); - this.logger.debug("SVN Repository path: "+repositoryPath); + logger.debug("SVN Repository URL: "+repositoryURL); + logger.debug("SVN Repository path: "+repositoryPath); response = new SVNRepository(repositoryURL, repositoryPath,repositoryUsername, repositoryPassword); diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ConfigurationImpl.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ConfigurationImpl.java index 363ad1d..445eee8 100755 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ConfigurationImpl.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/ConfigurationImpl.java @@ -30,23 +30,6 @@ public class ConfigurationImpl implements Configuration { } -// enum REPOSITORIES { -// REPO ("svn.repository"), -// MAIN_ALGO ("svn.algo.main.repo"); -// -// private String type; -// -// private REPOSITORIES(String type) { -// this.type = type; -// } -// -// @Override -// public String toString() { -// return this.type; -// } -// } - - private CONFIGURATIONS type; private ClientConfigurationCache cache; diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/DMPMClientConfiguratorManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/DMPMClientConfiguratorManager.java index 25f8f3f..9a50574 100755 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/DMPMClientConfiguratorManager.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/configuration/DMPMClientConfiguratorManager.java @@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory; import org.tmatesoft.svn.core.SVNException; public class DMPMClientConfiguratorManager { - private final Logger logger; + private final Logger logger=LoggerFactory.getLogger(DMPMClientConfiguratorManager.class); private Properties defaultAdmins; static DMPMClientConfiguratorManager instance; @@ -22,28 +22,27 @@ public class DMPMClientConfiguratorManager { private ScopedCacheMap cacheMap; private DMPMClientConfiguratorManager() { - this.cacheMap = new ScopedCacheMap(); - this.logger = LoggerFactory.getLogger(DMPMClientConfiguratorManager.class); - this.defaultAdmins = new Properties(); + cacheMap = new ScopedCacheMap(); + defaultAdmins = new Properties(); try { - this.defaultAdmins.load(this.getClass().getResourceAsStream("/default.admins")); - this.logger.debug("Default users successfully loaded"); + defaultAdmins.load(this.getClass().getResourceAsStream("/default.admins")); + logger.debug("Default users successfully loaded"); } catch (Exception e) { - this.logger.error("Unable to get default users", e); + logger.error("Unable to get default users", e); } } private ClientConfigurationCache getCurrentCache() { String currentScope = ScopeProvider.instance.get(); - this.logger.debug("Current scope = " + currentScope); - this.logger.debug("Getting current configuration cache"); - ClientConfigurationCache cache = this.cacheMap.get(currentScope); + logger.debug("Current scope = " + currentScope); + logger.debug("Getting current configuration cache"); + ClientConfigurationCache cache = cacheMap.get(currentScope); if (cache == null) { - this.logger.debug("Cache not created yet, creating..."); + logger.debug("Cache not created yet, creating..."); cache = new ClientConfigurationCache(); - this.cacheMap.put(currentScope, cache); + cacheMap.put(currentScope, cache); } @@ -88,8 +87,8 @@ public class DMPMClientConfiguratorManager { public static void main(String[] args) throws IOException, SVNException { DMPMClientConfiguratorManager a = new DMPMClientConfiguratorManager(); - ScopeProvider.instance.set("/gcube/devNext/NextNext"); - // SecurityTokenProvider.instance.set("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548"); + ScopeProvider.instance.set("/gcube/devsec/devVRE"); + // SecurityTokenProvider.instance.set("xxx-xxx-xxx-xxx"); System.out.println("RESULT 1" + a.getStagingConfiguration().getSVNCRANDepsList()); System.out.println("RESULT 2" + a.getProductionConfiguration().getRepository()); diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNRepositoryManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNRepositoryManager.java index 1bfa46c..137f0f7 100755 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNRepositoryManager.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNRepositoryManager.java @@ -14,11 +14,10 @@ public class SVNRepositoryManager { private SVNRepository svnRepository; private static SVNRepositoryManager instance; - private Logger logger; + private Logger logger=LoggerFactory.getLogger(SVNRepositoryManager.class); private SVNRepositoryManager (Configuration configuration) throws SVNException { - this.logger = LoggerFactory.getLogger(SVNRepositoryManager.class); org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.SVNRepository repository = configuration.getSVNRepository(); this.svnRepository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repository.getBaseUrl())); ISVNAuthenticationManager authManager = null; diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java index 1d55682..6f985db 100755 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java @@ -45,12 +45,11 @@ public abstract class SVNUpdater { private SVNRepository svnRepository; private Configuration configuration; - private Logger logger; + private Logger logger=LoggerFactory.getLogger(SVNUpdater.class); public SVNUpdater(Configuration configuration) throws SVNException { this.configuration = configuration; this.svnRepository = SVNRepositoryManager.getInstance(configuration).getSvnRepository(); - this.logger = LoggerFactory.getLogger(SVNUpdater.class); } // public void updateRPRotoDeps(Algorithm algorithm) { @@ -72,7 +71,7 @@ public abstract class SVNUpdater { private String getDependencyFile (Configuration configuration, String language) { - this.logger.debug("Getting dependency file for language "+language); + logger.debug("Getting dependency file for language "+language); switch (language) { @@ -123,7 +122,7 @@ public abstract class SVNUpdater { private void updateAlgorithmList(String svnMainAlgoRepo, File algorithmsFile) throws SVNException, SVNCommitException { - this.logger.debug("Adding .jar file: " + algorithmsFile + " to repository " + svnMainAlgoRepo); + logger.debug("Adding .jar file: " + algorithmsFile + " to repository " + svnMainAlgoRepo); try { @@ -137,7 +136,7 @@ public abstract class SVNUpdater { } catch (FileNotFoundException e) { - this.logger.error("Temporary algorithm file not found: this exception should not happen",e); + logger.error("Temporary algorithm file not found: this exception should not happen",e); } finally { @@ -149,7 +148,7 @@ public abstract class SVNUpdater { public void putFile(FileInputStream fileInputSreeam, String destinationFolder, String fileName) throws SVNException, SVNCommitException { - this.logger.debug("Putting new file on the SVN repository"); + logger.debug("Putting new file on the SVN repository"); final ISVNEditor commitEditor = svnRepository.getCommitEditor("Add algorithm to list", null); commitEditor.openRoot(-1); commitEditor.openDir(destinationFolder, -1); @@ -166,17 +165,17 @@ public abstract class SVNUpdater { if (errorMessage != null) { - this.logger.error("Operation failed: "+errorMessage.getFullMessage()); + logger.error("Operation failed: "+errorMessage.getFullMessage()); throw new SVNCommitException(errorMessage,fileName); } - this.logger.debug("Operation completed"); + logger.debug("Operation completed"); } public void updateFile(FileInputStream fileInputStream, String destinationFolder, String fileName) throws SVNException, SVNCommitException { - this.logger.debug("Updating existing file on the SVN repository"); + logger.debug("Updating existing file on the SVN repository"); final ISVNEditor commitEditor = svnRepository.getCommitEditor("Updating algorithm", null); commitEditor.openRoot(-1); commitEditor.openDir(destinationFolder, -1); @@ -197,12 +196,12 @@ public abstract class SVNUpdater { if (errorMessage != null) { - this.logger.error("Operation failed: "+errorMessage.getFullMessage()); + logger.error("Operation failed: "+errorMessage.getFullMessage()); throw new SVNCommitException(errorMessage,fileName+" to be updated"); } - this.logger.debug("Operation completed"); + logger.debug("Operation completed"); } @@ -231,7 +230,7 @@ public abstract class SVNUpdater { boolean response = false; try { - this.logger.debug("Updating algorithm list: " + file); + logger.debug("Updating algorithm list: " + file); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); @@ -277,7 +276,7 @@ public abstract class SVNUpdater { if (errorMessage != null) { - this.logger.error("Operation failed: "+errorMessage.getFullMessage()); + logger.error("Operation failed: "+errorMessage.getFullMessage()); response = false; } else response = true; @@ -286,7 +285,7 @@ public abstract class SVNUpdater { } catch (Exception ex) { - this.logger.error("Unable to commit algorithm list",ex); + logger.error("Unable to commit algorithm list",ex); response = false; } @@ -314,7 +313,7 @@ public abstract class SVNUpdater { sb.append("none | "); sb.append(this.getTimeZone() + " | "); - this.logger.info("Algo details: "+sb.toString()); + logger.info("Algo details: "+sb.toString()); return sb.toString(); } @@ -337,7 +336,7 @@ public abstract class SVNUpdater { } - this.logger.debug("Checking dependencies list: " + file); + logger.debug("Checking dependencies list: " + file); List validDependencies = new LinkedList(); @@ -351,7 +350,7 @@ public abstract class SVNUpdater { validDependencies.add(l.trim()); }} - this.logger.debug("Valid dependencies are: "+validDependencies); + logger.debug("Valid dependencies are: "+validDependencies); for(Dependency d: deps){ String depName = d.getName(); if(!validDependencies.contains(depName)){ @@ -410,6 +409,7 @@ public abstract class SVNUpdater { // return check; } catch (SVNException e) { + logger.error(e.getLocalizedMessage(),e); throw new GenericException(e); } @@ -423,7 +423,7 @@ public abstract class SVNUpdater { boolean check = false; try { - this.logger.info("Checking dependencies list: " + file); + logger.info("Checking dependencies list: " + file); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); @@ -454,7 +454,7 @@ public abstract class SVNUpdater { // } } catch (Exception a) { - this.logger.error(a.getMessage(),a); + logger.error(a.getMessage(),a); } @@ -464,7 +464,7 @@ public abstract class SVNUpdater { public void updateSVN(String file, Collection deps) { try { - this.logger.info("Updating dependencies list: " + file); + logger.info("Updating dependencies list: " + file); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); @@ -543,7 +543,7 @@ public abstract class SVNUpdater { Date fromDate = formatter.parse(cal.getTime().toString()); TimeZone central = TimeZone.getTimeZone("UTC"); formatter.setTimeZone(central); - this.logger.info(formatter.format(fromDate)); + logger.info(formatter.format(fromDate)); return formatter.format(fromDate); } diff --git a/src/main/resources/service.properties b/src/main/resources/service.properties index 3819f20..39733cf 100755 --- a/src/main/resources/service.properties +++ b/src/main/resources/service.properties @@ -6,7 +6,7 @@ svn.algo.main.repo = /trunk/data-analysis/DataMinerConfiguration/algorithms #STAGE -STAGE_GHOST = dataminer-ghost-d.dev.d4science.org +STAGE_GHOST = dataminer-ghost.cloud-dev.d4science.org svn.stage.algorithms-list = /trunk/data-analysis/DataMinerConfiguration/algorithms/dev/algorithms svn.stage.deps-linux-compiled = /trunk/data-analysis/RConfiguration/RPackagesManagement/r_deb_pkgs.txt diff --git a/src/main/resources/static/gcube-algorithm-installer/meta/main.yaml b/src/main/resources/static/gcube-algorithm-installer/meta/main.yaml index e3ea93e..fe33300 100755 --- a/src/main/resources/static/gcube-algorithm-installer/meta/main.yaml +++ b/src/main/resources/static/gcube-algorithm-installer/meta/main.yaml @@ -1,4 +1,4 @@ dependencies: # - { role: gcube-dataminer } # - { role: os-unzip } -# - { role: os-java-1.7.0 } +# - { role: os-java-1.8.0 } diff --git a/src/main/resources/static/os-java-1.7.0/tasks/main.yaml b/src/main/resources/static/os-java-1.8.0/tasks/main.yaml similarity index 50% rename from src/main/resources/static/os-java-1.7.0/tasks/main.yaml rename to src/main/resources/static/os-java-1.8.0/tasks/main.yaml index 2906525..a6c96f9 100755 --- a/src/main/resources/static/os-java-1.7.0/tasks/main.yaml +++ b/src/main/resources/static/os-java-1.8.0/tasks/main.yaml @@ -1,7 +1,7 @@ --- -- name: adding OS Package java-1.7.0 +- name: adding OS Package java-1.8.0 package: - name: java-1.7.0-openjdk + name: java-1.8.0-openjdk state: "{{os_package_state}}" become: true diff --git a/src/main/webapp/WEB-INF/.gitignore b/src/main/webapp/WEB-INF/.gitignore index e5d1453..5f5322b 100755 --- a/src/main/webapp/WEB-INF/.gitignore +++ b/src/main/webapp/WEB-INF/.gitignore @@ -3,3 +3,4 @@ /changelog.xml /gcube-app.xml /profile.xml +/classes/ diff --git a/src/test/java/org/gcube/dataanalysis/dataminerpoolmanager/SVNTests.java b/src/test/java/org/gcube/dataanalysis/dataminerpoolmanager/SVNTests.java index 89e7d8c..1d29cbe 100755 --- a/src/test/java/org/gcube/dataanalysis/dataminerpoolmanager/SVNTests.java +++ b/src/test/java/org/gcube/dataanalysis/dataminerpoolmanager/SVNTests.java @@ -24,7 +24,7 @@ public class SVNTests { //algo.setClazz(algo.getClazz() + "TEST"); algo.setAlgorithmType("transducerers"); algo.setCategory("NLP"); - algo.setFullname("Ondřej Košarko"); + algo.setFullname("Master Test"); //System.out.println(algo.getCategory()); //System.out.println(algo.getSkipJava());