Skip to content

Commit

Permalink
javaservice/README.md - indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallnoefer authored Jun 16, 2024
1 parent ad46a7c commit 6bce457
Showing 1 changed file with 67 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ service MyConsole {
inputPort Input {
location: "local"
interfaces: MyConsoleInterface
} foreign java {
}
foreign java {
class: "example.MyConsole"
}
}
Expand All @@ -55,7 +56,8 @@ It is now possible to embed `MyConsole` within a Jolie service, just like you wo
from .my-console import MyConsole
service Main {
embed MyConsole as console main {
embed MyConsole as console
main {
println@console( "Hello World!" )
}
}
Expand All @@ -76,7 +78,8 @@ public class Twice extends JavaService {
public Integer twiceInt( Integer request ) {
Integer result = request + request;
return result;
} public Double twiceDouble( Double request ) {
}
public Double twiceDouble( Double request ) {
Double result = request + request;
return result;
}
Expand All @@ -98,7 +101,8 @@ service Twice {
inputPort Input {
location: "local"
interfaces: TwiceInterface
} foreign java {
}
foreign java {
class: "example.Twice"
}
}
Expand All @@ -113,6 +117,7 @@ from .twice import Twice
service {
embed MyConsole as console
embed Twice as twice
main {
intExample = 3;
doubleExample = 3.14;
Expand Down Expand Up @@ -142,7 +147,8 @@ type Split_res{
}
interface SplitterInterface {
RequestResponse: split( Split_req )( Split_res )
RequestResponse:
split( Split_req )( Split_res )
}
interface MyJavaExampleInterface {
Expand All @@ -153,7 +159,8 @@ service Splitter {
inputPort Input {
location: "local"
interfaces: SplitterInterface
} foreign java {
}
foreign java {
class: "example.Splitter"
}
}
Expand All @@ -162,23 +169,26 @@ service JavaExample {
inputPort Input {
location: "local"
interfaces: MyJavaExampleInterface
} foreign java {
}
foreign java {
class: "example.MyJavaExample"
}
}
service Main {
embed Splitter as splitter
embed MyJavaExample as myJavaExample inputPort Embedder {
embed MyJavaExample as myJavaExample
inputPort Embedder {
location: "local"
interfaces: SplitterInterface
}
main
{
start@myJavaExample();
split( split_req )( split_res ) {
split@splitter( split_req )( split_res )
main {
start@myJavaExample();
split( split_req )( split_res ) {
split@splitter( split_req )( split_res )
}
}
}
```
Expand Down Expand Up @@ -207,12 +217,12 @@ public class JavaExample extends JavaService {
Value s_array = response.value();
ValueVector s_children = s_array.getChildren("s_chunk");
for( int i = 0; i < s_children.size(); i++ ){
System.out.println("\ts_chunk["+ i +"]: " + s_children.get(i).strValue() );
}
} catch( Exception e ){
e.printStackTrace();
}
}
System.out.println("\ts_chunk["+ i +"]: " + s_children.get(i).strValue() );
}
} catch( Exception e ){
e.printStackTrace();
}
}
}
```

Expand Down Expand Up @@ -294,8 +304,7 @@ package org.jolie.example;
import Jolie.runtime.JavaService;
import Jolie.runtime.Value;

public class FirstJavaService extends JavaService
{
public class FirstJavaService extends JavaService {
public Value HelloWorld( Value request ) {
String message = request.getFirstChild( "message" ).strValue();
System.out.println( message );
Expand Down Expand Up @@ -354,7 +363,8 @@ service FirstJavaService {
inputPort Input {
location: "local"
interfaces: FirstJavaServiceInterface
} foreign java {
}
foreign java {
class: "org.jolie.example.FirstJavaService"
}
}
Expand All @@ -379,7 +389,9 @@ from console import Console
service Main {
embed FirstJavaService as firstJavaService
embed Console as console main {
embed Console as console
main {
request.message = "Hello world!"
HelloWorld@firstJavaService( request )( response )
println@console( response.reply )()
Expand Down Expand Up @@ -412,12 +424,17 @@ from .first-java-service import FirstJavaService
from console import Console
service Main {
execution: concurrent embed FirstJavaService as firstJavaService
embed Console as console inputPort MyInputPort {
execution: concurrent
embed FirstJavaService as firstJavaService
embed Console as console
inputPort MyInputPort {
location: "socket://localhost:9090"
protocol: sodep
interfaces: FirstJavaServiceInterface
} main {
}
main {
HelloWorld( request )( response ) {
println@console("I am the embedder")()
HelloWorld@firstJavaServiceOutputPort( request )( response )
Expand All @@ -433,11 +450,16 @@ from .first-java-service import FirstJavaService
from console import Console
service Main {
execution: concurrent embed FirstJavaService as firstJavaService inputPort MyInputPort {
execution: concurrent
embed FirstJavaService as firstJavaService
inputPort MyInputPort {
location: "socket://localhost:9090"
protocol: sodep
aggregates: firstJavaService
} main {
}
main {
...
```

Expand Down Expand Up @@ -551,7 +573,9 @@ service FirstJavaService {
inputPort Input {
location: "local"
interfaces: FirstJavaServiceInterface
} foreign java {
}
foreign java {
class: "org.jolie.example.FirstJavaService"
}
}
Expand All @@ -565,7 +589,9 @@ from first-java-service import FirstJavaService
service Main {
embed FirstJavaService as firstJavaService
embed Console as console main {
embed Console as console
main {
install( WrongMessage => println@Console( main.WrongMessage.msg )() )
request.message = "I am Obi"
HelloWorld@FirstJavaServiceOutputPort( request )( response )
Expand Down Expand Up @@ -615,8 +641,7 @@ service DynamicJavaService {
inputPort Input {
location: "local"
interfaces: DynamicJavaServiceInterface
}
}
foreign java {
class: "org.jolie.example.FourthJavaService"
}
Expand All @@ -628,8 +653,12 @@ if we run a client that calls the service ten times as in the following code sni
```text
from fourth-java-service import DynamicJavaService
from console import Console
service main { embed DynamicJavaService as DynamicJavaService
embed Console as Console main {
service main {
embed DynamicJavaService as DynamicJavaService
embed Console as Console
main {
for ( i = 0 , i < 10 , i ++ ){
println@Console("Received counter " + start@DynamicJavaService() )()
}
Expand Down Expand Up @@ -661,14 +690,16 @@ from fourth-java-service import DynamicJavaServiceInterface
from console import Console
from runtime import Runtime
service main { embed Console as Console
service main {
embed Console as Console
embed Runtime as Runtime
outputPort DynamicJavaService {
Interfaces: DynamicJavaServiceInterface
}
main {
for ( i = 0 , i < 10 , i ++ ){
for ( i = 0 , i < 10 , i++ ){
with( emb ) {
.filepath = "org.jolie.example.DynamicJavaService"
.type = "Java"
Expand Down

0 comments on commit 6bce457

Please sign in to comment.