- Started with Web Protocol
This commit is contained in:
@@ -8,8 +8,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public enum ProtocolVersion implements Serializable {
|
||||
PV_1_0_0_CLASSIC("1.0.0", ProtocolType.CLASSIC, ProtocolSide.BOTH),
|
||||
PV_1_0_0_BETA("1.0.0", ProtocolType.BETA, ProtocolSide.BOTH, PV_1_0_0_CLASSIC);
|
||||
PV_1_0_0_CLASSIC("1.0.0", ProtocolType.CLASSIC, ProtocolSide.WEB_DNS, List.of(Protocol.HTTP)),
|
||||
PV_1_0_0_BETA("1.0.0", ProtocolType.BETA, ProtocolSide.ALL, List.of(Protocol.OAC), PV_1_0_0_CLASSIC);
|
||||
|
||||
@Getter
|
||||
private final String version;
|
||||
@@ -19,30 +19,49 @@ public enum ProtocolVersion implements Serializable {
|
||||
private final ProtocolSide protocolSide;
|
||||
@Getter
|
||||
private final List<ProtocolVersion> compatibleVersions;
|
||||
@Getter
|
||||
private final List<Protocol> supportedProtocols;
|
||||
|
||||
ProtocolVersion(String version, ProtocolType protocolType, ProtocolSide protocolSide, ProtocolVersion... compatibleVersions) {
|
||||
ProtocolVersion(String version, ProtocolType protocolType, ProtocolSide protocolSide, List<Protocol> supportedProtocols, ProtocolVersion... compatibleVersions) {
|
||||
this.version = version;
|
||||
this.protocolType = protocolType;
|
||||
this.protocolSide = protocolSide;
|
||||
this.compatibleVersions = new ArrayList<>(Arrays.stream(compatibleVersions).toList());
|
||||
if (!this.compatibleVersions.contains(this)) this.compatibleVersions.add(this);
|
||||
this.supportedProtocols = supportedProtocols;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
StringBuilder compatible = new StringBuilder("[");
|
||||
StringBuilder supported = new StringBuilder("[");
|
||||
for (ProtocolVersion compatibleVersion : compatibleVersions) compatible.append(compatibleVersion.buildName());
|
||||
for (Protocol supportedProtocol : supportedProtocols) supported.append(supportedProtocol.toString());
|
||||
compatible.append("]");
|
||||
supported.append("]");
|
||||
|
||||
return "{version=" + version + ";type=" + protocolType.toString() + ";side=" + protocolSide.toString() + ";compatible=" + compatible + "}";
|
||||
return "{version=" + version + ";type=" + protocolType.toString() + ";side=" + protocolSide.toString() + ";supportedProtocols=" + supported + ";compatibleVersions=" + compatible + "}";
|
||||
}
|
||||
|
||||
public final String buildName() {
|
||||
return version + "-" + protocolType.toString();
|
||||
}
|
||||
|
||||
public enum Protocol implements Serializable {
|
||||
HTTP,
|
||||
HTTPS,
|
||||
OAC
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return name().toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
public enum ProtocolType implements Serializable {
|
||||
CLASSIC, // -> See "_old" Projects on GitHub Organisation https://github.com/Open-Autonomous-Connection/
|
||||
CLASSIC, // -> See "_old" Projects https://repo.open-autonomous-connection.org/Open-Autonomous-Connection/
|
||||
BETA,
|
||||
STABLE;
|
||||
|
||||
@@ -54,9 +73,15 @@ public enum ProtocolVersion implements Serializable {
|
||||
|
||||
public enum ProtocolSide implements Serializable {
|
||||
CLIENT, // Protocol version can only used on Client
|
||||
SERVER, // Protocol version can only used on Server
|
||||
BOTH // Protocol version can only used on Server and Client
|
||||
DNS, // Protocol version can only used on DNS Server
|
||||
WEB, // Protocol version can only used on Web Server
|
||||
|
||||
WEB_DNS, // Protocol version can only used on DNS and WebSerber
|
||||
|
||||
CLIENT_DNS, // Protocol version can only used on DNS and Client
|
||||
CLIENT_WEB, // Protocol version can only used on WebServer and Client
|
||||
|
||||
ALL // Protocol version can used on all Sides
|
||||
;
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user