DYNAMIC PROXY AND CLASSIC SPRING AOP

Size: px
Start display at page:

Download "DYNAMIC PROXY AND CLASSIC SPRING AOP"

Transcription

1 Module 8 DYNAMIC PROXY AND CLASSIC SPRING AOP Aspect-oriented programming (AOP) > Aspect-oriented programming (AOP) is a new methodology to complement traditional object-oriented programming (OOP). > The motivation of AOP is not to substitute for OOP. > AOP is often used together with OOP. > In the world of OOP, applications are organized with classes and interfaces. > These elements are good for implementing the core business requirements, but not the crosscutting concerns

2 Aspect-oriented programming (AOP) > AOP provides another way for developers to organize their application structures. > Instead of the classes and interfaces of OOP, the main programming elements of AOP are aspects. > You may imagine that an aspect modularizes crosscutting concerns like a class modularizes states and behaviors in OOP. Aspect-oriented programming (AOP) > Besides the IoC container, another core module of the Spring framework is its AOP framework. > Currently, there are many AOP frameworks on the market implemented for different purposes and based on different technologies, but only the following three open source AOP frameworks have entered the mainstream: AspectJ, merged with AspectWerkz since version 5 JBoss AOP, as a subproject of the JBoss AS Spring AOP, as part of the Spring framework

3 Spring AOP > AspectJ is the most complete and popular AOP framework in the Java community. > By comparison, Spring AOP is not a competitor of AspectJ to provide another complete AOP implementation. > Its purpose is only to provide an AOP solution that can consistently integrate with its IoC container. > Spring AOP will only handle crosscutting concerns for the beans declared in its IoC container. Spring AOP > The core technology is dynamic proxy. > Although the usage of Spring AOP has changed significantly from version 1.x to 2.x, the implementation technology remains the same. > Spring AOP is backward compatible: you can continue to use your Spring 1.x AOP elements in Spring 2.x. > Spring version 1.x: AOP usage is through a set of proprietary Spring AOP APIs. > Spring version 2.0: AOP usage is through writing POJOs with either AspectJ annotations or XML-based configurations in the bean configuration file.

