17
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering Lab Vrije Universiteit Brussel ECOOP Workshop

Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Embed Size (px)

Citation preview

Page 1: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Modularizing Web Services Management with AOP

María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be

System and Software Engineering LabVrije Universiteit Brussel

ECOOP Workshop

Page 2: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

• Introduction– Web Services– Aspect Oriented Programming

• Web Services Management Layer– Architecture– JAsCo Technology– Redirection Mechanism and Hot Swapping– Service Management

• Conclusions

Overview

Page 3: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Introduction

• Web Services– Independent modules

• Described, published, localised and invoked over a network using XML-standards

– Integrated in client-applications using the Wrapper Approach

• Automatically generate client-stub and treat service as an internal component

• Used in Visual Studio.NET, Bea Web Logic, etc

Page 4: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Introduction

• Problem Statement– Services are hard-wired in application

• How to adapt to changes?• What if service or network fails?• How to deal with other service related issues?

– Checking of availability, switching to other services, dealing with billing, security, logging, etc

– Needs to be provided manually by the programmer– Results scattered and tangled in the application

Use AOP to achieve better separation of concerns

Page 5: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Introduction

• Aspect Oriented Programming (AOP)– Tyranny of the dominant decomposition

• Impossible to modularize some concerns (e.g. logging) using current software engineering methodologies such as OO.

• As a result code gets scattered all over the system

• AOP Concepts– Modularize these concerns in Aspects– An aspect defines a set of join points– Weavers to weave aspect logic in the core application

Page 6: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

The Wrapper Approach

Page 7: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

E-business application

Web Service

Web Service

Web Service

WSML

Introducing the WSML to decouple Web Servicesfrom the client-application

Page 8: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

Use the WSML to deal with all web service related issues

Page 9: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Core Functionality– Decoupling of Services from application

• Redirection of application requests to service invocations

– Hot-Swapping• Switch between services at runtime

– Advanced Service Selection and Monitoring• Select services based on business driven requirements

– Service Management• Security, logging, billing, transaction management, etc

Page 10: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Use of JAsCo Technology– Dynamic Aspect Oriented Language– Introduces two new concepts:

• Aspect Beans: – specify crosscutting behaviour in a reusable manner:

» When the normal execution of a method should be intercepted

» what extra behaviour should be executed at those points.

• Connectors:– Specify deployment details:

» where the crosscutting behaviour should be deployed.

Page 11: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

Page 12: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Hotel Service Example

Page 13: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Code Example 1

1. Class ListAvailableHotelsAspect {2. hook RedirectionHook {3. RedirectionHook(method(..args)){4. execute(method);5. }6. replace() {7. return specificMethod(args);8. }9. abstract public String specificMethod(args);10. }11. }

Redirection Aspect for the request ListHotels

One Aspect for each request

Hook specifying to replace method (..args) with

specificMethod (args)

specificMethod is specified in the connector

Page 14: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Code Example 1

1. static connector HotelServiceC_listHotels {2. ListAvailableHotelsAspect.RedirectionHook redirectionhook = new 3. ListAvailableHotelsAspect.RedirectionHook(List listHotels(args)){4. public String specificMethod(args) {5. try {6. Stub stub = new Stub (WebServiceC);7. result = stub.listAvailableHotels(args);8. return result;9. }10. catch (ServiceUnavailableException e) {11. WSML.failureNotification ("WebServiceC");12. return asi.HotelServiceASI.listHotels (args);13. }14. }15. }16. redirectionhook.replace();17. }

Connector for WebService C

Connector for each Service Invocation

specificMethod with actual service call

Hook instantiation

Page 15: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

class BillingPerUse { hook BillingHook { private int total = 0; private int cost = 0; public void setCost(int aCost){ cost = aCost; } private void pay(){ total = total + cost; } BillingHook(method (Date d1,Date d2,CityCode cc)) { call(method); } after() { pay(); } }}

Web Services Management Layer

• Code Example 2

Service Management: Billing Aspect

Billing Aspect to bill each time a service is invoked

Billing hook

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.

Page 16: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Web Services Management Layer

• Code Example 2

Service Management: Billing Aspect

Same connector before, now extended with billing hook

Instantiation of the billing hook

static connector HotelServiceC_listHotels {…BillingPerUse.BillingHook billPerUse = new BillingPerUse.BillingHook (List listHotels(args));

billPerUse.setCost(2);redirectionhook.replace();billPerUse.after();}

1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

Page 17: Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, Bart.Verheecke}@vub.ac.be System and Software Engineering

Conclusions

• AOP is suited to modularize Web Service related issues

• Use JAsCo to dynamically hot-swap between services and allow runtime management

• More flexible applications that can easily adapt to changes in the environment