Friday, June 18, 2010

EJB annotations and Stereotyping

Certainly for the EJB-related annotations, I would love to see @Stateless, @Stateful, @Singleton and @MessageDriven be used for stereotyping as well as all the other class level annotations for transactions, security, locking, timeouts and scheduling.

Great security example:

 @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
 public @interface Admins {}
In one swoop all the security rolls become controlled in one spot and there's no need to go changing a million usages to modify the roll names.

Here's a couple great scheduling examples:

 @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”)
 public @interface Daily {}
 @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”)
 public @interface BiMonthly {}
The list goes on and on. A much fuller example:
@RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
@Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class})
public @interface SuperBean {}
And to use all that, just:
public class MyBean {

    public void doSomething() {


Heiko W. Rupp said...

This for sure looks interesting. Would you allow stereotypes to inherit from each other?

For the @Daily stereotype: I voted in the EJB3 cycle to directly have such keywords (basically what you have in newer cron implementations) within @Schedule

David Blevins said...

Sure, I would allow stereotypes to inherit from each other. Having a lot of levels will add indirection and potentially slow down your deployments, but I don't see any issues giving people that choice.

Definitely the cron built-in @hourly @daily, etc. were an inspiration for me as well and I did make this proposal in EJB 3.1 while we were talking about @Schedule. There was definitely interest and we might see it in a future EJB spec -- though likely after EJB 3.2.

I've worked on it in OpenEJB and am hoping to have a prototype in another week.

Narender Godara said...

Packers and movers Kanpur
Packers and movers Karnal
Packers and movers Kolkata
Packers and movers Lucknow

Arjun Singh said...

just for getting new clients and for new promotions at last and so individuals want a organization who are thinking more regarding their clients and working for their specifications and expectations of clients.
Packers and Movers in Bangalore
Packers and Movers in Pune
Packers and Movers in Hyderabad
Packers and Movers in Mumbai

amine lahragui said...

Your work is very good and I appreciate you and hopping for some more informative posts. happy new year 2016 new year 2016 bonne année 2016 happy new year 2016 images feliz año nuevo 2016 imagenes de año nuevo 2016 feliz año 2016

Deepak Negi said...

Hey Guys Must Check these :-

I can do that live show
I can do that live telecast
I can do that Show live streaming
muharram 2015 Images
muharram 2015 Hd Wallpapers
Happy muharram 2015 Quotes
Muharram 2015 Slogans
muharram 2015 Karbala sms
Muharram 2015 Quotes
10 muharram 2015 Talwar Matam Videos
Muharram 2015 Zanjeer Juloos Videos
muharram 2015 Poems
Hazrat Hussain Poetry 2015
muharram 2015 Qawwali Mp3
10 Muharram 2015 shayari
Muharram 2015 Status
Labbaik ya hussain mp3 Songs
Hazrat Hussain Hd Images
Happy Childrens Day 2015 Images
Mastizaade Box Office Collection
Mastizaade Funny Scenes
Mastizaade hd Videos
Mastizaade Hot Scenes
Mastizaade Movie Review
Mastizaade Romantic Scenes
Mastizaade Songs
Mastizaade trailer film
World Aids Day 2015 Quotes
World Aids Day 2015 Posters
World Aids Day 2015 Themes
World Aids Day 2015 Slogans

Mary Brown said...

Java EE article is practical oriented and real time examples. How Java EE address the enterprise development is very important. for that you need a practical orieneted Java Training you need.

Online Java Training
Online Java Training from India
Java Training Institutes in Chennai
Java Training in Chennai
Java Training