Skip to content

Commit 27868fc

Browse files
committed
Basic classes
1 parent 9a3a027 commit 27868fc

File tree

17 files changed

+784
-6
lines changed

17 files changed

+784
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Created by .ignore support plugin (hsz.mobi)

LICENSE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ in one of these ways:
264264
medium customarily used for software interchange, for a price no
265265
more than your reasonable cost of physically performing this
266266
conveying of source, or (2) access to copy the
267-
Corresponding Source from a network server at no charge.
267+
Corresponding Source from a network ud.main.server at no charge.
268268

269269
c) Convey individual copies of the object code with a copy of the
270270
written offer to provide the Corresponding Source. This
@@ -277,11 +277,11 @@ in one of these ways:
277277
Corresponding Source in the same way through the same place at no
278278
further charge. You need not require recipients to copy the
279279
Corresponding Source along with the object code. If the place to
280-
copy the object code is a network server, the Corresponding Source
281-
may be on a different server (operated by you or a third party)
280+
copy the object code is a network ud.main.server, the Corresponding Source
281+
may be on a different ud.main.server (operated by you or a third party)
282282
that supports equivalent copying facilities, provided you maintain
283283
clear directions next to the object code saying where to find the
284-
Corresponding Source. Regardless of what server hosts the
284+
Corresponding Source. Regardless of what ud.main.server hosts the
285285
Corresponding Source, you remain obligated to ensure that it is
286286
available for as long as needed to satisfy these requirements.
287287

@@ -499,7 +499,7 @@ patent against the party.
499499
If you convey a covered work, knowingly relying on a patent license,
500500
and the Corresponding Source of the work is not available for anyone
501501
to copy, free of charge and under the terms of this License, through a
502-
publicly available network server or other readily accessible means,
502+
publicly available network ud.main.server or other readily accessible means,
503503
then you must either (1) cause the Corresponding Source to be so
504504
available, or (2) arrange to deprive yourself of the benefit of the
505505
patent license for this particular work, or (3) arrange, in a manner

