Projet

Général

Profil

SpeADL Reference » Historique » Version 30

Anonyme, 15/10/2014 17:43

1 28 Anonyme
h1. SpeADL Reference Guide
2 1 Anonyme
3 27 Anonyme
{{>toc}}
4 4 Anonyme
5 20 Anonyme
In SpeADL, a set of abstractions are provided to describe [[SpeADL Minus Reference|typical component-oriented architectures]].
6 21 Anonyme
On top of these, SpeADL introduces additional abstractions that complete them in order to describe dynamic architectures, in particular for Multi-Agent Systems.
7
The motivations behind these abstractions are fully discussed in the "Ph.D. thesis":http://www.irit.fr/~Victor.Noel/PhD/Dissertation that led to the creation of MAY, here we stay at the user level.
8 1 Anonyme
9 21 Anonyme
The main idea with these abstractions is to define software components, called ecosystems, that are able to dynamically create other software components, called species, and to link such components to their ecosystem in a safe and controlled manner.
10 15 Anonyme
For example, one could define a Bank component containing a Database and that creates Account component which themselves requires access to the Database.
11 21 Anonyme
Or one could define a MAS component that creates Agent components (themselves architectured as desired) connected to simulated situated entities living in a common 2D environment.
12 1 Anonyme
13 25 Anonyme
With these abstractions, one can actually implement its own interconnection mechanism between the dynamically created components and their creating component.
14
This enables for example to cleanly and easily implement any needed interaction mechanism in a MAS when there exists no agent-oriented framework proposing it, to develop domain-specific relations between the agents and their environment or more generally to easily separate concerns (the agents architecture, the simulated agents, the communication) by composing them while explicitly taking into account the 1..N relation existing between an ecosystem and its species.
15 12 Anonyme
16 29 Anonyme
This document focuses on SpeADL, for the implementation, the reader can refer to the [[SpeADL Java Reference|Java for SpeADL reference guide]].
17
18 1 Anonyme
h2. SpeADL⁻
19
20
It is needed to understand the content of the [[SpeADL Minus Reference|SpeADL⁻ Reference Guide]] before reading the current document.
21
22 25 Anonyme
h2. Ecosystem and Species Definition
23 6 Anonyme
24 1 Anonyme
From an external point of view, an ecosystem is exactly similar to a component: it has provided ports that can be accessed and required ports that must be connected.
25 6 Anonyme
It has a name, can have type parameters and be a specialisation of another component.
26 1 Anonyme
It has an implementation in Java, it can be used as a part of another component (or ecosystem) or instantiated directly if it has no required ports.
27
28 28 Anonyme
Its only specificity is that it can contain what is called species, a special kind of component definitions that can only be defined in an ecosystem.
29 1 Anonyme
Actually, a component is just an ecosystem without any species.
30 7 Anonyme
31 28 Anonyme
Species are to ecosystems what Java non-static inner classes are to Java classes: they are components that can only be instantiated from within an ecosystem instance.
32 22 Anonyme
Because of this particular relation to ecosystems, species can access elements inside the ecosystem in two different ways:
33 12 Anonyme
* Directly to the parts and ports of the ecosystem.
34 15 Anonyme
* Indirectly through a special construct called _uses_ that enables to take into account the dynamic creation aspects of the species to:
35 1 Anonyme
** Build tailored ecosystem-species relations.
36 15 Anonyme
** Build tailored inter-species relations mediated by the ecosystem.
37 1 Anonyme
38 30 Anonyme
Uses are discussed [[SpeADL Reference#The Use Abstraction|below]].
39 15 Anonyme
40 9 Anonyme
h3. Keywords
41 1 Anonyme
42 28 Anonyme
An ecosystem definition is declared with the keyword *ecosystem* followed by a name, optional type parameters and optional specialization.
43
Provided and required ports can be declared as with normal component definitions with the keywords *provides* and *requires*.
44
Parts can be declared as with normal component definitions with the keyword *part*.
45 25 Anonyme
A part can reference a typical component or an ecosystem.
46 12 Anonyme
47
A species is declared inside an ecosystem with the keyword *species* followed by a name starting with a capital.
48 25 Anonyme
It can't have type parameters but follows those of its ecosystem, and cannot specialise another component.
49 30 Anonyme
A species can have parameters (for initialisation) in-between *( * and * )* and separated by *, *: they are of the form _name: Type, name2: Type2_.
50 28 Anonyme
Provided and required ports can be declared as with normal component definitions with the keywords *provides* and *requires*.
51
Parts can be declared as with normal component definitions with the keyword *part*.
52 15 Anonyme
53 30 Anonyme
Uses are declared with the keyword *use* as discussed [[SpeADL Reference#The Use Abstraction|below]].
54 25 Anonyme
55 1 Anonyme
h3. Details
56
57 15 Anonyme
Declaring a species means that an instance of the ecosystem  containing it will be able to create new instances of the species at runtime.
58 1 Anonyme
Such species will be considered strongly linked to the containing ecosystem instance that created them: this is a thus 1..N relation.
59
60
The bindings of the parts can point to ports inside the species, as with a normal component, but also to ports inside the ecosystem containing the species.
61 30 Anonyme
They can NOT point to other species of the ecosystem (for inter-species connection, one must exploit the use abstraction detailed [[SpeADL Reference#The Use Abstraction|below]]).
62 1 Anonyme
63
h3. Example
64
65
<pre>
66
namespace simple.ecos {	
67
	ecosystem MyFirstEco {
68
69 15 Anonyme
		species S(name: String) {
70 1 Anonyme
			provides p1: AJavaInterface = c.portName
71 15 Anonyme
			provides p2: AJavaInterface
72
			requires p3: AnotherJavaInterface
73 1 Anonyme
			
74 15 Anonyme
			part c: MyBeautifulComponent {
75
				bind anotherPortName to p3
76
			}
77
		}
78
	}
79 3 Anonyme
}
80 1 Anonyme
</pre>
81
82
h2. The Use Abstraction
83
84
As we said previously, species can only be defined inside ecosystems.
85
Such a relation can be exploited either:
86 30 Anonyme
* At the SpeADL level with the bindings and delegation from the species to the ecosystem as described [[SpeADL Reference#Ecosystem and Species Definition|above]].
87 26 Anonyme
* At a higher-level using advanced interconnection mechanisms between ecosystem and their species.
88 15 Anonyme
89 26 Anonyme
We focus on the second point in this section with the *use* abstraction.
90
It is a construct that enables to:
91
* Build tailored ecosystem-species relations.
92
* Build tailored inter-species relations mediated by the ecosystem.
93
94 1 Anonyme
h3. Keywords
95 11 Anonyme
96 26 Anonyme
Inside a species, a special type of part (and for the rest it behave exactly as a part) can be declared using the keyword *use* followed by a name without capital letter.
97 11 Anonyme
It follows the syntax _use name: partName.SpeciesName_ where:
98
* _partName_ is the name of a part in the ecosystem containing the current species and whose type is an ecosystem.
99
* _SpeciesName_ is the name of a species declared in the ecosystem of _partName_.
100 19 Anonyme
* And optionally a list of arguments for the species parameters: one can refer to the parameters of the containing species only.
101 11 Anonyme
102
h3. Details
103
104
The important point about the *use* abstraction is that it relies on the definition of ecosystem and species: it is a way to recursively exploit an ecosystem and its species in another ecosystem and its species.
105
The contained ecosystem and its parts are instantiated with the containing ecosystem, and its species instantiated with the species that use them.
106
107
h3. Example
108
109
<pre>
110
namespace simple.ecos {	
111
	ecosystem MySecondEco {
112
		
113
		part e: MyFirstEco
114
		
115 15 Anonyme
		species S(name: String) {
116 11 Anonyme
			
117
			part c: MySimpleComponent
118 26 Anonyme
			
119
			use s: e.S(name) {
120
				bind p3 to c.p1
121
			}
122
		}
123
	}
124
}
125
</pre>