-
Notifications
You must be signed in to change notification settings - Fork 1
/
frontend.ol
57 lines (47 loc) · 1.2 KB
/
frontend.ol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from file import File
from string_utils import StringUtils
type GetTraceListResponse: void {
.trace*: string
}
type GetTraceLineRequest: void {
.line: int
}
interface FrontendInterface {
RequestResponse:
getTraceList( void )( GetTraceListResponse ),
getTraceLine( GetTraceLineRequest )( string ),
getTrace( string )( string ),
getServiceFile( string )( string )
}
service Main {
execution: concurrent
embed File as File
embed StringUtils as StringUtils
inputPort Frontend {
location: "local"
interfaces: FrontendInterface
}
main {
[ getTrace( request )( response ) {
f.filename = request
readFile@File( f )( response )
} ] {
split@StringUtils( response { .regex = "\\n" } )( global.trace_lines )
}
[ getTraceList( request )( response ) {
list@File( { .directory=".", .regex=".*\\.jolie\\.log\\.json"} )( list )
traceCount = 0
for( trace in list.result ) {
response.trace[ traceCount ] = trace
traceCount++
}
}]
[ getTraceLine( request )( response ) {
response = global.trace_lines.result[ request.line ]
}]
[ getServiceFile( request )( response ) {
f.filename = request
readFile@File( f )( response )
}]
}
}