SlideShare ist ein Scribd-Unternehmen logo
1 von 61
Downloaden Sie, um offline zu lesen
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016
A gentle introduction to
Saverio Giallorenzo | sgiallor@cs.unibo.it
1
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 2
Gentle introduction to Jolie
{ } { } æ
j œ I tc = eval(e, t) M(tc) = (oj, tÕ
) :: ˜m
q
iœI
[oi(xi) from e] {Bi} .t .M æ Bj .t Ù ( xj, tÕ
) .M[tc ‘æ ˜m]
ÂDCC|ChoiceË
tÕ
= eval(x, t)
x = e; B .t .M æ B .t Ù ( x, tÕ
) .M
ÂDCC|AssignË
P æ PÕ
P | P1 æ PÕ
| P1
ÂDCC|PParË
P = cq(x); B .t .M tc ”œ
t
i
dom(Mi) fi dom(M) tÕ
= t Ù ( x, tc )
+
Bs, P |
r
i
Bi .ti .Mi
,
l
æ
+
Bs, B .tÕ .M[tc ‘æ Á] |
r
i
Bi .ti .Mi
,
l
ÂDCC|CqË
P © P1 P1 æ PÕ
1 PÕ
1 © PÕ
ÈBs, PÍl æ
+
Bs, PÕ
,
l
ÂDCC|PEqË
P = o@e1(e2) to e3; B .t .M eval(e1, t) = l eval(e3, t) = tc
eval(e2, t) = tm MÕÕ
= MÕ
[tc ‘æ MÕ
(tc) :: (o, tm)]
+
Bs, P | BÕ .tÕ .MÕ
| P1
,
l
æ
+
Bs, B .t .M | BÕ .tÕ .MÕÕ
| P1
,
l
ÂDCC|InSendË
P = o@e1(e2) to e3; B .t .M eval(e1, t) = lÕ
eval(e3, t) = tc
eval(e2, t) = tm MÕÕ
= MÕ
[tc ‘æ MÕ
(tc) :: (o, tm)]
ÈBs, P | P1Íl |
+
BÕ
s, BÕ .tÕ .MÕ
| P2
,
lÕ
æ ÈBs, B .t .M | P1Íl |
+
BÕ
s, BÕ .tÕ .MÕÕ
| P2
,
lÕ
ÂDCC|SendË
P1 =?@e1(e2); B1 .t1 .M1 eval(e1, t1) = l Q = B .t‹ Ù ( x, eval(e2, t1) ) .ÿ
È!(x); B, PÍl |
+
BÕ
s, P1 | P2
,
lÕ
æ È!(x); B, Q | PÍl |
+
BÕ
s, B1 .t1 .M1 | P2
,
lÕ
ÂDCC|StartË
Õ
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 2
Gentle introduction to Jolie
{ } { } æ
j œ I tc = eval(e, t) M(tc) = (oj, tÕ
) :: ˜m
q
iœI
[oi(xi) from e] {Bi} .t .M æ Bj .t Ù ( xj, tÕ
) .M[tc ‘æ ˜m]
ÂDCC|ChoiceË
tÕ
= eval(x, t)
x = e; B .t .M æ B .t Ù ( x, tÕ
) .M
ÂDCC|AssignË
P æ PÕ
P | P1 æ PÕ
| P1
ÂDCC|PParË
P = cq(x); B .t .M tc ”œ
t
i
dom(Mi) fi dom(M) tÕ
= t Ù ( x, tc )
+
Bs, P |
r
i
Bi .ti .Mi
,
l
æ
+
Bs, B .tÕ .M[tc ‘æ Á] |
r
i
Bi .ti .Mi
,
l
ÂDCC|CqË
P © P1 P1 æ PÕ
1 PÕ
1 © PÕ
ÈBs, PÍl æ
+
Bs, PÕ
,
l
ÂDCC|PEqË
P = o@e1(e2) to e3; B .t .M eval(e1, t) = l eval(e3, t) = tc
eval(e2, t) = tm MÕÕ
= MÕ
[tc ‘æ MÕ
(tc) :: (o, tm)]
+
Bs, P | BÕ .tÕ .MÕ
| P1
,
l
æ
+
Bs, B .t .M | BÕ .tÕ .MÕÕ
| P1
,
l
ÂDCC|InSendË
P = o@e1(e2) to e3; B .t .M eval(e1, t) = lÕ
eval(e3, t) = tc
eval(e2, t) = tm MÕÕ
= MÕ
[tc ‘æ MÕ
(tc) :: (o, tm)]
ÈBs, P | P1Íl |
+
BÕ
s, BÕ .tÕ .MÕ
| P2
,
lÕ
æ ÈBs, B .t .M | P1Íl |
+
BÕ
s, BÕ .tÕ .MÕÕ
| P2
,
lÕ
ÂDCC|SendË
P1 =?@e1(e2); B1 .t1 .M1 eval(e1, t1) = l Q = B .t‹ Ù ( x, eval(e2, t1) ) .ÿ
È!(x); B, PÍl |
+
BÕ
s, P1 | P2
,
lÕ
æ È!(x); B, Q | PÍl |
+
BÕ
s, B1 .t1 .M1 | P2
,
lÕ
ÂDCC|StartË
Õ
FORMAL CALCULUS
(like POCs and
the pi-calculus)
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Laboratorio di Sistemi Operativi
Introduction to the Jolie Language
What is Jolie?
3
A Service-Oriented
Programming Language
Service
Instances
Objects
Operations Methods
Service-Oriented Object-Oriented
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Jolie is perfect for fast prototyping. In
little time a small team of developers can
build up a full-fledged distributed system.
Why SOC and Jolie?
4
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Jolie is perfect for fast prototyping. In
little time a small team of developers can
build up a full-fledged distributed system.
Why SOC and Jolie?
4
But I already know Java!
Why shall I use Jolie?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
5
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
5
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
5
SocketChannel socketChannel = SocketChannel.open();
socketChannel.connect(
new InetSocketAddress("http://someurl.com", 80));
Buffer buffer = . . .; // byte buffer
while( buffer.hasRemaining() ) {
channel.write( buffer );
}
Happy?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
5
SocketChannel socketChannel = SocketChannel.open();
socketChannel.connect(
new InetSocketAddress("http://someurl.com", 80));
Buffer buffer = . . .; // byte buffer
while( buffer.hasRemaining() ) {
channel.write( buffer );
}
Happy?
Ok, but you did not even close
the channel or handled
exceptions
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
6
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
6
SocketChannel socketChannel = SocketChannel.open();
try {
socketChannel.connect(new InetSocketAddress("http://someurl.com",
80));
Buffer buffer = . . .; // byte buffer
while( buffer.hasRemaining() ) {
channel.write( buffer );
} }
catch( UnresolvedAddressException e ) { . . . }
catch( SecurityException e ) { . . . }
/* . . . many catches later . . . */
catch( IOException e ) { . . . }
finally { channel.close(); }
Happier now?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
6
SocketChannel socketChannel = SocketChannel.open();
try {
socketChannel.connect(new InetSocketAddress("http://someurl.com",
80));
Buffer buffer = . . .; // byte buffer
while( buffer.hasRemaining() ) {
channel.write( buffer );
} }
catch( UnresolvedAddressException e ) { . . . }
catch( SecurityException e ) { . . . }
/* . . . many catches later . . . */
catch( IOException e ) { . . . }
finally { channel.close(); }
Happier now?
Yes, but what about the
server?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
7
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
7
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
7
Selector selector = Selector.open();
channel.configureBlocking(false);
SelectionKey key = channel.register(selector, SelectionKey.OP_READ);
while(true) {
int readyChannels = selector.select();
if(readyChannels == 0) continue;
Set<SelectionKey> selectedKeys = selector.selectedKeys();
Iterator<SelectionKey> keyIterator = selectedKeys.iterator();
while(keyIterator.hasNext()) {
SelectionKey key = keyIterator.next();
if(key.isAcceptable()) {
// a connection was accepted by a ServerSocketChannel.
} else if (key.isConnectable()) {
// a connection was established with a remote server.
} else if (key.isReadable()) {
// a channel is ready for reading
} else if (key.isWritable()) {
// a channel is ready for writing
}
keyIterator.remove();
}
}
Here you are
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
8
Well, ok, but again, you are not handling exceptions.
And what about if different operations use the same
channel?
And if we wanted to use RMIs instead of Sockets?
In what format are you
transmitting data? And if
we need to change the
format after we wrote the
application? Do you check the
type of data you receive/send?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
8
Well, ok, but again, you are not handling exceptions.
And what about if different operations use the same
channel?
And if we wanted to use RMIs instead of Sockets?
In what format are you
transmitting data? And if
we need to change the
format after we wrote the
application? Do you check the
type of data you receive/send?
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Why SOC and Jolie?
9
Programming distributed systems is usually
harder than programming non distributed ones.
Concerns of concurrent programming.
Plus (not exhaustive):
• handling communications;
• handling heterogeneity;
• handling faults;
• handling the evolution of systems.
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
operation
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
operation
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
operation
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
10
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
Include a
service
program entry point
operation service
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
11
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
11
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
11
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
hello_world.ol
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us get our hands dirty.
“Hello World!” is enough to let you see some of the main
features of Jolie and Service-Oriented Programming.
Hello World! in Jolie
11
include "console.iol"
main
{
println@Console( "Hello, world!" )()
}
hello_world.ol
$ jolie hello_world.ol
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Let us see some Jolie in Action
12
Everything starts
with a calculator…
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
include "MyInterface.iol"
outputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber @ B ( 5 )
}
include "MyInterface.iol"
inputPort B {
Location:
"socket://localhost:8000"
Protocol: sodep
Interfaces: MyInterface
}
main
{
sendNumber( x )
}
interface MyInterface {
OneWay: sendNumber( int )
}
Behaviours and Deployments
13
ServerClient
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016
Deployments
Enabling Communication
14
Gentle introduction to Jolie
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
Behaviours and Deployments
15
A B
sendNumber
output
port
sendNumber
input
port
medium
• Services communicate through ports.
• Ports give access to an interface.
• An interface is a set of operations.
• An output port is used to invoke interfaces exposed by other services.
• An input port is used to expose an interface.
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
A closer look on ports - Locations
16
Medium Parameters
TCP/IP socket:// www.google.it:80
Bluetooth btl2cap://
localhost:
3B9FA89520078C303355AAA694238F07;name=Vision;encrypt=
false;authenticate=false
Local localsocket: /tmp/mysocket.socket
Java RMI rmi:// myRmiUrl.com/MyService
In-Memory local
A location describes:
• the communication medium;
• the parameters to set the communication up.
In Jolie a location is a Uniform Resource Identifier (URI)
with form: medium[:parameters]
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
A closer look on ports - Protocols
17
A protocol defines the format the data is
sent (encoded) and received (encoded)
In Jolie protocols are names and possibly
additional parameters:
http { .debug = true }
json/rpc sodep https
soap
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016
Behaviours
Composing Interactions
18
Gentle introduction to Jolie
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Laboratorio di Sistemi Operativi
Basic Behaviour - Composition and Workflow
Interactions via Operations
19
Input
Operations
Output
Operations
oneWay( req )
reqRes( req )( res ){
// code block
}
oneWay@Port( req )
reqRes@Port( req )( res )
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
Behaviour Composition
20
The sequence operator ; denotes that
the left operand of the statement is
executed before the one on the right.
println@Console( "A" )();
println@Console( "B" )()
Prints
A
B
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016
A gentle introduction to Jolie
Behaviour Composition
21
The parallel operator | states
that both left and right
operands execute concurrently
println@Console( "A" )()|
println@Console( "B" )()
can print
A
B
but also
B
A
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Behaviour Composition
22
The input choice implements input-
guarded non-deterministic choice.
[ oneWayOperation() ] { branch_code }
[ oneWayOperation2() ] {branch_code2}
[ requestResponseOperation()(){
rr_code }
] { branch_code }
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Behaviour Composition
23
The input choice implements input-
guarded non-deterministic choice.
main {
[ buy( stock )( response ) {
buy@Exchange( stock )( response )
} ] { println@Console( "Buy order forwarded" )() }
[ sell( stock )( response ) {
sell@Exchange( stock )( response )
}] { println@Console( "Sell order forwarded" )() }
}
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016
Before you take off
26
Gentle introduction to Jolie
Leonardo
● A web server in pure Jolie.
● Can fit in a slide.
(ok, I reduced the font size a little)
● ~50 LOCs
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
The Jolie Interpreter
28
http://www.jolie-lang.org/downloads.html
Last release
• Requires JRE 1.6+
• Download jolie-installer.jar
• open a console and run
java -jar jolie-installer.jar
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Sources
29
Jolie is an open source project with
continuous updates and a well documented
codebase
“This is the programming language
you are looking for”
https://github.com/jolie/jolie
|Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo
A gentle introduction to Jolie
Bertinoro International Spring School 2016
Documentation
30
Comprehensive and ever-growing
documentation and Standard Library.
http://docs.jolie-lang.org
Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016
Thanks for your time!
32
Gentle introduction to Jolie

Weitere ähnliche Inhalte

Mehr von South Tyrol Free Software Conference

SFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure mattersSFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure mattersSouth Tyrol Free Software Conference
 
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...South Tyrol Free Software Conference
 
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...South Tyrol Free Software Conference
 
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free softwareSFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free softwareSouth Tyrol Free Software Conference
 
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...South Tyrol Free Software Conference
 
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changerSFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changerSouth Tyrol Free Software Conference
 
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...South Tyrol Free Software Conference
 
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation InternetSFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation InternetSouth Tyrol Free Software Conference
 
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...South Tyrol Free Software Conference
 
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...South Tyrol Free Software Conference
 
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...South Tyrol Free Software Conference
 
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSS
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSSSFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSS
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSSSouth Tyrol Free Software Conference
 
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...South Tyrol Free Software Conference
 
SFSCON23 - Attaullah Buriro - MBBS A Multimodal Behavioral Biometric Scheme ...
SFSCON23 - Attaullah Buriro - MBBS  A Multimodal Behavioral Biometric Scheme ...SFSCON23 - Attaullah Buriro - MBBS  A Multimodal Behavioral Biometric Scheme ...
SFSCON23 - Attaullah Buriro - MBBS A Multimodal Behavioral Biometric Scheme ...South Tyrol Free Software Conference
 
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...South Tyrol Free Software Conference
 

