genarch: automatic product derivation in multi-agent systems product line elder cirilo

40
GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Upload: ethan-lucas

Post on 27-Mar-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

GenArch: Automatic Product Derivation in Multi-agent Systems Product Line

Elder Cirilo

Page 2: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

GenArch: A Model-Based Product Derivation Tool

Page 3: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Motivation

• Product Derivation refers to the process of constructing a product from the set of assets specified or implemented for a SPL;

• Over the last years, instantiation/derivation tools have been proposed to facilitate the selection, composition and configuration of SPL code assets and their respective variabilities;

• Examples of tools:

– Gears

– Pure::variants

Page 4: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Problem

• These tools are in general complex and heavyweight to be used by the mainstream developer community.

• Some deficiencies from the existing tools:

– they incorporate a lot of new concepts from the SPL development area;

– definition of many complex models and/or functionalities;

– they are in general more adequate to work with proactive approaches.

Page 5: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Our work

• This work proposes GenArch, a model-driven product derivation tool.

• It is centered on the definition of three models:

(i) Feature model

(ii) Architecture model

(iii) Configuration model

• Our approach motivates:

- the generation of initial versions of these models based on a set of code annotations;

Page 6: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Approach Overview

Page 7: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Approach Overview

• The purpose of each model of our approach

• Feature Model

– Represent variabilities from the SPL architecture.

• Architecture Model

– Offer a visual representation of code artifacts from the SPL architecture.

• Configuration Model

– Define the mapping between features and code artifacts. It represents the configuration knowledge from a generative approach.

Page 8: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Approach in Action

• Illustrate the tool functionalities through an example.

• Approach Steps:

I. Annotating Java Code with Feature and Variabilities

II. Generating and Refining the Approach Models

III. Implementing Variabilities with Templates

IV. Generating SPL Instances

Page 9: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

9© LES/PUC-Rio

Framework JUnit

• Specification of unit tests.

• Implementation of Variabilities:

– Framework OO > polimorphism

– Aspect-Oriented Programming

• Existing variabilities:

– Test suites and test cases

– Graphical User Interface (Swing, AWT, Txt)

– Test cases extensions (repetition, concurrent execution) >> Aspects

Page 10: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

I. Annotating Java Code with Feature and Variabilities

• Two kinds of annotations: @Feature and @Variability

• Examples:

@Feature(name="TestCase",

parent="TestSuite",

type=FeatureType.mandatory)

@Variability(type=VariabilityType.hotSpot,

feature=“TestCase”)

• They are processed by a parser to generate initial versions of the models

Page 11: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

11© LES/PUC-Rio

Example: TestCase class annotated

Page 12: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

II. Generating and Refining the Approach Models

Page 13: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

13© LES/PUC-Rio

II. Generating and Refining the Approach Models

Before

After

Page 14: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

14© LES/PUC-Rio

II. Generating and Refining the Approach Models

Page 15: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Synchronization Implementation Assets & Models

• The following tasks are accomplished by GenArch

(i) removing features from the feature model which are not longer

used by the configuration model or some annotation in the code;

(ii) removing mapping relationships in the configuration model elements that refer to non-existing features or implementation elements;

(iii) removing implementation elements from the architecture model which do not exist anymore;

(iv) automatic creation of @Feature annotations in implementation elements based on the existence of dependency relationships between a feature and an implementation element in the configuration model; and

(v) changes in the original implementation elements (add, remove, move, rename) implies in the same changes in the

architecture model related to the element.

Page 16: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

III. Implementing Variabilities with Templates

@Feature

@Variability

@Feature

@Variability

Page 17: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

III. Implementing Variabilities with Templates

«IMPORT br::pucrio::inf::les::genarch::models::instance»

