KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > ejb > EJBWorkflowContext


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow.ejb;
6
7 import com.opensymphony.workflow.WorkflowContext;
8
9 import javax.ejb.SessionContext JavaDoc;
10
11
12 /**
13  * EJB specific workflow context.
14  * The default implementation is to get the caller principal from the
15  * container's SessionContext. If different behaviour is desired, this
16  * class can be subclassed with whatever custom logic in place to look
17  * up the caller. This can be done by specifying a <code>workflowContext</code>
18  * property in the ejb persistence store's properties in osworkflow.xml.
19  * The value of this properly should be the classname of the WorkflowContext
20  * to use.
21  *
22  * @author Hani Suleiman
23  * @version $Revision: 1.6 $
24  */

25 public class EJBWorkflowContext implements WorkflowContext {
26     //~ Instance fields ////////////////////////////////////////////////////////
27

28     private SessionContext JavaDoc sessionContext;
29
30     //~ Methods ////////////////////////////////////////////////////////////////
31

32     public String JavaDoc getCaller() {
33         return sessionContext.getCallerPrincipal().getName();
34     }
35
36     public void setRollbackOnly() {
37         sessionContext.setRollbackOnly();
38     }
39
40     public void setSessionContext(SessionContext JavaDoc context) {
41         this.sessionContext = context;
42     }
43
44     public SessionContext JavaDoc getSessionContext() {
45         return sessionContext;
46     }
47 }
48
Popular Tags