GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo.
-
Upload
ethan-lucas -
Category
Documents
-
view
224 -
download
1
Transcript of GenArch: Automatic Product Derivation in Multi-agent Systems Product Line Elder Cirilo.
GenArch: Automatic Product Derivation in Multi-agent Systems Product Line
Elder Cirilo
GenArch: A Model-Based Product Derivation Tool
© 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
© 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.
© 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;
© LES/PUC-Rio
Approach Overview
© 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.
© 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
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
© 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
11© LES/PUC-Rio
Example: TestCase class annotated
© LES/PUC-Rio
II. Generating and Refining the Approach Models
13© LES/PUC-Rio
II. Generating and Refining the Approach Models
Before
After
14© LES/PUC-Rio
II. Generating and Refining the Approach Models
© 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.
III. Implementing Variabilities with Templates
@Feature
@Variability
@Feature
@Variability
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
© 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
© LES/PUC-Rio
IV. Generating SPL Instances
• Choose the Variable Features (Feature Model Instance)
© LES/PUC-Rio
IV. Generating SPL Instances
• Load the Product Code in a Eclipse Project
© LES/PUC-Rio
Architecture Overview
Multi-Level Customization in SPL Derivation
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
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»
DSAM Composition
Domain-specificArchitectureModels
Automatic Product Derivation in Multi-agent Systems Product Line
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
OLIS – Configuration Metrics
• XML files
– 10 JADEX files
– 4 Spring application context
• Lines of code
– JADEX: 1144
– Spring: 382
– Total: 1526
MAS Model (I)
• Metamodel
—Agent—Capability
— Goal
— Belief
— Plan
— Event
— Expression
—Goal
—Belief
—Plan
—Event
—Expression
MAS Model (II)
Spring Model (II)
Configuration Knowlege
• Mapping between domain elements e features expression
• Mapping between domain elements and implementation elements (Classes, Aspects, Fragments, ...)
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»
Extension Points
Domain Model
Domain Model Extractor
Derivation Process
Frameworks-Specifics Elements
Classes, Aspects, Files ...
Core Assets
Architecture ModelModeling
GenArchGenArchConfiguration Model
Configuration Knowledge
ProductProduct
DSLsTemplates
Feature Model
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
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
GenArch: Automatic Product Derivation in Multi-agent Systems Product Line
Questions?
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