Overview
• Service-oriented programming• Introduction
• Fundamental concepts
• Jolie – Service Oriented Programming Language• Basic
• Data structure
Introduction
• What’s “service”?A service is an abstract resource that represents a capability of performing tasks that form a coherent functionality from the point of view of provider entities and requester entities. To be used, a service must be realized by a concrete provider agent
What’s Service-oriented programming (SOP) Service-oriented programming (SOP) is a programming paradigm
that uses "services" as the unit of computer work, to design and implement integrated business applications and mission critical software programs. Services can represent steps of business processes and thus one of the main applications of this paradigm is the cost-effective delivery of standalone or composite business applications that can "integrate from the inside-out"
ELEMEMT OF SOP
• Contract – An interface that contractually defines the syntax and semantics of a single behavior.
• Component – A third-party deployable computing element that is reusable due to independence from platforms, protocols, and deployment environments.
• Connector – An encapsulation of transport-specific details for a specifiedcontract. It is an individually deployable element.
• Container – An environment for executing components that managers availability and code security
• Context – An environment for deploying plug and play components, that prescribes the details of installation, security, discovery, and lookup
Fundamental concepts
• Encapsulation• In-memory software modules are strictly encapsulated
• Using service interfaces for information hiding
Fundamental concepts (Con.)
• Service interface• A service interface in SOP is an in-memory object that describes a well-
defined software task with well-defined input and output data structures
• Service interfaces can be grouped in to packages
• An SOP service interface can be externalized as a WSDL operation and a single service or a package of services can be described using WSDL
Fundamental concepts (Con.)
• Service implementation
• Semantic-based approach
• Programming constructs
• …
Introduction
• Nice logo:
• Formal foundations from the Academia
• Tested and used in the real world:
• Open source (http://www.jolie-lang.org/)
What’s JOLIE can do?
• Simple services
• Orchestrators
• Web Application
• System compostition
and more program in a service-oriented style
Our first service-oriented application
• A program defines the input/output communication it will make
• A sends 5 to B through the sendNunmber operation
• We need tell A how to reach B
• We need tell B how to expose sendNumber
• In other words, how they can communicate!
Ports and interfaces: overview
• 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 service
• An input port is used to expose an interface
• Example: a client has an output port connected an input port a a calculator
Anatomy of a port
• A port specifies:• The location on which the communication can take place;
• The protocol to use for encoding/decoding data
• The interfaces it exposes
• Ther is no limit how many ports a service can use
Anatomy of a port: location
• A location is a URI (Uniform Resource Identifier) describing:• The communication medium to use;
• The parameters for the communication medium to work
• Some examples:• TCP/ IP : socket://www.google.com:80/
• Bluetooth :btl2cap://localhost:3B9FA89520078C303355AAA694238F07;name=Vision;encrypt=false;authenticate=false
• Unix sockets : localsocket:/tmp/mysocket.socket
• Java RMI : rmi://myrmiurl.com/MyService
Anatomy of a port: protocol
• A protocol is a name, optionally equipped with configuration parameters
• Some examples: sodep, soap, htp, xmlrpc,..
Protocol : sodepProtocol : soapProtocol : http { .debug = true }
Deployment and Behaviour
• A JOLIE program is composed by two definitions:• Deployment: defines how to execute by behavior and how to interact with
the rest of the system
• Behaviour : defines the workflow the service will execute
Operation types:
• JOLIE sypports two of operations:• ONE – WAY: receives a message;
• REQUEST-RESPONSE: receives a message and send a response back
• In our example, sendNumber was a One-way operation
• Syntax for Request-Response:
Basic data types
• Jolie is a dynamically typed language• No type declaration is needed when assigning values to variables
• Jolie supports seven basic data types:• bool : Booleans;
• int : integers;
• long : long integers;
• double: double-precision float;
• string : strings;
• raw : byte arrays;
• void: the empty type;
Basic data types (cont.)
• Jolie supports the any basic type, which means a value that can be any basic type
1
2
a = 5;
a = "Hello"
Basic data types (cont.)
• JOLIE supports some basic arithmetic operators: add (+) , subtract (-), multiply ( *) , divide ( / ) and modulo (%)
• pre-/post-increment (++) and pre-/post-decrement (--) operators.
Casting and checking variable types
• Variables can be cast to other types by using corresponding casting functions: bools(), int(), long(), double()and string()
s = “10”
n = s + int( s ); // n = 15
d = “1.3”
n = double ( d ) ; // n = 1.3
n = int ( n ) // n = 1
Dynamic array
• Arrray in Joie are dynamic and can be accessed by using [ ] oprator• a [ 0 ] = 0;
• a [ 1 ] = 5;
• a [ 2 ] = “Hello”;
• a [ 3 ] = 2.5
• a = 1; // JOLIE interprets this as a[0] = 1
• println@Console( a[ 0 ] )( ) // Will print 1
in JOLIE every variable is a dynamic array.
Data Structures
• Jolie data structures are tree-like• It is easier to understand them by making a comparison between a data
structure in Jolie and its equivalent in XML.
Createing a data structure
• Create a root node, named animals which contains two children note : pet and wild. Each of them is an array with two elements, respectively equipped with another sub-element (its name).
Creating a data structure
• In JOLIE
main
{
animals.pet[0].name = "cat";
animals.pet[1].name = "dog";
animals.wild[0].name = "tiger";
animals.wild[1].name = "lion"
}