Skip to content
Snippets Groups Projects
Commit 99297052 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

return ok when listing methods

parent 9fccbf5f
No related branches found
No related tags found
No related merge requests found
package eu.hbp.mip.akka;
import javax.inject.Named;
/**
* Created by mirco on 24.10.16.
*/
@Named("ListeningService")
public class ListeningService {
public void listen(String result) {
System.out.println(result);
}
}
\ No newline at end of file
......@@ -15,18 +15,14 @@ import static eu.hbp.mip.akka.SpringExtension.SpringExtProvider;
@Configuration
class AkkaConfiguration {
// the application context is needed to initialize the Akka Spring Extension
@Autowired
private ApplicationContext applicationContext;
/**
* Actor system singleton for this application.
*/
@Bean
public ActorSystem actorSystem() {
ActorSystem system = ActorSystem.create("AkkaJavaSpring");
// initialize the application context in the Akka Spring Extension
ActorSystem system = ActorSystem.create("AkkaActorSystem");
SpringExtProvider.get(system).initialize(applicationContext);
return system;
}
}
\ No newline at end of file
......@@ -7,8 +7,6 @@ import akka.actor.Props;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import eu.hbp.mip.akka.ExperimentActor;
import eu.hbp.mip.akka.SimpleActor;
import eu.hbp.mip.configuration.SecurityConfiguration;
......@@ -25,6 +23,7 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -80,6 +79,9 @@ public class ExperimentApi {
@Autowired
private ActorSystem actorSystem;
@Autowired
private ApplicationContext applicationContext;
@Value("#{'${akka.woken-path:akka.tcp://woken@127.0.0.1:8088/user/entrypoint}'}")
private String wokenPath;
......@@ -211,7 +213,7 @@ public class ExperimentApi {
@ApiOperation(value = "List available methods and validations", response = String.class)
@Cacheable("methods")
@RequestMapping(path = "/methods", method = RequestMethod.GET)
public ResponseEntity<String> listAvailableMethodsAndValidations() throws IOException {
public ResponseEntity listAvailableMethodsAndValidations() throws IOException {
LOGGER.info("List available methods and validations");
StringBuilder response = new StringBuilder();
......@@ -220,19 +222,7 @@ public class ExperimentApi {
ActorRef simpleActor = actorSystem.actorOf(Props.create(SimpleActor.class));
wokenActor.tell(new MethodsQuery(), simpleActor);
// TODO: remove this
int code = 200;
JsonObject catalog = new JsonParser().parse(response.toString()).getAsJsonObject();
//
// InputStream is = ExperimentApi.class.getClassLoader().getResourceAsStream(EXAREME_ALGO_JSON_FILE);
// InputStreamReader isr = new InputStreamReader(is);
// BufferedReader br = new BufferedReader(isr);
// JsonObject exaremeAlgo = new JsonParser().parse(br).getAsJsonObject();
//
// catalog.get("algorithms").getAsJsonArray().add(exaremeAlgo);
//
return new ResponseEntity<>(gson.toJson(catalog), HttpStatus.valueOf(code));
return ResponseEntity.ok().build();
}
private ResponseEntity<String> doListExperiments(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment