Skip to content
Snippets Groups Projects
Commit 2e623363 authored by Korentin Duquenne's avatar Korentin Duquenne
Browse files

Conf : Add README.md doc

parent 8bd8109f
Branches
No related tags found
No related merge requests found
......@@ -2,3 +2,70 @@
Here is the first version of Microblog API.
###### Requirement :
Java : JDK >= 8
Maven : Utilisation de maven
#### Change on the project to do
In MicroBlog.java you have to change :
````java
c = DriverManager.getConnection("jdbc:postgresql://"+ip+":5432/microblog","korentin","123456");
````
replace korentin by your username in db
replace "123456" by the password of the user to acces db
If the user of your database is in trust mode you can do
````java
c = DriverManager.getConnection("jdbc:postgresql://"+ip+":5432/microblog","common_user","");
````
With just replacing the user name
In App.java
````java
Microblog microblog = new Microblog("172.28.100.8");
````
you have to change the ip with the one where is locate your database
#### Build & Run
To build & Run here are the following command to use
To build the project :
````
mvn assembly:assembly -DdescriptorId=jar-with-dependencies
````
To run the project :
````
java -jar .\target\postgresqlJava-1.0-SNAPSHOT-jar-with-dependencies.jar
````
Or you can use directly the main from your favorite IDE
#### Example
`````java
public static void main( String[] args ) throws SQLException {
Microblog microblog = new Microblog("172.28.100.8"); // IP of the target PC ( Where the database is)
microblog.createUser("toto","titi"); // To create a user
microblog.publish_post("toto","titi","test",null); // to publish a post
// You can replace null by an existing uuid // UUID.fromString("ca0eb23c-1a53-11ec-8526-293e013173f6") Si ajout d'uuid
microblog.follow("toto","titi",UUID.fromString("2b371920-1a52-11ec-8526-293e013173f6")); // to follow a user
microblog.get_messages(); // to get_messages
microblog.get_feed("user0","userpass0",10); // To get a feed of a user
}
`````
......@@ -41,6 +41,17 @@
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>postgresqlJava.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
......@@ -57,6 +68,13 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>postgresqlJava.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
......
......@@ -12,7 +12,7 @@ public class App
public static void main( String[] args ) throws SQLException {
Microblog microblog = new Microblog("172.28.100.8");
//microblog.createUser("toto","titi");
// UUID.fromString("ca0eb23c-1a53-11ec-8526-293e013173f6") Si ajout d'uuid
// UUID.fromString("ca0eb23c-1a53-11ec-8526-293e013173f6")
//microblog.publish_post("toto","titi","test",null);
//microblog.follow("toto","titi",UUID.fromString("2b371920-1a52-11ec-8526-293e013173f6"));
//microblog.get_messages();
......
......@@ -10,7 +10,7 @@ public class Microblog {
public Microblog(String ip){
try{
Class.forName("org.postgresql.Driver");
c = DriverManager.getConnection("jdbc:postgresql://"+ip+":5432/microblog","korentin","123456");
c = DriverManager.getConnection("jdbc:postgresql://"+ip+":5432/microblog","common_user","");
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment