aop

Interesting AOP question on a cross cutting concern?

Consider a set of DOAs with methods similar to this public void addObject(Long sessionId, Long clientId, Dom obj){...} Now every domain pojo (Dom) has a sessionId property and for every insert, update or delete on a domain object a sessionId must be passed with setSessionId(Long sessionId)so we can know who does what. But it seems tha...

Config files containing environment-specific settings

In my organization we have multiple environments (Dev, QA, Stage, Prod, Disaster Recovery) and I would like my app/web.config files to contain no environment specific details in URIs, connections strings, etc. My preferred approach would be to perform run-time substitution, e.g. Instead of this: <endpoint address="http://MyDevWebServer/...

Best Aspect Oriented Framework for features / build performances in .net

Hi, In various projects I worked with, we had to use some AOP or dependency injection framework. We used Enterprise LIbrary, Unity and PostSharp. For now, Postsharp is my best choice when it comes to the flexibiity I get over how I generate my aspects. The only problem is the build time required once PostSharp is installed. My dev...

Software Applications Designs

Is strict OOD/Interface-based design/Aspect oriented design is desirable in case of a software application development? Or, is it desirable to mix all of them for the ease of coding? Are all successful and highly maintainable software applications strictly Object oriented, or, strictly Interface oriented, or, strictly Aspect Oriented, ...

What is the best way to "adorn objects with functionality"?

I made the example below which enables a factory to pack objects with functionality, but the problem is that the functionality is divorced from the object. My ultimate goal is attach functionality such as log, and save and display which operates on the specific properties that each different object has. How would I keep the exterior a...

PostSharp: Custom attributes are removed when using OnMethodInvocationAspect

I've got some aspect like this: public class MyAttribute : OnMethodInvocationAspect { public int Offset { get; internal set; } public MyAttribute(int offset) { this.Offset = offset; } public override void OnInvocation(MethodInvocationEventArgs eventArgs) { //do some stuff } } Now I'm havi...

Marking a 3rd party class property as required (Java/Spring)

Recently, I hit a very perplexing error while trying to clean up my spring configs. The exception was being thrown from deep within a third party library and was basically an obfuscated NPE. What I would like to be able to do is configure spring to require a specific field on this class as being required, but I do not want to build a cu...

Refactoring nasty legacy systems via AOP or other automated means?

I've recently been playing around with PostSharp, and it brought to mind a problem I faced a few years back: A client's developer had produced a web application, but they had not given a lot of thought to how they managed state information - storing it (don't ask me why) statically on the Application instance in IIS. Needless to say the ...

Traditional logging vs AOP logging

I'm starting this new project and we are thrashing out our logging/debugging approach and I wanted to put the question to the rest of you on SO, given private final static Logger logger = LoggerFactory.getLogger(getClass()); ... public void doSumething(){ ... if(logger.isDebugEnabled()) logger.debug("..."); } or @After("executio...

Whats the difference between PostSharp and Castle Dynamic Proxy?

Just wondering what the main differences are between these libraries, how they differ in features and functionality. Hoping for more information than I could find with a Google query... ...

AspectJ problem

Hi I am new to AspectJ and I would like to find out if creating variants of a class using Aspects - I will create another instance of the class as well? ...

Gang-of-four pattern usage in aspect-oriented-programming?

I am doing research on a SOA topic and i am trying to understand what gang of four say about aspect orientation. I also need to implement one of these pattern in AOP paradigm. What would be best pattern to pick for this? ...

Need Method Entry and Exit event in .net

Hi, I like to have event like OnMethodEntry and OnMethodExit which will be used to raise an event when a method in a class is getting invoked in C#.NET. I have seen Post Sharp which give this feature. Since it is third party tool, we like to design a library something similar to that. How can I do that? Thanks, P.Gopalakrishnan. ...

How to automatically create and inject a proxy of a missing dependency?

Given the following classes: package com.acme; public class Foo { private Bar bar; public void setBar(Bar newBar) { this.bar = newBar; } } @AcmeService public interface Bar {} and a Spring configuration file of: <beans> <bean id="foo" class="com.acme.Foo"> <property name="bar" ref="bar" /> </bean> </beans> when ...

Has anybody used any AOP products under Mono?

I'm looking into using PostSharp on one of my projects. The complicating factor is that I need PostSharp to work on both Windows x64 and Linux x64/Mono. According to the available info for PostSharp, you can compile on Windows/.NET and run under both .NET and Mono. The question is this: can I perform PostSharp builds on Linux/Mono? ...

Invalid compiler-generated .NET Class Name

I was going through Getting Started (with PostSharp) And when I saw PostSharp injected (is this expression is right?) an aspect code into assembly, I saw this oddly named class marked with CompilerGeneratedAttribute. It is named <>AspectsImplementationDetails_1. As far as I know, class name cannot be started with <>. But how is it po...

System.AccessViolationException with Dynamic Proxy Generation

We are using PostSharp to inject caching functionality, we are only seeing this issue when we are using it. When we use Spring the issue seems to go away. Any help would be appreciated as this, the issue is very difficult to replicate. I've included the stack trace below: Attempted to read or write protected memory. This is often an in...

.NET Conditional Compiler Symbols and Unit Test Libraries

My team has a set of unit test libraries that run against our application code - unfortunately they are throwing (unexpected) exceptions. The reason for this is that our logging code is being called and the objects aren't setup. The logging code is executed via a method attribute we have setup using PostSharp (which get called before and...

Accessing jax-rs (CXF) MessageContext outside service class in Spring (2.5)

Hey All, I'm trying to access the MessageContext (or WebServiceContext) in an aspect to get access to the HTTPServletRequest for logging purposes. I would like to inject the context like I did for spring-ws but I have not found a way to do it. Here is what I used for spring-ws: <beans:bean id="transportContext" class="org.springframewo...

Would aspect oriented programming be a positive addition to the C# language?

I've had some interesting debates with colleagues about the merits if incorporating aspect oriented programming as a native paradigm to the C# language. The debate seems to be divided into three camps: Those folks who think that C# is already too complicated as it is, and another major feature like AOP would only muddy the waters furt...