Skip to content

Commit

Permalink
Merge pull request #28 from diging/develop
Browse files Browse the repository at this point in the history
Prepare release
  • Loading branch information
jdamerow authored Sep 23, 2021
2 parents da20b4d + 092b79e commit 2b32b88
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 25 deletions.
18 changes: 12 additions & 6 deletions nepomuk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<properties>
<geco.nepomuk.version>0.4.1-SNAPSHOT</geco.nepomuk.version>
<org.slf4j-version>1.7.5</org.slf4j-version>
<org.springframework-version>4.3.1.RELEASE</org.springframework-version>
<org.springframework-version>4.3.2.RELEASE</org.springframework-version>
<spring-security-version>4.1.3.RELEASE</spring-security-version>
<geco.requests.version>0.6</geco.requests.version>
<geco.util.version>0.4.2</geco.util.version>
<geco.september.util.version>0.2</geco.september.util.version>
<geco.requests.version>0.10</geco.requests.version>
<geco.util.version>0.4.3</geco.util.version>
<geco.september.util.version>0.3</geco.september.util.version>
<geco.kafka-util.version>0.1</geco.kafka-util.version>
<buildNumber></buildNumber>

<admin.password>$2a$04$NXKVTx9XrpEST6CLn/ps7eP8YsK3t.5A/mvAoYpg.X8QqgOKtc1za</admin.password>
Expand Down Expand Up @@ -62,8 +63,8 @@

<!-- Giles Ecosystem -->
<dependency>
<groupId>edu.asu.diging.giles-eco</groupId>
<artifactId>requests</artifactId>
<groupId>edu.asu.diging</groupId>
<artifactId>giles-eco-requests</artifactId>
<version>${geco.requests.version}</version>
</dependency>
<dependency>
Expand All @@ -76,6 +77,11 @@
<artifactId>september-util</artifactId>
<version>${geco.september.util.version}</version>
</dependency>
<dependency>
<groupId>edu.asu.diging.giles-eco</groupId>
<artifactId>kafka-util</artifactId>
<version>${geco.kafka-util.version}</version>
</dependency>

<!-- Spring -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -40,27 +40,28 @@ 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);
} catch (TokenGenerationErrorException e) {
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();
}
}
9 changes: 9 additions & 0 deletions nepomuk/src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss,SSS} %-5p: %c - %m%n" />
</layout>
</appender>
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="file" value="logs/nepomuk.log"/>
<param name="immediateFlush" value="true"/>

<layout class="org.apache.log4j.PatternLayout">
<param name="conversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p: %c - %m%n"/>
</layout>
</appender>

<!-- Application Loggers -->
<logger name="edu.asu.nepomuk">
Expand Down Expand Up @@ -44,6 +52,7 @@
<root>
<priority value="warn" />
<appender-ref ref="console" />
<appender-ref ref="FILE" />
</root>

</log4j:configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">

<mvc:annotation-driven />
<context:component-scan base-package="edu.asu.diging.gilesecosystem.nepomuk.web" />
<context:component-scan base-package="edu.asu.diging.gilesecosystem.nepomuk.web,edu.asu.diging.gilesecosystem.kafka.util.web" />


<!-- Handles HTTP GET requests for /resources/** by efficiently serving
Expand Down
2 changes: 1 addition & 1 deletion nepomuk/src/main/webapp/WEB-INF/spring/root-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<mvc:annotation-driven />
<context:component-scan base-package="edu.asu.diging.gilesecosystem.requests,edu.asu.diging.gilesecosystem.nepomuk.core,edu.asu.diging.gilesecosystem.util" />
<context:component-scan base-package="edu.asu.diging.gilesecosystem.requests,edu.asu.diging.gilesecosystem.nepomuk.core,edu.asu.diging.gilesecosystem.util,edu.asu.diging.gilesecosystem.kafka.util.service" />

<import resource="spring-security.xml" />

Expand Down
4 changes: 4 additions & 0 deletions nepomuk/src/main/webapp/WEB-INF/tiles-defs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<definition name="admin/system/admin" extends="base.definition">
<put-attribute name="content" value="/WEB-INF/views/config/admin_password.jsp" />
</definition>

<definition name="admin/kafka/listeners" extends="base.definition">
<put-attribute name="content" value="/WEB-INF/views/admin/manage_listeners.jsp" />
</definition>

<!-- apps -->
<definition name="admin/apps" extends="base.definition">
Expand Down
2 changes: 2 additions & 0 deletions nepomuk/src/main/webapp/WEB-INF/tiles/skeleton.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
<li><a href="<c:url value="/admin/system/admin" />">Admin Password</a></li>
</ul>
</li>
<li role="presentation">
<a href="<c:url value="/admin/kafka/listeners" />">Kafka</a>
</li>

<!--
Expand Down
43 changes: 43 additions & 0 deletions nepomuk/src/main/webapp/WEB-INF/views/admin/manage_listeners.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>



<div class="well">

<h3>
Kafka listeners are currently:
<c:if test="${listenerStatus}">
<span class="label label-success pull-right">Active</span>
</c:if>
<c:if test="${not listenerStatus}">
<span class="label label-danger pull-right">Stopped</span>
</c:if>
</h3>

<div style="margin-top: 70px;"><center>
<c:if test="${listenerStatus}">
<form:form
action="${pageContext.request.contextPath}/admin/kafka/listeners/stop"
method="POST">
<input type="submit" value="Stop Kafka Listeners"
class="btn btn-lg btn-danger" />
</form:form>
<p><br>
Kafka listeners have been started!
</p>
</c:if>

<c:if test="${not listenerStatus}">
<form:form
action="${pageContext.request.contextPath}/admin/kafka/listeners/start"
method="POST">
<input type="submit" value="Start Kafka Listeners"
class="btn btn-lg btn-success" />
</form:form>
<p><br>
Kafka listeners have been stopped!
</p>
</c:if>
</center></div>
</div>

0 comments on commit 2b32b88

Please sign in to comment.