diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..b9168f1
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,75 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Run Client (Task 1)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 1",
+ "mainClass": "client.Client",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run ComputeEngine (Task 1)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 1",
+ "mainClass": "engine.ComputeEngine",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run Server (Task 2)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 2",
+ "mainClass": "server.Server",
+ "preLaunchTask": "build-task2",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run Client (Task 2)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 2",
+ "mainClass": "client.Client",
+ "preLaunchTask": "build-task2",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run Server (Task 5)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 5",
+ "mainClass": "server.Server",
+ "preLaunchTask": "build-task5",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run Client (Task 5)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 5",
+ "mainClass": "client.Client",
+ "preLaunchTask": "build-task5",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run HelloWorldServer (Task 7/example)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 7/example",
+ "projectName": "example",
+ "mainClass": "org.tinsae.grpc.server.HelloWorldServer",
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "java",
+ "name": "Run HelloWorldClient (Task 7/example)",
+ "request": "launch",
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 7/example",
+ "projectName": "example",
+ "mainClass": "org.tinsae.grpc.client.HelloWorldClient",
+ "console": "integratedTerminal"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..b1c4a20
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,29 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build-task2",
+ "type": "shell",
+ "options": {
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 2"
+ },
+ "command": "mkdir -p out && javac -cp \"lib/*\" -d out $(find src -name \"*.java\")",
+ "group": "build",
+ "problemMatcher": [
+ "$javac"
+ ]
+ },
+ {
+ "label": "build-task5",
+ "type": "shell",
+ "options": {
+ "cwd": "${workspaceFolder}/week3_TinsaeGhilay/Task 5"
+ },
+ "command": "mkdir -p out && javac -d out $(find src -name \"*.java\")",
+ "group": "build",
+ "problemMatcher": [
+ "$javac"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/week3_TinsaeGhilay/Task 2/README.md b/week3_TinsaeGhilay/Task 2/README.md
index d18472e..285f32a 100644
--- a/week3_TinsaeGhilay/Task 2/README.md
+++ b/week3_TinsaeGhilay/Task 2/README.md
@@ -24,115 +24,130 @@
java -cp "out:lib/*" client.Client
```
+### Server commands:
+```java
+// list of valid commands
+private String[] commands = {
+ "add",
+ "subtract",
+ "multiply",
+ "divide",
+ "mod",
+ "power",
+ "root",
+ "exit"
+};
- ### inspecting packets using wireshark.
- ***
- #### Normal functions
- ***
+```
- I installed wireshark-cli and run
- ```bash
- sudo tshark -i lo -f "tcp port 8080" -z follow,tcp,ascii,0
- ```
- In Client program the interaction looked like this
- ```
- Enter an integer: 4
- Enter an integer: 6
- The sum is: 10
- ```
- And the output of wireshark was as follows
+### inspecting packets using wireshark.
+***
+#### Normal functions
+***
- ```xml
- POST /RPC2 HTTP/1.1
- Content-Type: text/xml
- User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
- Cache-Control: no-cache
- Pragma: no-cache
- Host: localhost:8080
- Accept: */*
- Connection: keep-alive
- Content-Length: 195
+I installed wireshark-cli and run
+```bash
+sudo tshark -i lo -f "tcp port 8080" -z follow,tcp,ascii,0
+```
+In Client program the interaction looked like this
+```
+Enter an integer: 4
+Enter an integer: 6
+The sum is: 10
+```
+And the output of wireshark was as follows
-
-
- sample.sum
-
-
- 4
-
-
- 6
-
-
-
+```xml
+POST /RPC2 HTTP/1.1
+Content-Type: text/xml
+User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
+Cache-Control: no-cache
+Pragma: no-cache
+Host: localhost:8080
+Accept: */*
+Connection: keep-alive
+Content-Length: 195
- HTTP/1.1 200 OK
- Server: Apache XML-RPC 1.0
- Connection: close
- Content-Type: text/xml
- Content-Length: 129
+
+
+ sample.sum
+
+
+ 4
+
+
+ 6
+
+
+
-
-
+HTTP/1.1 200 OK
+Server: Apache XML-RPC 1.0
+Connection: close
+Content-Type: text/xml
+Content-Length: 129
+
+
+
+
+
+ 10
+
+
+
+```
+I believe this is the expected result.
+
+***
+#### Intentional error
+I changed the messge call string to `sample.add` instead of the correct `sample.sum` and run the program. obviously it threw an exception. the http response from wireguard was as follows
+```xml
+POST /RPC2 HTTP/1.1
+Content-Type: text/xml
+User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
+Cache-Control: no-cache
+Pragma: no-cache
+Host: localhost:8080
+Accept: */*
+Connection: keep-alive
+Content-Length: 196
+
+
+
+ sample.add
- 10
+ 23
+
+
+ 4
-
- ```
- I believe this is the expected result.
+
- ***
- #### Intentional error
- I changed the messge call string to `sample.add` instead of the correct `sample.sum` and run the program. obviously it threw an exception. the http response from wireguard was as follows
- ```xml
- POST /RPC2 HTTP/1.1
- Content-Type: text/xml
- User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
- Cache-Control: no-cache
- Pragma: no-cache
- Host: localhost:8080
- Accept: */*
- Connection: keep-alive
- Content-Length: 196
+HTTP/1.1 200 OK
+Server: Apache XML-RPC 1.0
+Connection: close
+Content-Type: text/xml
+Content-Length: 265
-
-
- sample.add
-
-
- 23
-
-
- 4
-
-
-
+
+
+
+
+
+
+ faultCode
+ 0
+
+
+ faultString
+ No such handler: sample.add
+
+
+
+
+
+```
+Again the expected results. I only tested it in one machine. so time will be done may be another time.
- HTTP/1.1 200 OK
- Server: Apache XML-RPC 1.0
- Connection: close
- Content-Type: text/xml
- Content-Length: 265
-
-
-
-
-
-
-
- faultCode
- 0
-
-
- faultString
- No such handler: sample.add
-
-
-
-
-
- ```
- Again the expected results. I only tested it in one machine. so time will be done may be another time.
-
diff --git a/week3_TinsaeGhilay/Task 2/out/client/Client.class b/week3_TinsaeGhilay/Task 2/out/client/Client.class
index 51180a4..92e79ec 100644
Binary files a/week3_TinsaeGhilay/Task 2/out/client/Client.class and b/week3_TinsaeGhilay/Task 2/out/client/Client.class differ
diff --git a/week3_TinsaeGhilay/Task 2/out/client/InputHandler.class b/week3_TinsaeGhilay/Task 2/out/client/InputHandler.class
new file mode 100644
index 0000000..6a650b6
Binary files /dev/null and b/week3_TinsaeGhilay/Task 2/out/client/InputHandler.class differ
diff --git a/week3_TinsaeGhilay/Task 2/out/server/Executor.class b/week3_TinsaeGhilay/Task 2/out/server/Executor.class
new file mode 100644
index 0000000..552edc3
Binary files /dev/null and b/week3_TinsaeGhilay/Task 2/out/server/Executor.class differ
diff --git a/week3_TinsaeGhilay/Task 2/out/server/Server.class b/week3_TinsaeGhilay/Task 2/out/server/Server.class
index d9a4001..214e22a 100644
Binary files a/week3_TinsaeGhilay/Task 2/out/server/Server.class and b/week3_TinsaeGhilay/Task 2/out/server/Server.class differ
diff --git a/week3_TinsaeGhilay/Task 2/src/client/Client.java b/week3_TinsaeGhilay/Task 2/src/client/Client.java
index f76540b..e6214bb 100644
--- a/week3_TinsaeGhilay/Task 2/src/client/Client.java
+++ b/week3_TinsaeGhilay/Task 2/src/client/Client.java
@@ -39,23 +39,43 @@ public class Client {
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
+ InputHandler handler = new InputHandler();
+
while (true) {
// create parameters to be sent to server method in a vector
// and populate it
Vector params = new Vector();
- int a = validateInput(scanner);
- int b = validateInput(scanner);
+ // get two integers from user
+ // promptForInt returns null if user wants to exit
+ Integer a = handler.promptForInt(scanner);
+ if (a == null) { // user wants to exit
+ notifyExit();
+ break;
+ }
+ Integer b = handler.promptForInt(scanner);
+ if (b == null) { // user wants to exit
+ notifyExit();
+ break;
+ }
+ // get command from user
+ String command = handler.promptForCommand(scanner);
+ if (command.equals("exit")) { // user wants to exit
+ notifyExit();
+ break;
+ }
+
+ // add parameters to vector
params.addElement(Integer.valueOf(a));
params.addElement(Integer.valueOf(b));
// make the remote method call
// the result of the remot call must be an Object
// and be casted to the appropriate type
- Object result = client.execute("sample.add", params);
+ Object result = client.execute("calculator." + command, params);
// process the result
int sum = ((Integer) result).intValue();
- System.out.println("The sum is: " + sum);
+ System.out.println("The " + handler.mapCommand(command) + " of " + a + " and " + b + " is: " + sum);
}
@@ -64,19 +84,8 @@ public class Client {
}
}
- private static int validateInput(Scanner scanner) {
- int number;
- while (true) {
- System.out.print("Enter an integer: ");
- if (scanner.hasNextInt()) {
- number = scanner.nextInt();
- break;
- } else {
- System.out.println("Invalid input. Please enter a valid integer.");
- scanner.next();
- }
- }
- return number;
+ private static void notifyExit() {
+ System.out.println("Exit command received. Exiting...");
}
}
diff --git a/week3_TinsaeGhilay/Task 2/src/client/InputHandler.java b/week3_TinsaeGhilay/Task 2/src/client/InputHandler.java
new file mode 100644
index 0000000..37c6e4e
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 2/src/client/InputHandler.java
@@ -0,0 +1,127 @@
+package client;
+
+/**
+ * InputHandler class
+ *
+ * @author Tinsae Ghilay
+ * for handling user inputs
+ */
+
+import java.util.Scanner;
+import java.util.Arrays;
+
+public class InputHandler {
+
+ // list of valid commands
+ private String[] commands = {
+ "add",
+ "subtract",
+ "multiply",
+ "divide",
+ "mod",
+ "power",
+ "root",
+ "exit"
+ };
+
+ /**
+ * method to prompt user for a valid integer
+ *
+ * @param scanner Scanner object for user input
+ * @return valid integer input from user
+ */
+ public Integer promptForInt(Scanner scanner) {
+ Integer number;
+ while (true) {
+ System.out.print("Enter an integer: ");
+ if (scanner.hasNextInt()) {
+ number = scanner.nextInt();
+ scanner.nextLine(); // consume the newline
+ break;
+ } else {
+ String command = scanner.nextLine();
+ // check if user wants to exit and return null
+ if (command.equalsIgnoreCase("exit")) {
+ return null;
+ }
+ System.out.println("Invalid input. Please enter a valid integer.");
+ }
+ }
+ return number;
+ }
+
+ /**
+ * method to prompt user for a valid command
+ *
+ * @param scanner Scanner object for user input
+ * @return valid command input from user
+ */
+ public String promptForCommand(Scanner scanner) {
+ System.out.print("Enter command (add, subtract, multiply, divide, mod, power, root, exit): ");
+ while (true) {
+ String command = scanner.nextLine().trim().toLowerCase();
+ if (isValidCommand(command)) {
+ return command;
+ } else {
+ System.out.print("Invalid command. Please enter a valid command: ");
+ }
+ }
+ }
+
+ /**
+ * helper method to check if command is valid
+ *
+ * @param command
+ * @return
+ */
+ private boolean isValidCommand(String command) {
+ return Arrays.asList(commands).contains(command.toLowerCase());
+ }
+
+ /**
+ * getter for commands
+ *
+ * @return
+ */
+ public String[] getCommands() {
+ return commands;
+ }
+
+ /**
+ * getter for command at index
+ *
+ * @param index
+ * @return
+ */
+ public String getCommand(int index) {
+ return commands[index];
+ }
+
+ /**
+ * method to map user command to result term
+ *
+ * @param command
+ * @return
+ */
+ public String mapCommand(String command) {
+ switch (command.toLowerCase()) {
+ case "add":
+ return "sum";
+ case "subtract":
+ return "difference";
+ case "multiply":
+ return "product";
+ case "divide":
+ return "quotient";
+ case "mod":
+ return "mod";
+ case "power":
+ return "power";
+ case "root":
+ return "root";
+ default:
+ return null;
+ }
+ }
+
+}
diff --git a/week3_TinsaeGhilay/Task 2/src/server/Executor.java b/week3_TinsaeGhilay/Task 2/src/server/Executor.java
new file mode 100644
index 0000000..0946722
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 2/src/server/Executor.java
@@ -0,0 +1,91 @@
+package server;
+
+/**
+ * Executor class for XML-RPC communication
+ *
+ * @author Tinsae Ghilay
+ * based on tutorial from
+ * https://www.tutorialspoint.com/xml-rpc/xml_rpc_examples.htm
+ */
+public class Executor {
+
+ // define methods that can be called remotely
+
+ /**
+ * sum of two integers
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer add(Integer x, Integer y) {
+ return Integer.valueOf(x + y);
+ }
+
+ /**
+ * difference of two integers x - y
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer subtract(Integer x, Integer y) {
+ return Integer.valueOf(x - y);
+ }
+
+ /**
+ * product of two integers
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer multiply(Integer x, Integer y) {
+ return Integer.valueOf(x * y);
+ }
+
+ /**
+ * division of two integers x/y
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Double divide(Integer x, Integer y) {
+ return Double.valueOf((double) x / y);
+ }
+
+ /**
+ * modulus of two integers
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer mod(Integer x, Integer y) {
+ return Integer.valueOf(x % y);
+ }
+
+ /**
+ * power of two integers x^y
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer power(Integer x, Integer y) {
+ return Integer.valueOf((int) Math.pow(x, y));
+ }
+
+ /**
+ * root of two integers X√Y
+ *
+ * @param x
+ * @param y
+ * @return
+ */
+ public Integer root(Integer x, Integer y) {
+ return Integer.valueOf((int) Math.pow(x, 1.0 / y));
+ }
+
+}
diff --git a/week3_TinsaeGhilay/Task 2/src/server/Server.java b/week3_TinsaeGhilay/Task 2/src/server/Server.java
index f5b3423..6fd5257 100644
--- a/week3_TinsaeGhilay/Task 2/src/server/Server.java
+++ b/week3_TinsaeGhilay/Task 2/src/server/Server.java
@@ -24,20 +24,24 @@ public class Server {
// start XML-RPC server at port 8080
WebServer server = new WebServer(8080);
+
XmlRpcServer xmlRpcServer = server.getXmlRpcServer();
+
PropertyHandlerMapping phm = new PropertyHandlerMapping();
- phm.addHandler("sample", Server.class);
+
+ phm.addHandler("calculator", Executor.class);
+
xmlRpcServer.setHandlerMapping(phm);
+
server.start();
+
System.out.println(TAG + ": Server started successfully.");
+
System.out.println("Accepting requests. (Halt program to stop.)");
+
} catch (Exception e) { // catch exceptions if problems occur
System.err.println(TAG + ": " + e.getMessage());
}
}
- public Integer sum(Integer x, Integer y) {
- return Integer.valueOf(x + y);
- }
-
}
diff --git a/week3_TinsaeGhilay/Task 3/out/client/Client.class b/week3_TinsaeGhilay/Task 3/out/client/Client.class
new file mode 100644
index 0000000..00fe8d2
Binary files /dev/null and b/week3_TinsaeGhilay/Task 3/out/client/Client.class differ
diff --git a/week3_TinsaeGhilay/Task 3/out/hello/Hello.class b/week3_TinsaeGhilay/Task 3/out/hello/Hello.class
new file mode 100644
index 0000000..642f421
Binary files /dev/null and b/week3_TinsaeGhilay/Task 3/out/hello/Hello.class differ
diff --git a/week3_TinsaeGhilay/Task 3/out/server/Server.class b/week3_TinsaeGhilay/Task 3/out/server/Server.class
new file mode 100644
index 0000000..5d91238
Binary files /dev/null and b/week3_TinsaeGhilay/Task 3/out/server/Server.class differ
diff --git a/week3_TinsaeGhilay/Task 3/src/client/Client.java b/week3_TinsaeGhilay/Task 3/src/client/Client.java
new file mode 100644
index 0000000..24c1960
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 3/src/client/Client.java
@@ -0,0 +1,41 @@
+package client;
+
+// Client/Client.java class represents the client that has to relay on the Hello engine
+// to perform tasks remotely.
+// it needs the Hello interface from Hello package
+import hello.Hello;
+
+// it also needs those to access the registry,
+// so it can get remote object reference of the server
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Scanner;
+
+public class Client {
+ private Client() {
+ }
+
+ public static void main(String[] args) {
+
+ // normally, the address of the server is passed here on the command line as an
+ // argument
+ // we get that address from args[0] if provided, else we use null for localhost
+ String host = (args.length < 1) ? null : args[0];
+ String name = "Hello";
+
+ try (Scanner scanner = new Scanner(System.in);) {
+
+ // get the registry from host(server)
+ Registry registry = LocateRegistry.getRegistry(host);
+
+ // look up the remote object by name in the registry
+ // stub is the a reference to the remote object
+ Hello stub = (Hello) registry.lookup(name);
+ String response = stub.sayHello();
+ System.out.println("response: " + response);
+
+ } catch (Exception e) {
+ System.err.println("Client exception: " + e.getMessage());
+ }
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 3/src/hello/Hello.java b/week3_TinsaeGhilay/Task 3/src/hello/Hello.java
new file mode 100644
index 0000000..5f2bbd6
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 3/src/hello/Hello.java
@@ -0,0 +1,12 @@
+package hello;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// this interface extends the interface "java.rmi.Remote"
+// so its methods can be invoked from another Java virtual machine
+public interface Hello extends Remote {
+
+ // say hello method, This is a repeat of task 1(done as part of learning RMI)
+ String sayHello() throws RemoteException;
+}
diff --git a/week3_TinsaeGhilay/Task 3/src/server/Server.java b/week3_TinsaeGhilay/Task 3/src/server/Server.java
new file mode 100644
index 0000000..d22c46b
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 3/src/server/Server.java
@@ -0,0 +1,56 @@
+
+package server;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+
+// needs the compute and task interfaces from compute package
+// define constructor for each
+// and provide an implementation for each remote method in the remote interfaces
+import hello.Hello;
+
+/**
+ * The implementation of the Compute interface for the compute engine.
+ * it has to declare the remote class to be implemented (in this case Compute
+ * (implements it)
+ */
+public class Server implements Hello {
+
+ public Server() {
+ super();
+ }
+
+ @Override
+ public String sayHello() throws RemoteException {
+ return "Hello, world!";
+ }
+
+ // entry
+ public static void main(String[] args) {
+
+ // the code provided on the tutorial was deprecated.
+ // so google led me to
+ // [this](https://docs.oracle.com/javase/8/docs/technotes/guides/rmi/hello/hello-world.html#create)
+ try {
+ String name = "Hello";
+ // create remote object that provides service (server).
+ Hello server = new Server();
+
+ // and export remote object to java RMI runtime
+ // so it may receive remote incoming calls
+ Hello stub = (Hello) UnicastRemoteObject.exportObject(server, 0);
+ // the register the remote object with java RMI registry
+ // the registry is a name service that allows clients get a reference of remote
+ // objects
+ // once a remote object is registered, callers can look up the object by name
+ // and obtain its remote object reference
+ Registry registry = LocateRegistry.getRegistry();
+ registry.rebind(name, stub);
+ System.out.println("Server bound");
+ } catch (Exception e) {
+ System.err.println("Server exception: " + e.getMessage());
+ }
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 4/out/client/Client.class b/week3_TinsaeGhilay/Task 4/out/client/Client.class
new file mode 100644
index 0000000..5d4c8a5
Binary files /dev/null and b/week3_TinsaeGhilay/Task 4/out/client/Client.class differ
diff --git a/week3_TinsaeGhilay/Task 4/out/compute/Compute.class b/week3_TinsaeGhilay/Task 4/out/compute/Compute.class
new file mode 100644
index 0000000..1483395
Binary files /dev/null and b/week3_TinsaeGhilay/Task 4/out/compute/Compute.class differ
diff --git a/week3_TinsaeGhilay/Task 4/out/server/Server.class b/week3_TinsaeGhilay/Task 4/out/server/Server.class
new file mode 100644
index 0000000..b4be60d
Binary files /dev/null and b/week3_TinsaeGhilay/Task 4/out/server/Server.class differ
diff --git a/week3_TinsaeGhilay/Task 4/src/client/Client.java b/week3_TinsaeGhilay/Task 4/src/client/Client.java
new file mode 100644
index 0000000..db0fe27
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 4/src/client/Client.java
@@ -0,0 +1,44 @@
+package client;
+
+// Client/Client.java class represents the client that has to relay on the Hello engine
+// to perform tasks remotely.
+// it needs the Hello interface from Hello package
+import compute.Compute;
+
+// it also needs those to access the registry,
+// so it can get remote object reference of the server
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Scanner;
+
+public class Client {
+ private Client() {
+ }
+
+ public static void main(String[] args) {
+
+ // normally, the address of the server is passed here on the command line as an
+ // argument
+ // we get that address from args[0] if provided, else we use null for localhost
+ String host = (args.length < 1) ? null : args[0];
+
+ try (Scanner scanner = new Scanner(System.in);) {
+
+ // get the registry from host(server)
+ Registry registry = LocateRegistry.getRegistry(host);
+
+ // look up the remote object by name in the registry
+ // stub is the a reference to the remote object
+ Compute stub = (Compute) registry.lookup(Compute.SERVICE_NAME);
+ boolean isAuthenticated = stub.authenticate();
+ if (isAuthenticated) {
+ System.out.println("Client authenticated successfully. Door opens.");
+ } else {
+ System.out.println("Client authentication failed. Door remains closed.");
+ }
+
+ } catch (Exception e) {
+ System.err.println("Client exception: " + e.getMessage());
+ }
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 4/src/compute/Compute.java b/week3_TinsaeGhilay/Task 4/src/compute/Compute.java
new file mode 100644
index 0000000..38b3cc3
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 4/src/compute/Compute.java
@@ -0,0 +1,13 @@
+package compute;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// this interface extends the interface "java.rmi.Remote"
+// so its methods can be invoked from another Java virtual machine
+public interface Compute extends Remote {
+ static final String SERVICE_NAME = "authenticator";
+
+ // say hello method, This is a repeat of task 1(done as part of learning RMI)
+ boolean authenticate() throws RemoteException;
+}
diff --git a/week3_TinsaeGhilay/Task 4/src/server/Server.java b/week3_TinsaeGhilay/Task 4/src/server/Server.java
new file mode 100644
index 0000000..361802b
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 4/src/server/Server.java
@@ -0,0 +1,65 @@
+
+package server;
+
+/**
+ * Server implementation for the Compute interface
+ * @author Tinsae Ghilay
+ *
+ * mimics an authentication service for some client to access a secure resource
+ * (mocked as a door that opens or remains closed based on authentication result)
+ * verification is done randomly for demo purposes
+ */
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.Random;
+
+// needs the compute and task interfaces from compute package
+// define constructor for each
+// and provide an implementation for each remote method in the remote interfaces
+import compute.Compute;
+
+/**
+ * The implementation of the Compute interface for the compute engine.
+ * it has to declare the remote class to be implemented (in this case Compute
+ * (implements it)
+ */
+public class Server implements Compute {
+
+ public Server() {
+ super();
+ }
+
+ @Override
+ public boolean authenticate() throws RemoteException {
+ return new Random().nextBoolean();
+ }
+
+ // entry
+ public static void main(String[] args) {
+
+ // the code provided on the tutorial was deprecated.
+ // so google led me to
+ // [this](https://docs.oracle.com/javase/8/docs/technotes/guides/rmi/hello/hello-world.html#create)
+ try {
+ // create remote object that provides service (server).
+ Compute server = new Server();
+
+ // and export remote object to java RMI runtime
+ // so it may receive remote incoming calls
+ Compute stub = (Compute) UnicastRemoteObject.exportObject(server, 0);
+ // the register the remote object with java RMI registry
+ // the registry is a name service that allows clients get a reference of remote
+ // objects
+ // once a remote object is registered, callers can look up the object by name
+ // and obtain its remote object reference
+ Registry registry = LocateRegistry.createRegistry(1099);
+ registry.rebind(Compute.SERVICE_NAME, stub);
+ System.out.println("Server bound");
+ } catch (Exception e) {
+ System.err.println("Server exception: " + e.getMessage());
+ }
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 5/out/client/Client.class b/week3_TinsaeGhilay/Task 5/out/client/Client.class
index 6ecca47..cb833a8 100644
Binary files a/week3_TinsaeGhilay/Task 5/out/client/Client.class and b/week3_TinsaeGhilay/Task 5/out/client/Client.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/pom.xml b/week3_TinsaeGhilay/Task 7/example/pom.xml
new file mode 100644
index 0000000..014e783
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/pom.xml
@@ -0,0 +1,70 @@
+
+
+ 4.0.0
+
+ org.tinsae.grpc
+ example
+ 1.0-SNAPSHOT
+
+
+ 17
+ 17
+
+
+
+ io.grpc
+ grpc-netty-shaded
+ 1.49.0
+
+
+ io.grpc
+ grpc-protobuf
+ 1.49.0
+
+
+ io.grpc
+ grpc-stub
+ 1.49.0
+
+
+ org.apache.tomcat
+ annotations-api
+ 6.0.53
+ provided
+
+
+
+
+
+
+ kr.motd.maven
+ os-maven-plugin
+ 1.6.2
+
+
+
+
+ org.xolstice.maven.plugins
+ protobuf-maven-plugin
+ 0.6.1
+
+ com.google.protobuf:protoc:3.21.1:exe:${os.detected.classifier}
+ grpc-java
+ true
+ io.grpc:protoc-gen-grpc-java:1.49.0:exe:${os.detected.classifier}
+
+
+
+
+ compile
+ compile-custom
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReply.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReply.java
new file mode 100644
index 0000000..465763b
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReply.java
@@ -0,0 +1,567 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HelloWorldServiceProtos.proto
+
+package org.tinsae.grpc;
+
+/**
+ *
+ * The response message containing the response
+ *
+ *
+ * Protobuf type {@code org.tinsae.grpc.HelloReply}
+ */
+public final class HelloReply extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:org.tinsae.grpc.HelloReply)
+ HelloReplyOrBuilder {
+private static final long serialVersionUID = 0L;
+ // Use HelloReply.newBuilder() to construct.
+ private HelloReply(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private HelloReply() {
+ message_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new HelloReply();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private HelloReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ message_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloReply_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.tinsae.grpc.HelloReply.class, org.tinsae.grpc.HelloReply.Builder.class);
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 1;
+ private volatile java.lang.Object message_;
+ /**
+ * string message = 1;
+ * @return The message.
+ */
+ @java.lang.Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+ /**
+ * string message = 1;
+ * @return The bytes for message.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.tinsae.grpc.HelloReply)) {
+ return super.equals(obj);
+ }
+ org.tinsae.grpc.HelloReply other = (org.tinsae.grpc.HelloReply) obj;
+
+ if (!getMessage()
+ .equals(other.getMessage())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.tinsae.grpc.HelloReply prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * The response message containing the response
+ *
+ *
+ * Protobuf type {@code org.tinsae.grpc.HelloReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:org.tinsae.grpc.HelloReply)
+ org.tinsae.grpc.HelloReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloReply_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.tinsae.grpc.HelloReply.class, org.tinsae.grpc.HelloReply.Builder.class);
+ }
+
+ // Construct using org.tinsae.grpc.HelloReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ message_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloReply_descriptor;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloReply getDefaultInstanceForType() {
+ return org.tinsae.grpc.HelloReply.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloReply build() {
+ org.tinsae.grpc.HelloReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloReply buildPartial() {
+ org.tinsae.grpc.HelloReply result = new org.tinsae.grpc.HelloReply(this);
+ result.message_ = message_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.tinsae.grpc.HelloReply) {
+ return mergeFrom((org.tinsae.grpc.HelloReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.tinsae.grpc.HelloReply other) {
+ if (other == org.tinsae.grpc.HelloReply.getDefaultInstance()) return this;
+ if (!other.getMessage().isEmpty()) {
+ message_ = other.message_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.tinsae.grpc.HelloReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.tinsae.grpc.HelloReply) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object message_ = "";
+ /**
+ * string message = 1;
+ * @return The message.
+ */
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string message = 1;
+ * @return The bytes for message.
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string message = 1;
+ * @param value The message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessage(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string message = 1;
+ * @return This builder for chaining.
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+ /**
+ * string message = 1;
+ * @param value The bytes for message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:org.tinsae.grpc.HelloReply)
+ }
+
+ // @@protoc_insertion_point(class_scope:org.tinsae.grpc.HelloReply)
+ private static final org.tinsae.grpc.HelloReply DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.tinsae.grpc.HelloReply();
+ }
+
+ public static org.tinsae.grpc.HelloReply getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public HelloReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloReply(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloReply getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReplyOrBuilder.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReplyOrBuilder.java
new file mode 100644
index 0000000..76935fc
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReplyOrBuilder.java
@@ -0,0 +1,21 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HelloWorldServiceProtos.proto
+
+package org.tinsae.grpc;
+
+public interface HelloReplyOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:org.tinsae.grpc.HelloReply)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * string message = 1;
+ * @return The message.
+ */
+ java.lang.String getMessage();
+ /**
+ * string message = 1;
+ * @return The bytes for message.
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequest.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequest.java
new file mode 100644
index 0000000..82bcfc6
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequest.java
@@ -0,0 +1,567 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HelloWorldServiceProtos.proto
+
+package org.tinsae.grpc;
+
+/**
+ *
+ * The request message containing the user's name
+ *
+ *
+ * Protobuf type {@code org.tinsae.grpc.HelloRequest}
+ */
+public final class HelloRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:org.tinsae.grpc.HelloRequest)
+ HelloRequestOrBuilder {
+private static final long serialVersionUID = 0L;
+ // Use HelloRequest.newBuilder() to construct.
+ private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private HelloRequest() {
+ name_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new HelloRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private HelloRequest(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ java.lang.String s = input.readStringRequireUtf8();
+
+ name_ = s;
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.tinsae.grpc.HelloRequest.class, org.tinsae.grpc.HelloRequest.Builder.class);
+ }
+
+ public static final int NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object name_;
+ /**
+ * string name = 1;
+ * @return The name.
+ */
+ @java.lang.Override
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ }
+ }
+ /**
+ * string name = 1;
+ * @return The bytes for name.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.tinsae.grpc.HelloRequest)) {
+ return super.equals(obj);
+ }
+ org.tinsae.grpc.HelloRequest other = (org.tinsae.grpc.HelloRequest) obj;
+
+ if (!getName()
+ .equals(other.getName())) return false;
+ if (!unknownFields.equals(other.unknownFields)) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static org.tinsae.grpc.HelloRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(org.tinsae.grpc.HelloRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * The request message containing the user's name
+ *
+ *
+ * Protobuf type {@code org.tinsae.grpc.HelloRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:org.tinsae.grpc.HelloRequest)
+ org.tinsae.grpc.HelloRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.tinsae.grpc.HelloRequest.class, org.tinsae.grpc.HelloRequest.Builder.class);
+ }
+
+ // Construct using org.tinsae.grpc.HelloRequest.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.internal_static_org_tinsae_grpc_HelloRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloRequest getDefaultInstanceForType() {
+ return org.tinsae.grpc.HelloRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloRequest build() {
+ org.tinsae.grpc.HelloRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloRequest buildPartial() {
+ org.tinsae.grpc.HelloRequest result = new org.tinsae.grpc.HelloRequest(this);
+ result.name_ = name_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.tinsae.grpc.HelloRequest) {
+ return mergeFrom((org.tinsae.grpc.HelloRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.tinsae.grpc.HelloRequest other) {
+ if (other == org.tinsae.grpc.HelloRequest.getDefaultInstance()) return this;
+ if (!other.getName().isEmpty()) {
+ name_ = other.name_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.tinsae.grpc.HelloRequest parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.tinsae.grpc.HelloRequest) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private java.lang.Object name_ = "";
+ /**
+ * string name = 1;
+ * @return The name.
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * string name = 1;
+ * @return The bytes for name.
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * string name = 1;
+ * @param value The name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * string name = 1;
+ * @return This builder for chaining.
+ */
+ public Builder clearName() {
+
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * string name = 1;
+ * @param value The bytes for name to set.
+ * @return This builder for chaining.
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:org.tinsae.grpc.HelloRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:org.tinsae.grpc.HelloRequest)
+ private static final org.tinsae.grpc.HelloRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new org.tinsae.grpc.HelloRequest();
+ }
+
+ public static org.tinsae.grpc.HelloRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public HelloRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloRequest(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public org.tinsae.grpc.HelloRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequestOrBuilder.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequestOrBuilder.java
new file mode 100644
index 0000000..45419e6
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequestOrBuilder.java
@@ -0,0 +1,21 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HelloWorldServiceProtos.proto
+
+package org.tinsae.grpc;
+
+public interface HelloRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:org.tinsae.grpc.HelloRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * string name = 1;
+ * @return The name.
+ */
+ java.lang.String getName();
+ /**
+ * string name = 1;
+ * @return The bytes for name.
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceGrpc.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceGrpc.java
new file mode 100644
index 0000000..5e9350a
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceGrpc.java
@@ -0,0 +1,291 @@
+package org.tinsae.grpc;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+
+/**
+ *
+ * The greeting service definition
+ *
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.49.0)",
+ comments = "Source: HelloWorldServiceProtos.proto")
+@io.grpc.stub.annotations.GrpcGenerated
+public final class HelloWorldServiceGrpc {
+
+ private HelloWorldServiceGrpc() {}
+
+ public static final String SERVICE_NAME = "org.tinsae.grpc.HelloWorldService";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor getSayHelloMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "sayHello",
+ requestType = org.tinsae.grpc.HelloRequest.class,
+ responseType = org.tinsae.grpc.HelloReply.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getSayHelloMethod() {
+ io.grpc.MethodDescriptor getSayHelloMethod;
+ if ((getSayHelloMethod = HelloWorldServiceGrpc.getSayHelloMethod) == null) {
+ synchronized (HelloWorldServiceGrpc.class) {
+ if ((getSayHelloMethod = HelloWorldServiceGrpc.getSayHelloMethod) == null) {
+ HelloWorldServiceGrpc.getSayHelloMethod = getSayHelloMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "sayHello"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.tinsae.grpc.HelloRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.tinsae.grpc.HelloReply.getDefaultInstance()))
+ .setSchemaDescriptor(new HelloWorldServiceMethodDescriptorSupplier("sayHello"))
+ .build();
+ }
+ }
+ }
+ return getSayHelloMethod;
+ }
+
+ /**
+ * Creates a new async stub that supports all call types for the service
+ */
+ public static HelloWorldServiceStub newStub(io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HelloWorldServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceStub(channel, callOptions);
+ }
+ };
+ return HelloWorldServiceStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+ */
+ public static HelloWorldServiceBlockingStub newBlockingStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HelloWorldServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceBlockingStub(channel, callOptions);
+ }
+ };
+ return HelloWorldServiceBlockingStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new ListenableFuture-style stub that supports unary calls on the service
+ */
+ public static HelloWorldServiceFutureStub newFutureStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HelloWorldServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceFutureStub(channel, callOptions);
+ }
+ };
+ return HelloWorldServiceFutureStub.newStub(factory, channel);
+ }
+
+ /**
+ *
+ * The greeting service definition
+ *
+ */
+ public static abstract class HelloWorldServiceImplBase implements io.grpc.BindableService {
+
+ /**
+ */
+ public void sayHello(org.tinsae.grpc.HelloRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSayHelloMethod(), responseObserver);
+ }
+
+ @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getSayHelloMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ org.tinsae.grpc.HelloRequest,
+ org.tinsae.grpc.HelloReply>(
+ this, METHODID_SAY_HELLO)))
+ .build();
+ }
+ }
+
+ /**
+ *
+ * The greeting service definition
+ *
+ */
+ public static final class HelloWorldServiceStub extends io.grpc.stub.AbstractAsyncStub {
+ private HelloWorldServiceStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HelloWorldServiceStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public void sayHello(org.tinsae.grpc.HelloRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getSayHelloMethod(), getCallOptions()), request, responseObserver);
+ }
+ }
+
+ /**
+ *
+ * The greeting service definition
+ *
+ */
+ public static final class HelloWorldServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub {
+ private HelloWorldServiceBlockingStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HelloWorldServiceBlockingStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceBlockingStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public org.tinsae.grpc.HelloReply sayHello(org.tinsae.grpc.HelloRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getSayHelloMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ *
+ * The greeting service definition
+ *
+ */
+ public static final class HelloWorldServiceFutureStub extends io.grpc.stub.AbstractFutureStub {
+ private HelloWorldServiceFutureStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HelloWorldServiceFutureStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HelloWorldServiceFutureStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public com.google.common.util.concurrent.ListenableFuture sayHello(
+ org.tinsae.grpc.HelloRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getSayHelloMethod(), getCallOptions()), request);
+ }
+ }
+
+ private static final int METHODID_SAY_HELLO = 0;
+
+ private static final class MethodHandlers implements
+ io.grpc.stub.ServerCalls.UnaryMethod,
+ io.grpc.stub.ServerCalls.ServerStreamingMethod,
+ io.grpc.stub.ServerCalls.ClientStreamingMethod,
+ io.grpc.stub.ServerCalls.BidiStreamingMethod {
+ private final HelloWorldServiceImplBase serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(HelloWorldServiceImplBase serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_SAY_HELLO:
+ serviceImpl.sayHello((org.tinsae.grpc.HelloRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver invoke(
+ io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ private static abstract class HelloWorldServiceBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+ HelloWorldServiceBaseDescriptorSupplier() {}
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+ return org.tinsae.grpc.HelloWorldServiceProtos.getDescriptor();
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+ return getFileDescriptor().findServiceByName("HelloWorldService");
+ }
+ }
+
+ private static final class HelloWorldServiceFileDescriptorSupplier
+ extends HelloWorldServiceBaseDescriptorSupplier {
+ HelloWorldServiceFileDescriptorSupplier() {}
+ }
+
+ private static final class HelloWorldServiceMethodDescriptorSupplier
+ extends HelloWorldServiceBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+ private final String methodName;
+
+ HelloWorldServiceMethodDescriptorSupplier(String methodName) {
+ this.methodName = methodName;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+ return getServiceDescriptor().findMethodByName(methodName);
+ }
+ }
+
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (HelloWorldServiceGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new HelloWorldServiceFileDescriptorSupplier())
+ .addMethod(getSayHelloMethod())
+ .build();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceImpl.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceImpl.java
new file mode 100644
index 0000000..aedd959
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceImpl.java
@@ -0,0 +1,20 @@
+package org.tinsae.grpc;
+
+import io.grpc.stub.StreamObserver;
+
+public class HelloWorldServiceImpl extends
+ HelloWorldServiceGrpc.HelloWorldServiceImplBase {
+ @Override
+ public void sayHello(HelloRequest req, StreamObserver responseObserver) {
+
+ System.out.println("Hello! Received: " + req.getName());
+
+ System.out.println("Sending back: Hello " + req.getName());
+
+ HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
+
+ responseObserver.onNext(reply);
+
+ responseObserver.onCompleted();
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceProtos.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceProtos.java
new file mode 100644
index 0000000..4761be9
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceProtos.java
@@ -0,0 +1,63 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HelloWorldServiceProtos.proto
+
+package org.tinsae.grpc;
+
+public final class HelloWorldServiceProtos {
+ private HelloWorldServiceProtos() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_tinsae_grpc_HelloRequest_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_org_tinsae_grpc_HelloRequest_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_tinsae_grpc_HelloReply_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_org_tinsae_grpc_HelloReply_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\035HelloWorldServiceProtos.proto\022\017org.tin" +
+ "sae.grpc\"\034\n\014HelloRequest\022\014\n\004name\030\001 \001(\t\"\035" +
+ "\n\nHelloReply\022\017\n\007message\030\001 \001(\t2[\n\021HelloWo" +
+ "rldService\022F\n\010sayHello\022\035.org.tinsae.grpc" +
+ ".HelloRequest\032\033.org.tinsae.grpc.HelloRep" +
+ "lyB,\n\017org.tinsae.grpcB\027HelloWorldService" +
+ "ProtosP\001b\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ });
+ internal_static_org_tinsae_grpc_HelloRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_tinsae_grpc_HelloRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_org_tinsae_grpc_HelloRequest_descriptor,
+ new java.lang.String[] { "Name", });
+ internal_static_org_tinsae_grpc_HelloReply_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_org_tinsae_grpc_HelloReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_org_tinsae_grpc_HelloReply_descriptor,
+ new java.lang.String[] { "Message", });
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/client/HelloWorldClient.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/client/HelloWorldClient.java
new file mode 100644
index 0000000..370342b
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/client/HelloWorldClient.java
@@ -0,0 +1,26 @@
+package org.tinsae.grpc.client;
+
+import org.tinsae.grpc.HelloReply;
+import org.tinsae.grpc.HelloRequest;
+import org.tinsae.grpc.HelloWorldServiceGrpc;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+
+public class HelloWorldClient {
+
+ public static void main(String[] args) {
+
+ ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost",
+ 8080)
+ .usePlaintext()
+ .build();
+
+ HelloWorldServiceGrpc.HelloWorldServiceBlockingStub stub = HelloWorldServiceGrpc.newBlockingStub(channel);
+
+ HelloRequest request = HelloRequest.newBuilder().setName("Andrea").build();
+
+ HelloReply response = stub.sayHello(request);
+
+ System.out.println("Response: " + response.getMessage());
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/server/HelloWorldServer.java b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/server/HelloWorldServer.java
new file mode 100644
index 0000000..5d657c4
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/server/HelloWorldServer.java
@@ -0,0 +1,18 @@
+package org.tinsae.grpc.server;
+
+import org.tinsae.grpc.HelloWorldServiceImpl;
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import java.io.IOException;
+
+public class HelloWorldServer {
+ public static void main(String[] args) throws IOException,
+ InterruptedException {
+ Server server = ServerBuilder.forPort(8080)
+ .addService(new HelloWorldServiceImpl())
+ .build();
+ server.start();
+ System.out.println("Server started...");
+ server.awaitTermination();
+ }
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/src/main/proto/HelloWorldServiceProtos.proto b/week3_TinsaeGhilay/Task 7/example/src/main/proto/HelloWorldServiceProtos.proto
new file mode 100644
index 0000000..bd3feff
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/src/main/proto/HelloWorldServiceProtos.proto
@@ -0,0 +1,22 @@
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "org.tinsae.grpc";
+option java_outer_classname = "HelloWorldServiceProtos";
+
+package org.tinsae.grpc;
+
+// The greeting service definition
+service HelloWorldService {
+ rpc sayHello ( HelloRequest) returns ( HelloReply);
+}
+
+// The request message containing the user's name
+message HelloRequest {
+ string name = 1;
+}
+
+// The response message containing the response
+message HelloReply {
+ string message = 1;
+}
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$1.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$1.class
new file mode 100644
index 0000000..89eca99
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$1.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$Builder.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$Builder.class
new file mode 100644
index 0000000..201e71a
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply$Builder.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply.class
new file mode 100644
index 0000000..0f73957
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReply.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReplyOrBuilder.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReplyOrBuilder.class
new file mode 100644
index 0000000..a4b7c5c
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloReplyOrBuilder.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$1.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$1.class
new file mode 100644
index 0000000..906e095
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$1.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$Builder.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$Builder.class
new file mode 100644
index 0000000..3edc4e4
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest$Builder.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest.class
new file mode 100644
index 0000000..4fb6b44
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequest.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequestOrBuilder.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequestOrBuilder.class
new file mode 100644
index 0000000..851a46e
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloRequestOrBuilder.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$1.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$1.class
new file mode 100644
index 0000000..df899e7
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$1.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$2.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$2.class
new file mode 100644
index 0000000..47b92b9
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$2.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$3.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$3.class
new file mode 100644
index 0000000..20d37f4
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$3.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBaseDescriptorSupplier.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBaseDescriptorSupplier.class
new file mode 100644
index 0000000..b1127eb
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBaseDescriptorSupplier.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBlockingStub.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBlockingStub.class
new file mode 100644
index 0000000..a3792b5
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBlockingStub.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFileDescriptorSupplier.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFileDescriptorSupplier.class
new file mode 100644
index 0000000..bfd2f42
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFileDescriptorSupplier.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFutureStub.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFutureStub.class
new file mode 100644
index 0000000..5cf8d7b
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFutureStub.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceImplBase.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceImplBase.class
new file mode 100644
index 0000000..1cdf483
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceImplBase.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceMethodDescriptorSupplier.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceMethodDescriptorSupplier.class
new file mode 100644
index 0000000..321cf7f
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceMethodDescriptorSupplier.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceStub.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceStub.class
new file mode 100644
index 0000000..d0baa41
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceStub.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$MethodHandlers.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$MethodHandlers.class
new file mode 100644
index 0000000..8572229
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc$MethodHandlers.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc.class
new file mode 100644
index 0000000..b5884f8
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceGrpc.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceImpl.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceImpl.class
new file mode 100644
index 0000000..b23f3e1
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceImpl.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceProtos.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceProtos.class
new file mode 100644
index 0000000..037eb93
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/HelloWorldServiceProtos.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/client/HelloWorldClient.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/client/HelloWorldClient.class
new file mode 100644
index 0000000..923e295
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/client/HelloWorldClient.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/server/HelloWorldServer.class b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/server/HelloWorldServer.class
new file mode 100644
index 0000000..e84fe77
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/classes/org/tinsae/grpc/server/HelloWorldServer.class differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/example-1.0-SNAPSHOT.jar b/week3_TinsaeGhilay/Task 7/example/target/example-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..760f945
Binary files /dev/null and b/week3_TinsaeGhilay/Task 7/example/target/example-1.0-SNAPSHOT.jar differ
diff --git a/week3_TinsaeGhilay/Task 7/example/target/maven-archiver/pom.properties b/week3_TinsaeGhilay/Task 7/example/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..784024e
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/target/maven-archiver/pom.properties
@@ -0,0 +1,3 @@
+artifactId=example
+groupId=org.tinsae.grpc
+version=1.0-SNAPSHOT
diff --git a/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..a636d57
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,24 @@
+org/tinsae/grpc/HelloReply$1.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFileDescriptorSupplier.class
+org/tinsae/grpc/HelloWorldServiceGrpc$3.class
+org/tinsae/grpc/client/HelloWorldClient.class
+org/tinsae/grpc/HelloRequestOrBuilder.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceImplBase.class
+org/tinsae/grpc/HelloWorldServiceGrpc$1.class
+org/tinsae/grpc/HelloRequest.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceMethodDescriptorSupplier.class
+org/tinsae/grpc/server/HelloWorldServer.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBaseDescriptorSupplier.class
+org/tinsae/grpc/HelloRequest$1.class
+org/tinsae/grpc/HelloReplyOrBuilder.class
+org/tinsae/grpc/HelloWorldServiceGrpc$MethodHandlers.class
+org/tinsae/grpc/HelloWorldServiceProtos.class
+org/tinsae/grpc/HelloWorldServiceImpl.class
+org/tinsae/grpc/HelloWorldServiceGrpc.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceStub.class
+org/tinsae/grpc/HelloReply$Builder.class
+org/tinsae/grpc/HelloRequest$Builder.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceBlockingStub.class
+org/tinsae/grpc/HelloWorldServiceGrpc$2.class
+org/tinsae/grpc/HelloWorldServiceGrpc$HelloWorldServiceFutureStub.class
+org/tinsae/grpc/HelloReply.class
diff --git a/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..05bb66f
--- /dev/null
+++ b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,9 @@
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReply.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloReplyOrBuilder.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequest.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloRequestOrBuilder.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceGrpc.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceImpl.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/HelloWorldServiceProtos.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/client/HelloWorldClient.java
+/home/tgk/Repos/Trusted/DistributedSystems/week3_TinsaeGhilay/Task 7/example/src/main/java/org/tinsae/grpc/server/HelloWorldServer.java
diff --git a/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/week3_TinsaeGhilay/Task 7/example/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/week3_TinsaeGhilay/solutions.txt b/week3_TinsaeGhilay/solutions.txt
new file mode 100644
index 0000000..fbac32a
--- /dev/null
+++ b/week3_TinsaeGhilay/solutions.txt
@@ -0,0 +1,7 @@
+Exercise 1: not mandatory
+Exercise 2: done 100%
+Exercise 3: done 100%
+Exercise 4: not mandatory
+Exercise 5: done 100%
+Exercise 6: not mandatory
+Exercise 7: done 100%
\ No newline at end of file