Lucio Lelii 7 years ago
parent 2b4cb4818b
commit e0af8b8a4f

@ -30,11 +30,13 @@ public class GcubeAlgorithmRepository implements IAlgorithmRepository {
log.info("gcube algorithm repository started");
if (updater==null) throw new RuntimeException("GcubeAlgorithmRepository cannot be initialized: updater is null");
updater.init();
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
updater.startWhatcher();
}
public ProcessDescriptionType getProcessDescription(String identifier){
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
log.info("getProcessDescription with identifier {} ",identifier);
try{
@ -49,6 +51,7 @@ public class GcubeAlgorithmRepository implements IAlgorithmRepository {
}
public boolean containsAlgorithm(String identifier) {
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
log.info("containsAlgorithm with identifier {} ",identifier);
Set<Class<?>> classes = reflection.getTypesAnnotatedWith(Algorithm.class);
@ -61,6 +64,7 @@ public class GcubeAlgorithmRepository implements IAlgorithmRepository {
}
public IAlgorithm getAlgorithm(String identifier){
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
log.info("getAlgorithm with identifier {} ",identifier);
try{
@ -80,13 +84,13 @@ public class GcubeAlgorithmRepository implements IAlgorithmRepository {
}
public static Set<Class<?>> getAllAlgorithms() {
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
return reflection.getTypesAnnotatedWith(Algorithm.class);
}
private static synchronized void updateRepository(){
if (reflection==null || updater.mustUpdate()){
Thread.currentThread().setContextClassLoader(updater.getLoader());
log.info("updating repository ({}) ",updater.mustUpdate());
updater.reset();
ConfigurationBuilder confBuilder = new ConfigurationBuilder()
@ -98,6 +102,7 @@ public class GcubeAlgorithmRepository implements IAlgorithmRepository {
@Override
public Collection<String> getAlgorithmNames() {
Thread.currentThread().setContextClassLoader(updater.getLoader());
updateRepository();
Collection<String> toReturn = new ArrayList<String>();
Set<Class<?>> classes = reflection.getTypesAnnotatedWith(Algorithm.class);

@ -25,7 +25,7 @@ no. 654119), SoBigData (grant no. 654024);
Version
--------------------------------------------------
1.1.0-SNAPSHOT (${maven.build.timestamp})
1.1.0-SNAPSHOT (2017-10-11)
Please see the file named "changelog.xml" in this directory for the release notes.

Loading…
Cancel
Save