Updated pom.xml to include configuration resources [#26192]

This commit is contained in:
Giancarlo Panichi 2024-01-29 12:49:28 +01:00
parent e1d88418be
commit 166d8cca86
13 changed files with 67 additions and 67 deletions

View File

@ -3,8 +3,7 @@
## [v2.8.0-SNAPSHOT] ## [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 ## [v2.7.1] - 2022-04-06

View File

@ -1,6 +1,6 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.dataanalysis.dataminer-pool-manager.2-8-0" date="2023-11-09"> <Changeset component="org.gcube.dataanalysis.dataminer-pool-manager.2-8-0" date="2024-01-29">
<Change>Updated to gcube-smartgears-bom.2.5.0</Change> <Change>Updated pom.xml to include configuration resources [#26192]</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.dataanalysis.dataminer-pool-manager.2-7-1" date="2022-04-06"> <Changeset component="org.gcube.dataanalysis.dataminer-pool-manager.2-7-1" date="2022-04-06">
<Change>Updated to gcube-smartgears-bom.2.2.0 [#23133]</Change> <Change>Updated to gcube-smartgears-bom.2.2.0 [#23133]</Change>

19
pom.xml
View File

@ -191,6 +191,25 @@
</resources> </resources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>copy-config</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<outputDirectory>${webappDirectory}/classes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>*/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>

View File

@ -97,16 +97,16 @@ public class ClientConfigurationCache
if (repositoryPassword != null && repositoryPassword.trim() == "") repositoryPassword = null; if (repositoryPassword != null && repositoryPassword.trim() == "") repositoryPassword = null;
this.logger.debug("Repository username "+repositoryUsername); logger.debug("Repository username "+repositoryUsername);
this.logger.debug("Repository password "+repositoryPassword); logger.debug("Repository password "+repositoryPassword);
} catch (Exception e) } catch (Exception e)
{ {
this.logger.debug("SVN Username and password not present"); this.logger.debug("SVN Username and password not present");
} }
this.logger.debug("SVN Repository URL: "+repositoryURL); logger.debug("SVN Repository URL: "+repositoryURL);
this.logger.debug("SVN Repository path: "+repositoryPath); logger.debug("SVN Repository path: "+repositoryPath);
response = new SVNRepository(repositoryURL, repositoryPath,repositoryUsername, repositoryPassword); response = new SVNRepository(repositoryURL, repositoryPath,repositoryUsername, repositoryPassword);

View File

@ -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 CONFIGURATIONS type;
private ClientConfigurationCache cache; private ClientConfigurationCache cache;

View File

@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNException;
public class DMPMClientConfiguratorManager { public class DMPMClientConfiguratorManager {
private final Logger logger; private final Logger logger=LoggerFactory.getLogger(DMPMClientConfiguratorManager.class);
private Properties defaultAdmins; private Properties defaultAdmins;
static DMPMClientConfiguratorManager instance; static DMPMClientConfiguratorManager instance;
@ -22,28 +22,27 @@ public class DMPMClientConfiguratorManager {
private ScopedCacheMap cacheMap; private ScopedCacheMap cacheMap;
private DMPMClientConfiguratorManager() { private DMPMClientConfiguratorManager() {
this.cacheMap = new ScopedCacheMap(); cacheMap = new ScopedCacheMap();
this.logger = LoggerFactory.getLogger(DMPMClientConfiguratorManager.class); defaultAdmins = new Properties();
this.defaultAdmins = new Properties();
try { try {
this.defaultAdmins.load(this.getClass().getResourceAsStream("/default.admins")); defaultAdmins.load(this.getClass().getResourceAsStream("/default.admins"));
this.logger.debug("Default users successfully loaded"); logger.debug("Default users successfully loaded");
} catch (Exception e) { } catch (Exception e) {
this.logger.error("Unable to get default users", e); logger.error("Unable to get default users", e);
} }
} }
private ClientConfigurationCache getCurrentCache() { private ClientConfigurationCache getCurrentCache() {
String currentScope = ScopeProvider.instance.get(); String currentScope = ScopeProvider.instance.get();
this.logger.debug("Current scope = " + currentScope); logger.debug("Current scope = " + currentScope);
this.logger.debug("Getting current configuration cache"); logger.debug("Getting current configuration cache");
ClientConfigurationCache cache = this.cacheMap.get(currentScope); ClientConfigurationCache cache = cacheMap.get(currentScope);
if (cache == null) { if (cache == null) {
this.logger.debug("Cache not created yet, creating..."); logger.debug("Cache not created yet, creating...");
cache = new ClientConfigurationCache(); 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 { public static void main(String[] args) throws IOException, SVNException {
DMPMClientConfiguratorManager a = new DMPMClientConfiguratorManager(); DMPMClientConfiguratorManager a = new DMPMClientConfiguratorManager();
ScopeProvider.instance.set("/gcube/devNext/NextNext"); ScopeProvider.instance.set("/gcube/devsec/devVRE");
// SecurityTokenProvider.instance.set("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548"); // SecurityTokenProvider.instance.set("xxx-xxx-xxx-xxx");
System.out.println("RESULT 1" + a.getStagingConfiguration().getSVNCRANDepsList()); System.out.println("RESULT 1" + a.getStagingConfiguration().getSVNCRANDepsList());
System.out.println("RESULT 2" + a.getProductionConfiguration().getRepository()); System.out.println("RESULT 2" + a.getProductionConfiguration().getRepository());

View File

@ -14,11 +14,10 @@ public class SVNRepositoryManager {
private SVNRepository svnRepository; private SVNRepository svnRepository;
private static SVNRepositoryManager instance; private static SVNRepositoryManager instance;
private Logger logger; private Logger logger=LoggerFactory.getLogger(SVNRepositoryManager.class);
private SVNRepositoryManager (Configuration configuration) throws SVNException private SVNRepositoryManager (Configuration configuration) throws SVNException
{ {
this.logger = LoggerFactory.getLogger(SVNRepositoryManager.class);
org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.SVNRepository repository = configuration.getSVNRepository(); org.gcube.dataanalysis.dataminer.poolmanager.clients.configuration.SVNRepository repository = configuration.getSVNRepository();
this.svnRepository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repository.getBaseUrl())); this.svnRepository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repository.getBaseUrl()));
ISVNAuthenticationManager authManager = null; ISVNAuthenticationManager authManager = null;

View File

@ -45,12 +45,11 @@ public abstract class SVNUpdater {
private SVNRepository svnRepository; private SVNRepository svnRepository;
private Configuration configuration; private Configuration configuration;
private Logger logger; private Logger logger=LoggerFactory.getLogger(SVNUpdater.class);
public SVNUpdater(Configuration configuration) throws SVNException { public SVNUpdater(Configuration configuration) throws SVNException {
this.configuration = configuration; this.configuration = configuration;
this.svnRepository = SVNRepositoryManager.getInstance(configuration).getSvnRepository(); this.svnRepository = SVNRepositoryManager.getInstance(configuration).getSvnRepository();
this.logger = LoggerFactory.getLogger(SVNUpdater.class);
} }
// public void updateRPRotoDeps(Algorithm algorithm) { // public void updateRPRotoDeps(Algorithm algorithm) {
@ -72,7 +71,7 @@ public abstract class SVNUpdater {
private String getDependencyFile (Configuration configuration, String language) 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) switch (language)
{ {
@ -123,7 +122,7 @@ public abstract class SVNUpdater {
private void updateAlgorithmList(String svnMainAlgoRepo, File algorithmsFile) throws SVNException, SVNCommitException 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 try
{ {
@ -137,7 +136,7 @@ public abstract class SVNUpdater {
} }
catch (FileNotFoundException e) 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 finally
{ {
@ -149,7 +148,7 @@ public abstract class SVNUpdater {
public void putFile(FileInputStream fileInputSreeam, String destinationFolder, String fileName) throws SVNException, SVNCommitException 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); final ISVNEditor commitEditor = svnRepository.getCommitEditor("Add algorithm to list", null);
commitEditor.openRoot(-1); commitEditor.openRoot(-1);
commitEditor.openDir(destinationFolder, -1); commitEditor.openDir(destinationFolder, -1);
@ -166,17 +165,17 @@ public abstract class SVNUpdater {
if (errorMessage != null) if (errorMessage != null)
{ {
this.logger.error("Operation failed: "+errorMessage.getFullMessage()); logger.error("Operation failed: "+errorMessage.getFullMessage());
throw new SVNCommitException(errorMessage,fileName); 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 { 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); final ISVNEditor commitEditor = svnRepository.getCommitEditor("Updating algorithm", null);
commitEditor.openRoot(-1); commitEditor.openRoot(-1);
commitEditor.openDir(destinationFolder, -1); commitEditor.openDir(destinationFolder, -1);
@ -197,12 +196,12 @@ public abstract class SVNUpdater {
if (errorMessage != null) if (errorMessage != null)
{ {
this.logger.error("Operation failed: "+errorMessage.getFullMessage()); logger.error("Operation failed: "+errorMessage.getFullMessage());
throw new SVNCommitException(errorMessage,fileName+" to be updated"); 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; boolean response = false;
try { try {
this.logger.debug("Updating algorithm list: " + file); logger.debug("Updating algorithm list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n");
@ -277,7 +276,7 @@ public abstract class SVNUpdater {
if (errorMessage != null) if (errorMessage != null)
{ {
this.logger.error("Operation failed: "+errorMessage.getFullMessage()); logger.error("Operation failed: "+errorMessage.getFullMessage());
response = false; response = false;
} }
else response = true; else response = true;
@ -286,7 +285,7 @@ public abstract class SVNUpdater {
} }
catch (Exception ex) catch (Exception ex)
{ {
this.logger.error("Unable to commit algorithm list",ex); logger.error("Unable to commit algorithm list",ex);
response = false; response = false;
} }
@ -314,7 +313,7 @@ public abstract class SVNUpdater {
sb.append("none | "); sb.append("none | ");
sb.append(this.getTimeZone() + " | "); sb.append(this.getTimeZone() + " | ");
this.logger.info("Algo details: "+sb.toString()); logger.info("Algo details: "+sb.toString());
return 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<String> validDependencies = new LinkedList<String>(); List<String> validDependencies = new LinkedList<String>();
@ -351,7 +350,7 @@ public abstract class SVNUpdater {
validDependencies.add(l.trim()); validDependencies.add(l.trim());
}} }}
this.logger.debug("Valid dependencies are: "+validDependencies); logger.debug("Valid dependencies are: "+validDependencies);
for(Dependency d: deps){ for(Dependency d: deps){
String depName = d.getName(); String depName = d.getName();
if(!validDependencies.contains(depName)){ if(!validDependencies.contains(depName)){
@ -410,6 +409,7 @@ public abstract class SVNUpdater {
// return check; // return check;
} catch (SVNException e) } catch (SVNException e)
{ {
logger.error(e.getLocalizedMessage(),e);
throw new GenericException(e); throw new GenericException(e);
} }
@ -423,7 +423,7 @@ public abstract class SVNUpdater {
boolean check = false; boolean check = false;
try { try {
this.logger.info("Checking dependencies list: " + file); logger.info("Checking dependencies list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
String lines[] = byteArrayOutputStream.toString().split("\\r?\\n"); String lines[] = byteArrayOutputStream.toString().split("\\r?\\n");
@ -454,7 +454,7 @@ public abstract class SVNUpdater {
// } // }
} catch (Exception a) } 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<Dependency> deps) { public void updateSVN(String file, Collection<Dependency> deps) {
try { try {
this.logger.info("Updating dependencies list: " + file); logger.info("Updating dependencies list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream); svnRepository.getFile(file, SVNRepository.INVALID_REVISION, null, byteArrayOutputStream);
@ -543,7 +543,7 @@ public abstract class SVNUpdater {
Date fromDate = formatter.parse(cal.getTime().toString()); Date fromDate = formatter.parse(cal.getTime().toString());
TimeZone central = TimeZone.getTimeZone("UTC"); TimeZone central = TimeZone.getTimeZone("UTC");
formatter.setTimeZone(central); formatter.setTimeZone(central);
this.logger.info(formatter.format(fromDate)); logger.info(formatter.format(fromDate));
return formatter.format(fromDate); return formatter.format(fromDate);
} }

View File

@ -6,7 +6,7 @@ svn.algo.main.repo = /trunk/data-analysis/DataMinerConfiguration/algorithms
#STAGE #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.algorithms-list = /trunk/data-analysis/DataMinerConfiguration/algorithms/dev/algorithms
svn.stage.deps-linux-compiled = /trunk/data-analysis/RConfiguration/RPackagesManagement/r_deb_pkgs.txt svn.stage.deps-linux-compiled = /trunk/data-analysis/RConfiguration/RPackagesManagement/r_deb_pkgs.txt

View File

@ -1,4 +1,4 @@
dependencies: dependencies:
# - { role: gcube-dataminer } # - { role: gcube-dataminer }
# - { role: os-unzip } # - { role: os-unzip }
# - { role: os-java-1.7.0 } # - { role: os-java-1.8.0 }

View File

@ -1,7 +1,7 @@
--- ---
- name: adding OS Package java-1.7.0 - name: adding OS Package java-1.8.0
package: package:
name: java-1.7.0-openjdk name: java-1.8.0-openjdk
state: "{{os_package_state}}" state: "{{os_package_state}}"
become: true become: true

View File

@ -3,3 +3,4 @@
/changelog.xml /changelog.xml
/gcube-app.xml /gcube-app.xml
/profile.xml /profile.xml
/classes/

View File

@ -24,7 +24,7 @@ public class SVNTests {
//algo.setClazz(algo.getClazz() + "TEST"); //algo.setClazz(algo.getClazz() + "TEST");
algo.setAlgorithmType("transducerers"); algo.setAlgorithmType("transducerers");
algo.setCategory("NLP"); algo.setCategory("NLP");
algo.setFullname("Ondřej Košarko"); algo.setFullname("Master Test");
//System.out.println(algo.getCategory()); //System.out.println(algo.getCategory());
//System.out.println(algo.getSkipJava()); //System.out.println(algo.getSkipJava());