4 Non-Modularized Crosscutting Concerns > A crosscutting concern is a functionality that spans multiple modules of an application. > This kind of concern is often hard to modularize with the traditional object-oriented approach. public interface ArithmeticCalculator { public double add(double a, double b); public double sub(double a, double b); public double mul(double a, double b); public double div(double a, double b); public interface UnitCalculator { public double kilogramtopound(double kg); public double kilometertomile(double km); ArithmeticCalculatorImpl public class ArithmeticCalculatorImpl implements ArithmeticCalculator { public double add(double a, double b) { double result = a + b; System.out.println(a + " + " + b + " = " + result); public double sub(double a, double b) { double result = a - b; System.out.println(a + " - " + b + " = " + result); public double mul(double a, double b) { double result = a * b; System.out.println(a + " * " + b + " = " + result); public double div(double a, double b) { double result = a / b; System.out.println(a + " / " + b + " = " + result);

5 UnitCalculatorImpl public class UnitCalculatorImpl implements UnitCalculator { public double kilogramtopound(double kilogram) { double pound = kilogram * 2.2; System.out.println(kilogram + " kilogram = " + pound + " pound"); return pound; public double kilometertomile(double kilometer) { double mile = kilometer * 0.62; System.out.println(kilometer + " kilometer = " + mile + " mile"); return mile; Tracing the Methods > A common requirement of most applications is to trace the activities that take place during program execution. > There are several logging implementations available for you to choose. > If you would like your application to be independent of the logging implementation, you can make use of the Apache Commons Logging library. > It provides abstract APIs that are implementation independent and allows you to switch between different implementations without modifying code.

6 Apache Commons Logging library > To use the Apache Commons Logging library, you have to include commons-logging.jar (located in the lib/jakartacommons directory of the Spring installation) in your classpath. > log4j.properties ### direct log messages to stdout ### log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern= %d{yyyy-mm-dd HH:mm:ss %5p %c{1:%l - %m%n ### set root logger level ### log4j.rootlogger=error, stdout log4j.logger.edu.itu.service=info ArithmeticCalculatorImpl public class ArithmeticCalculatorImpl implements ArithmeticCalculator { private Log log = LogFactory.getLog(this.getClass()); public double add(double a, double b) { log.info("the method add() begins with " + a + ", " + b); double result = a + b; log.info("the method add() ends with " + result); public double sub(double a, double b) { log.info("the method sub() begins with " + a + ", " + b); double result = a - b; log.info("the method sub() ends with " + result); public double mul(double a, double b) { log.info("the method mul() begins with " + a + ", " + b); double result = a * b; log.info("the method mul() ends with " + result);

7 UnitCalculatorImpl public class UnitCalculatorImpl implements UnitCalculator { private Log log = LogFactory.getLog(this.getClass()); public double kilogramtopound(double kilogram) { log.info("the method kilogramtopound() begins with " + kilogram); double pound = kilogram * 2.2; log.info("the method kilogramtopound() ends with " + pound); return pound; public double kilometertomile(double kilometer) { log.info("the method kilometertomile() begins with " + kilometer); double mile = kilometer * 0.62; log.info("the method kilometertomile() ends with " + mile); return mile; Validating the Arguments > Now let s consider adding a restriction to your calculators. > Suppose you would like your calculators to support positive numbers only. > At the beginning of each method, you make calls to the validate() method to check if all the arguments are positive numbers. > For any negative numbers, you throw an IllegalArgumentException.

8 ArithmeticCalculatorImpl public class ArithmeticCalculatorImpl implements ArithmeticCalculator { private Log log = LogFactory.getLog(this.getClass()); public double add(double a, double b) { validate(a); validate(b); log.info("the method add() begins with " + a + ", " + b); double result = a + b; log.info("the method add() ends with " + result); private void validate(double a) { if (a < 0) { throw new IllegalArgumentException("Positive numbers only"); Identifying the Problems: crosscutting concerns > As you can see, the original calculator methods expand as you add more and more non-business requirements, such as logging and validation. > These system wide requirements usually have to crosscut multiple modules, so they are called crosscutting concerns to distinguish them from the core business requirements, which are called the core concerns of a system. > Typical crosscutting concerns within an enterprise application include logging, validation, pooling, caching, authentication, and transaction.

9 Crosscutting Concerns Arithmetic Calculator Unit Calculator... Logging Validation > The traditional object-oriented approach cannot modularize crosscutting concerns well with only classes and interfaces as programming elements. Modularizing Crosscutting Concerns with Dynamic Proxy > You can apply a design pattern called proxy to separate crosscutting concerns from core concerns > The principle of the proxy design pattern is to wrap an object with a proxy and use this proxy to substitute for the original object. > Any calls that were made to the original object will go through the proxy first. Client Target Object

10 LoggingHandler public class LoggingHandler implements InvocationHandler { private Log log = LogFactory.getLog(this.getClass()); private Object target; public LoggingHandler(Object target) { this.target = target; public Object invoke(object proxy, Method method, Object[] args) throws Throwable { log.info("the method "+method.getname()+"() begins with " +Arrays.toString(args)); Object result = method.invoke(target, args); log.info("the method " + method.getname() + "() ends with " + result); Proxy.newProxyInstance public class TestArithmeticCalculator { public static void main(string[] args) { ArithmeticCalculator arithmeticcalculator = new ArithmeticCalculatorServiceImpl(); ArithmeticCalculator calc= (ArithmeticCalculator) Proxy.newProxyInstance( arithmeticcalculator.getclass().getclassloader(), arithmeticcalculator.getclass().getinterfaces(), new LoggingHandler(arithmeticCalculator)); calc.add(1, 2); calc.sub(4, 3); calc.mul(2, 3); calc.div(4, 2);

11 CalculatorValidationHandler public class CalculatorValidationHandler implements InvocationHandler { public static Object createproxy(object target) { return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getclass().getinterfaces(), new CalculatorValidationHandler(target)); private Object target; public CalculatorValidationHandler(Object target) { this.target = target; public Object invoke(object proxy, Method method, Object[] args) throws Throwable { for (Object arg : args) { validate((double) arg); Object result = method.invoke(target, args); private void validate(double a) { if (a < 0) throw new IllegalArgumentException("Positive numbers only"); Validation and Logging Proxies ArithmeticCalculator arithmeticcalculator = new ArithmeticCalculatorServiceImpl(); ArithmeticCalculator calc = (ArithmeticCalculator) LoggingHandler.createProxy(arithmeticCalculator); ArithmeticCalculator proxy= (ArithmeticCalculator) CalculatorValidationHandler.createProxy(calc); proxy.add(-1, 2);

12 Crosscutting Concerns with Classic Spring Advices > Classic Spring AOP supports four types of advices, each of which takes effect at different times of an execution point: Before advice: Before the method execution After returning advice: After the method returns a result After throwing advice: After the method throws an exception Around advice: Around the method execution How It Works: Before Advices public class LoggingBeforeAdvice implements MethodBeforeAdvice { private Log log = LogFactory.getLog(this.getClass()); public void before(method method, Object[] args, Object target) throws Throwable { log.info("the method " + method.getname() + "() begins with " + Arrays.toString(args));

13 How It Works: Before Advices <bean id="loggingbeforeadvice" class="edu.itu.advice.loggingbeforeadvice"/> <bean id="arithmeticcalculatorproxy" class="org.springframework.aop.framework.proxyfactorybean"> <property name="proxyinterfaces"> <list> <value> edu.itu.service.arithmeticcalculator </value> </list> </property> <property name="target" ref="arithmeticcalculator"/> <property name="interceptornames"> <list> <value>loggingbeforeadvice</value> </list> </property> </bean> <bean id="arithmeticcalculator" class="edu.itu.service.arithmeticcalculatorserviceimpl"/> How It Works: Before Advices ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); ArithmeticCalculator arithmeticcalculator = (ArithmeticCalculator) context.getbean("arithmeticcalculatorproxy"); arithmeticcalculator.add(2,2);

14 How It Works: After Returning Advices public class LoggingAfterAdvice implements AfterReturningAdvice { private Log log = LogFactory.getLog(this.getClass()); public void afterreturning(object returnvalue, Method method, Object[] args, Object target) throws Throwable { log.info("the method "+method.getname() + "() ends with "+ returnvalue); How It Works: After Returning Advices <bean id="loggingafteradvice" class="edu.itu.advice.loggingafteradvice"/> <bean id="arithmeticcalculatorproxy" class="org.springframework.aop.framework.proxyfactorybean"> <property name="proxyinterfaces"> <list> <value> edu.itu.service.arithmeticcalculator </value> </list> </property> <property name="target" ref="arithmeticcalculator"/> <property name="interceptornames"> <list> <value>loggingbeforeadvice</value> <value>loggingafteradvice</value> </list> </property> </bean>

15 How It Works: After Returning Advices ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); ArithmeticCalculator arithmeticcalculator = (ArithmeticCalculator) context.getbean("arithmeticcalculatorproxy"); arithmeticcalculator.add(2,2); How It Works: After Throwing Advices public class ArithmeticCalculatorServiceImpl implements ArithmeticCalculator {... public double div(double a, double b) { if (b == 0) { throw new IllegalArgumentException("Division by zero"); return a/b;

16 How It Works: After Throwing Advices public class LoggingThrowsAdvice implements ThrowsAdvice { private Log log = LogFactory.getLog(this.getClass()); public void afterthrowing(illegalargumentexception e) throws Throwable { log.error("illegal argument"); How It Works: After Throwing Advices <bean id="loggingthrowsadvice" class="edu.itu.advice.loggingthrowsadvice"/> <bean id="arithmeticcalculatorproxy" class="org.springframework.aop.framework.proxyfactorybean"> <property name="proxyinterfaces"> <list> <value> edu.itu.service.arithmeticcalculator </value> </list> </property> <property name="target" ref="arithmeticcalculator"/> <property name="interceptornames"> <list> <value>loggingbeforeadvice</value> <value>loggingafteradvice</value> <value>loggingthrowsadvice</value> </list> </property> </bean>

A short introduction to INF329. Spring AOP

A short introduction to INF329. Spring AOP A short introduction to INF329 Spring AOP Introduction to AOP AOP is an abbreviation for aspectoriented programming Aspect-oriented programming is a new paradigm in programming, seperating functionality

More information

AOP 101: Intro to Aspect Oriented Programming. Ernest Hill

AOP 101: Intro to Aspect Oriented Programming. Ernest Hill AOP 101: Intro to Aspect Oriented Programming ernesthill@earthlink.net AOP 101-1 AOP 101: Aspect Oriented Programming Goal of Software History of Programming Methodology Remaining Problem AOP to the Rescue

More information

CONFIGURING A SPRING DEVELOPMENT ENVIRONMENT

CONFIGURING A SPRING DEVELOPMENT ENVIRONMENT Module 5 CONFIGURING A SPRING DEVELOPMENT ENVIRONMENT The Spring Framework > The Spring framework (spring.io) is a comprehensive Java SE/Java EE application framework > Spring addresses many aspects of

More information

Enterprise AOP With the Spring Framework

Enterprise AOP With the Spring Framework Enterprise AOP With the Spring Framework Jürgen Höller VP & Distinguished Engineer, Interface21 Agenda Spring Core Container Spring AOP Framework AOP in Spring 2.0 Example: Transaction Advice What's Coming

More information

AOP Tutorial. Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan

AOP Tutorial. Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan AOP Tutorial Written By: Muhammad Asif. Department of Computer Science, Virtual University of Pakistan Table of Contents 1.0 INTRODUCTION... 3 2.0 SCOPE AND OBJECTIVE... 4 3.0 MOTIVATION... 5 4.0 HISTORY...

More information

XML SCHEMA BASED AOP WITH SPRING

XML SCHEMA BASED AOP WITH SPRING XML SCHEMA BASED AOP WITH SPRING http://www.tutorialspoint.com/spring/schema_based_aop_appoach.htm Copyright tutorialspoint.com To use the aop namespace tags described in this section, you need to import

More information

Dynamic Implementation

Dynamic Implementation Dynamic Implementation Example dynamic-implementation can be browsed at https://github.com/apache/tomee/tree/master/examples/dynamicimplementation Help us document this example! Click the blue pencil icon

More information

SPRING MOCK TEST SPRING MOCK TEST I

SPRING MOCK TEST SPRING MOCK TEST I http://www.tutorialspoint.com SPRING MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Spring Framework. You can download these sample mock tests at

More information

Information systems modeling. Tomasz Kubik

Information systems modeling. Tomasz Kubik Information systems modeling Tomasz Kubik Aspect-oriented programming, AOP Systems are composed of several components, each responsible for a specific piece of functionality. But often these components

More information

@ASPECTJ BASED AOP WITH SPRING

@ASPECTJ BASED AOP WITH SPRING @ASPECTJ BASED AOP WITH SPRING http://www.tutorialspoint.com/spring/aspectj_based_aop_appoach.htm Copyright tutorialspoint.com @AspectJ refers to a style of declaring aspects as regular Java classes annotated

More information

Using Aspect-Oriented Programming to extend Protégé. Henrik Eriksson Linköping University

Using Aspect-Oriented Programming to extend Protégé. Henrik Eriksson Linköping University Using Aspect-Oriented Programming to extend Protégé Henrik Eriksson Linköping University Questions about MOP and Protégé Original goal: Extending the JessTab plug-in What is the class precedence in Protégé?

More information

The Spring Framework: Overview and Setup

The Spring Framework: Overview and Setup 2009 Marty Hall The Spring Framework: Overview and Setup Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/spring.html Customized Java EE Training: http://courses.coreservlets.com/

More information

Aspect-Oriented Programming

Aspect-Oriented Programming Aspect-Oriented Programming Based on the Example of AspectJ Prof. Harald Gall University of Zurich, Switzerland software evolution & architecture lab AOP is kind of a complicated one for me ( ) the idea

More information

SCALA AND ASPECTJ. Approaching Modularizing of Crosscutting. Ramnivas Laddad. Concerns. ramnivas

SCALA AND ASPECTJ. Approaching Modularizing of Crosscutting. Ramnivas Laddad. Concerns. ramnivas SCALA AND ASPECTJ Approaching Modularizing of Crosscutting Concerns Ramnivas Laddad ramnivas ramnivas!com @ramnivas Copyright Ramnivas Laddad. All rights reserved. @ramnivas Spring framework committer

More information

Spring Interview Questions

Spring Interview Questions Spring Interview Questions By Srinivas Short description: Spring Interview Questions for the Developers. @2016 Attune World Wide All right reserved. www.attuneww.com Contents Contents 1. Preface 1.1. About

More information

Advanced Web Systems 10- Spring and AOP Transactions Ajax Introduction. A. Venturini

Advanced Web Systems 10- Spring and AOP Transactions Ajax Introduction. A. Venturini Advanced Web Systems 10- Spring and AOP Transactions Ajax Introduction A. Venturini Spring Architecture The seven modules of the Spring framework 2 Intro to Spring AOP In Spring, aspects are woven into

More information

Fast Track to Spring 3 and Spring MVC / Web Flow

Fast Track to Spring 3 and Spring MVC / Web Flow Duration: 5 days Fast Track to Spring 3 and Spring MVC / Web Flow Description Spring is a lightweight Java framework for building enterprise applications. Its Core module allows you to manage the lifecycle

More information

Aspect-Oriented Programming and Aspect-J

Aspect-Oriented Programming and Aspect-J Aspect-Oriented Programming and Aspect-J TDDD05 Ola Leifer Most slides courtesy of Jens Gustafsson and Mikhail Chalabine Outline: Aspect-Oriented Programming New concepts introduced Crosscutting concern

More information

Java AOP in Spring 2.0 Rob Harrop, Interface21 Ltd.

Java AOP in Spring 2.0 Rob Harrop, Interface21 Ltd. Java AOP in Spring 2.0 Rob Harrop, Interface21 Ltd. Agenda What's new in Spring 2.0 Simplifying transaction configuration @AspectJ Aspects Writing pointcuts with AspectJ Using AspectJ aspects Aspects and

More information

Your required reading begins below...

Your required reading begins below... March 2006-- Issue 9.2 This month's articles: Developing Spring applications for WebSphere Application Server: Part 1: An introduction to Spring Locking strategies for database access Web services security

More information

Struts: Struts 1.x. Introduction. Enterprise Application

Struts: Struts 1.x. Introduction. Enterprise Application Struts: Introduction Enterprise Application System logical layers a) Presentation layer b) Business processing layer c) Data Storage and access layer System Architecture a) 1-tier Architecture b) 2-tier

More information

Introduction to. Bruno Harbulot. ESNW, the University of Manchester.

Introduction to. Bruno Harbulot. ESNW, the University of Manchester. Introduction to Aspect-Oriented Software Development Bruno Harbulot ESNW, the University of Manchester http://www.cs.man.ac.uk/~harbulob/ ELF Developers' Forum Manchester - October 2005 1/24 Presentation

More information

Course 7 25 November Adrian Iftene

Course 7 25 November Adrian Iftene Course 7 25 November 2013 Adrian Iftene adiftene@info.uaic.ro 1 Recapitulation course 6 AOP AOP Profiler Tracing Pooling PostSharp Spring Framework Runtime Verification Model Checking MOP Java MOP 2 Concern

More information

Course 6 7 November Adrian Iftene

Course 6 7 November Adrian Iftene Course 6 7 November 2016 Adrian Iftene adiftene@info.uaic.ro 1 Recapitulation course 5 BPMN AOP AOP Cross cutting concerns pointcuts advice AspectJ Examples In C#: NKalore 2 BPMN Elements Examples AOP

More information

Spring framework was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003.

Spring framework was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003. About the Tutorial Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. Spring framework

More information

No Fluff, Just Stuff Anthology

No Fluff, Just Stuff Anthology Extracted from: No Fluff, Just Stuff Anthology The 2006 Edition This PDF file contains pages extracted from No Fluff, Just Stuff Anthology, published by the Pragmatic Bookshelf. For more information or

More information

Program Transformation with Reflective and Aspect-Oriented Programming

Program Transformation with Reflective and Aspect-Oriented Programming Program Transformation with Reflective and Aspect-Oriented Programming Shigeru Chiba Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology, Japan Abstract. A meta-programming technique

More information

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP 2013 Empowering Innovation DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP contact@dninfotech.com www.dninfotech.com 1 JAVA 500: Core JAVA Java Programming Overview Applications Compiler Class Libraries

More information

Encapsulation in Java

Encapsulation in Java Encapsulation in Java EECS2030: Advanced Object Oriented Programming Fall 2017 CHEN-WEI WANG Encapsulation (1.1) Consider the following problem: A person has a name, a weight, and a height. A person s

More information

Sitesbay.com. A Perfect Place for All Tutorials Resources. Java Projects C C++ DS Interview Questions JavaScript

Sitesbay.com.  A Perfect Place for All Tutorials Resources. Java Projects C C++ DS Interview Questions JavaScript Sitesbay.com A Perfect Place for All Tutorials Resources Java Projects C C++ DS Interview Questions JavaScript Core Java Servlet JSP JDBC Struts Hibernate Spring Java Projects C C++ DS Interview Questions

More information

AJDT: Getting started with Aspect-Oriented Programming in Eclipse

AJDT: Getting started with Aspect-Oriented Programming in Eclipse AJDT: Getting started with Aspect-Oriented Programming in Eclipse Matt Chapman IBM Java Technology Hursley, UK AJDT Committer Andy Clement IBM Java Technology Hursley, UK AJDT & AspectJ Committer Mik Kersten

More information

Page 1

Page 1 Java 1. Core java a. Core Java Programming Introduction of Java Introduction to Java; features of Java Comparison with C and C++ Download and install JDK/JRE (Environment variables set up) The JDK Directory

More information

Enterprise Informatization LECTURE

Enterprise Informatization LECTURE Enterprise Informatization LECTURE Piotr Zabawa, PhD. Eng. IBM/Rational Certified Consultant e-mail: pzabawa@pk.edu.pl www: http://www.pk.edu.pl/~pzabawa/en 07.10.2011 Lecture 7 Aspect-Oriented Programming

More information

Take Control with AspectJ

Take Control with AspectJ Hermod Opstvedt Chief Architect DnB NOR ITUD Common components Hermod Opstvedt Slide 1 What is AspectJ? Aspect-oriented programming (AOP) is a technique for improving separation of concerns. Crosscutting

More information

Fast Track. Evaluation Copy. to Spring 3.x. on Eclipse/Tomcat. LearningPatterns, Inc. Courseware. Student Guide

Fast Track. Evaluation Copy. to Spring 3.x. on Eclipse/Tomcat. LearningPatterns, Inc. Courseware. Student Guide Fast Track to Spring 3.x on Eclipse/Tomcat LearningPatterns, Inc. Courseware Student Guide This material is copyrighted by LearningPatterns Inc. This content and shall not be reproduced, edited, or distributed,

More information

Specialized - Mastering Spring 4.2

Specialized - Mastering Spring 4.2 Specialized - Mastering Spring 4.2 Code: Lengt h: URL: TT3330-S4 5 days View Online The Spring framework is an application framework that provides a lightweight container that supports the creation of

More information

Enterprise AOP with Spring Applications IN ACTION SAMPLE CHAPTER. Ramnivas Laddad FOREWORD BY ROD JOHNSON MANNING

Enterprise AOP with Spring Applications IN ACTION SAMPLE CHAPTER. Ramnivas Laddad FOREWORD BY ROD JOHNSON MANNING Enterprise AOP with Spring Applications IN ACTION SAMPLE CHAPTER Ramnivas Laddad FOREWORD BY ROD JOHNSON MANNING AspectJ in Action Second Edition by Ramnivas Laddad Chapter 1 Copyright 2010 Manning Publications

More information

Spring. Paul Jensen Principal, Object Computing Inc.

Spring. Paul Jensen Principal, Object Computing Inc. Spring Paul Jensen Principal, Object Computing Inc. Spring Overview Lightweight Container Very loosely coupled Components widely reusable and separately packaged Created by Rod Johnson Based on Expert

More information

C C C C++ 2 ( ) C C++ 4 C C

C C C C++ 2 ( ) C C++ 4 C C # 7 11 13 C 4 8 11 20 C 9 11 27 C++ 1 10 12 4 C++ 2 11 12 11 C++ 3 12 12 18 C++ 4 C++ 5 13 1 8 ( ) 14 1 15 C++ 15 1 22 2 (D) ( ) C++ 3 7 new delete 4 5 1. 0 99 1000 0 99. 0 hist[ r ]++; (*(hist + r ))++;

More information

What is Transaction? Why Transaction Management Required? JDBC Transaction Management in Java with Example. JDBC Transaction Management Example

What is Transaction? Why Transaction Management Required? JDBC Transaction Management in Java with Example. JDBC Transaction Management Example JDBC Transaction Management in Java with Example Here you will learn to implement JDBC transaction management in java. By default database is in auto commit mode. That means for any insert, update or delete

More information

Business Logic and Spring Framework

Business Logic and Spring Framework Business Logic and Spring Framework Petr Křemen petr.kremen@fel.cvut.cz Winter Term 2017 Petr Křemen (petr.kremen@fel.cvut.cz) Business Logic and Spring Framework Winter Term 2017 1 / 32 Contents 1 Business

More information

POJOs to the rescue. Easier and faster development with POJOs and lightweight frameworks

POJOs to the rescue. Easier and faster development with POJOs and lightweight frameworks POJOs to the rescue Easier and faster development with POJOs and lightweight frameworks by Chris Richardson cer@acm.org http://chris-richardson.blog-city.com 1 Who am I? Twenty years of software development

More information

Chapitre 6 Programmation orientée aspect (AOP)

Chapitre 6 Programmation orientée aspect (AOP) 6 Programmation orientée aspect (AOP) 2I1AC3 : Génie logiciel et Patrons de conception Régis Clouard, ENSICAEN - GREYC «L'homme est le meilleur ordinateur que l'on puisse embarquer dans un engin spatial...

More information

This tutorial will take you through simple and practical approaches while learning AOP framework provided by Spring.

This tutorial will take you through simple and practical approaches while learning AOP framework provided by Spring. About the Tutorial One of the key components of Spring Framework is the Aspect Oriented Programming (AOP) framework. Aspect Oriented Programming entails breaking down program logic into distinct parts

More information

JML and Aspects: The Benefits of

JML and Aspects: The Benefits of JML and Aspects: The Benefits of Instrumenting JML Features with AspectJ Henrique Rebêlo Sérgio Soares Ricardo Lima Paulo Borba Márcio Cornélio Java Modeling Language Formal specification language for

More information

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum Copyright Descriptor Systems, 2001-2010. Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum Copyright Descriptor Systems, 2001-2010. Course materials

More information

Simple Stateless with Descriptor

Simple Stateless with Descriptor Simple Stateless with Descriptor Example simple-stateless-with-descriptor can be browsed at https://github.com/apache/tomee/tree/master/examples/simple-stateless-withdescriptor This test is similar to

More information

Enterprise Java in 2012 and Beyond From Java EE 6 To Cloud Computing

Enterprise Java in 2012 and Beyond From Java EE 6 To Cloud Computing Enterprise Java in 2012 and Beyond From Java EE 6 To Cloud Computing Jürgen Höller, Principal Engineer, SpringSource 2012 SpringSource, A division of VMware. All rights reserved Deployment Platforms: Becoming

More information

Modular Java Applications with Spring, dm Server and OSGi

Modular Java Applications with Spring, dm Server and OSGi Modular Java Applications with Spring, dm Server and OSGi Copyright 2005-2008 SpringSource. Copying, publishing or distributing without express written permission is prohibit Topics in this session Introduction

More information

Call: Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline

Call: Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline Core&Advanced Java Springframeworks Course Content:35-40hours Course Outline Object-Oriented Programming (OOP) concepts Introduction Abstraction Encapsulation Inheritance Polymorphism Getting started with

More information

Decorator Pattern. Decorator Pattern. Decorator Problems Decorator Examples Proxy Pattern. Motivation Structure Decorator vs Inheritance vs Strategy

Decorator Pattern. Decorator Pattern. Decorator Problems Decorator Examples Proxy Pattern. Motivation Structure Decorator vs Inheritance vs Strategy Decorator Pattern Decorator Pattern Motivation Structure Decorator vs Inheritance vs Strategy Decorator Problems Decorator Examples Proxy Pattern 1 Vibrating & Skin Phones 2 Implementation with Inheritance

More information

Integration of Application Business Logic and Business Rules with DSL and AOP

Integration of Application Business Logic and Business Rules with DSL and AOP Integration of Application Business Logic and Business Rules with DSL and AOP Bogumiła Hnatkowska and Krzysztof Kasprzyk Wroclaw University of Technology, Wyb. Wyspianskiego 27 50-370 Wroclaw, Poland Bogumila.Hnatkowska@pwr.wroc.pl

More information

Desarrollo de Aplicaciones Web Empresariales con Spring 4

Desarrollo de Aplicaciones Web Empresariales con Spring 4 Desarrollo de Aplicaciones Web Empresariales con Spring 4 Referencia JJD 296 Duración (horas) 30 Última actualización 8 marzo 2018 Modalidades Presencial, OpenClass, a medida Introducción Over the years,

More information

Aspect-oriented programming with AspectJ

Aspect-oriented programming with AspectJ www.ijcsi.org 212 Aspect-oriented programming with AspectJ Daniela Gotseva 1 and Mario Pavlov 2 1 Computer Systems Department, Technical University of Sofia Sofia, Bulgaria 2 Computer Systems Department,

More information

ADVANCED JAVA TRAINING IN BANGALORE

ADVANCED JAVA TRAINING IN BANGALORE ADVANCED JAVA TRAINING IN BANGALORE TIB ACADEMY #5/3 BEML LAYOUT, VARATHUR MAIN ROAD KUNDALAHALLI GATE, BANGALORE 560066 PH: +91-9513332301/2302 www.traininginbangalore.com 2EE Training Syllabus Java EE

More information

Spring, a J2EE extension framework. JUGS presentation by Philipp H. Oser

Spring, a J2EE extension framework. JUGS presentation by Philipp H. Oser Spring, a J2EE extension framework JUGS presentation by Philipp H. Oser 30.08.2005 Agenda 1 Introduction Context Essential spring Demo Spring in more details More spring features: configuration, interceptors,

More information

Seasar2.3. Yasuo Higa Seasar Foundation/Chief Committer Translated by:h.ozawa

Seasar2.3. Yasuo Higa Seasar Foundation/Chief Committer   Translated by:h.ozawa Seasar2.3 Yasuo Higa Seasar Foundation/Chief Committer http://www.seasar.org/en 1 I want to ask this question to every developer in the world, DO YOU REALLY WANT TO WRITE CONFIGURATION FILES? Seasar2 saves

More information

Mobile and Context-aware Interactive Systems

Mobile and Context-aware Interactive Systems Mobile and Context-aware Interactive Systems Gaëlle Calvary Grenoble INP Laboratoire d Informatique de Grenoble (LIG) Core concepts Principles Terminology For more information, see Sara Bouchenak s M1

More information

Exception-Handling Overview

Exception-Handling Overview م.عبد الغني أبوجبل Exception Handling No matter how good a programmer you are, you cannot control everything. Things can go wrong. Very wrong. When you write a risky method, you need code to handle the

More information

BEAAquaLogic. Service Bus. Interoperability With EJB Transport

BEAAquaLogic. Service Bus. Interoperability With EJB Transport BEAAquaLogic Service Bus Interoperability With EJB Transport Version 3.0 Revised: February 2008 Contents EJB Transport Introduction...........................................................1-1 Invoking

More information

Meta-Program and Meta-Programming

Meta-Program and Meta-Programming Meta-Program and Meta-Programming What is a Meta-Programming? The creation of procedures and programs that automatically construct the definitions of other procedures and programs. First example the Turing

More information

G l a r i m y Training on. Spring Framework

G l a r i m y Training on. Spring Framework http://www.glarimy.com Training on Spring Framework Krishna Mohan Koyya Technology Consultant & Corporate Trainer krishna@glarimy.com www.glarimy.com 091-9731 4231 66 [Visit the portal for latest version

More information

More on Exception Handling

More on Exception Handling Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2

More information

Table of Contents. Tutorial API Deployment Prerequisites... 1

Table of Contents. Tutorial API Deployment Prerequisites... 1 Copyright Notice All information contained in this document is the property of ETL Solutions Limited. The information contained in this document is subject to change without notice and does not constitute

More information

Advances in Aspect-oriented Programming

Advances in Aspect-oriented Programming Advances in Aspect-oriented Programming Ramnivas Laddad Principal, Interface21 Author, AspectJ in Action ramnivas.laddad@interface21.com About Speaker Principal at Interface21 Specializing in aspect-oriented

More information

More on Exception Handling

More on Exception Handling Chapter 18 More on Exception Handling Lecture slides for: Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2

More information

GenUTest: An Automatic Unit Test & Mock Aspect Generation Tool

GenUTest: An Automatic Unit Test & Mock Aspect Generation Tool Tel Aviv University The Raymond and Beverly Sackler Faculty of Exact Sciences GenUTest: An Automatic Unit Test & Mock Aspect Generation Tool Thesis submitted in partial fulfillment of the requirements

More information

Fast Track to Spring 3 and Spring Web Flow 2.1

Fast Track to Spring 3 and Spring Web Flow 2.1 Fast Track to Spring 3 and Spring Web Flow 2.1 on Tomcat/Eclipse LearningPatterns, Inc. Courseware Student Guide This material is copyrighted by LearningPatterns Inc. This content and shall not be reproduced,

More information

Spring JavaConfig Reference Guide

Spring JavaConfig Reference Guide Spring JavaConfig Reference Guide Version 1.0.0.m4-SNAPSHOT Copyright 2005-2008 Rod Johnson, Costin Leau, Chris Beams Copies of this document may be made for your own use and for distribution to others,

More information

Call: JSP Spring Hibernate Webservice Course Content:35-40hours Course Outline

Call: JSP Spring Hibernate Webservice Course Content:35-40hours Course Outline JSP Spring Hibernate Webservice Course Content:35-40hours Course Outline Advanced Java Database Programming JDBC overview SQL- Structured Query Language JDBC Programming Concepts Query Execution Scrollable

More information

Lecture 5: Methods CS2301

Lecture 5: Methods CS2301 Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int

More information

Chair of Software Engineering. Java and C# in depth. Carlo A. Furia, Marco Piccioni, Bertrand Meyer. Java: reflection

Chair of Software Engineering. Java and C# in depth. Carlo A. Furia, Marco Piccioni, Bertrand Meyer. Java: reflection Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: reflection Outline Introductory detour: quines Basic reflection Built-in features Introspection Reflective method invocation

More information

Unit-Testing Aspectual Behavior

Unit-Testing Aspectual Behavior Unit-Testing Aspectual Behavior [Position Paper] Cristina Videira Lopes and Trung Chi Ngo Donald Bren School of Information and Computer Sciences University of California, Irvine Irvine, CA 92697 {lopes,trungcn}@ics.uci.edu

More information

A Brief Introduction to Aspect-Oriented Programming. Historical View Of Languages. Procedural language Functional language Object-Oriented language

A Brief Introduction to Aspect-Oriented Programming. Historical View Of Languages. Procedural language Functional language Object-Oriented language A Brief Introduction to Aspect-Oriented Programming Historical View Of Languages Procedural language Functional language Object-Oriented language 1 Acknowledgements Zhenxiao Yang Gregor Kiczales Procedural

More information

A Brief Introduction to Aspect-Oriented Programming" Historical View Of Languages"

A Brief Introduction to Aspect-Oriented Programming Historical View Of Languages A Brief Introduction to Aspect-Oriented Programming" Historical View Of Languages" Procedural language" Functional language" Object-Oriented language" 1 Acknowledgements" Zhenxiao Yang" Gregor Kiczales"

More information

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module Java Platform, Enterprise Edition 5 (Java EE 5) Core Java EE Java EE 5 Platform Overview Java EE Platform Distributed Multi tiered Applications Java EE Web & Business Components Java EE Containers services

More information

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009 Enterprise Java Development using JPA, Hibernate and Spring Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009 About the Speaker Enterprise Architect Writer, Speaker, Editor (InfoQ)

More information

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

(800) Toll Free (804) Fax   Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented

More information

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX Duration: 5 Days US Price: $2795 UK Price: 1,995 *Prices are subject to VAT CA Price: CDN$3,275 *Prices are subject

More information

2005, Cornell University

2005, Cornell University Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson bh79@cornell.edu Agenda Kuali Application Architecture CATS Case Study CATS Demo CATS Source

More information

To Mediate is the Message (a brief history of indirection) Glen Daniels Independent Technologist

To Mediate is the Message (a brief history of indirection) Glen Daniels Independent Technologist To Mediate is the Message (a brief history of indirection) Glen Daniels Independent Technologist glen@thoughtcraft.com Your Presenter What You re Going To Learn Today A Brief History of Indirection and

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Aspect-Oriented Programming

Aspect-Oriented Programming Aspect-Oriented Programming Harald Gall University of Zurich seal.ifi.uzh.ch/ase Source: http://www.eclipse.org/aspectj/doc/released/progguide/starting-aspectj.html Programming paradigms Procedural programming

More information

Introducing the Spring framework

Introducing the Spring framework Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Introducing the Spring framework Marco Piccioni Yet another framework? It addresses areas that other frameworks

More information

A Unit Testing Framework for Aspects without Weaving

A Unit Testing Framework for Aspects without Weaving A Unit Testing Framework for Aspects without Weaving Yudai Yamazaki l01104@sic.shibaura-it.ac.jp Kouhei Sakurai sakurai@komiya.ise.shibaura-it.ac.jp Saeko Matsuura matsuura@se.shibaura-it.ac.jp Hidehiko

More information

Ron Bodkin. New Aspects of Software Colorado Software Summit: October 22 27, 2006

Ron Bodkin. New Aspects of Software Colorado Software Summit: October 22 27, 2006 Using the Spring Framework for Aspect-Oriented Programming Ron Bodkin New Aspects of Software rbodkin@newaspects.com Rod Bodkin Using the Spring Framework for Aspect-Oriented Programming Page 1 This Talk

More information

Incremental improvements for the Spring Framework

Incremental improvements for the Spring Framework Incremental improvements for the Spring Framework I am working as an architect for a middle-sized software development company, where we have been actively using J2EE extension frameworks for the last

More information

So, What is an Aspect?

So, What is an Aspect? Introduction to AspectJ Aspect-oriented paradigm AspectJ constructs Types of Join Points Primitive Lexical designators Type designators Control flow Types of Advice Before After Around Receptions Join

More information

Atelier Java - J2. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Atelier Java - J2. Marwan Burelle.   EPITA Première Année Cycle Ingénieur. marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 1 2 Notions of interfaces describe what an object must provide without describing how. It extends the types name strategy to provide

More information

Le L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling

Le L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling Course Name: Advanced Java Lecture 5 Topics to be covered Exception Handling Exception HandlingHandlingIntroduction An exception is an abnormal condition that arises in a code sequence at run time A Java

More information

Introduction to Reflection

Introduction to Reflection Introduction to Reflection Mark Allen Weiss Copyright 2000 1 What is Reflection The Class class Outline of Topics Run Time Type Identification (RTTI) Getting Class Information Accessing an arbitrary object

More information

Mapping Features to Aspects

Mapping Features to Aspects Mapping Features to Aspects The Road from Crosscutting to Product Lines (Work in Progress) Roberto E. Lopez-Herrejon Computing Laboratory Oxford University 1 Motivation Features Feature Informally: A characteristic

More information

Chapter 7. Modular Refactoring. 7.1 Introduction to Modular Refactoring

Chapter 7. Modular Refactoring. 7.1 Introduction to Modular Refactoring Chapter 7 Modular Refactoring I n this chapter, the role of Unified Modeling Language (UML) diagrams and Object Constraint Language (OCL) expressions in modular refactoring have been explained. It has

More information

Spring and OSGi. Martin Lippert akquinet agile GmbH Bernd Kolb Gerd Wütherich

Spring and OSGi. Martin Lippert akquinet agile GmbH Bernd Kolb Gerd Wütherich Spring and OSGi Martin Lippert akquinet agile GmbH lippert@acm.org Bernd Kolb b.kolb@kolbware.de Gerd Wütherich gerd@gerd-wuetherich.de 2006 by Martin Lippert, Bernd Kolb & Gerd Wütherich, made available

More information

Frequently Asked Questions about POJO Cache

Frequently Asked Questions about POJO Cache Frequently Asked Questions about POJO Cache Ben Wang Scott Marlow Jason Greene Release 3.0.0 November 2008 These are frequently asked questions regarding POJO Cache. General Information Q: What is POJO

More information

Chapter 13 Exception Handling

Chapter 13 Exception Handling Chapter 13 Exception Handling 1 Motivations When a program runs into a runtime error, the program terminates abnormally. How can you handle the runtime error so that the program can continue to run or

More information

WHAT IS EJB. Security. life cycle management.

WHAT IS EJB. Security. life cycle management. EJB WHAT IS EJB EJB is an acronym for enterprise java bean. It is a specification provided by Sun Microsystems to develop secured, robust and scalable distributed applications. To run EJB application,

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

SPRING DECLARATIVE TRANSACTION MANAGEMENT

SPRING DECLARATIVE TRANSACTION MANAGEMENT SPRING DECLARATIVE TRANSACTION MANAGEMENT http://www.tutorialspoint.com/spring/declarative_management.htm Copyright tutorialspoint.com Declarative transaction management approach allows you to manage the

More information

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java COURSE DETAILS: CORE AND ADVANCE JAVA Core Java 1. Object Oriented Concept Object Oriented Programming & its Concepts Classes and Objects Aggregation and Composition Static and Dynamic Binding Abstract

More information