|
|
|
@ -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);
|
|
|
|
|