This commit is contained in:
Lucio Lelii 2017-10-11 16:17:52 +00:00
parent 2b4cb4818b
commit e0af8b8a4f
2 changed files with 7 additions and 2 deletions

View File

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

View File

@ -25,7 +25,7 @@ no. 654119), SoBigData (grant no. 654024);
Version 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. Please see the file named "changelog.xml" in this directory for the release notes.