JAsCo an Aspect-Oriented approach tailored for

Slides:



Advertisements
Similar presentations
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Introduction to AOP.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Aspect Oriented Programming Scott Nykl CSSE 411 Senior Seminar.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
SCALABLE EVOLUTION OF HIGHLY AVAILABLE SYSTEMS BY ABHISHEK ASOKAN 8/6/2004.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Chapter 10: Introduction to Inheritance. Objectives Learn about the concept of inheritance Extend classes Override superclass methods Call constructors.
Introduction to Object-Oriented Programming Lesson 2.
Interfaces F What is an Interface? F Creating an Interface F Implementing an Interface F What is Marker Interface?
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Classes, Interfaces and Packages
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
Object Oriented Programming Some Interesting Genes.
Class Inheritance Part II: Overriding and Polymorphism Corresponds with Chapter 10.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Modern Programming Tools And Techniques-I
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
Software Engineering Lecture 7
Inheritance and Polymorphism
Chengyu Sun California State University, Los Angeles
Remote Method Invocation
What is RMI? Remote Method Invocation
Inheritance in Java.
PL/SQL Scripting in Oracle:
Object Oriented Programming
Programming Models for Distributed Application
Inheritance Basics Programming with Inheritance
Java Programming Language
Lecture 22 Inheritance Richard Gesick.
Chengyu Sun California State University, Los Angeles
Packages and Interfaces
Interfaces.
Polymorphism Polymorphism
Computer Programming with JAVA
Java – Inheritance.
Java Programming, Second Edition
Exception Handling Imran Rashid CTO at ManiWeber Technologies.
(Computer fundamental Lab)
Inheritance.
Tonga Institute of Higher Education IT 141: Information Systems
CISC101 Reminders Assignment 3 due next Friday. Winter 2019
CS520 Web Programming Spring – Aspect Oriented Programming
Tonga Institute of Higher Education IT 141: Information Systems
Object-Oriented PHP (1)
Java Remote Method Invocation
CMSC 202 Exceptions.
Exception Handling.
C++ Object Oriented 1.
SPL – PS1 Introduction to C++.
Creating and Using Classes
Plug-In Architecture Pattern
Presentation transcript:

JAsCo an Aspect-Oriented approach tailored for Component Based Software Development This presentation covers a paper of the same name found at: http://www.umcs.maine.edu/~huang/readings/JAsCo.pdf Because the audience may not be familiar with aspect oriented programming (AOP), the first few slides give a very rough overview of AOP. The later slides describe the JAsCo language and implementation.

Crosscutting Concerns public long doSomething() { if(!Security.isAuthorized()) { return AUTHERROR; } Transaction.begin(); try { doTheThing(); Transaction.commit(); } catch(Exeception e) { Log.error(e); Transaction.rollback(); return 0; Most real systems/applications have many concerns other than just getting the job done, e.g. security, database consistency, synchronization, logging, etc. Once all the business concerns of a system have reared their ugly heads, code meant to do something simple can become very busy. This is a contrived example, similar to an example you would find in any introduction to AOP.

Security public long doSomething() { if(!Security.isAuthorized()) { return AUTHERROR; } Transaction.begin(); try { doTheThing(); Transaction.commit(); } catch(Exeception e) { Log.error(e); Transaction.rollback(); return 0; We have to do a similar security check all over the application. Fortunately, in this mock example, we have a security component that makes access checking very simple, but we are still reliant on every component being aware of, and using, the Security component.

Consistency public long doSomething() { if(!Security.isAuthorized()) { return AUTHERROR; } Transaction.begin(); try { doTheThing(); Transaction.commit(); } catch(SomeErrorEvent e) { Log.error(e); Transaction.rollback(); return 0; Once again, we have magic component that simplifies the transaction mechanism for us, but in order for our components to use it, we are reliant on –every- component being aware of and utilizing this transactional component.

Logging public long doSomething() { if(!Security.isAuthorized()) { return AUTHERROR; } Transaction.begin(); try { doTheThing(); Transaction.commit(); } catch(Exeception e) { Log.error(e); Transaction.rollback(); return 0; Most exceptional conditions require some logging. For this contrived example, we are assuming that the calling code will check the Transaction component to see if a rollback occurred. Perhaps it could also obtain the error from the Log component.

Actual Purpose public long doSomething() { doTheThing(); } The actual thing this method wanted to accomplish was very simple, but we had to go and clutter it up. Wouldn’t it be nice if we could avoid all that repetitive code and even make it where our components didn’t have to be aware of every single one of our cross cutting concerns?

Join Points Method Invocations / Property Accesses On Events Interceptor Glue Code/ Component/ Environment Component To summarize, join points are places where it would be advantageous to inject our code, i.e. before or after a method invocation, in place of a method invocation, and when an event fires. So in our previous example, we could replace the method firing with a call to the Security component, which would fire the method if it decided that the invocation was allowed. Similarly, the Transaction component would intercept the invocation before it happened and begin a transaction, and then commit that transaction after the invocation. Likewise, when the method tries “doSomething(),” an Event occurs and in response, the Transaction component would rollback the transaction (and then after the invocation it would recognize that it had already committed.) Finally, the Log component would be invoked in response to the error event, and it would log the error. Invocation Event

Weaving Component Logging Aspect Subclass Security Aspect Some implementations of AOP achieve their goal by (at runtime or compile time) incorporating the configured aspects into the component, via subclassing, byte code injection, or a similar method. This is known as aspect weaving. Weaving has undesirable side effects. Firstly, the aspect code is copied into and becomes a part of whatever class it is applied to. This means the aspects lose their identity at runtime, and are, in general, statically bound to the classes they advise. doSomething()

JAsCo Keywords hook connector execute cflow on event * [signature wildcards] JAsCo extends Java with just 5 keywords plus a special wildcard syntax used in the constructor to a hook. (See the paper for definitions) It should be noted that the extra keywords are just for brevity. It is possible to implement all the functionality of the JAsCo model using regular Java, although modifications to the byte code of non-aspect enabled components would still be necessary.

This shows the definition of an aspect bean (component) This shows the definition of an aspect bean (component). An aspect bean is no different from a normal Java Bean except that it contains hook definitions which describe when it should join. The hook definition also may contain the definitions of the before, after, and replace methods, which define a hook’s behavior. An important feature of JAsCo is that the hook does not define what sort of methods/events are intercepted.

These are some connector definitions These are some connector definitions. Connectors are what attach aspect bean hooks to method invocations and events. Inside a connector it is possible to specify the order of the hooks, and what part of the hooks should be applied. Notice that connectors instantiate hook instances with the signatures that they will be applied to.

At run time, components have either been written with, or had their byte code altered to contain traps that make calls to the connector registry whenever a public method (or property change) is invoked or an event is fired. The traps cause the connector registry to determine which connectors match and to apply the relevant hooks as specified by the connector. Another important feature of the JAsCo architecture is that both connectors and aspect beans are available at runtime (since traps always result in action by the connector registry, they should be), so it is possible to dynamically apply and remove aspects to/from other components while running. For example, it would be possible to apply the logging aspect to different parts of a running application server via a control console.