«DEFINE Main FOR Instance»«FOREACH featureConfigurations (“TestSuite",featureModel) AS fc»

«FILE fc.attribute + ".java"»

package junit.framework;

public class «fc.attribute» extends TestSuite {

}

«ENDFILE»

(...)

«ENDDEFINE»

Before

Page 18: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

III. Implementing Variabilities with Templates

«IMPORT br::pucrio::inf::les::genarch::models::instance»«DEFINE Main FOR Instance»«FOREACH featureConfigurations (“TestSuite",featureModel) AS fc»

«FILE fc.attribute + ".java"»package junit.framework;public class «fc.attribute» extends TestSuite {

public static Test suite() {TestSuite suite = new TestSuite();«FOREACH fc.features AS child»suite.addTestSuite(«child.attribute».class);«ENDFOREACH»return suite;

}}

«ENDFILE»(...)«ENDDEFINE»

After

Page 19: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

IV. Generating SPL Instances

• Choose the Variable Features (Feature Model Instance)

Page 20: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

IV. Generating SPL Instances

• Load the Product Code in a Eclipse Project

Page 21: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

© LES/PUC-Rio

Architecture Overview

Page 22: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Multi-Level Customization in SPL Derivation

Page 23: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

SPL Implementation Architecture

• Architecture-centric Software Product Lines

• Today: Frameworks-Based architectures

– Components (Spring, OGSi)

– Agents (JADE, JADEX)

– Services (OASIS)

– Events (Esper)

• Architecture realization

– Massive use of XML and Configuration files

• Error-prone Product Derivation / Configuration

Page 24: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Multi-level Customization in SPL Derivation

Spring Model

Classes, Aspectos ...

JADEX Model

XML

Feature Model

«IMPORT br::pucrio::inf::les::genarch::models::instance»«EXTENSION br::pucrio::inf::les::genarch::models::Model»«DEFINE Main FOR Instance»«FILE "User.agent.xml"-»(...)<capabilities>«LET domainModelElement(“mas",“user",domainModels) AS u»«FOREACH u.capabilities AS c» «c.fragment.content»«FOREACH»«ENDLET»</capabilities>(...)«ENDFILE»«ENDDEFINE»

Page 25: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

DSAM Composition

Domain-specificArchitectureModels

Page 26: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Automatic Product Derivation in Multi-agent Systems Product Line

Page 27: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

OLIS (JADEX/Spring)

AssignPapersAction

BaseAction

Observable

Database

CoordinatorServiceImpl

ConferenceDAOHibernate

PaperDAOHibernate

CreateConferenceAction

DeadlineAgent

TaskAgent

NotifierAgent

UserAgents

GUI Layer

ChairServiceImp

l…

Observer

User DataAgent

<<creates>>

Data Layer

ObservableService

TaskAction

TaskServiceImp

l

TaskDAOHibernate

Business Layer

EnvironmentAgent

Spring

Jadex

Page 28: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

OLIS – Configuration Metrics

• XML files

– 10 JADEX files

– 4 Spring application context

• Lines of code

– JADEX: 1144

– Spring: 382

– Total: 1526

Page 29: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

MAS Model (I)

• Metamodel

—Agent—Capability

— Goal

— Belief

— Plan

— Event

— Expression

—Goal

—Belief

—Plan

—Event

—Expression

Page 30: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

MAS Model (II)

Page 31: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Spring Model (II)

Page 32: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Configuration Knowlege

• Mapping between domain elements e features expression

• Mapping between domain elements and implementation elements (Classes, Aspects, Fragments, ...)

Page 33: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Template: JADEX Agent

«IMPORT br::pucrio::inf::les::genarch::models::instance»«EXTENSION br::pucrio::inf::les::genarch::models::Model»«DEFINE Main FOR Instance»«FILE "User.agent.xml"-»(...)<capabilities>

«LET domainModelElement(“mas",“user",domainModels) AS u»«FOREACH u.capabilities AS c» «c.fragment.content»«FOREACH»«ENDLET»

</capabilities>

(...)

«ENDFILE»«ENDDEFINE»

«IMPORT br::pucrio::inf::les::genarch::models::instance»«EXTENSION br::pucrio::inf::les::genarch::models::Model»«DEFINE Main FOR Instance»«FILE "User.agent.xml"-»(...)<capabilities>

«LET domainModelElement(“mas",“user",domainModels) AS u»«FOREACH u.capabilities AS c» «c.fragment.content»«FOREACH»«ENDLET»

</capabilities>

(...)

«ENDFILE»«ENDDEFINE»

Page 34: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Extension Points

Domain Model

Domain Model Extractor

Page 35: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Derivation Process

Frameworks-Specifics Elements

Classes, Aspects, Files ...

Core Assets

Architecture ModelModeling

GenArchGenArchConfiguration Model

Configuration Knowledge

ProductProduct

DSLsTemplates

Feature Model

Page 36: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Conclusions

• GenArch is lightweight tool that can be used to derivate SPL or Framework instances

• GenArch fit all the SPL adoption approach

• GenArch was used in a commercial scenario to derivate Mobile Games

• The GenArch can be extended incrementally

Page 37: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Future Works

• Integrate GenArch with more high level models

– Business Process

– Active Diagram

• Feature Model (GenArch) in Autonomic Computing

– Use Feature model to manage self-adaptation in autonomic environments

Page 38: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

GenArch: Automatic Product Derivation in Multi-agent Systems Product Line

Questions?

Page 39: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo
Page 40: GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo

Feature ModelFeature Model

GenArch

Agent/ServiceAgent/Service

Maven/AntMaven/Ant

RepositoryRepository

Runtime Environment

Request a new feature

Obtain Feature Metdata

Deploy the derivate Agent/Service

Derivate

Derivate ascript

Agent/Service