Search |
||
Practical AOP (Part 1): Transparent remoting with AOP and EJBsPosted by mister__m on December 17, 2004 at 1:44 PM PST
There are basically four views about AOP nowadays (ok, it's more or less the same for any technology): those who think it's the golden hammer and everything is a nail, those who think it has some applicability, those who are strongly against it or have deep concerns about its wild adoption and those who simply couldn't care less about it. :-) I hope this kind of posts I intend to write help all the four groups in some way. Let's start with an example most people are familiar with: remoting. Many technologies try to address remoting with different approaches - RMI, CORBA, EJB, webservices etc. - and each one has its own applicability, since most of them (are intended to) do more than just remoting. Also, these technologies can be implemented in several ways - consider the way EJB implementations in application servers has evolved, as an example. So, let's narrow our requirements for this case of study:
In a simple way, we want EJB benefits without any of its limitations. How could we implement this? Using genesis this should be as hard as:
public class RemoteClass implements java.io.Serializable {
/**
* @Remotable
*/
public void helloWorld() {
System.out.println("Hello world");
}
}
public class Client {
public static void main(String[] args) {
RemoteClass remote = new RemoteClass();
remote.helloWorld();
}
}
If you run this example using a genesis empty-project based structure, putting RemoteClass in your shared sources dir and Client in your client sources dir you will see that genesis' aspect named net.java.dev.genesis.aspect.EJBCommandExecutionAspect intercepts execution of methods annotated as For further information about how this actually is implemented by genesis, refer to the documentation pages for genesis aspects and genesis business component model. »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|