README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,63 @@
1-
# prog3_proyecto_client
1+
# prog3.proyecto
2+
Student project for Programming III course at Deusto University made by [Rafael Romón](https://github.com/rafaelromon), [Saul Segura](https://github.com/luasaul) and [Mikel Solabarrieta](https://github.com/mikelsr).
3+
4+
## Description:
5+
Self-Hosted Java Server that stores documents and media files, it communicates with a Java Client, this Client uses 3 databases:
6+
7+
* Neo4j - Information about movies, series and music.
8+
* MongoDB - Documents.
9+
* DWH - Analytics (Likes, usage, etc).
10+
11+
<p align="center">
12+
<img src="https://github.com/Ninia/prog3.proyecto/blob/master/src/main/resources/web/planteamiento.png" alt="Planteamiento"/>
13+
</p>
14+
┳┻|<br>
15+
┻┳|<br>
16+
┳┻|<br>
17+
┻┳|<br>
18+
┳┻|<br>
19+
┻┳|<br>
20+
┳┻|<br>
21+
┻┳|<br>
22+
┳┻|<br>
23+
┻┳|<br>
24+
┳┻|<br>
25+
┻┳|<br>
26+
┳┻|_<br>
27+
┻┳| •.•) &nbsp;&nbsp;&nbsp;we are working<br>
28+
┳┻|⊂&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on ssl<br>
29+
┻┳|<br>
30+
31+
## Monitoring the Server
32+
Some stats and conditions of the host server can be stored in [InfluxDB](
33+
https://github.com/influxdata/influxdb),
34+
so it's possible either to monitor them in real time or query them in a
35+
historical database. The real time monitoring can be done using [Grafana](
36+
http://grafana.org/).
37+
### InfluxDB
38+
>InfluxDB is an open-source time series database developed by InfluxData.
39+
It is written in Go and optimized for fast, high-availability storage and
40+
retrieval of time series data in fields such as operations monitoring,
41+
application metrics, Internet of Things sensor data, and real-time analytics.
42+
43+
Official documentation can be accessed [here](
44+
https://docs.influxdata.com/influxdb/v1.2/).
45+
### Grafana
46+
>Grafana is most commonly used for visualizing time series data for Internet
47+
infrastructure and application analytics but many use it in other domains
48+
including industrial sensors, home automation, weather, and process control.
49+
50+
Official documentation can be accessed [here](
51+
http://docs.grafana.org/).
52+
53+
## Recommended Installation for Server
54+
1. Download and install [Vagrant](https://www.vagrantup.com/downloads.html)
55+
2. Clone [our vagrant repository](
56+
https://github.com/Ninia/p3p-vagrant) and go to that folder
57+
3. Run `vagrant up`
58+
59+
**_Hopefully you're good to go!_**
60+
61+
## License
62+
This project fall under the GPL 3 license fell free to use it, modify it and let us know of your changes :)
63+

conf/Network.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<network>
3+
<https-client>
4+
<host>localhost</host>
5+
<port>8080</port>
6+
</https-client>
7+
<test-client>
8+
<port>[port number]</port>
9+
</test-client>
10+
</network>

pom.xml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>ud.binmonkey.prog3-proyecto</groupId>
8+
<artifactId>prog3-proyecto_client</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
12+
<licenses>
13+
<license>
14+
<name>GNU General Public License, Version 3.0</name>
15+
<url>https://github.com/binmonkey/prog3_proyecto_client/blob/master/LICENSE</url>
16+
<distribution>repo</distribution>
17+
</license>
18+
</licenses>
19+
20+
<build>
21+
<plugins>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-compiler-plugin</artifactId>
25+
<configuration>
26+
<source>1.8</source>
27+
<target>1.8</target>
28+
</configuration>
29+
</plugin>
30+
</plugins>
31+
</build>
32+
33+
<contributors>
34+
35+
<contributor>
36+
<name>Rafael Romon</name>
37+
<email>[email protected]</email>
38+
<url>https://github.com/rafaelromon</url>
39+
<organization>Binary Monkey</organization>
40+
<organizationUrl>https://github.com/binary-monkey</organizationUrl>
41+
<roles>
42+
<role>developer</role>
43+
</roles>
44+
<timezone>Europe/Madrid</timezone>
45+
</contributor>
46+
47+
<contributor>
48+
<name>Saul Segura</name>
49+
<email>[email protected] </email>
50+
<url>https://github.com/luasaul</url>
51+
<roles>
52+
<role>developer</role>
53+
</roles>
54+
<timezone>Europe/Madrid</timezone>
55+
</contributor>
56+
57+
<contributor>
58+
<name>Mikel Solabarrieta</name>
59+
<email>[email protected]</email>
60+
<url>https://github.com/mikelsr</url>
61+
<organization>Binary Monkey</organization>
62+
<organizationUrl>https://github.com/binary-monkey</organizationUrl>
63+
<roles>
64+
<role>developer</role>
65+
</roles>
66+
<timezone>Europe/Madrid</timezone>
67+
</contributor>
68+
69+
</contributors>
70+
71+
72+
<dependencies>
73+
</dependencies>
74+
75+
</project>

prog3-proyecto_client.iml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
11+
<excludeFolder url="file://$MODULE_DIR$/target" />
12+
</content>
13+
<orderEntry type="inheritedJdk" />
14+
<orderEntry type="sourceFolder" forTests="false" />
15+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.6.1" level="project" />
16+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
17+
<orderEntry type="library" name="Maven: org.apache.ftpserver:ftpserver-core:1.1.0" level="project" />
18+
<orderEntry type="library" name="Maven: org.apache.ftpserver:ftplet-api:1.1.0" level="project" />
19+
<orderEntry type="library" name="Maven: org.apache.mina:mina-core:2.0.16" level="project" />
20+
<orderEntry type="library" name="Maven: org.json:json:20160810" level="project" />
21+
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
22+
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
23+
</component>
24+
</module>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ud.binmonkey.prog3_proyecto_client.common;
2+
3+
import java.io.File;
4+
import java.io.FileNotFoundException;
5+
import java.io.IOException;
6+
import javax.xml.parsers.DocumentBuilder;
7+
import javax.xml.parsers.DocumentBuilderFactory;
8+
import javax.xml.parsers.ParserConfigurationException;
9+
import org.w3c.dom.Document;
10+
import org.xml.sax.SAXException;
11+
12+
public class DocumentReader {
13+
public static Document getDoc(String path) {
14+
15+
Document document = null; /*TODO: find a better way to handle this*/
16+
17+
try {
18+
19+
File file = new File(path);
20+
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
21+
DocumentBuilder db = dbf.newDocumentBuilder();
22+
document = db.parse(file);
23+
24+
} catch (FileNotFoundException fnne) {
25+
System.err.println("FILE NOT FOUND.");
26+
fnne.printStackTrace();
27+
28+
} catch (ParserConfigurationException pce) {
29+
System.err.println("INCORRECT CONFIGURATION FILE");
30+
pce.printStackTrace();
31+
} catch (IOException | SAXException ex) {
32+
ex.printStackTrace();
33+
}
34+
35+
return document;
36+
}
37+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package ud.binmonkey.prog3_proyecto_server.common;
2+
3+
/**
4+
* Create or compare indexed pairs of strings
5+
*/
6+
public class Pair<String> {
7+
8+
private String key;
9+
private String value;
10+
11+
public Pair(String key, String value) {
12+
this.key = key;
13+
this.value = value;
14+
}
15+
16+
public String getKey() { return key; }
17+
public String getValue() { return value; }
18+
19+
@Override
20+
public int hashCode() { return key.hashCode() ^ value.hashCode(); }
21+
22+
@Override
23+
public boolean equals(Object o) {
24+
if (!(o instanceof Pair)) return false;
25+
Pair pair = (Pair) o;
26+
return this.key.equals(pair.getKey()) &&
27+
this.value.equals(pair.getValue());
28+
}
29+
30+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package ud.binmonkey.prog3_proyecto_server.common.network;
2+
3+
/**
4+
* List of supported rest methods
5+
*/
6+
public enum HttpMethods {
7+
GET, POST
8+
}

0 commit comments

Comments
 (0)