From 8e7526e841e375c59d15ddc1156367a8eb3884c6 Mon Sep 17 00:00:00 2001 From: abhikrish503501 Date: Wed, 18 Apr 2018 14:17:39 -0700 Subject: [PATCH 1/5] Story/geco 98 (#26) * [GECO-98] Now admins can stop listening to Kafka * [GECO-98] Fixed some formatting * [GECO-98] Addressed review comments * [GECO-98] Removed the some component package reference from the servlet-context.xml * [GECO-98] Made changes to the context files as required * [GECO-98] Provided proper component scan in root and server context files to avoid duplicacy --- nepomuk/pom.xml | 12 ++++-- .../kafka/impl/StorageRequestReceiver.java | 12 ++---- .../admin/AddRegisteredAppController.java | 19 ++++---- .../spring/appServlet/servlet-context.xml | 2 +- .../webapp/WEB-INF/spring/root-context.xml | 2 +- .../src/main/webapp/WEB-INF/tiles-defs.xml | 4 ++ .../main/webapp/WEB-INF/tiles/skeleton.jsp | 2 + .../WEB-INF/views/admin/manage_listeners.jsp | 43 +++++++++++++++++++ 8 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 nepomuk/src/main/webapp/WEB-INF/views/admin/manage_listeners.jsp diff --git a/nepomuk/pom.xml b/nepomuk/pom.xml index adb1840..6a1f352 100644 --- a/nepomuk/pom.xml +++ b/nepomuk/pom.xml @@ -11,11 +11,12 @@ 0.4.1-SNAPSHOT 1.7.5 - 4.3.1.RELEASE + 4.3.2.RELEASE 4.1.3.RELEASE - 0.6 - 0.4.2 + 0.7 + 0.4.3 0.2 + 0.1 $2a$04$NXKVTx9XrpEST6CLn/ps7eP8YsK3t.5A/mvAoYpg.X8QqgOKtc1za @@ -76,6 +77,11 @@ september-util ${geco.september.util.version} + + edu.asu.diging.giles-eco + kafka-util + ${geco.kafka-util.version} + diff --git a/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/core/kafka/impl/StorageRequestReceiver.java b/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/core/kafka/impl/StorageRequestReceiver.java index f597ed7..0585d9e 100644 --- a/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/core/kafka/impl/StorageRequestReceiver.java +++ b/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/core/kafka/impl/StorageRequestReceiver.java @@ -2,8 +2,6 @@ import java.io.IOException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.PropertySource; import org.springframework.kafka.annotation.KafkaListener; @@ -19,14 +17,12 @@ @PropertySource("classpath:/config.properties") public class StorageRequestReceiver { - private final Logger logger = LoggerFactory.getLogger(getClass()); - @Autowired private IRequestProcessor requestProcessor; - + @Autowired private ISystemMessageHandler messageHandler; - + @KafkaListener(topics = "${topic_storage_request}") public void receiveMessage(String message) { ObjectMapper mapper = new ObjectMapper(); @@ -35,10 +31,10 @@ public void receiveMessage(String message) { request = mapper.readValue(message, StorageRequest.class); } catch (IOException e) { messageHandler.handleMessage("Could not unmarshall request.", e, MessageType.ERROR); - // FIXME: handel this case + // FIXME: handle this case return; } - + requestProcessor.processRequest(request); } } diff --git a/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/web/controller/admin/AddRegisteredAppController.java b/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/web/controller/admin/AddRegisteredAppController.java index 18e0c97..0ecfd4a 100755 --- a/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/web/controller/admin/AddRegisteredAppController.java +++ b/nepomuk/src/main/java/edu/asu/diging/gilesecosystem/nepomuk/web/controller/admin/AddRegisteredAppController.java @@ -23,13 +23,13 @@ @Controller public class AddRegisteredAppController { - + @Autowired private IRegisteredAppManager appManager; @Autowired private ISystemMessageHandler messageHandler; - + @InitBinder("app") public void init(WebDataBinder binder) { binder.addValidators(new RegisteredAppValidator()); @@ -40,16 +40,17 @@ public String showRegisterAppPage(Model model) { model.addAttribute("app", new RegisteredApp()); return "admin/apps/register"; } - + @RequestMapping(value = "/admin/apps/register", method = RequestMethod.POST) - public String registerApp(@Validated @ModelAttribute("app") RegisteredApp app, BindingResult results, Model model, RedirectAttributes redirectAttrs) { - + public String registerApp(@Validated @ModelAttribute("app") RegisteredApp app, BindingResult results, Model model, + RedirectAttributes redirectAttrs) { + if (results.hasErrors()) { return "admin/apps/register"; } - + IRegisteredApp newApp = appManager.storeApp(app); - + IAppToken token = null; try { token = appManager.createToken(newApp); @@ -57,10 +58,10 @@ public String registerApp(@Validated @ModelAttribute("app") RegisteredApp app, B messageHandler.handleMessage("Token generation failed.", e, MessageType.ERROR); redirectAttrs.addFlashAttribute("show_alert", true); redirectAttrs.addFlashAttribute("alert_type", "danger"); - redirectAttrs.addFlashAttribute("alert_msg", "You app has been registered, but token generation failed."); + redirectAttrs.addFlashAttribute("alert_msg", "You app has been registered, but token generation failed."); } redirectAttrs.addFlashAttribute("token", token); - + return "redirect:/admin/apps/" + app.getId(); } } diff --git a/nepomuk/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml b/nepomuk/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml index b72e813..a3601c7 100644 --- a/nepomuk/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml +++ b/nepomuk/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml @@ -12,7 +12,7 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd"> - + diff --git a/nepomuk/src/main/webapp/WEB-INF/tiles/skeleton.jsp b/nepomuk/src/main/webapp/WEB-INF/tiles/skeleton.jsp index cc9b77f..160741a 100755 --- a/nepomuk/src/main/webapp/WEB-INF/tiles/skeleton.jsp +++ b/nepomuk/src/main/webapp/WEB-INF/tiles/skeleton.jsp @@ -63,6 +63,8 @@
  • ">Admin Password
  • +
  • + ">Kafka
  • @@ -44,6 +52,7 @@ + From 8831da3e7fa4626f8aa26f00fa6d3015448136bd Mon Sep 17 00:00:00 2001 From: Julia Damerow Date: Tue, 21 Sep 2021 15:10:22 -0400 Subject: [PATCH 3/5] Update pom.xml --- nepomuk/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nepomuk/pom.xml b/nepomuk/pom.xml index 6a1f352..83b08af 100644 --- a/nepomuk/pom.xml +++ b/nepomuk/pom.xml @@ -13,7 +13,7 @@ 1.7.5 4.3.2.RELEASE 4.1.3.RELEASE - 0.7 + 0.10 0.4.3 0.2 0.1 From d1786dc0879e5f490b294d34b2d0e3d8595e0a5a Mon Sep 17 00:00:00 2001 From: Julia Damerow Date: Tue, 21 Sep 2021 15:24:13 -0400 Subject: [PATCH 4/5] updated requests dependency --- nepomuk/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nepomuk/pom.xml b/nepomuk/pom.xml index 83b08af..ac6e8e3 100644 --- a/nepomuk/pom.xml +++ b/nepomuk/pom.xml @@ -63,8 +63,8 @@ - edu.asu.diging.giles-eco - requests + edu.asu.diging + giles-eco-requests ${geco.requests.version} From 092b79e03527587068b3d68f90c40b4593ef73f2 Mon Sep 17 00:00:00 2001 From: Julia Damerow Date: Tue, 21 Sep 2021 16:16:35 -0400 Subject: [PATCH 5/5] Updated september-util version --- nepomuk/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nepomuk/pom.xml b/nepomuk/pom.xml index ac6e8e3..ae1e815 100644 --- a/nepomuk/pom.xml +++ b/nepomuk/pom.xml @@ -15,7 +15,7 @@ 4.1.3.RELEASE 0.10 0.4.3 - 0.2 + 0.3 0.1