Projet

Général

Profil

SpeADL Reference » Historique » Version 34

Anonyme, 03/04/2020 01:48
Add (Component)Type suffix

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 32 Anonyme
It it identified by a name in a namespace, can have type parameters and be a specialisation of component definition.
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 9 Anonyme
h3. Keywords
39 1 Anonyme
40 28 Anonyme
An ecosystem definition is declared with the keyword *ecosystem* followed by a name, optional type parameters and optional specialization.
41
Provided and required ports can be declared as with normal component definitions with the keywords *provides* and *requires*.
42
Parts can be declared as with normal component definitions with the keyword *part*.
43 25 Anonyme
A part can reference a typical component or an ecosystem.
44 12 Anonyme
45
A species is declared inside an ecosystem with the keyword *species* followed by a name starting with a capital.
46 25 Anonyme
It can't have type parameters but follows those of its ecosystem, and cannot specialise another component.
47 30 Anonyme
A species can have parameters (for initialisation) in-between *( * and * )* and separated by *, *: they are of the form _name: Type, name2: Type2_.
48 28 Anonyme
Provided and required ports can be declared as with normal component definitions with the keywords *provides* and *requires*.
49
Parts can be declared as with normal component definitions with the keyword *part*.
50 15 Anonyme
51 30 Anonyme
Uses are declared with the keyword *use* as discussed [[SpeADL Reference#The Use Abstraction|below]].
52 25 Anonyme
53 1 Anonyme
h3. Details
54
55 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.
56 1 Anonyme
Such species will be considered strongly linked to the containing ecosystem instance that created them: this is a thus 1..N relation.
57
58
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.
59 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]]).
60 1 Anonyme
61
h3. Example
62
63
<pre>
64
namespace simple.ecos {	
65
	ecosystem MyFirstEco {
66
67 15 Anonyme
		species S(name: String) {
68 1 Anonyme
			provides p1: AJavaInterface = c.portName
69 15 Anonyme
			provides p2: AJavaInterface
70
			requires p3: AnotherJavaInterface
71 1 Anonyme
			
72 33 Anonyme
			part c: MyBeautifulComponentType {
73 15 Anonyme
				bind anotherPortName to p3
74
			}
75
		}
76
	}
77 3 Anonyme
}
78 1 Anonyme
</pre>
79
80
h2. The Use Abstraction
81
82
As we said previously, species can only be defined inside ecosystems.
83
Such a relation can be exploited either:
84 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]].
85 26 Anonyme
* At a higher-level using advanced interconnection mechanisms between ecosystem and their species.
86 15 Anonyme
87 26 Anonyme
We focus on the second point in this section with the *use* abstraction.
88
It is a construct that enables to:
89
* Build tailored ecosystem-species relations.
90
* Build tailored inter-species relations mediated by the ecosystem.
91
92 1 Anonyme
h3. Keywords
93 11 Anonyme
94 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.
95 11 Anonyme
It follows the syntax _use name: partName.SpeciesName_ where:
96
* _partName_ is the name of a part in the ecosystem containing the current species and whose type is an ecosystem.
97
* _SpeciesName_ is the name of a species declared in the ecosystem of _partName_.
98 19 Anonyme
* And optionally a list of arguments for the species parameters: one can refer to the parameters of the containing species only.
99 11 Anonyme
100
h3. Details
101
102
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.
103
The contained ecosystem and its parts are instantiated with the containing ecosystem, and its species instantiated with the species that use them.
104
105
h3. Example
106
107
<pre>
108
namespace simple.ecos {	
109
	ecosystem MySecondEco {
110
		
111
		part e: MyFirstEco
112
		
113 15 Anonyme
		species S(name: String) {
114 11 Anonyme
			
115 34 Anonyme
			part c: MySimpleComponentType
116 26 Anonyme
			
117
			use s: e.S(name) {
118
				bind p3 to c.p1
119
			}
120
		}
121
	}
122
}
123
</pre>