Mehr von South Tyrol Free Software Conference (20)

SFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure mattersSFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
SFSCON23 - Charles H. Schulz - Why open digital infrastructure matters
 
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portalSFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
SFSCON23 - Andrea Vianello - Achieving FAIRness with EDP-portal
 
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
SFSCON23 - Thomas Aichner - How IoT and AI are revolutionizing Mass Customiza...
 
SFSCON23 - Stefan Mutschlechner - Smart Werke Meran
SFSCON23 - Stefan Mutschlechner - Smart Werke MeranSFSCON23 - Stefan Mutschlechner - Smart Werke Meran
SFSCON23 - Stefan Mutschlechner - Smart Werke Meran
 
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
SFSCON23 - Mirko Boehm - European regulators cast their eyes on maturing OSS ...
 
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free softwareSFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
SFSCON23 - Marco Pavanelli - Monitoring the fleet of Sasa with free software
 
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
SFSCON23 - Marco Cortella - KNOWAGE and AICS for 2030 agenda SDG goals monito...
 
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changerSFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
SFSCON23 - Lina Ceballos - Interoperable Europe Act - A real game changer
 
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
SFSCON23 - Johannes Näder Linus Sehn - Let’s monitor implementation of Free S...
 
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation InternetSFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
SFSCON23 - Gabriel Ku Wei Bin - Why Do We Need A Next Generation Internet
 
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis MapsSFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
SFSCON23 - Edoardo Scepi - The Brand-New Version of IGis Maps
 
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...SFSCON23 - Davide Vernassa - Empowering Insights  Unveiling the latest innova...
SFSCON23 - Davide Vernassa - Empowering Insights Unveiling the latest innova...
 
