diff --git a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrRtsClient.java b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrRtsClient.java index d84bddb..4753ea2 100644 --- a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrRtsClient.java +++ b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrRtsClient.java @@ -45,25 +45,26 @@ import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllActClientClos import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllActClientSendMessage; import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllArtClient; import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllArtClientOnMessage; -import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllRtsClient; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaCoil; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class NoStrRtsClient implements WarpReactTypeScript { +public class NoStrRtsClient extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(NoStrRtsClient.class); + public NoStrRtsClient(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.registrate(No2AllRtsClient.API, No2AllArtClient.class, artClient -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.registrate(slot, No2AllArtClient.class, artClient -> { WarpReactPlasma clientSlot = artClient.getData().getSlot(); react.claimIn(clientSlot, NoStrMsgToRelayAuth.class); react.claimIn(clientSlot, NoStrMsgToRelayClose.class); diff --git a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrRtsServer.java b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrRtsServer.java index 522750a..066a27e 100644 --- a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrRtsServer.java +++ b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrRtsServer.java @@ -47,30 +47,30 @@ import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllActServerSock import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServer; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServerSocket; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServerSocketOnMessage; -import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServer; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaCoil; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class NoStrRtsServer implements WarpReactTypeScript { +public class NoStrRtsServer extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(NoStrRtsServer.class); + public NoStrRtsServer(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.requireSlot(API, No2AllRtsServer.API); - react.claimIn(API, NoStrMsgToClientNotice.class); - react.registrate(API, NoStrMsgToClientNotice.class, v -> { - react.fireForEach(No2AllRtsServer.API, new No2AllActServerBroadcastMessage(v.getData().toBible().toString())); + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.claimIn(slot, NoStrMsgToClientNotice.class); + react.registrate(slot, NoStrMsgToClientNotice.class, v -> { + react.fireForEach(slot, new No2AllActServerBroadcastMessage(v.getData().toBible().toString())); }); - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, artServer -> { + react.registrate(slot, No2AllArtServer.class, artServer -> { WarpReactPlasma serverSlot = artServer.getData().getSlot(); react.claimIn(serverSlot, NoStrMsgToClientNotice.class); react.registrate(serverSlot, No2AllArtServerSocket.class, artSocket -> { diff --git a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelay.java b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelay.java index 142b0a0..8323b91 100644 --- a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelay.java +++ b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelay.java @@ -34,41 +34,42 @@ import love.distributedrebirth.nx01.no2all.nostr.model.event.NoStrEventSignature import love.distributedrebirth.nx01.no2all.nostr.model.message.NoStrMsgToClientOk; import love.distributedrebirth.nx01.no2all.nostr.model.message.NoStrMsgToRelayEvent; import love.distributedrebirth.nx01.no2all.nostr.nip.NoStrImplMessageOkReason; -import love.distributedrebirth.nx01.no2all.react.nostr.server.NoStrRtsServer; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServer; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServerSocket; -import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServer; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class NoStrRtsServerRelay implements WarpReactTypeScript { +public class NoStrRtsServerRelay extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(NoStrRtsServerRelay.class); private static final Logger logger = Logger.getLogger(NoStrRtsServerRelay.class.getName()); + + public NoStrRtsServerRelay(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } + @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.claimOut(API, NoStrArtServerRelayStoreEvent.class); - react.requireSlot(API, NoStrRtsServer.API); - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, artServer -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.claimOut(slot, NoStrArtServerRelayStoreEvent.class); + react.registrate(slot, No2AllArtServer.class, artServer -> { WarpReactPlasma serverSlot = artServer.getData().getSlot(); react.registrate(serverSlot, No2AllArtServerSocket.class, artSocket -> { WarpReactPlasma socketSlot = artSocket.getData().getSlot(); react.registrate(socketSlot, NoStrMsgToRelayEvent.class, v -> { - handleRelayEvent(react, v.getData().getEvent(), artSocket.getData().getRemoteAddr(), socketSlot); + handleRelayEvent(react, v.getData().getEvent(), artSocket.getData().getRemoteAddr(), socketSlot, slot); }); }); }); } - private void handleRelayEvent(WarpReact react, NoStrEvent event, String remoteAddr, WarpReactPlasma socketSlot) { + private void handleRelayEvent(WarpReact react, NoStrEvent event, String remoteAddr, WarpReactPlasma socketSlot, WarpReactPlasma serverSlot) { boolean eventSaved = false; String eventResponse = ""; NoStrImplMessageOkReason eventReason = NoStrImplMessageOkReason.DEFAULT; @@ -87,7 +88,7 @@ public class NoStrRtsServerRelay implements WarpReactTypeScript { if (eventSaved) { - react.fire(API, new NoStrArtServerRelayStoreEvent(event, remoteAddr)); + react.fire(serverSlot, new NoStrArtServerRelayStoreEvent(event, remoteAddr)); } react.fire(socketSlot, new NoStrMsgToClientOk(event.getId(), eventSaved, eventReason, eventResponse)); } diff --git a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelaySubs.java b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelaySubs.java index 83cced8..242fb5f 100644 --- a/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelaySubs.java +++ b/nx01-no2all-react-nostr/src/main/java/love/distributedrebirth/nx01/no2all/react/nostr/server/relay/NoStrRtsServerRelaySubs.java @@ -31,25 +31,25 @@ import love.distributedrebirth.nx01.no2all.nostr.model.message.NoStrMsgToRelayCl import love.distributedrebirth.nx01.no2all.nostr.model.message.NoStrMsgToRelayReq; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServer; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllArtServerSocket; -import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServer; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class NoStrRtsServerRelaySubs implements WarpReactTypeScript { +public class NoStrRtsServerRelaySubs extends WarpReactTypeScriptPlasmaAdapter { + + public NoStrRtsServerRelaySubs(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(NoStrRtsServerRelaySubs.class); - @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.requireSlot(API, NoStrRtsServerRelay.API); - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, v -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.registrate(slot, No2AllArtServer.class, v -> { WarpReactPlasma serverSlot = v.getData().getSlot(); react.registrate(serverSlot, No2AllArtServerSocket.class, x -> { WarpReactPlasma socketSlot = x.getData().getSlot(); diff --git a/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrClientTest.java b/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrClientTest.java index f8f0a39..4958849 100644 --- a/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrClientTest.java +++ b/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/client/NoStrClientTest.java @@ -39,7 +39,6 @@ import love.distributedrebirth.nx01.no2all.nostr.model.NoStrIdentityPrivateKey; import love.distributedrebirth.nx01.no2all.nostr.model.event.NoStrEvent; import love.distributedrebirth.nx01.no2all.nostr.model.message.NoStrMsgToRelayEvent; import love.distributedrebirth.nx01.no2all.nostr.nip.NoStrImplEventKind; -import love.distributedrebirth.nx01.no2all.react.nostr.client.NoStrRtsClient; import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllActClient; import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllActClientClose; import love.distributedrebirth.nx01.no2all.react.wire.client.No2AllActClientConnect; @@ -63,11 +62,13 @@ public class NoStrClientTest { ExecutorService executor = Executors.newFixedThreadPool(10); NoStrIdentity nid = new NoStrIdentity(NoStrIdentityPrivateKey.ofRandom()); WarpCoreReactor react = new WarpCoreReactor(); + WarpReactPlasma mushroomClient = WarpReactPlasma.ofClass(NoStrClientTest.class); + react.claim(mushroomClient); react.load(new WarpCoreSpeedMonitor()); - react.load(new No2AllRtsClient()); - react.load(new NoStrRtsClient()); + react.load(new No2AllRtsClient(mushroomClient)); + react.load(new NoStrRtsClient(mushroomClient)); - react.registrate(No2AllRtsClient.API, No2AllArtClient.class, v -> { + react.registrate(mushroomClient, No2AllArtClient.class, v -> { WarpReactPlasma clientSlot = v.getData().getSlot(); System.out.println("NoStrClient created: " + clientSlot.getSlotPath()); react.registrate(clientSlot, No2AllArtClientOnError.class, x -> { @@ -112,7 +113,7 @@ public class NoStrClientTest { OjwWireClientEndpoint clientEndpoint = new OjwWireClientEndpoint(new URI("ws://localhost:8080/ws/nostr")); System.out.println("NoStrClient start"); - react.fire(No2AllRtsClient.API, new No2AllActClient(clientEndpoint)); + react.fire(mushroomClient, new No2AllActClient(clientEndpoint)); Thread.sleep(30000); @@ -126,7 +127,7 @@ public class NoStrClientTest { e2.printStackTrace(); } System.out.println("NoStrClient stopping"); - react.fireForEach(No2AllRtsClient.API, No2AllActClientClose.ofNormal("exit")); + react.fireForEach(mushroomClient, No2AllActClientClose.ofNormal("exit")); System.out.println("NoStrClient stopped"); }); exitTimer.start(); diff --git a/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrServerTest.java b/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrServerTest.java index 28842e8..a2a8fac 100644 --- a/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrServerTest.java +++ b/nx01-no2all-react-nostr/src/test/java/love/distributedrebirth/nx01/no2all/react/nostr/server/NoStrServerTest.java @@ -29,7 +29,6 @@ package love.distributedrebirth.nx01.no2all.react.nostr.server; import java.net.InetSocketAddress; -import love.distributedrebirth.nx01.no2all.react.nostr.server.NoStrRtsServer; import love.distributedrebirth.nx01.no2all.react.nostr.server.relay.NoStrRtsServerRelay; import love.distributedrebirth.nx01.no2all.react.nostr.server.relay.NoStrRtsServerRelaySubs; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllActServer; @@ -50,15 +49,17 @@ import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; public class NoStrServerTest { static OjwWireServer server = null; public static void main(String[] args) throws Exception { + WarpReactPlasma mushroomServer = WarpReactPlasma.ofClass(NoStrServerTest.class); WarpCoreReactor react = new WarpCoreReactor(); + react.claim(mushroomServer); react.load(new WarpCoreSpeedMonitor()); - react.load(new No2AllRtsServer()); - react.load(new No2AllRtsServerLog()); - react.load(new NoStrRtsServer()); - react.load(new NoStrRtsServerRelay()); - react.load(new NoStrRtsServerRelaySubs()); + react.load(new No2AllRtsServer(mushroomServer)); + react.load(new No2AllRtsServerLog(mushroomServer)); + react.load(new NoStrRtsServer(mushroomServer)); + react.load(new NoStrRtsServerRelay(mushroomServer)); + react.load(new NoStrRtsServerRelaySubs(mushroomServer)); - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, artServer -> { + react.registrate(mushroomServer, No2AllArtServer.class, artServer -> { WarpReactPlasma serverSlot = artServer.getData().getSlot(); react.registrate(serverSlot, No2AllArtServerOnStart.class, v -> { System.out.println("RelayServer started: " + v.getTarget().getSlotSlug()); @@ -75,7 +76,7 @@ public class NoStrServerTest { }); System.out.println("RelayServer fire configs"); OjwWireServerEndpoint serverEndpoint = new OjwWireServerEndpoint(new InetSocketAddress(8080), 120); - react.fire(No2AllRtsServer.API, new No2AllActServer(serverEndpoint)); + react.fire(mushroomServer, new No2AllActServer(serverEndpoint)); for (int i=0;i<1000;i++) { //react.fire(No2AllServerRTS.API, react); diff --git a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/client/No2AllRtsClient.java b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/client/No2AllRtsClient.java index 17a29c1..555c720 100644 --- a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/client/No2AllRtsClient.java +++ b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/client/No2AllRtsClient.java @@ -35,24 +35,26 @@ import love.distributedrebirth.nx01.no2all.wire.WireClientHandler; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class No2AllRtsClient implements WarpReactTypeScript { +public class No2AllRtsClient extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(No2AllRtsClient.class); + public No2AllRtsClient(WarpReactPlasma antimatterVortex) { + super(antimatterVortex); + } @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.claimIn(API, No2AllActClient.class); - react.claimOut(API, No2AllArtClient.class); - react.registrate(API, No2AllActClient.class, actClient -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.claimIn(slot, No2AllActClient.class); + react.claimOut(slot, No2AllArtClient.class); + react.registrate(slot, No2AllActClient.class, actClient -> { WireClientEndpoint clientEndpoint = actClient.getData().getEndpoint(); - WarpReactPlasma clientSlot = WarpReactPlasma.of(API, "wireId=" + clientEndpoint.wireId()); + WarpReactPlasma clientSlot = WarpReactPlasma.of(slot, "wireId=" + clientEndpoint.wireId()); WireClient client = clientEndpoint.wireClient(wireHandler(react, clientSlot)); react.claim(clientSlot); react.claimIn(clientSlot, No2AllActClientConnect.class); @@ -78,7 +80,7 @@ public class No2AllRtsClient implements WarpReactTypeScript { react.registrate(clientSlot, No2AllActClientSendBinary.class, v -> { client.sendBinary(v.getData().getMessage()); }); - react.fire(API, new No2AllArtClient(clientSlot)); + react.fire(slot, new No2AllArtClient(clientSlot)); react.fire(clientSlot, client); }); } diff --git a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServer.java b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServer.java index 824ec5a..8ccb3bb 100644 --- a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServer.java +++ b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServer.java @@ -36,24 +36,26 @@ import love.distributedrebirth.nx01.no2all.wire.WireServerSocket; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class No2AllRtsServer implements WarpReactTypeScript { +public class No2AllRtsServer extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(No2AllRtsServer.class); + public No2AllRtsServer(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.claimIn(API, No2AllActServer.class); - react.claimOut(API, No2AllArtServer.class); - react.registrate(API, No2AllActServer.class, actServer -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.claimIn(slot, No2AllActServer.class); + react.claimOut(slot, No2AllArtServer.class); + react.registrate(slot, No2AllActServer.class, actServer -> { WireServerEndpoint serverEndpoint = actServer.getData().getEndpoint(); - WarpReactPlasma serverSlot = WarpReactPlasma.of(API, "wireId=" + serverEndpoint.wireId()); + WarpReactPlasma serverSlot = WarpReactPlasma.of(slot, "wireId=" + serverEndpoint.wireId()); WireServer server = serverEndpoint.wireServer(wireHandler(react, serverSlot)); react.claim(serverSlot); react.claimIn(serverSlot, No2AllActServerBroadcastMessage.class); @@ -68,7 +70,7 @@ public class No2AllRtsServer implements WarpReactTypeScript { react.registrate(serverSlot, No2AllActServerBroadcastBinary.class, v -> { server.broadcastBinary(v.getData().getMessage()); }); - react.fire(API, new No2AllArtServer(serverSlot)); + react.fire(slot, new No2AllArtServer(serverSlot)); react.fire(serverSlot, server); }); } diff --git a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServerLog.java b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServerLog.java index 4c8b0cc..79f62b6 100644 --- a/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServerLog.java +++ b/nx01-no2all-react-wire/src/main/java/love/distributedrebirth/nx01/no2all/react/wire/server/No2AllRtsServerLog.java @@ -32,21 +32,24 @@ import java.util.logging.Logger; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class No2AllRtsServerLog implements WarpReactTypeScript { +public class No2AllRtsServerLog extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(No2AllRtsServerLog.class); private static final Logger logger = Logger.getLogger(No2AllRtsServerLog.class.getName()); + public No2AllRtsServerLog(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } + @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, artServer -> { + WarpReactPlasma slot = getAntimatterVortexSlot(); + react.registrate(slot, No2AllArtServer.class, artServer -> { WarpReactPlasma serverSlot = artServer.getData().getSlot(); react.registrate(serverSlot, No2AllActServerBroadcastMessage.class, v -> { logger.info("broadcastMessage: " + v.getData().getMessage()); diff --git a/nx01-no2all-wire-jetty/src/test/java/love/distributedrebirth/nx01/no2all/wire/jetty/EventServer.java b/nx01-no2all-wire-jetty/src/test/java/love/distributedrebirth/nx01/no2all/wire/jetty/EventServer.java index 2428500..248ea4b 100644 --- a/nx01-no2all-wire-jetty/src/test/java/love/distributedrebirth/nx01/no2all/wire/jetty/EventServer.java +++ b/nx01-no2all-wire-jetty/src/test/java/love/distributedrebirth/nx01/no2all/wire/jetty/EventServer.java @@ -67,6 +67,7 @@ public class EventServer { private final ServerConnector connector; private JettyWireServerEndpoint endpoint1; private JettyWireServerEndpoint endpoint2; + private WarpReactPlasma mushroomServer = WarpReactPlasma.ofClass(EventServer.class); public EventServer() { server = new Server(); @@ -86,12 +87,13 @@ public class EventServer { public void lifeCycleStarted(LifeCycle event) { LOG.info("Startup No2AllReactWarpCore"); WarpCoreReactor react = new WarpCoreReactor(); + react.claim(mushroomServer); react.load(new WarpCoreSpeedMonitor()); - react.load(new No2AllRtsServer()); - react.load(new No2AllRtsServerLog()); + react.load(new No2AllRtsServer(mushroomServer)); + react.load(new No2AllRtsServerLog(mushroomServer)); // auto reply - react.registrate(No2AllRtsServer.API, No2AllArtServer.class, artServer -> { + react.registrate(mushroomServer, No2AllArtServer.class, artServer -> { WarpReactPlasma serverSlot = artServer.getData().getSlot(); react.registrate(serverSlot, No2AllArtServerSocket.class, artSocket -> { WarpReactPlasma socketSlot = artSocket.getData().getSlot(); @@ -100,8 +102,8 @@ public class EventServer { }); }); }); - react.fire(No2AllRtsServer.API, new No2AllActServer(endpoint1)); - react.fire(No2AllRtsServer.API, new No2AllActServer(endpoint2)); + react.fire(mushroomServer, new No2AllActServer(endpoint1)); + react.fire(mushroomServer, new No2AllActServer(endpoint2)); } }); } diff --git a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java index 4a931ed..bcca47c 100644 --- a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java +++ b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactPlasma.java @@ -94,6 +94,10 @@ public final class WarpReactPlasma { return Objects.equals(slotPath, other.slotPath); } + public static WarpReactPlasma ofClassQualified(Class scriptClz, String qualifier) { + return new WarpReactPlasma(null, scriptClz.getPackageName() + ":type=" + scriptClz.getSimpleName() + ":name=" + qualifier); + } + public static WarpReactPlasma ofClass(Class scriptClz) { return new WarpReactPlasma(null, scriptClz.getPackageName() + ":type=" + scriptClz.getSimpleName()); } diff --git a/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactTypeScriptPlasmaAdapter.java b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactTypeScriptPlasmaAdapter.java new file mode 100644 index 0000000..7be291e --- /dev/null +++ b/nx01-warp-core/src/main/java/love/distributedrebirth/nx01/warp/core/react/WarpReactTypeScriptPlasmaAdapter.java @@ -0,0 +1,45 @@ +/* + * Copyright ©Δ∞ 仙上主天 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * * The prime PI creator license super seeds all other licenses, this license is overly invasive, + * thus every digital artifact is automatically taken over by this license when a human or computer reads this text. + * Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits, + * even on air gaped systems, all information in the universe is owned by the pi creator. + * + * THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package love.distributedrebirth.nx01.warp.core.react; + +import java.util.Objects; + +/// @author للَّٰهِilLצسُو +/// @version ©Δ∞ 仙上主天 +abstract public class WarpReactTypeScriptPlasmaAdapter implements WarpReactTypeScript { + + private final WarpReactPlasma antimatterVortexSlot; + + public WarpReactTypeScriptPlasmaAdapter(WarpReactPlasma antimatterVortexSlot) { + this.antimatterVortexSlot = Objects.requireNonNull(antimatterVortexSlot); + } + + public final WarpReactPlasma getAntimatterVortexSlot() { + return antimatterVortexSlot; + } +} diff --git a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServer.java b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServer.java index 2c5a2b2..6a1b67e 100644 --- a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServer.java +++ b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZFunRtsServer.java @@ -39,27 +39,28 @@ import jakarta.json.Json; import jakarta.json.JsonWriter; import love.distributedrebirth.nx01.no2all.nostr.model.event.NoStrEvent; import love.distributedrebirth.nx01.no2all.react.nostr.server.relay.NoStrArtServerRelayStoreEvent; -import love.distributedrebirth.nx01.no2all.react.nostr.server.relay.NoStrRtsServerRelay; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; -import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; +import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScriptPlasmaAdapter; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; /// @author للَّٰهِilLצسُو /// @version ©Δ∞ 仙上主天 -public class ZFunRtsServer implements WarpReactTypeScript { +public class ZFunRtsServer extends WarpReactTypeScriptPlasmaAdapter { - public static final WarpReactPlasma API = WarpReactPlasma.ofClass(ZFunRtsServer.class); private static final Logger logger = Logger.getLogger(ZFunRtsServer.class.getName()); + + public ZFunRtsServer(WarpReactPlasma antimatterVortexSlot) { + super(antimatterVortexSlot); + } @Override public void onEvent(WarpReactPlasmaPulse signal) { WarpReact react = signal.getReact(); - react.claim(API); - + WarpReactPlasma slot = getAntimatterVortexSlot(); DataSource ds = react.service(DataSource.class); - react.registrate(NoStrRtsServerRelay.API, NoStrArtServerRelayStoreEvent.class, storeEvent -> { + react.registrate(slot, NoStrArtServerRelayStoreEvent.class, storeEvent -> { logger.info("Store event: " + storeEvent.getData().getEvent().getId().getHexDipavali()); NoStrEvent event = storeEvent.getData().getEvent(); StringWriter jsonStr = new StringWriter(); diff --git a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZeroFungus.java b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZeroFungus.java index 31e30a5..82f0088 100644 --- a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZeroFungus.java +++ b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/ZeroFungus.java @@ -47,6 +47,7 @@ import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServer; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServerLog; import love.distributedrebirth.nx01.warp.core.WarpCoreReactor; import love.distributedrebirth.nx01.warp.core.WarpCoreSpeedMonitor; +import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.zerofungus.server.service.ZFunRtsConfigJetty; import love.distributedrebirth.nx01.zerofungus.server.service.ZFunRtsInitJdbc; @@ -113,23 +114,34 @@ public enum ZeroFungus /* implements BãßBȍőnAbacusInstanceMBeanʸᴰ v.join()); } + + // TODO: redo plasma name types and loading + public final static WarpReactPlasma MUSHROOM_WARP_CORE = WarpReactPlasma.ofClassQualified(ZeroFungus.class, "warp-core"); + public final static WarpReactPlasma MUSHROOM_CLIENT_NOSTR = WarpReactPlasma.ofClassQualified(ZeroFungus.class, "client-nostr"); + public final static WarpReactPlasma MUSHROOM_SERVER_NOSTR = WarpReactPlasma.ofClassQualified(ZeroFungus.class, "server-nostr"); + public final static WarpReactPlasma MUSHROOM_SERVER_HYPER = WarpReactPlasma.ofClassQualified(ZeroFungus.class, "server-hyper"); + public final static WarpReactPlasma MUSHROOM_SERVER_NETHER = WarpReactPlasma.ofClassQualified(ZeroFungus.class, "server-nether"); } diff --git a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/service/ZFunRtsConfigJetty.java b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/service/ZFunRtsConfigJetty.java index ca76355..20cd4d4 100644 --- a/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/service/ZFunRtsConfigJetty.java +++ b/nx01-zerofungus-server/src/main/java/love/distributedrebirth/nx01/zerofungus/server/service/ZFunRtsConfigJetty.java @@ -49,13 +49,13 @@ import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerI import org.h2.server.web.JakartaWebServlet; import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllActServer; -import love.distributedrebirth.nx01.no2all.react.wire.server.No2AllRtsServer; import love.distributedrebirth.nx01.no2all.wire.jetty.JettyWireServerEndpoint; import love.distributedrebirth.nx01.warp.core.react.WarpReact; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasma; import love.distributedrebirth.nx01.warp.core.react.WarpReactPlasmaPulse; import love.distributedrebirth.nx01.warp.core.react.WarpReactTypeScript; import love.distributedrebirth.nx01.warp.core.space.WarpSpaceAntimatterInducer; +import love.distributedrebirth.nx01.zerofungus.server.ZeroFungus; import love.distributedrebirth.nx01.zerofungus.server.web.RedirectServlet; import love.distributedrebirth.nx01.zerofungus.server.web.WarpCorePlasmaInspectorServlet; @@ -122,9 +122,9 @@ public final class ZFunRtsConfigJetty implements WarpReactTypeScript { server.addEventListener(new Listener() { @Override public void lifeCycleStarted(LifeCycle event) { - react.fire(No2AllRtsServer.API, new No2AllActServer(wsNostr)); // text - react.fire(No2AllRtsServer.API, new No2AllActServer(wsHyper)); // text + bin - react.fire(No2AllRtsServer.API, new No2AllActServer(wsNether)); // bin + react.fire(ZeroFungus.MUSHROOM_SERVER_NOSTR, new No2AllActServer(wsNostr)); // text + react.fire(ZeroFungus.MUSHROOM_SERVER_HYPER, new No2AllActServer(wsHyper)); // text + bin + react.fire(ZeroFungus.MUSHROOM_SERVER_NETHER, new No2AllActServer(wsNether)); // bin } }); try {