Initial commit

This commit is contained in:
ymaurel
2024-03-10 19:38:34 +01:00
commit ce684107c5
15 changed files with 551 additions and 0 deletions

289
.gitignore vendored Normal file
View File

@@ -0,0 +1,289 @@
# Created by https://www.toptal.com/developers/gitignore/api/java,maven,gradle,linux,windows,eclipse,visualstudiocode,intellij+all
# Edit at https://www.toptal.com/developers/gitignore?templates=java,maven,gradle,linux,windows,eclipse,visualstudiocode,intellij+all
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
*.iml
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### Gradle ###
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
# JDT-specific (Eclipse Java Development Tools)
### Gradle Patch ###
# Java heap dump
*.hprof
# End of https://www.toptal.com/developers/gitignore/api/java,maven,gradle,linux,windows,eclipse,visualstudiocode,intellij+all

1
README.md Normal file
View File

@@ -0,0 +1 @@
# Votre compte rendu ici

77
pom.xml Normal file
View File

@@ -0,0 +1,77 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.istic</groupId>
<artifactId>tp.grpc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.61.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.61.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.61.0</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.25.1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.61.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,11 @@
package fr.istic.grpc.chat;
import fr.istic.grpc.chat.Chat.*;
import io.grpc.*;
import io.grpc.stub.*;
import java.util.*;
public class ChatClient {
}

View File

@@ -0,0 +1,13 @@
package fr.istic.grpc.chat;
import fr.istic.grpc.echo.*;
import io.grpc.*;
import java.io.*;
public class ChatServer {
public static void main(String[] args) throws IOException, InterruptedException {
}
}

View File

@@ -0,0 +1,17 @@
package fr.istic.grpc.chat;
import com.google.protobuf.*;
import fr.istic.grpc.chat.Chat.*;
import fr.istic.grpc.chat.ChatServiceGrpc.*;
import io.grpc.*;
import io.grpc.stub.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.*;
public class ChatService extends ChatServiceImplBase {
//private static final List<StreamObserver<ChatMessage>> observers = new CopyOnWriteArrayList<>();
}

View File

@@ -0,0 +1,11 @@
package fr.istic.grpc.echo;
import com.google.rpc.context.AttributeContext.*;
import fr.istic.grpc.echo.Echo.*;
import fr.istic.grpc.echo.EchoServiceGrpc.*;
import io.grpc.*;
public class EchoClient {
}

View File

@@ -0,0 +1,10 @@
package fr.istic.grpc.echo;
import fr.istic.grpc.todo.*;
import io.grpc.*;
import java.io.*;
public class EchoServeur {
}

View File

@@ -0,0 +1,10 @@
package fr.istic.grpc.echo;
import com.google.protobuf.*;
import fr.istic.grpc.echo.Echo.*;
import fr.istic.grpc.echo.EchoServiceGrpc.*;
import io.grpc.stub.*;
public class EchoService extends EchoServiceImplBase {
}

View File

@@ -0,0 +1,9 @@
package fr.istic.grpc.todo;
import fr.istic.grpc.todo.Todo.*;
import fr.istic.grpc.todo.TodoServiceGrpc.*;
import io.grpc.*;
public class TodoClient {
}

View File

@@ -0,0 +1,9 @@
package fr.istic.grpc.todo;
import io.grpc.*;
import java.io.*;
public class TodoServeur {
}

View File

@@ -0,0 +1,34 @@
package fr.istic.grpc.todo;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
public class TodoServiceImpl extends TodoServiceGrpc.TodoServiceImplBase {
private final ConcurrentHashMap<String, Todo.TaskResponse> tasks = new ConcurrentHashMap<>();
private final AtomicInteger taskId = new AtomicInteger();
public int generateUniqueTaskId() {
return taskId.incrementAndGet();
}
/*
@Override
public void createTask(Todo.CreateTaskRequest request, StreamObserver<Todo.TaskResponse> responseObserver) {
// Créer une tâche en générant un identifiant
}
@Override
public void listTasks(Todo.ListTasksRequest request, StreamObserver<Todo.ListTasksResponse> responseObserver) {
// La réponse est une liste
}
@Override
public void deleteTask(Todo.DeleteTaskRequest request, StreamObserver<Todo.TaskResponse> responseObserver) {
// si la tâche existe, on efface, sinon on indique que l'opération est un echec
}
*/
}

13
src/main/proto/chat.proto Normal file
View File

@@ -0,0 +1,13 @@
syntax = "proto3";
package chat;
option java_package = "fr.istic.grpc.chat";
service ChatService {
rpc joinChat(stream ChatMessage) returns (stream ChatMessage) {}
}
message ChatMessage {
string user = 1;
string message = 2;
}

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
package echo;
option java_package = "fr.istic.grpc.echo";
service EchoService {
}

38
src/main/proto/todo.proto Normal file
View File

@@ -0,0 +1,38 @@
syntax = "proto3";
package todo;
option java_package = "fr.istic.grpc.todo";
// Le service TodoService définit les opérations disponibles pour gérer les tâches.
service TodoService {
// A COMPLETER !
}
// Message de requête pour créer une nouvelle tâche.
message CreateTaskRequest {
string title = 1; // Le titre de la tâche
string description = 2; // La description de la tâche
}
// Message de requête pour lister toutes les tâches.
message ListTasksRequest {
// Aucun champ requis pour cette requête
}
// Message de requête pour supprimer une tâche spécifique.
message DeleteTaskRequest {
string id = 1; // L'identifiant de la tâche à supprimer
}
// Message de réponse pour les opérations CreateTask et DeleteTask.
message TaskResponse {
string id = 1; // L'identifiant de la tâche
string title = 2; // Le titre de la tâche
string description = 3; // La description de la tâche
bool success = 4; // Indique si l'opération a réussi
}
// Message de réponse pour l'opération ListTasks.
message ListTasksResponse {
repeated TaskResponse tasks = 1; // La liste des tâches
}