KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > ExecutionAdmin


1 package org.enhydra.shark;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.HashMap JavaDoc;
5 import java.util.Iterator JavaDoc;
6 import java.util.List JavaDoc;
7 import java.util.Map JavaDoc;
8
9 import org.enhydra.shark.api.RootException;
10 import org.enhydra.shark.api.SharkTransaction;
11 import org.enhydra.shark.api.client.wfbase.BaseException;
12 import org.enhydra.shark.api.client.wfmodel.WfActivity;
13 import org.enhydra.shark.api.client.wfmodel.WfActivityIterator;
14 import org.enhydra.shark.api.client.wfmodel.WfAssignment;
15 import org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator;
16 import org.enhydra.shark.api.client.wfmodel.WfProcess;
17 import org.enhydra.shark.api.client.wfmodel.WfProcessIterator;
18 import org.enhydra.shark.api.client.wfmodel.WfProcessMgr;
19 import org.enhydra.shark.api.client.wfmodel.WfResource;
20 import org.enhydra.shark.api.client.wfservice.ConnectFailed;
21 import org.enhydra.shark.api.client.wfservice.ExecutionAdministration;
22 import org.enhydra.shark.api.client.wfservice.NotConnected;
23 import org.enhydra.shark.api.client.wfservice.WfProcessMgrIterator;
24 import org.enhydra.shark.api.client.wfservice.WfResourceIterator;
25 import org.enhydra.shark.api.common.SharkConstants;
26 import org.enhydra.shark.api.internal.caching.CacheMgr;
27 import org.enhydra.shark.api.internal.instancepersistence.ActivityPersistenceInterface;
28 import org.enhydra.shark.api.internal.instancepersistence.ActivityVariablePersistenceInterface;
29 import org.enhydra.shark.api.internal.instancepersistence.PersistenceException;
30 import org.enhydra.shark.api.internal.instancepersistence.PersistentManagerInterface;
31 import org.enhydra.shark.api.internal.instancepersistence.ProcessPersistenceInterface;
32 import org.enhydra.shark.api.internal.instancepersistence.ProcessVariablePersistenceInterface;
33 import org.enhydra.shark.api.internal.processlocking.LockMaster;
34 import org.enhydra.shark.api.internal.security.SecurityManager;
35 import org.enhydra.shark.api.internal.working.CallbackUtilities;
36 import org.enhydra.shark.api.internal.working.WfActivityInternal;
37 import org.enhydra.shark.api.internal.working.WfAssignmentInternal;
38 import org.enhydra.shark.api.internal.working.WfProcessInternal;
39 import org.enhydra.shark.api.internal.working.WfProcessMgrInternal;
40 import org.enhydra.shark.api.internal.working.WfResourceInternal;
41
42 /**
43  * The client interface through which client accesses the engine
44  * objects, and performs the various actions on engine.
45  *
46  * @author Sasa Bojanic
47  * @version 1.1
48  */

