APAM/APAM Details/APAM Components

From Wiki Adele Team
< APAM‎ | APAM Details
Revision as of 16:47, 17 October 2012 by Mehdi (talk | contribs) (Implementation)

Jump to: navigation, search

Apam is based on the concept of component. Components can be of three types: Specification, Implementations and Instances, which share most of their characteristics.

Components

Specification

A specification is a first class object that defines a set of provided and required resources (in the Java sense). Complete compositions can be designed and developed only in term of specifications.

<specification name="S2" interfaces="apam.test.S2, apam.test.AB" messages="apam.test.M1, apam.Test.M2" >
	…..
</specification>

The example shows how are declared specifications. Specification S2 provides two interfaces, apam.test.S2 and apam.test.AB and produces two messages of type apam.test.M1 and apam.Test.M2. Requires resources will be discussed later !!!!!!!.

Implementation

An implementation is related by an “implements” relationship with one and only one specification. An implementation is an executable entity (in Java) that implements all the resources defined by its associated specification, and that requires at least the resources required by its associated specification. In practice, an implementation must define a main class that implements (in the Javasense) the interfaces of its specification.

<implementation name="S2Impl" specification="S2"
	classname=" apam.test.S2Impl" 
message-methods="produceM1, produceM2"
interfaces=" apam.test.AC" >	
</implementation>

In this example, the implementation S2Impl implements specification S2 and therefore provides the same interfaces (apam.test.S2 and apam.test.AB) and messages (apam.test.M1 and apam.Test.M2 ) as S2, additionally it also provides interface apam.test.AC and message apam.test.M3. Message field will be discussed alter.

Instance

An instance is related by an “instanceOf” relationship with one and only one implementation. An instance is a run-time entity, represented in the run-time platform (OSGi) as a set of Java objects, one of which is an instance (in the Java sense) of its associated main class implementation. In the underlying service platform, an instance can be seen as a set of services, one for each of the associated specification resource; in Apam it is an object. Instances are essentially created automatically at run-time, but they can also be declared, as follows:

<instance name="InstS2Impl" implementation="S2Impl" >
	<property name="XY" value="false" >
	….
</instance>

When the bundle containing this declaration will be loaded, an instance called InstS2Impl of implementation S2Impl will be created with the properties indicated (here XY=false).

The group concept

As shown in the metamodel, components are related by a “group-members” relationship. A specification is a group whose members are implementations, and an implementation is a group whose members are instances. A group-member relationship established a de facto inheritance between the group and its members. More precisely, all the characteristics of the group (its properties, its provided and requires resources) are automatically inherited by all its members, like in a class-instance relationship.

Component life cycle

During execution, in Apam, a component has a single state: it is either existing (and therefore available and active), or non-existing.