aop

How to intercept all Hibernate sessions when they're created (Spring / Grails environment)

Is there a way of intercepting all new Hibernate sessions when they're created? I need to access each Session instance to enable a Hibernate filter with a parameter. The only solution I've gotten working has involved wrapping the SessionFactory, but this involved a lot of semi nasty hacks as well as it required me to implement around 6...

GWT Spring Integration - How to do AOP logging?

I have a GWT application where its RPC services are handled by a GWTHandler bean so that it can integrate with Spring smoothly. The application works. No problem with that. My issue is I can't do any AOP logging with Spring. I like to log user activities from the GWT interface using AOP. (I could of course do it the old way of calling ...

First Struts2 application with AOP

Hi, i want to make an web app based on appfuse-basic-struts maven archetype. My goal is to add AOP with the simplest way, I never used AOP before, so could someone help me with this? Any tutorial - how to add and use it? Any good AOP solution ? (AspectJ/Spring AOP) Any advice on how to write it? ...

AspectJ Load time weaver doesn't detect all classes

Hi, I am using Spring's declarative transactions (the @Transactional annotation) in "aspectj" mode. It works in most cases exactly like it should, but for one it doesn't. We can call it Lang (because that's what it's actually called). I have been able to pinpoint the problem to the load time weaver. By turning on debug and verbose logg...

Intercept Unity 2.0 HandlerAttribute without an interface.

Hi there. I'm a first-time user of the AOP features of Unity 2.0 and would like some advice. My goal is to be able to log method calls in an ASPX page, like so: public partial class Page2 : Page { protected void Page_Load(object sender, EventArgs e) { } [Log] private void Testing() {...

can't weave, please help

Need to modify Log4PostSharp project by inheriting from the ready-made (and working) custom attribute. It looks similar to this: [AttributeUsage( AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Module | AttributeTargets.Struct, AllowMultiple = true,...

APT and AOP in the same project, using Maven

I have to use Annotation Processing (apt) and AspectJ in the same Maven project. Both work for themselves, but I need to create aspects based on code created by apt. So I would need binary weaving (the original source files are extended by apt). How can I enable binary weaving within a maven project? I know the only standard option is ...

PostSharp access to original attribute markup string parameter

I have a POstSHarp attribute implementing OnMethodBoundaryAspect. The mark up is as follows: [ExceptionLogging("RepositoryLayer")] What I want to do within the implementation of the aspect is access the string that was passed with the attribute markup above. The idea is that based on this value I can see (in a very rudimnentary manner...

JavaScript global logging

Hi, is it possible to add some global exception listener in javascript? Let's say I have JS function: function log(message) { alert('logged: ' + message); } and I want to invoke it if any exception occurs on page. It is well known that aop is ideal for that case, but is there any really useful library which has that well advise-poi...

Can I annotate a method as cacheable in Spring?

I would like to use an annotation that marked the result of a method call as cacheable. When provided it would use a caching provider to cache the output for the given input. For example: @Cacheable public Bar doExpensiveCalculation(Foo foo) { Bar bar = jiggeryPokeryWith(foo); return bar; } ... Foo foo1 = new Foo(...); Foo foo...

PostSharp - What am I doing Wrong?

Hello, I have a project Company.Business that I'm trying to target with PostSharp to wrap my business layer. In the project Company.AOP, I have a method boundary aspect to use EL logging application block as such: [Serializable] public class MethodExcecutionAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodEx...

using AOP in web context and affection on performance

Hi I have a web application running most of my services through web services. first i want to know how much degradation in performance would take place using AOP in web context for example if i can handle 200 request/second without AOP, what would be the result with it (having simple logging and authorization) Is there any great AOP f...

Logging Entity changes in Java Web Application

Hi, We have a requirement on our project, where we need to maintain a sort of history of changes that are made to certain Entities in the Application. The the Application is a Java Web App based on Struts, Spring and Hibernate. What sort of approaches have been used in this case ? Triggers on the respective tables is one idea but the...

Javascript AOP support

It is easy enough (for 90% of aop features) to do it without any support being the language itself, like in most dynamic languages like python and ruby. However, Dojo had direct support for it on 1.3.2. What happened in the latest versions? Did they remove it? Is there another javascript aop library that should get more attention? ...

Aspect-oriented programming in android

What would be the best way to implement Aspect-oriented programming (AOP) in an Android application? Would it be efficient with the mobile battery? ...

Compile-time weaving configuration

I am trying to convert my load-time-woven aspectj to compile-time-woven. So I removed <context:load-time-weaver/> from my spring config, and added an aspectj compiler to my pom.xml. But I don't know how to convert the info in META-INF/aop.xml. I have something like this in there: <!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" ...

Spring.Net Before Advice not working

Hi everybody, I am trying to implement a very basic before advice with Spring.Net, that just prints some information to the console. Here is the relevant part of the spring config: <!-- Before Advice: Method Logging --> <object id="methodLoggingBeforeAdvice" type="Ch.Test.AddressBook.Common.Advice.MethodLoggingBeforeAdvice" />...

C# AOP Method Interception on child method calls?

My AOP (C#) implementation always intercepts the first (public) method call but not subsequent methods called within the first intercepted method, is this a limitation with ContextBoundObject AOP implementations or am I doing it wrong? [InterceptMe] public void MethodOne() { MethodTwo(); } [InterceptMe] public void MethodTwo() { ...

spring 3.0 aop Pointcut is not well-formed: expecting 'name pattern' error

The following is my pointcut and advise declaration //PointCut on A method which takes two parameters and is in a DAO @Pointcut("execution(backend.repository.QuestionsRepository.AnswerQuestion (..))") public void answerQuestionPointCut() {} @Around( value="web.activity.advisors.UserActivityAdvisor.answerQuestionPointCut()", arg...

AOP x IoC for caching

Do you prefer the clean approach of an AOP cache layer on top of your methods (any DAO or service method) OR do you prefer the total control approach of injecting a cache instance wherever you need? I understand AOP gives you loose coupling and separation of concerns, but not so much flexibility, unless you are coding the method interce...