Files
rosetta-wss/src/main/java/com/rosetta/im/Boot.java

45 lines
1.2 KiB
Java

package com.rosetta.im;
import com.rosetta.im.executors.Executor0Handshake;
import com.rosetta.im.packet.Packet0Handshake;
import io.orprotocol.packet.PacketManager;
public class Boot {
private PacketManager packetManager;
public Boot() {
this.packetManager = new PacketManager();
}
public PacketManager getPacketManager() {
return this.packetManager;
}
/**
* Инициализация всех пакетов и их обработчиков
*/
public Boot bootstrap() {
this.registerAllPackets();
this.registerAllExecutors();
this.printBootMessage();
return this;
}
private void registerAllPackets() {
this.packetManager.registerPacket(0, Packet0Handshake.class);
}
private void registerAllExecutors() {
this.packetManager.registerExecutor(0, Executor0Handshake.class);
}
private void printBootMessage() {
System.out.println("Bootstrapping completed. All packets and executors are registered.");
System.out.println("Total packets registered: " + this.packetManager.totalPackets());
System.out.println("Total executors registered: " + this.packetManager.totalExecutors());
}
}