blob: 1a86fc7611be7cd78287d628925c1570afab9aff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package pl.edu.mimuw.cloudatlas.agent.modules;
import pl.edu.mimuw.cloudatlas.agent.ApiImplementation;
import pl.edu.mimuw.cloudatlas.agent.messages.AgentMessage;
import pl.edu.mimuw.cloudatlas.agent.messages.RMIMessage;
import pl.edu.mimuw.cloudatlas.api.Api;
import pl.edu.mimuw.cloudatlas.interpreter.Main;
import pl.edu.mimuw.cloudatlas.model.ZMI;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class RMI extends Module {
public RMI(ModuleType moduleType) {
super(moduleType);
runRegistry();
}
public void runRegistry() {
try {
ZMI root = Main.createTestHierarchy2();
ApiImplementation api = new ApiImplementation(root);
Api apiStub =
(Api) UnicastRemoteObject.exportObject(api, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind("Api", apiStub);
System.out.println("Agent: api bound");
} catch (Exception e) {
System.err.println("Agent registry initialization exception:");
e.printStackTrace();
}
}
public void handleTyped(RMIMessage event) throws InterruptedException {
}
}
|