49 public class ExecutionAdmin implements ExecutionAdministration {
50
51    private String JavaDoc userId;
52    private boolean connected=false;
53
54    private String JavaDoc connectionKey;
55
56
57    private CallbackUtilities cus;
58    protected ExecutionAdmin () {
59       this.cus=SharkEngineManager.getInstance().getCallbackUtilities();
60    }
61
62    public void connect (String JavaDoc userId,String JavaDoc password,String JavaDoc engineName,String JavaDoc scope) throws BaseException, ConnectFailed {
63       SharkTransaction t = null;
64       try {
65          t = SharkUtilities.createTransaction();
66          connect(t, userId, password, engineName, scope);
67          SharkUtilities.commitTransaction(t);
68       } catch (RootException e) {
69          SharkUtilities.rollbackTransaction(t,e);
70          if (e instanceof ConnectFailed)
71             throw (ConnectFailed)e;
72          else if (e instanceof BaseException)
73             throw (BaseException)e;
74          else
75             throw new BaseException(e);
76       } finally {
77          SharkUtilities.releaseTransaction(t);
78       }
79    }
80
81    public void connect (SharkTransaction t,String JavaDoc userId,String JavaDoc password,String JavaDoc engineName,String JavaDoc scope) throws BaseException, ConnectFailed {
82       this.userId=userId;
83
84       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
85       if (sm!=null) {
86          try {
87             sm.check_executionadministration_connect(t,userId);
88          } catch (Exception JavaDoc ex) {
89             throw new BaseException(ex);
90          }
91       }
92       try {
93          if (!SharkUtilities.validateUser(userId,password)) {
94             cus.info("ExecutionAdmin -> Login failed: Invalid username or password"+userId);
95             throw new ConnectFailed("Connection failed, invalid username or password");
96          }
97
98          if (SharkUtilities.getResource(t, userId)==null) {
99             WfResourceInternal resInternal=SharkEngineManager
100                .getInstance()
101                .getObjectFactory()
102                .createResource(t,userId);
103          }
104          connectionKey=SharkUtilities.connect(userId);
105          connected=true;
106          cus.info("ExecutionAdmin -> User "+userId+" with connection key "+connectionKey+" is logged on");
107       } catch (Exception JavaDoc ex) {
108          if (ex instanceof ConnectFailed) {
109             throw (ConnectFailed)ex;
110          }
111          cus.info("ExecutionAdmin -> Unexpected error while user "+userId+" loggs on");
112          ex.printStackTrace();
113          throw new BaseException(ex);
114       }
115    }
116
117    public void disconnect () throws BaseException, NotConnected {
118       SharkTransaction t = null;
119       try {
120          t = SharkUtilities.createTransaction();
121          disconnect(t);
122          //SharkUtilities.commitTransaction(t);
123
} catch (RootException e) {
124          //SharkUtilities.rollbackTransaction(t);
125
SharkUtilities.emptyCaches(t);
126          if (e instanceof NotConnected)
127             throw (NotConnected)e;
128          else if (e instanceof BaseException)
129             throw (BaseException)e;
130          else
131             throw new BaseException(e);
132       } finally {
133          SharkUtilities.releaseTransaction(t);
134       }
135    }
136
137    public void disconnect (SharkTransaction t) throws BaseException, NotConnected {
138       if (!connected) {
139          throw new NotConnected("The connection is not established...");
140       }
141       try {
142          SharkUtilities.disconnect(connectionKey);
143          connected=false;
144          cus.info("ExecutionAdmin -> User "+userId+" with connection key "+connectionKey+" is logged off");
145       } catch (Exception JavaDoc ex) {
146          if (ex instanceof NotConnected) {
147             throw (NotConnected)ex;
148          }
149          cus.info("ExecutionAdmin -> Unexpected error while user "+userId+" loggs off");
150          throw new BaseException(ex);
151       }
152    }
153
154    public WfProcessMgrIterator get_iterator_processmgr () throws BaseException, NotConnected {
155       WfProcessMgrIterator ret = null;
156       SharkTransaction t = null;
157       try {
158          t = SharkUtilities.createTransaction();
159          ret = get_iterator_processmgr(t);
160          //SharkUtilities.commitTransaction(t);
161
} catch (RootException e) {
162          //SharkUtilities.rollbackTransaction(t);
163
SharkUtilities.emptyCaches(t);
164          if (e instanceof NotConnected)
165             throw (NotConnected)e;
166          else if (e instanceof BaseException)
167             throw (BaseException)e;
168          else
169             throw new BaseException(e);
170       } finally {
171          SharkUtilities.releaseTransaction(t);
172       }
173       return ret;
174    }
175
176    public WfProcessMgrIterator get_iterator_processmgr (SharkTransaction t) throws BaseException, NotConnected {
177       if (!connected) {
178          throw new NotConnected("The connection is not established...");
179       }
180       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
181       if (sm!=null) {
182          try {
183             sm.check_executionadministration_get_iterator_processmgr(t,userId);
184          } catch (Exception JavaDoc ex) {
185             throw new BaseException(ex);
186          }
187       }
188       try {
189          WfProcessMgrIterator ret=SharkEngineManager.getInstance().
190             getObjectFactory().createProcessMgrIteratorWrapper(t,userId);
191          return ret;
192       } catch (Exception JavaDoc ex) {
193          cus.info("ExecutionAdmin -> Unexpected error while user tries to get process managers iterator");
194          throw new BaseException(ex);
195       }
196    }
197
198    public WfProcessMgr[] get_sequence_processmgr (int max_number) throws BaseException, NotConnected {
199       WfProcessMgr[] ret = null;
200       SharkTransaction t = null;
201       try {
202          t = SharkUtilities.createTransaction();
203          ret = get_sequence_processmgr(t, max_number);
204          //SharkUtilities.commitTransaction(t);
205
} catch (RootException e) {
206          //SharkUtilities.rollbackTransaction(t);
207
SharkUtilities.emptyCaches(t);
208          if (e instanceof NotConnected)
209             throw (NotConnected)e;
210          else if (e instanceof BaseException)
211             throw (BaseException)e;
212          else
213             throw new BaseException(e);
214       } finally {
215          SharkUtilities.releaseTransaction(t);
216       }
217       return ret;
218    }
219
220    public WfProcessMgr[] get_sequence_processmgr (SharkTransaction t,int max_number) throws BaseException, NotConnected {
221       if (!connected) {
222          throw new NotConnected("The connection is not established...");
223       }
224       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
225       if (sm!=null) {
226          try {
227             sm.check_executionadministration_get_sequence_processmgr(t,userId);
228          } catch (Exception JavaDoc ex) {
229             throw new BaseException(ex);
230          }
231       }
232       try {
233          return SharkEngineManager
234             .getInstance()
235             .getObjectFactory()
236             .createProcessMgrIteratorWrapper(t,userId)
237             .get_next_n_sequence (t,max_number);
238       } catch (Exception JavaDoc ex) {
239          cus.info("ExecutionAdmin -> Unexpected error while user tries to get the list of process managers");
240          throw new BaseException(ex);
241       }
242    }
243
244    public WfResourceIterator get_iterator_resource () throws BaseException, NotConnected {
245       WfResourceIterator ret = null;
246       SharkTransaction t = null;
247       try {
248          t = SharkUtilities.createTransaction();
249          ret = get_iterator_resource(t);
250          //SharkUtilities.commitTransaction(t);
251
} catch (RootException e) {
252          //SharkUtilities.rollbackTransaction(t);
253
SharkUtilities.emptyCaches(t);
254          if (e instanceof NotConnected)
255             throw (NotConnected)e;
256          else if (e instanceof BaseException)
257             throw (BaseException)e;
258          else
259             throw new BaseException(e);
260       } finally {
261          SharkUtilities.releaseTransaction(t);
262       }
263       return ret;
264    }
265
266    public WfResourceIterator get_iterator_resource (SharkTransaction t) throws BaseException, NotConnected {
267       if (!connected) {
268          throw new NotConnected("The connection is not established...");
269       }
270       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
271       if (sm!=null) {
272          try {
273             sm.check_executionadministration_get_iterator_resource(t,userId);
274          } catch (Exception JavaDoc ex) {
275             throw new BaseException(ex);
276          }
277       }
278       try {
279          return SharkEngineManager
280             .getInstance()
281             .getObjectFactory()
282             .createResourceIteratorWrapper(t,userId);
283       } catch (Exception JavaDoc ex) {
284          cus.info("ExecutionAdmin -> Unexpected error while user tries to get resource's iterator");
285          throw new BaseException(ex);
286       }
287    }
288
289    public WfResource[] get_sequence_resource (int max_number) throws BaseException, NotConnected {
290       WfResource[] ret = null;
291       SharkTransaction t = null;
292       try {
293          t = SharkUtilities.createTransaction();
294          ret = get_sequence_resource(t, max_number);
295          //SharkUtilities.commitTransaction(t);
296
} catch (RootException e) {
297          //SharkUtilities.rollbackTransaction(t);
298
SharkUtilities.emptyCaches(t);
299          if (e instanceof NotConnected)
300             throw (NotConnected)e;
301          else if (e instanceof BaseException)
302             throw (BaseException)e;
303          else
304             throw new BaseException(e);
305       } finally {
306          SharkUtilities.releaseTransaction(t);
307       }
308       return ret;
309    }
310
311    public WfResource[] get_sequence_resource (SharkTransaction t,int max_number) throws BaseException, NotConnected {
312       if (!connected) {
313          throw new NotConnected("The connection is not established...");
314       }
315       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
316       if (sm!=null) {
317          try {
318             sm.check_executionadministration_get_sequence_resource(t,userId);
319          } catch (Exception JavaDoc ex) {
320             throw new BaseException(ex);
321          }
322       }
323
324       try {
325          return SharkEngineManager
326             .getInstance()
327             .getObjectFactory()
328             .createResourceIteratorWrapper(t,userId)
329             .get_next_n_sequence (max_number);
330       } catch (Exception JavaDoc ex) {
331          cus.info("ExecutionAdmin -> Unexpected error while user tries to get the list of resources");
332          throw new BaseException(ex);
333       }
334    }
335
336    public Map JavaDoc getLoggedUsers () throws BaseException, NotConnected {
337       Map JavaDoc ret = null;
338       SharkTransaction t = null;
339       try {
340          t = SharkUtilities.createTransaction();
341          ret = getLoggedUsers(t);
342          //SharkUtilities.commitTransaction(t);
343
} catch (RootException e) {
344          //SharkUtilities.rollbackTransaction(t);
345
SharkUtilities.emptyCaches(t);
346          if (e instanceof NotConnected)
347             throw (NotConnected)e;
348          else if (e instanceof BaseException)
349             throw (BaseException)e;
350          else
351             throw new BaseException(e);
352       } finally {
353          SharkUtilities.releaseTransaction(t);
354       }
355       return ret;
356    }
357
358    public Map JavaDoc getLoggedUsers(SharkTransaction t) throws BaseException, NotConnected {
359       if (!connected) {
360          throw new NotConnected("The connection is not established...");
361       }
362       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
363       if (sm!=null) {
364          try {
365             sm.check_executionadministration_getLoggedUsers(t,userId);
366          } catch (Exception JavaDoc ex) {
367             throw new BaseException(ex);
368          }
369       }
370       try {
371          Map JavaDoc ret=SharkUtilities.getLoggedUsers();
372          return ret;
373       } catch (Exception JavaDoc ex) {
374          cus.info("ExecutionAdmin -> Unexpected error while user tries to get logged users");
375          throw new BaseException(ex);
376       }
377    }
378
379    public void startActivity (String JavaDoc procId,String JavaDoc blockActId,String JavaDoc actDefId) throws BaseException, NotConnected {
380       SharkTransaction t = null;
381       try {
382          t = SharkUtilities.createTransaction();
383          startActivity(t, procId, blockActId, actDefId);
384          SharkUtilities.commitTransaction(t);
385       } catch (RootException e) {
386          SharkUtilities.rollbackTransaction(t,e);
387          if (e instanceof NotConnected)
388             throw (NotConnected)e;
389          else if (e instanceof BaseException)
390             throw (BaseException)e;
391          else
392             throw new BaseException(e);
393       } finally {
394          SharkUtilities.releaseTransaction(t);
395       }
396    }
397
398    public void startActivity (SharkTransaction t,String JavaDoc procId,String JavaDoc blockActId,String JavaDoc actDefId) throws BaseException, NotConnected {
399       if (!connected) {
400          throw new NotConnected("The connection is not established...");
401       }
402       try {
403          WfProcessInternal proc=SharkUtilities.getProcess(t, procId);
404          SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
405          if (sm!=null) {
406             sm.check_executionadministration_startActivity(t,
407                                                            procId,
408                                                            userId,
409                                                            proc.requester(t).getResourceRequesterUsername(t));
410          }
411          proc.start_activity(t, actDefId, blockActId);
412       } catch (Exception JavaDoc ex) {
413          throw new BaseException(ex);
414       }
415    }
416
417    public WfProcessMgr getProcessMgr (String JavaDoc name) throws BaseException, NotConnected {
418       WfProcessMgr ret = null;
419       SharkTransaction t = null;
420       try {
421          t = SharkUtilities.createTransaction();
422          ret = getProcessMgr(t, name);
423          //SharkUtilities.commitTransaction(t);
424
} catch (RootException e) {
425          //SharkUtilities.rollbackTransaction(t);
426
SharkUtilities.emptyCaches(t);
427          if (e instanceof NotConnected)
428             throw (NotConnected)e;
429          else if (e instanceof BaseException)
430             throw (BaseException)e;
431          else
432             throw new BaseException(e);
433       } finally {
434          SharkUtilities.releaseTransaction(t);
435       }
436       return ret;
437    }
438
439    public WfProcessMgr getProcessMgr (SharkTransaction t,String JavaDoc name) throws BaseException, NotConnected {
440       if (!connected) {
441          throw new NotConnected("The connection is not established...");
442       }
443       SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
444       if (sm!=null) {
445          try {
446             sm.check_executionadministration_getProcessMgr(t,name,userId);
447          } catch (Exception JavaDoc ex) {
448             throw new BaseException(ex);
449          }
450       }
451       try {
452          return (null != SharkUtilities.getProcessMgr(t, name))
453             ? SharkEngineManager.getInstance().getObjectFactory().createProcessMgrWrapper(userId,name)
454             : null;
455       } catch (Exception JavaDoc ex) {
456          throw new BaseException(ex);
457       }
458    }
459
460    public WfProcessMgr getProcessMgr (String JavaDoc pkgId,String JavaDoc pDefId) throws BaseException, NotConnected {
461       WfProcessMgr ret = null;
462       SharkTransaction t = null;
463       try {
464          t = SharkUtilities.createTransaction();
465          ret = getProcessMgr(t, pkgId, pDefId);
466          //SharkUtilities.commitTransaction(t);
467
} catch (RootException e) {
468          //SharkUtilities.rollbackTransaction(t);
469
SharkUtilities.emptyCaches(t);
470          if (e instanceof NotConnected)
471             throw (NotConnected)e;
472          else if (e instanceof BaseException)
473             throw (BaseException)e;
474          else
475             throw new BaseException(e);
476       } finally {
477          SharkUtilities.releaseTransaction(t);
478       }
479       return ret;
480    }
481
482    public WfProcessMgr getProcessMgr (SharkTransaction t,String JavaDoc pkgId,String JavaDoc pDefId) throws BaseException, NotConnected {
483       if (!connected) {
484          throw new NotConnected("The connection is not established...");
485       }
486       try {
487          String JavaDoc curVer=SharkUtilities.getCurrentPkgVersion(pkgId,false);
488          String JavaDoc mgrName=SharkUtilities.createProcessMgrKey(pkgId,curVer,pDefId);
489          SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
490          if (sm!=null) {
491             sm.check_executionadministration_getProcessMgr(t,mgrName,userId);
492          }
493          return (null != SharkUtilities.getProcessMgr(t, mgrName))
494             ? SharkEngineManager.getInstance().getObjectFactory().createProcessMgrWrapper(userId,mgrName)
495             : null;
496       } catch (Exception JavaDoc ex) {
497          throw new BaseException(ex);
498       }
499    }
500
501    public WfProcessMgr getProcessMgr (String JavaDoc pkgId,String JavaDoc pkgVer,String JavaDoc pDefId) throws BaseException, NotConnected {
502       WfProcessMgr ret = null;
503       SharkTransaction t = null;
504       try {
505          t = SharkUtilities.createTransaction();
506          ret = getProcessMgr(t, pkgId, pkgVer, pDefId);
507          //SharkUtilities.commitTransaction(t);
508
} catch (RootException e) {
509          //SharkUtilities.rollbackTransaction(t);
510
SharkUtilities.emptyCaches(t);
511          if (e instanceof NotConnected)
512             throw (NotConnected)e;
513          else if (e instanceof BaseException)
514             throw (BaseException)e;
515          else
516             throw new BaseException(e);
517       } finally {
518          SharkUtilities.releaseTransaction(t);
519       }
520       return ret;
521    }
522
523    public WfProcessMgr getProcessMgr (SharkTransaction t,String JavaDoc pkgId,String JavaDoc pkgVer,String JavaDoc pDefId) throws BaseException, NotConnected {
524       if (!connected) {
525          throw new NotConnected("The connection is not established...");
526       }
527       try {
528          String JavaDoc mgrName=SharkUtilities.createProcessMgrKey(pkgId,pkgVer,pDefId);
529          SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
530          if (sm!=null) {
531             sm.check_executionadministration_getProcessMgr(t,mgrName,userId);
532          }
533          return (null != SharkUtilities.getProcessMgr(t, mgrName))
534             ? SharkEngineManager.getInstance().getObjectFactory().createProcessMgrWrapper(userId,mgrName)
535             : null;
536       } catch (Exception JavaDoc ex) {
537          throw new BaseException(ex);
538       }
539    }
540
541    public WfProcess getProcess (String JavaDoc procId) throws BaseException, NotConnected {
542       WfProcess ret = null;
543       SharkTransaction t = null;
544       try {
545          t = SharkUtilities.createTransaction();
546          ret = getProcess(t, procId);
547          //SharkUtilities.commitTransaction(t);
548
} catch (RootException e) {
549          //SharkUtilities.rollbackTransaction(t);
550
SharkUtilities.emptyCaches(t);
551          if (e instanceof NotConnected)
552             throw (NotConnected)e;
553          else if (e instanceof BaseException)
554             throw (BaseException)e;
555          else
556             throw new BaseException(e);
557       } finally {
558          SharkUtilities.releaseTransaction(t);
559       }
560       return ret;
561    }
562
563    public WfProcess getProcess (SharkTransaction t,String JavaDoc procId) throws BaseException, NotConnected {
564       if (!connected) {
565          throw new NotConnected("The connection is not established...");
566       }
567       try {
568          WfProcessInternal proc=SharkUtilities.getProcess(t, procId);
569          SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
570          if (sm!=null && proc!=null) {
571             sm.check_executionadministration_getProcess(t,
572                                                         procId,
573                                                         userId,
574                                                         proc.requester(t).getResourceRequesterUsername(t));
575          }
576          return (null != proc)
577             ? SharkEngineManager.getInstance().getObjectFactory().createProcessWrapper(userId,proc.manager_name(t),procId)
578             : null;
579       } catch (Exception JavaDoc ex) {
580          throw new BaseException(ex);
581       }
582    }
583
584    public WfActivity getActivity (String JavaDoc procId,String JavaDoc actId) throws BaseException, NotConnected {
585       WfActivity ret = null;
586       SharkTransaction t = null;
587       try {
588          t = SharkUtilities.createTransaction();
589          ret = getActivity(t, procId, actId);
590          //SharkUtilities.commitTransaction(t);
591
} catch (RootException e) {
592          //SharkUtilities.rollbackTransaction(t);
593
SharkUtilities.emptyCaches(t);
594          if (e instanceof NotConnected)
595             throw (NotConnected)e;
596          else if (e instanceof BaseException)
597             throw (BaseException)e;
598          else
599             throw new BaseException(e);
600       } finally {
601          SharkUtilities.releaseTransaction(t);
602       }
603       return ret;
604    }
605
606    public WfActivity getActivity (SharkTransaction t,String JavaDoc procId,String JavaDoc actId) throws BaseException, NotConnected {
607       if (!connected) {
608          throw new NotConnected("The connection is not established...");
609       }
610       try {
611          WfActivityInternal act=SharkUtilities.getActivity(t, procId, actId);
612          SecurityManager JavaDoc sm=SharkEngineManager.getInstance().getSecurityManager();
613          if (sm!=null && act!=null) {
614             sm.check_executionadministration_getActivity(t,
615                                                          procId,
616                                                          actId,
617                                                          userId,
618                                                          act.container(t).requester(t).getResourceRequesterUsername(t),
619                                                          act.getResourceUsername(t),
620                                                          act.getAssignmentResourceIds(t));
621          }
622          return (null != act)
623             ? SharkEngineManager.getInstance().getObjectFactory().createActivityWrapper(userId,act.manager_name(t),procId,actId)
624             : null;
625       } catch (Exception JavaDoc ex) {
626          throw new BaseException(ex);
627       }
628    }
629
630    public WfResource getResource (String JavaDoc username) throws BaseException, NotConnected {
631       WfResource ret = null;
632       SharkTransaction t = null;
633       try {
634          t = SharkUtilities.createTransaction();
635          ret = getResource(t, username);
636          //SharkUtilities.commitTransaction(t);
637
} catch (RootException e) {
638          //SharkUtilities.rollbackTransaction(t);
639
SharkUtilities.emptyCaches(t);
640          if (e instanceof NotConnected)
641             throw (NotConnected)e;
642          else if (e instanceof BaseException)
643             throw (BaseException)e;
644          else
645             throw new BaseException(e);
646       } finally {
647          SharkUtilities.releaseTransaction(t);
648       }
649       return ret;
650