Skip to content

Commit 10ce797

Browse files
committed
Initial move
1 parent 1dae60c commit 10ce797

File tree

163 files changed

+44001
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+44001
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Eclipse
2+
.classpath
3+
.project
4+
.settings/
5+
6+
# Intellij
7+
.idea/
8+
*.iml
9+
*.iws
10+
11+
# Mac
12+
.DS_Store
13+
14+
# Maven
15+
log/
16+
target/
17+
18+
# Others
19+
derby.log

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sudo: required
2+
3+
language: java
4+
5+
services:
6+
7+
jdk:
8+
- oraclejdk8
9+
10+
before_install:
11+
- chmod +x pom.xml
12+
13+
script:
14+
- mvn -DskipTests

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!---
2+
Copyright 2017 Ericsson AB.
3+
For a full list of individual contributors, please see the commit history.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
--->
17+
18+
# Eiffel Intelligence
19+
Eiffel Intelligence is a real time data aggregation and analysis solution for Eiffel events. While Eiffel represents an event based architecture, Eiffel Intelligence addresses the need of stakeholders to view the current state of the system by bridging the divide from immutable events to mutable state representation.
20+
21+
This repository contains a software implementation based on the Eiffel protocol. For more information on Eiffel, its vocabulary, descriptions, guides and schemas, please see [the Eiffel repository](https://github.com/Ericsson/eiffel). For news, discussions and questions, please visit the [Eiffel Community Google group](https://groups.google.com/forum/#!forum/eiffel-community).
22+
23+
Eiffel Intelligence is licensed under the [Apache License 2.0](./LICENSE).
24+
25+
## How to Propose Changes
26+
27+
Anyone is welcome to propose changes to this repository by creating a new [Issue](https://github.com/Ericsson/eiffel-intelligence/issues) ticket in GitHub. These requests may concern anything contained in the repo: changes to documentation, changes to interfaces, changes to implementations, additional tests et cetera.
28+
29+
When posting a new issue, try to be as precise as possible and phrase your arguments for your request carefully. Keep in mind that collaborative software develpoment is often an exercise in finding workable compromises between multiple and often conflicting needs. In particular, pay attention to the following:
30+
1. What type of change is requested?
31+
1. Why would you like to see this change?
32+
1. Can you provide any concrete examples?
33+
1. Which arguments in favor can you think of?
34+
1. Which arguments against can you think of, and why are they outweighed by the arguments in favor?
35+
36+
Also, keep in mind that just as anyone is welcome to propose a change, anyone is welcome to disagree with and criticize that proposal.
37+
38+
## How to Contribute
39+
Contributions can be made by anyone using the standard [GitHub Fork and Pull model](https://help.github.com/articles/about-pull-requests). When making a pull request, keep a few things in mind.
40+
1. Always explicitly connect a pull request to an Issue. See How to Propose Changes above for further information.
41+
1. Make sure you target the correct branch. If you are unsure which branch is appropriate, ask in the Issue thread.
42+
1. Pull Requests will be publicly reviewed, criticized, and potentially rejected. Don't take it personally.
43+
44+
### Reviewing and Merging Pull Requests
45+
We use the Squash and Merge model, which means that all commits in a Pull Request get squashed into a single commit in the target branch. In other words, the revision history will look like a string of single commits corresponding one-to-one with Issues.
46+
47+
Pull requests can be merged by members of the [Eiffel team](https://github.com/orgs/Ericsson/teams/eiffel). There is a certain protocol to adhere to, however, as well as expectations on membership.
48+
1. All members of the Eiffel team are expected to make the effort to participate in the review of Pull Requests. Every member may not review everything in detail, but everyone can make the effort to chime in on some. Remember that expedient high quality reviews are crucial to the long term survival of any open source project.
49+
1. Eiffel team members are strongly encouraged to participate in reviews even if they do not feel entirely qualified to assess the pull request. Looking at changes and participating in review discussions is one of the best ways to learn, and presents an excellent opportunity to ask questions. And remember, participating in a review is not the same as having to make the final decision.
50+
1. Anyone can participate in reviews, not only Eiffel team members.
51+
1. A Pull Request should be approved by at least two Eiffel team members (including the one doing the merging). For this to function well, the above point on participation is critical.
52+
1. Do not feel any pressure to merge Pull Requests. Unless you feel confident about what you are doing, don't press that big green button. Instead, ask a more senior member to make the decision.
53+
1. When squashing and merging, ensure that the description reflects the change. Detailing every individual commit in the Pull Request is unnecessary, as they are squashed anyway. Instead, describe the change as a single thing. That description should always include an Issue reference, and should focus on WHY the change was made, to provide the reader with context. See [this excellent guide](https://chris.beams.io/posts/git-commit) on writing good commit messages.
54+
55+
### License Management
56+
To be accepted into the repository, contributions must be licensed under the Apache License 2.0. Consequently, a license notice shall be included in suitable comment syntax where applicable. This license notice shall state the copyright holder(s) and point to the commit history for a full list of individual contributors, on the following format:
57+
58+
> Copyright <Year(s)> <Copyright holder of original contribution [and others].>
59+
> For a full list of individual contributors, please see the commit history.
60+
61+
The copyright holder is either the individual contributor if they act on their own behalf, or any organization on whose behalf they contribute. When multiple copyright holders have contributed to the same file, the copyright notice shall be appended "and others". The copyright year(s) shall reflect the year(s) of contribution(s) and be updated accordingly when new contributions are made to the file. To exemplify, the copyright notice of an original contribution made by Jane Doe acting on behalf of Ericsson AB may read:
62+
63+
> Copyright 2017 Ericsson AB.
64+
> For a full list of individual contributors, please see the commit history.
65+
66+
When John Doe, acting on his own behalf, makes a subsequent addition to the same file, the notice will be updated accordingly:
67+
68+
> Copyright 2017 Ericsson AB and others.
69+
> For a full list of individual contributors, please see the commit history.
70+
71+
When John Doe makes a subsequent contribution the following year, the notice will again be updated:
72+
73+
> Copyright 2017-2018 Ericsson AB and others.
74+
> For a full list of individual contributors, please see the commit history.
75+

pom.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
4+
<groupId>com.ericsson.ei.frontend</groupId>
5+
<artifactId>ei-frontend</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
9+
<parent>
10+
<groupId>org.springframework.boot</groupId>
11+
<artifactId>spring-boot-starter-parent</artifactId>
12+
<version>1.5.4.RELEASE</version>
13+
<relativePath/> <!-- .. lookup parent from repository -->
14+
</parent>
15+
16+
<properties>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
19+
<java.version>1.8</java.version>
20+
<fabric8.mode>kubernetes</fabric8.mode>
21+
</properties>
22+
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-actuator</artifactId>
28+
<version>1.5.4.RELEASE</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-web</artifactId>
33+
<version>1.5.4.RELEASE</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.springframework.cloud</groupId>
37+
<artifactId>spring-cloud-starter-hystrix</artifactId>
38+
<version>1.3.1.RELEASE</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.springframework.cloud</groupId>
42+
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
43+
<version>1.3.1.RELEASE</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-devtools</artifactId>
52+
<optional>true</optional>
53+
</dependency>
54+
</dependencies>
55+
<build>
56+
<plugins>
57+
<plugin>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-maven-plugin</artifactId>
60+
</plugin>
61+
</plugins>
62+
63+
</build>
64+
65+
66+
</project>
67+

src/main/docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM fabric8/java-jboss-openjdk8-jdk:1.2
2+
ENV JAVA_APP_DIR=/deployments
3+
EXPOSE 8080 8778 9779
4+
COPY maven /deployments/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.ericsson.ei.frontend;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
import org.springframework.boot.SpringApplication;
6+
import org.springframework.boot.autoconfigure.SpringBootApplication;
7+
8+
@SpringBootApplication
9+
public class EI_FrontEnd_Application {
10+
11+
public static final Logger log = LoggerFactory.getLogger(EI_FrontEnd_Application.class);
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(EI_FrontEnd_Application.class, args);
15+
}
16+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.ericsson.ei.frontend;
2+
3+
import java.io.File;
4+
import java.io.FileInputStream;
5+
import java.io.FileNotFoundException;
6+
import java.io.IOException;
7+
import java.io.InputStream;
8+
9+
import javax.servlet.ServletContext;
10+
import javax.servlet.http.HttpServletRequest;
11+
import javax.servlet.http.HttpServletResponse;
12+
13+
import org.springframework.beans.factory.annotation.Value;
14+
import org.springframework.boot.context.properties.ConfigurationProperties;
15+
import org.springframework.stereotype.Controller;
16+
import org.springframework.util.FileCopyUtils;
17+
import org.springframework.web.bind.annotation.RequestMapping;
18+
import org.springframework.web.bind.annotation.RequestMethod;
19+
import org.springframework.web.bind.annotation.ResponseBody;
20+
21+
@Controller
22+
public class SubscriptionFilesController {
23+
24+
@Value("${ei.subscriptionFilePath}") private String subscriptionFilePath;
25+
private static final String APPLICATION_JSON = "application/json";
26+
27+
28+
@RequestMapping(value = "/download/subscriptiontemplate", method = RequestMethod.GET, produces = APPLICATION_JSON)
29+
public @ResponseBody void downloadA(HttpServletResponse response) throws IOException {
30+
File file = getFile(subscriptionFilePath);
31+
InputStream in = new FileInputStream(file);
32+
33+
response.setContentType(APPLICATION_JSON);
34+
response.setHeader("Content-Disposition", "attachment; filename=" + file.getName());
35+
response.setHeader("Content-Length", String.valueOf(file.length()));
36+
FileCopyUtils.copy(in, response.getOutputStream());
37+
}
38+
39+
40+
private File getFile(String filePath) throws FileNotFoundException {
41+
File file = new File(filePath);
42+
if (!file.exists()){
43+
throw new FileNotFoundException("File " + '"' + filePath + '"' + " was not found.");
44+
}
45+
return file;
46+
}
47+
}
48+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.ericsson.ei.frontend;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.ui.Model;
6+
import org.springframework.web.bind.annotation.RequestParam;
7+
import org.springframework.boot.context.properties.ConfigurationProperties;
8+
9+
10+
@Controller
11+
@ConfigurationProperties(prefix="ei")
12+
public class WebController {
13+
14+
private String backendServiceHost;
15+
private int backendServicePort;
16+
17+
18+
@RequestMapping("/")
19+
public String greeting(Model model) {
20+
21+
String backendServiceUrl = String.format("http://%s:%d", backendServiceHost, backendServicePort);
22+
23+
model.addAttribute("backendServiceUrl", backendServiceUrl); // inject in DOM for AJAX etc
24+
25+
return "index";
26+
}
27+
28+
// Backend host and port (Getter & Setters), application.properties -> greeting.xxx
29+
public String getBackendServiceHost() {
30+
return backendServiceHost;
31+
}
32+
33+
public void setBackendServiceHost(String backendServiceHost) {
34+
this.backendServiceHost = backendServiceHost;
35+
}
36+
37+
public int getBackendServicePort() {
38+
return backendServicePort;
39+
}
40+
41+
public void setBackendServicePort(int backendServicePort) {
42+
this.backendServicePort = backendServicePort;
43+
}
44+
45+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# REST api returns json in pretty format with jackson
2+
spring.jackson.default-property-inclusion=non_null
3+
4+
spring.application.name=ei-frontend
5+
#${project.artifactId}
6+
7+
server.port=8080
8+
9+
######## EI Backend
10+
ei.backendServiceHost=localhost
11+
ei.backendServicePort=8090
12+
13+
###### Subscription Template file ########
14+
ei.subscriptionFilePath=./src/main/resources/subscriptions/subscriptionsTemplate.json
15+
16+
17+

0 commit comments

Comments
 (0)