developing adaptive j2me applications using aspectj ayla débora and paulo borba {add,...
Post on 28-Dec-2015
212 Views
Preview:
TRANSCRIPT
Developing Adaptive J2ME Applications Using AspectJ
Ayla Débora and Paulo Borba
{add, phmb}@cin.ufpe.br
Centro de Informática - UFPE
Centro de Informática - UFPE 2
Summary Introduction and Motivation
Goals The Application AspectJ
Adaptive Concerns Customization Screens Caching Internationalization
Conclusions
Centro de Informática - UFPE 3
Introduction and Motivation
Goals: Evaluate AspectJ as a way to provide adaptive
behaviors for J2ME applications Identify advantages and drawbacks of using
AspectJ for this purpose Develop several adaptive concerns in an existent
J2ME application and identify possible patterns Compare AspectJ solutions to pure Java solutions
using Design Patterns
Centro de Informática - UFPE 4
Introduction Adaptability
Adaptable x Adaptive Adaptability x Ubiquity Why J2ME?
The Application J2ME Dictionary Possible adaptive behaviors
Centro de Informática - UFPE 5
The Dictionary Application
Centro de Informática - UFPE 6
AspectJ Language
public aspect Screens { }
pointcut showingScreen(): execution (public void showScreen(byte)) ;
before(): showingScreen(){ System.out.println("A screen will be shown");
}
public static final byte A.REGISTRATION_SCREEN=-3;
Pointcut
Advice
Introduction
Centro de Informática - UFPE 7
Adaptive Concerns
Customization Screens Caching Internationalization
Centro de Informática - UFPE 8
Customization Concern
Configuring the adaptation
Comparing with design patterns
Reusability Comparing with a pure
Java implementation
Centro de Informática - UFPE 9
Customization Concern
pointcut MIDletStart(MIDlet midlet):execution(void startApp())&&target(midlet);
before(MIDlet midlet): MIDletStart(midlet){ adaptBefore(midlet);}void around (MIDlet midlet) : MIDletStart(midlet){ boolean shouldProceed = adaptAround(midlet); if (shouldProceed) proceed(midlet);}after(MIDlet midlet): MIDletStart(midlet){ adaptAfter(midlet);}
Centro de Informática - UFPE 10
Screen Concern Using Introduction Changing screens
DictionaryConstants
getStringValue()addStringValue()
GeneralList MainMenuEnhancerRegistrationScreen
DictionaryController
getInstance()initializeScreens()addScreen()getScreen()showScreen()
PresentationScreen
paint()commandAction()
UpdateObject
Screens<<aspect>>
Centro de Informática - UFPE 11
Caching Concern
Avoids server connections Transparency
Caching
writeServerContentsOnXML()
<<aspect>>
ServerUpdate
DictionaryCustomization
getUpdateObject()
<<aspect>>
UpdateObjectConfig
makeUpdateObject()
<<aspect>>
UpdateObject
getInputSearchData()getSearchMechanism()getDictionaryEntries()changeMainMenu()
Screens<<aspect>>
Centro de Informática - UFPE 12
Internationalization Concern The need for refactoring The use of auxiliary classes Interference between aspects
Internationalization
setLanguage()getLanguage()addStringValue()getStringValue()
InternationalizationAspect
internationalization
DictionaryConstants
getStringValue()addStringValue()
Centro de Informática - UFPE 13
Internationalization Concernpointcut internationalizing(Object key): execution(public static String DictionaryConstants.getStringValue(Object))&&args(key);
String around(Object key): internationalizing(key){ return internationalization.getStringValue(key);}
pointcut internationalizingNewScreens (Internationalization in): initialization(public Internationalization.new())
&& target(in);
Centro de Informática - UFPE 14
Conclusions
AspectJ and the implementation of adaptive concerns
Pure OO solutions generally require more changes
The use of J2ME and the identification of join points
The use of auxiliary classes The necessity of refactoring
Centro de Informática - UFPE 15
Conclusions
Interference between aspects Reusing aspects Dynamic adaptations Problems in J2ME while using AspectJ Applicability for other platforms
Developing Adaptive J2ME Applications Using AspectJ
Ayla Débora and Paulo Borba
{add, phmb}@cin.ufpe.br
Centro de Informática - UFPE
top related