History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-198
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Phillip Ghadir
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

EJBInvoker enhancement for real life applications

Created: 20/May/05 11:11 AM   Updated: 26/May/05 10:51 PM
Component/s: Jobs
Affects Version/s: 1.4.5
Fix Version/s: 1.5

File Attachments: 1. Java Source File EJBInvokerJob.java (9 kb)

Environment: Win2k/AIX, BEA WLS, Quartz 1.4.5, SUN JSDK > 1.4.2_05, DB2

Flags: Patch, Important


 Description  « Hide
1.) EJBInvokerJob doesn't support propagation of security settings.

E.g.: I need to call method performDemo(String) on EJB MyDemoService. This method requires to be called by an authorized user in role Presenter.

I would like to provide settings like this:

JobDetail jobDetail = new JobDetail("myJob", sched.DEFAULT_GROUP,
                EJBInvokerJob.class, false, true, false);

HashMap hash = new HashMap();
        hash.put(EJBInvokerJob.EJB_JNDI_NAME_KEY, "THE_JNDI_NAME");
        hash.put(EJBInvokerJob.EJB_METHOD_KEY, "performDemo);
        hash.put(EJBInvokerJob.EJB_ARGS_KEY, new Object[] { "argString" });
        hash.put(EJBInvokerJob.EJB_ARG_TYPES_KEY, new Class[] { String.class } );

hash.put(InitialContext.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        hash.put(InitialContext.SECURITY_PRINCIPAL, "theUser");
        hash.put(InitialContext.SECURITY_CREDENTIALS, "thePassword");

JobDataMap map = new JobDataMap(hash);
        jobDetail.setJobDataMap(map);

...

Because that was not possible to achieve, I've extended the method getInitialContext(JobDataMap) of class EJBInvokerJob.

2.) EJBInvokerJob does use getDeclaredMethod() to retrieve the method specified with the JobDetail specified. If you need to call an ejb via remote interface and you are using Business Interface J2EE design pattern, this method would be declared in a business interface. The EJB's remote interface would inherit the method.
That's why the implementation of Quartz's EJBInvokerJob isn't suitable for existing enterprise applications, which were designed using the Business Interface pattern.

However, it's only one statement in one line which enables quartz to be used in this context too.

I've changed that one line in EJBInvokerJob.execute(...) accordingly:

methodExecute = remoteClass.getMethod(method, argTypes);


I'll attach the modified Java file to this issue, hoping that's integrated into your version control system and shipped like this in order to be safe in using this feature. Otherwise I'd need to superflously create my own EJBInvokerJob class.



 All   Comments   Change History      Sort Order:
Phillip Ghadir - [20/May/05 11:13 AM ]
Modified source of EJBInvokerJob.

Path: quartz-1.4.5\src\java\main\org\quartz\jobs\ee\ejb\EJBInvokerJob.java