Environment: JDK1.6, Spring 2.5.0
I have a Javabean "Service" which provides a number of services:
An access control configuration determines if service X would beCode:Service { A() ; B() ; //... }
available. Instead of having the bean "Service" consult the
access control, I would like to create a dynamic proxy of "Service" -
say "ServiceP", have it evaluate the access control and invoke
Service:X() or decline:
Is this an appropriate application of dynamic proxy andCode:class Service { @Condition("foo") public void A() { /* ... do A ... */ } @Condition("bar") public void B() { /* ... do B ... */ } public void freeForAll() { /* ... do freeForAll ... */ } } class ServiceP /* dynamic proxy of Service */ { public void A() { // check if condition "foo" is true // If yes, call Service.A() // If not, print error // } public void B() { // check if condition "bar" is true // If yes, call Service.B() // If not, print error // } public void freeForAll() { // No conditions annotated - // call Service.B() // } }
AOP? If so, could you please point me to an illustrative
example?
Tx,
/U


Reply With Quote