-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
203 additions
and
3 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
src/main/java/org/nasdanika/launcher/demo/drawio/RouteBuilderProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.nasdanika.launcher.demo.drawio; | ||
|
||
import java.util.concurrent.CompletionStage; | ||
import java.util.function.BiConsumer; | ||
import java.util.function.Consumer; | ||
|
||
import org.nasdanika.capability.CapabilityFactory.Loader; | ||
import org.nasdanika.common.Invocable; | ||
import org.nasdanika.common.ProgressMonitor; | ||
import org.nasdanika.drawio.Node; | ||
import org.nasdanika.graph.Element; | ||
import org.nasdanika.graph.processor.ConnectionProcessorConfig; | ||
import org.nasdanika.graph.processor.NodeProcessorConfig; | ||
import org.nasdanika.graph.processor.ProcessorConfig; | ||
import org.nasdanika.graph.processor.ProcessorElement; | ||
import org.nasdanika.graph.processor.ProcessorInfo; | ||
import org.nasdanika.http.HttpServerRouteBuilder; | ||
|
||
import reactor.core.publisher.Mono; | ||
import reactor.netty.http.server.HttpServerRoutes; | ||
|
||
/** | ||
* Diagram element processor which builds HTTP routes | ||
*/ | ||
public class RouteBuilderProcessor implements HttpServerRouteBuilder { | ||
|
||
private String amount; | ||
|
||
@ProcessorElement | ||
public void setElement(Node element) { | ||
this.amount = element.getProperty("amount"); | ||
} | ||
|
||
/** | ||
* This is the constructor signature for graph processor classes which are to be instantiated by URIInvocableCapabilityFactory (org.nasdanika.capability.factories.URIInvocableCapabilityFactory). | ||
* Config may be of specific types {@link ProcessorConfig} - {@link NodeProcessorConfig} or {@link ConnectionProcessorConfig}. | ||
* @param loader | ||
* @param loaderProgressMonitor | ||
* @param data | ||
* @param fragment | ||
* @param config | ||
* @param infoProvider | ||
* @param endpointWiringStageConsumer | ||
* @param wiringProgressMonitor | ||
*/ | ||
public RouteBuilderProcessor( | ||
Loader loader, | ||
ProgressMonitor loaderProgressMonitor, | ||
Object data, | ||
String fragment, | ||
ProcessorConfig config, | ||
BiConsumer<Element, BiConsumer<ProcessorInfo<Invocable>, ProgressMonitor>> infoProvider, | ||
Consumer<CompletionStage<?>> endpointWiringStageConsumer, | ||
ProgressMonitor wiringProgressMonitor) { | ||
|
||
System.out.println("I got constructed " + this); | ||
} | ||
|
||
@Override | ||
public void buildRoutes(HttpServerRoutes routes) { | ||
routes.get("/balance", (request, response) -> response.sendString(Mono.just("Account: " + request.param("account") + ", Amount: " + amount))); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/org/nasdanika/launcher/demo/http/ReflectorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.nasdanika.launcher.demo.http; | ||
|
||
import org.nasdanika.common.Reflector; | ||
import org.nasdanika.http.ReflectiveHttpServerRouteBuilder.Route; | ||
|
||
/** | ||
* Demo of a hierarchical routing with factory | ||
*/ | ||
@Route("/factory") | ||
public class ReflectorFactory { | ||
|
||
@Route("/demo") | ||
@Reflector.Factory | ||
public DemoReflectiveHttpRoutes getRoutes() { | ||
return new DemoReflectiveHttpRoutes(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/org/nasdanika/launcher/demo/http/ReflectorSuperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.nasdanika.launcher.demo.http; | ||
|
||
import org.nasdanika.common.Reflector; | ||
import org.nasdanika.http.ReflectiveHttpServerRouteBuilder.Route; | ||
|
||
/** | ||
* Demo of a hierarchical routing with factory | ||
*/ | ||
@Route("/super-factory") | ||
public class ReflectorSuperFactory { | ||
|
||
@Route("/super-demo") | ||
@Reflector.Factory | ||
public ReflectorFactory getRoutes() { | ||
return new ReflectorFactory(); | ||
} | ||
|
||
} |
2 changes: 0 additions & 2 deletions
2
src/main/java/org/nasdanika/launcher/demo/rules/inspectors/ReflectiveInspectorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.0.4 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" compressed="true" version="26.0.4"><diagram id="ibs-context" name="System Context Diagram">dZTLlqIwEIafhqUcILTo0ntv+pweXUxvY1KS9ATKE4LoPP0EKBXGmRXJV0Vd/ioI2Kq47iw/qw+UYIIkkteArYMkibM48Y+W3IjEM9aT3GpJ7AkO+jcQjIjWWkI1cnSIxunzGAosSxBuxLi12IzdTmjGWc88hxdwENy80p9aOnVvYzp/Gt5B54pSz5KsNxT87kydVIpLbAaIbQK2soiuP+Hxu20giQw/ehU7PxIPxcTCqUf7zWL9sQkLSfktOnS3M5W7EE5jGbBFkEyDhHkV2TJo00UGBX/YPEiDbHnkFUxqq4NsrUsJ11C5wvRx78N5VlpcV2C8ddtf/YEqHlkj/be+Fko3FGL7/3b3WDvwaFlrI8E+OhRQVWh7H8kd9z188wtvS7B5WPJK8lL/4qHhdSkU2FBCgaG0vNEYdkEp4ucjVh/acAEKW8t4TWxXCI1g290mx3tRW68cFwJr31e2plUrumv3Rvo2DbPZWMb5l7qwH18xm+enPTa72RTVJH7RNqrc7b55PqufSft+7IfYKO3gcPb1etD4j82zblq9+VVs6uQC1sF1gCjfDrAAZ2/ehawpo0WlTzVN3/p789z7GbmowcanxDhJmD8iJ8NloRb/tTudxOgGroO/Cdv8AQ==</diagram></mxfile> |