Download presentation
Presentation is loading. Please wait.
1
AspectJ2EE/Clasa Israel Institute of Technology The Computer Science department Itay Maman
2
2 Talk outline Our Group Overview of AspectJ2EE Weaving mechanism The Clasa language A generic middleware platform: The vision
3
3 Overview of AspectJ2EE The key issue: Weaving can be achieved via sub-classing The sub-class will inject the additional code into its super class Each aspect is actually a type-to-subtype mapping Hence, aspects in AspectJ2EE are called: Shakeins Objects must be created through an object factory (the dynamic type of the object is different from its static type)
4
4 AspectJ2EE: What the System Generates (Assumes 4 Applied aspects) Lifecycle management is an aspect
5
5 Current focus: Clasa (1/4) Motivation Describing the characteristic of a class is not an easy task Example 1- Let ’ s define a stateless class as a class with no fields. Can it have static fields? Can its super class have a private instance field? Example 2- NoName is a class without a “ getName() ” method Can it have a static getName() method? Can its super class have a private non-static getName() method?
6
6 Current focus: Clasa (2/4) Motivation (continued) There is a major gap between the intuition and the formal definition This gap must be bridged when: Statistical analysis is applied over classes A refactoring tool is developed A point-cut is defined … Current point-cut constructs lack in their expressive power Thus, they cannot capture the wide spectrum of Java element
7
7 Current focus: Clasa (3/4) What is Clasa? A language over the domain of Java programs A Jar file can be thought of as a database A Clasa function can be thought of as a query Main features Built-in functions for handling relations Pattern matching Elegant syntax Static, strong typing, with type inference Implementation is based on ideas drawn from languages such as Icon, Prolog By using Clasa, one can precisely define complex pointcuts
8
8 Current focus: Clasa (4/4) Some Clasa queries has_age := abstract class { public int getAge(); public void setAge(int); } primitive := boolean | char | int | long | float | double; serializeable := primitive | implements: { ‘java.lang.Serializeable‘) non_private_ctor := [public|protected|default] ctor; singleton := class { no non_private_ctor; static T create(); private static T field; }
9
9 Generic middleware platform (GMF) 1/4 1 st approach What AspectJ2EE needs? An infrastructure which provides core J2EE services: Persistency Security Transaction Logging … The protocol should be minimal but complete No fancy (compound) operations Just like the APIs provided by an operating system
10
10 (1 st approach continued) What AspectJ2EE does not need? AspectJ2EE ’ s weaver is based on inheritance The advice is woven by means of sub-classing sub-classing is a built-in mechanism of Java =>No “ Aspect awareness ” : Neither the GMF nor the JVM need to support aspects A “ nice to have ” feature: GMF will allow client code to customize the type of each created object Can be thought of as a built-in object factory Increases POJOness of the code Generic middleware platform (GMF) 2/4
11
11 2 nd approach Let ’ s think of the GMF abstractly … 1. Provides a set of built-in aspects 2. Allows developers to define new aspects 3. Is implemented by aspects ?! => one aspect-weaving mechanism that is used both internally and externally Pros Small, compact core A Highly customizable GMF Cons Bootstrapping Not specifically related to middleware platforms Performance Generic middleware platform (GMF) 3/4
12
12 (2 nd approach continued) What is the minimal kernel of such a GMF? A Pointcut matching engine “ primitive ” aspect: Object creation The type-to-subtype mapping is just a parameter “ primitive ” aspect: System configuration change The bottom line: A small kernel A huge library Almost every thing can be customized Generic middleware platform (GMF) 4/4
13
13 - The End -
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.