SFSCON23 - Alexander Sander - Free Software and AI in Europe
SFSCON23 - Alexander Sander - Free Software and AI in EuropeSFSCON23 - Alexander Sander - Free Software and AI in Europe
SFSCON23 - Alexander Sander - Free Software and AI in Europe
 
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...
SFSCON23 - Ranindya Paramitha - Technical leverage analysis in the Python eco...
 
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...
SFSCON23 - Jorge Melegati Moritz Mock Barbara Russo - Recommending security f...
 
SFSCON23 - Francesco Pavanello - Decoding the Corporate Maze
SFSCON23 - Francesco Pavanello - Decoding the Corporate MazeSFSCON23 - Francesco Pavanello - Decoding the Corporate Maze
SFSCON23 - Francesco Pavanello - Decoding the Corporate Maze
 
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSS
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSSSFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSS
SFSCON23 - Carlos Esteban Budde - Predict security attacks in FOSS
 
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...
SFSCON23 - Carlo Falciola - Opensource to help increase organizations Cyberse...
 
SFSCON23 - Attaullah Buriro - MBBS A Multimodal Behavioral Biometric Scheme ...
SFSCON23 - Attaullah Buriro - MBBS  A Multimodal Behavioral Biometric Scheme ...SFSCON23 - Attaullah Buriro - MBBS  A Multimodal Behavioral Biometric Scheme ...
SFSCON23 - Attaullah Buriro - MBBS A Multimodal Behavioral Biometric Scheme ...
 
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...
SFSCON23 - Valentina Del Prete Stefano Pampaloni - RIOS (Rete Italiana Open S...
 

Kürzlich hochgeladen

Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastUXDXConf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jNeo4j
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 

Kürzlich hochgeladen (20)

Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 

SFScon19 - Matthias Dieter Wallnöfer - Jolie The first language for Microservices - Copia

  • 1. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 A gentle introduction to Saverio Giallorenzo | sgiallor@cs.unibo.it 1
  • 2. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 2 Gentle introduction to Jolie { } { } æ j œ I tc = eval(e, t) M(tc) = (oj, tÕ ) :: ˜m q iœI [oi(xi) from e] {Bi} .t .M æ Bj .t Ù ( xj, tÕ ) .M[tc ‘æ ˜m] ÂDCC|ChoiceË tÕ = eval(x, t) x = e; B .t .M æ B .t Ù ( x, tÕ ) .M ÂDCC|AssignË P æ PÕ P | P1 æ PÕ | P1 ÂDCC|PParË P = cq(x); B .t .M tc ”œ t i dom(Mi) fi dom(M) tÕ = t Ù ( x, tc ) + Bs, P | r i Bi .ti .Mi , l æ + Bs, B .tÕ .M[tc ‘æ Á] | r i Bi .ti .Mi , l ÂDCC|CqË P © P1 P1 æ PÕ 1 PÕ 1 © PÕ ÈBs, PÍl æ + Bs, PÕ , l ÂDCC|PEqË P = o@e1(e2) to e3; B .t .M eval(e1, t) = l eval(e3, t) = tc eval(e2, t) = tm MÕÕ = MÕ [tc ‘æ MÕ (tc) :: (o, tm)] + Bs, P | BÕ .tÕ .MÕ | P1 , l æ + Bs, B .t .M | BÕ .tÕ .MÕÕ | P1 , l ÂDCC|InSendË P = o@e1(e2) to e3; B .t .M eval(e1, t) = lÕ eval(e3, t) = tc eval(e2, t) = tm MÕÕ = MÕ [tc ‘æ MÕ (tc) :: (o, tm)] ÈBs, P | P1Íl | + BÕ s, BÕ .tÕ .MÕ | P2 , lÕ æ ÈBs, B .t .M | P1Íl | + BÕ s, BÕ .tÕ .MÕÕ | P2 , lÕ ÂDCC|SendË P1 =?@e1(e2); B1 .t1 .M1 eval(e1, t1) = l Q = B .t‹ Ù ( x, eval(e2, t1) ) .ÿ È!(x); B, PÍl | + BÕ s, P1 | P2 , lÕ æ È!(x); B, Q | PÍl | + BÕ s, B1 .t1 .M1 | P2 , lÕ ÂDCC|StartË Õ
  • 3. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 2 Gentle introduction to Jolie { } { } æ j œ I tc = eval(e, t) M(tc) = (oj, tÕ ) :: ˜m q iœI [oi(xi) from e] {Bi} .t .M æ Bj .t Ù ( xj, tÕ ) .M[tc ‘æ ˜m] ÂDCC|ChoiceË tÕ = eval(x, t) x = e; B .t .M æ B .t Ù ( x, tÕ ) .M ÂDCC|AssignË P æ PÕ P | P1 æ PÕ | P1 ÂDCC|PParË P = cq(x); B .t .M tc ”œ t i dom(Mi) fi dom(M) tÕ = t Ù ( x, tc ) + Bs, P | r i Bi .ti .Mi , l æ + Bs, B .tÕ .M[tc ‘æ Á] | r i Bi .ti .Mi , l ÂDCC|CqË P © P1 P1 æ PÕ 1 PÕ 1 © PÕ ÈBs, PÍl æ + Bs, PÕ , l ÂDCC|PEqË P = o@e1(e2) to e3; B .t .M eval(e1, t) = l eval(e3, t) = tc eval(e2, t) = tm MÕÕ = MÕ [tc ‘æ MÕ (tc) :: (o, tm)] + Bs, P | BÕ .tÕ .MÕ | P1 , l æ + Bs, B .t .M | BÕ .tÕ .MÕÕ | P1 , l ÂDCC|InSendË P = o@e1(e2) to e3; B .t .M eval(e1, t) = lÕ eval(e3, t) = tc eval(e2, t) = tm MÕÕ = MÕ [tc ‘æ MÕ (tc) :: (o, tm)] ÈBs, P | P1Íl | + BÕ s, BÕ .tÕ .MÕ | P2 , lÕ æ ÈBs, B .t .M | P1Íl | + BÕ s, BÕ .tÕ .MÕÕ | P2 , lÕ ÂDCC|SendË P1 =?@e1(e2); B1 .t1 .M1 eval(e1, t1) = l Q = B .t‹ Ù ( x, eval(e2, t1) ) .ÿ È!(x); B, PÍl | + BÕ s, P1 | P2 , lÕ æ È!(x); B, Q | PÍl | + BÕ s, B1 .t1 .M1 | P2 , lÕ ÂDCC|StartË Õ FORMAL CALCULUS (like POCs and the pi-calculus)
  • 4. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Laboratorio di Sistemi Operativi Introduction to the Jolie Language What is Jolie? 3 A Service-Oriented Programming Language Service Instances Objects Operations Methods Service-Oriented Object-Oriented
  • 5. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Jolie is perfect for fast prototyping. In little time a small team of developers can build up a full-fledged distributed system. Why SOC and Jolie? 4
  • 6. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Jolie is perfect for fast prototyping. In little time a small team of developers can build up a full-fledged distributed system. Why SOC and Jolie? 4 But I already know Java! Why shall I use Jolie?
  • 7. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 5
  • 8. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 5
  • 9. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 5 SocketChannel socketChannel = SocketChannel.open(); socketChannel.connect( new InetSocketAddress("http://someurl.com", 80)); Buffer buffer = . . .; // byte buffer while( buffer.hasRemaining() ) { channel.write( buffer ); } Happy?
  • 10. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 5 SocketChannel socketChannel = SocketChannel.open(); socketChannel.connect( new InetSocketAddress("http://someurl.com", 80)); Buffer buffer = . . .; // byte buffer while( buffer.hasRemaining() ) { channel.write( buffer ); } Happy? Ok, but you did not even close the channel or handled exceptions
  • 11. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 6
  • 12. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 6 SocketChannel socketChannel = SocketChannel.open(); try { socketChannel.connect(new InetSocketAddress("http://someurl.com", 80)); Buffer buffer = . . .; // byte buffer while( buffer.hasRemaining() ) { channel.write( buffer ); } } catch( UnresolvedAddressException e ) { . . . } catch( SecurityException e ) { . . . } /* . . . many catches later . . . */ catch( IOException e ) { . . . } finally { channel.close(); } Happier now?
  • 13. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 6 SocketChannel socketChannel = SocketChannel.open(); try { socketChannel.connect(new InetSocketAddress("http://someurl.com", 80)); Buffer buffer = . . .; // byte buffer while( buffer.hasRemaining() ) { channel.write( buffer ); } } catch( UnresolvedAddressException e ) { . . . } catch( SecurityException e ) { . . . } /* . . . many catches later . . . */ catch( IOException e ) { . . . } finally { channel.close(); } Happier now? Yes, but what about the server?
  • 14. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 7
  • 15. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 7
  • 16. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 7 Selector selector = Selector.open(); channel.configureBlocking(false); SelectionKey key = channel.register(selector, SelectionKey.OP_READ); while(true) { int readyChannels = selector.select(); if(readyChannels == 0) continue; Set<SelectionKey> selectedKeys = selector.selectedKeys(); Iterator<SelectionKey> keyIterator = selectedKeys.iterator(); while(keyIterator.hasNext()) { SelectionKey key = keyIterator.next(); if(key.isAcceptable()) { // a connection was accepted by a ServerSocketChannel. } else if (key.isConnectable()) { // a connection was established with a remote server. } else if (key.isReadable()) { // a channel is ready for reading } else if (key.isWritable()) { // a channel is ready for writing } keyIterator.remove(); } } Here you are
  • 17. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 8 Well, ok, but again, you are not handling exceptions. And what about if different operations use the same channel? And if we wanted to use RMIs instead of Sockets? In what format are you transmitting data? And if we need to change the format after we wrote the application? Do you check the type of data you receive/send?
  • 18. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 8 Well, ok, but again, you are not handling exceptions. And what about if different operations use the same channel? And if we wanted to use RMIs instead of Sockets? In what format are you transmitting data? And if we need to change the format after we wrote the application? Do you check the type of data you receive/send?
  • 19. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Why SOC and Jolie? 9 Programming distributed systems is usually harder than programming non distributed ones. Concerns of concurrent programming. Plus (not exhaustive): • handling communications; • handling heterogeneity; • handling faults; • handling the evolution of systems.
  • 20. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() }
  • 21. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() }
  • 22. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() }
  • 23. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service
  • 24. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service
  • 25. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service
  • 26. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point
  • 27. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point
  • 28. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point
  • 29. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point operation
  • 30. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point operation
  • 31. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point operation
  • 32. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 10 include "console.iol" main { println@Console( "Hello, world!" )() } Include a service program entry point operation service
  • 33. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 11 include "console.iol" main { println@Console( "Hello, world!" )() }
  • 34. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 11 include "console.iol" main { println@Console( "Hello, world!" )() }
  • 35. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 11 include "console.iol" main { println@Console( "Hello, world!" )() } hello_world.ol
  • 36. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us get our hands dirty. “Hello World!” is enough to let you see some of the main features of Jolie and Service-Oriented Programming. Hello World! in Jolie 11 include "console.iol" main { println@Console( "Hello, world!" )() } hello_world.ol $ jolie hello_world.ol
  • 37. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Let us see some Jolie in Action 12 Everything starts with a calculator…
  • 38. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 39. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 40. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 41. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 42. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 43. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 44. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 45. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie include "MyInterface.iol" outputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber @ B ( 5 ) } include "MyInterface.iol" inputPort B { Location: "socket://localhost:8000" Protocol: sodep Interfaces: MyInterface } main { sendNumber( x ) } interface MyInterface { OneWay: sendNumber( int ) } Behaviours and Deployments 13 ServerClient
  • 46. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 Deployments Enabling Communication 14 Gentle introduction to Jolie
  • 47. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie Behaviours and Deployments 15 A B sendNumber output port sendNumber input port medium • Services communicate through ports. • Ports give access to an interface. • An interface is a set of operations. • An output port is used to invoke interfaces exposed by other services. • An input port is used to expose an interface.
  • 48. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie A closer look on ports - Locations 16 Medium Parameters TCP/IP socket:// www.google.it:80 Bluetooth btl2cap:// localhost: 3B9FA89520078C303355AAA694238F07;name=Vision;encrypt= false;authenticate=false Local localsocket: /tmp/mysocket.socket Java RMI rmi:// myRmiUrl.com/MyService In-Memory local A location describes: • the communication medium; • the parameters to set the communication up. In Jolie a location is a Uniform Resource Identifier (URI) with form: medium[:parameters]
  • 49. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie A closer look on ports - Protocols 17 A protocol defines the format the data is sent (encoded) and received (encoded) In Jolie protocols are names and possibly additional parameters: http { .debug = true } json/rpc sodep https soap
  • 50. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 Behaviours Composing Interactions 18 Gentle introduction to Jolie
  • 51. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Laboratorio di Sistemi Operativi Basic Behaviour - Composition and Workflow Interactions via Operations 19 Input Operations Output Operations oneWay( req ) reqRes( req )( res ){ // code block } oneWay@Port( req ) reqRes@Port( req )( res )
  • 52. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie Behaviour Composition 20 The sequence operator ; denotes that the left operand of the statement is executed before the one on the right. println@Console( "A" )(); println@Console( "B" )() Prints A B
  • 53. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo Bertinoro International Spring School 2016 A gentle introduction to Jolie Behaviour Composition 21 The parallel operator | states that both left and right operands execute concurrently println@Console( "A" )()| println@Console( "B" )() can print A B but also B A
  • 54. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Behaviour Composition 22 The input choice implements input- guarded non-deterministic choice. [ oneWayOperation() ] { branch_code } [ oneWayOperation2() ] {branch_code2} [ requestResponseOperation()(){ rr_code } ] { branch_code }
  • 55. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Behaviour Composition 23 The input choice implements input- guarded non-deterministic choice. main { [ buy( stock )( response ) { buy@Exchange( stock )( response ) } ] { println@Console( "Buy order forwarded" )() } [ sell( stock )( response ) { sell@Exchange( stock )( response ) }] { println@Console( "Sell order forwarded" )() } }
  • 56. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 Before you take off 26 Gentle introduction to Jolie
  • 57. Leonardo ● A web server in pure Jolie. ● Can fit in a slide. (ok, I reduced the font size a little) ● ~50 LOCs
  • 58. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 The Jolie Interpreter 28 http://www.jolie-lang.org/downloads.html Last release • Requires JRE 1.6+ • Download jolie-installer.jar • open a console and run java -jar jolie-installer.jar
  • 59. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Sources 29 Jolie is an open source project with continuous updates and a well documented codebase “This is the programming language you are looking for” https://github.com/jolie/jolie
  • 60. |Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo A gentle introduction to Jolie Bertinoro International Spring School 2016 Documentation 30 Comprehensive and ever-growing documentation and Standard Library. http://docs.jolie-lang.org
  • 61. Saverio Giallorenzo | sgiallor@cs.unibo.it | DISI@Unibo |Bertinoro International Spring School 2016 Thanks for your time! 32 Gentle introduction to Jolie