KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark;
2
3
4 import java.util.Arrays JavaDoc;
5 import java.util.List JavaDoc;
6 import org.enhydra.shark.api.RootException;
7 import org.enhydra.shark.api.UserTransaction;
8 import org.enhydra.shark.api.client.wfbase.BaseException;
9 import org.enhydra.shark.api.client.wfservice.UserGroupAdministration;
10 import org.enhydra.shark.api.internal.usergroup.UserGroupManager;
11 import org.enhydra.shark.api.internal.working.CallbackUtilities;
12
13 /**
14  * Interface used to perform some administrative operations.
15  * @author Sasa Bojanic
16  * @author Vladimir Puskas
17  */

18 public class UserGroupAdmin implements UserGroupAdministration {
19
20    UserGroupManager ugm;
21
22    private CallbackUtilities cus;
23    private String JavaDoc userId="Unknown";
24
25    /**
26     * Default constructor ().
27     */

28    protected UserGroupAdmin () {
29       this.cus=SharkEngineManager.getInstance().getCallbackUtilities();
30       ugm=SharkEngineManager.getInstance().getUserGroupManager();
31    }
32
33    /**
34     * This method is used to let shark know who uses this API.
35     *
36     * @param userId String representing user Id.
37     *
38     */

39    public void connect (String JavaDoc userId) {
40       this.userId=userId;
41    }
42
43    /**
44     * Returns Ids of all user groups.
45     *
46     * @return Array of user group Ids.
47     *
48     * @throws BaseException If something unexpected happens.
49     */

50    public String JavaDoc[] getAllGroupnames () throws BaseException {
51       String JavaDoc[] s;
52       UserTransaction t = null;
53       try {
54          t = SharkUtilities.createUserTransaction();
55          s = getAllGroupnames(t);
56          //SharkUtilities.commitUserTransaction(t);
57
return s;
58       } catch (RootException e) {
59          //SharkUtilities.rollbackUserTransaction(t);
60
if (e instanceof BaseException)
61             throw (BaseException)e;
62          else
63             throw new BaseException(e);
64       } finally {
65          SharkUtilities.releaseUserTransaction(t);
66       }
67    }
68
69    /**
70     * Returns Ids of all users.
71     *
72     * @param t user transaction.
73     * @return Array of user Ids.
74     *
75     * @throws BaseException If something unexpected happens.
76     */

77    public String JavaDoc[] getAllGroupnames (UserTransaction t) throws BaseException {
78       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
79       try {
80          List JavaDoc l=ugm.getAllGroupnames(t);
81          String JavaDoc [] ret=new String JavaDoc[l.size()];
82          l.toArray(ret);
83          return ret;
84       } catch (Exception JavaDoc e) {
85          throw new BaseException(e);
86       }
87    }
88
89    /**
90     * Returns Ids of all users.
91     *
92     * @return Array of user Ids.
93     *
94     * @throws BaseException If something unexpected happens.
95     */

96    public String JavaDoc[] getAllUsers () throws BaseException {
97       String JavaDoc[] s;
98       UserTransaction t = null;
99       try {
100          t = SharkUtilities.createUserTransaction();
101          s = getAllUsers(t);
102          //SharkUtilities.commitUserTransaction(t);
103
return s;
104       } catch (RootException e) {
105          //SharkUtilities.rollbackUserTransaction(t);
106
if (e instanceof BaseException)
107             throw (BaseException)e;
108          else
109             throw new BaseException(e);
110       } finally {
111          SharkUtilities.releaseUserTransaction(t);
112       }
113    }
114
115    /**
116     * Returns Ids of all users.
117     *
118     * @param t user transaction.
119     * @return Array of user Ids.
120     *
121     * @throws BaseException If something unexpected happens.
122     */

123    public String JavaDoc[] getAllUsers (UserTransaction t) throws BaseException {
124       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
125       try {
126          List JavaDoc l=ugm.getAllUsers(t);
127          String JavaDoc [] ret=new String JavaDoc[l.size()];
128          l.toArray(ret);
129          return ret;
130       } catch (Exception JavaDoc e) {
131          throw new BaseException(e);
132       }
133    }
134
135    /**
136     * Returns all usernames that belong to the given group.
137     *
138     * @param groupName name of the given group.
139     * @return Array of all usernames that belong to given group.
140     *
141     * @throws BaseException If something unexpected happens.
142     */

143    public String JavaDoc[] getAllUsers (String JavaDoc groupName) throws BaseException {
144       String JavaDoc[] s;
145       UserTransaction t = null;
146       try {
147          t = SharkUtilities.createUserTransaction();
148          s = getAllUsers(t,groupName);
149          //SharkUtilities.commitUserTransaction(t);
150
return s;
151       } catch (RootException e) {
152          //SharkUtilities.rollbackUserTransaction(t);
153
if (e instanceof BaseException)
154             throw (BaseException)e;
155          else
156             throw new BaseException(e);
157       } finally {
158          SharkUtilities.releaseUserTransaction(t);
159       }
160    }
161
162    /**
163     * Returns all usernames that belong to the given group.
164     *
165     * @param t user transaction.
166     * @param groupName name of the given group.
167     * @return Array of all usernames that belong to given group.
168     *
169     * @throws BaseException If something unexpected happens.
170     */

171    public String JavaDoc[] getAllUsers (UserTransaction t, String JavaDoc groupName) throws BaseException {
172       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
173       try {
174          List JavaDoc l=ugm.getAllUsers(t,groupName);
175          String JavaDoc [] ret=new String JavaDoc[l.size()];
176          l.toArray(ret);
177          return ret;
178       } catch (Exception JavaDoc e) {
179          throw new BaseException(e);
180       }
181    }
182
183    /**
184     * Returns all users that belong to the given groups.
185     *
186     * @param groupNames names of the given groups.
187     * @return Array of all users that belong to given groups.
188     *
189     * @throws BaseException If something unexpected happens.
190     */

191    public String JavaDoc[] getAllUsers (String JavaDoc[] groupNames) throws BaseException {
192       String JavaDoc[] s;
193       UserTransaction t = null;
194       try {
195          t = SharkUtilities.createUserTransaction();
196          s = getAllUsers(t, groupNames);
197          //SharkUtilities.commitUserTransaction(t);
198
return s;
199       } catch (RootException e) {
200          //SharkUtilities.rollbackUserTransaction(t);
201
if (e instanceof BaseException)
202             throw (BaseException)e;
203          else
204             throw new BaseException(e);
205       } finally {
206          SharkUtilities.releaseUserTransaction(t);
207       }
208    }
209
210    /**
211     * Returns all users that belong to the given groups.
212     *
213     * @param t user transaction.
214     * @param groupNames names of the given groups.
215     * @return Array of all users that belong to given groups.
216     *
217     * @throws BaseException If something unexpected happens.
218     */

219    public String JavaDoc[] getAllUsers (UserTransaction t, String JavaDoc[] groupNames) throws BaseException {
220       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
221       try {
222          List JavaDoc l=ugm.getAllUsers(t,Arrays.asList(groupNames));
223          String JavaDoc [] ret=new String JavaDoc[l.size()];
224          l.toArray(ret);
225          return ret;
226       } catch (Exception JavaDoc e) {
227          throw new BaseException(e);
228       }
229    }
230
231    /**
232     * Returns all users that are immediate children of the given group.
233     *
234     * @param groupName name of the given group.
235     * @return Array of all immediate (direct) users that belong to the given
236     * group.
237     *
238     * @throws BaseException If something unexpected happens.
239     */

240    public String JavaDoc[] getAllImmediateUsers (String JavaDoc groupName) throws BaseException {
241       String JavaDoc[] s;
242       UserTransaction t = null;
243       try {
244          t = SharkUtilities.createUserTransaction();
245          s = getAllImmediateUsers(t,groupName);
246          //SharkUtilities.commitUserTransaction(t);
247
return s;
248       } catch (RootException e) {
249          //SharkUtilities.rollbackUserTransaction(t);
250
if (e instanceof BaseException)
251             throw (BaseException)e;
252          else
253             throw new BaseException(e);
254       } finally {
255          SharkUtilities.releaseUserTransaction(t);
256       }
257    }
258
259    /**
260     * Returns all users that are immediate children of the given group.
261     *
262     * @param t user transaction.
263     * @param groupName name of the given group.
264     * @return Array of all immediate (direct) users that belong to the given
265     * group.
266     *
267     * @throws BaseException If something unexpected happens.
268     */

269    public String JavaDoc[] getAllImmediateUsers (UserTransaction t, String JavaDoc groupName) throws BaseException {
270       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
271       try {
272          List JavaDoc l=ugm.getAllImmediateUsers(t,groupName);
273          String JavaDoc [] ret=new String JavaDoc[l.size()];
274          l.toArray(ret);
275          return ret;
276       } catch (Exception JavaDoc e) {
277          throw new BaseException(e);
278       }
279    }
280
281    /**
282     * Returns all groups that belong to the given group.
283     *
284     * @param groupName name of the given group.
285     * @return Array of all groups that belong to the given group.
286     *
287     * @throws BaseException If something unexpected happens.
288     */

289    public String JavaDoc[] getAllSubgroups (String JavaDoc groupName) throws BaseException {
290       String JavaDoc[] s;
291       UserTransaction t = null;
292       try {
293          t = SharkUtilities.createUserTransaction();
294          s = getAllSubgroups(t,groupName);
295          //SharkUtilities.commitUserTransaction(t);
296
return s;
297       } catch (RootException e) {
298          //SharkUtilities.rollbackUserTransaction(t);
299
if (e instanceof BaseException)
300             throw (BaseException)e;
301          else
302             throw new BaseException(e);
303       } finally {
304          SharkUtilities.releaseUserTransaction(t);
305       }
306     }
307
308    /**
309     * Returns all groups that belong to the given group.
310     *
311     * @param t user transaction.
312     * @param groupName name of the given group.
313     * @return Array of all groups that belong to the given group.
314     *
315     * @throws BaseException If something unexpected happens.
316     */

317     public String JavaDoc[] getAllSubgroups (UserTransaction t, String JavaDoc groupName) throws BaseException {
318      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
319       try {
320          List JavaDoc l=ugm.getAllSubgroups(t,groupName);
321          String JavaDoc [] ret=new String JavaDoc[l.size()];
322          l.toArray(ret);
323          return ret;
324       } catch (Exception JavaDoc e) {
325          throw new BaseException(e);
326       }
327     }
328
329    /**
330     * Returns all groups that belong to the given groups.
331     *
332     * @param groupNames names of the given groups.
333     * @return Array of all groups that belong to the given groups.
334     *
335     * @throws BaseException If something unexpected happens.
336     */

337    public String JavaDoc[] getAllSubgroups (String JavaDoc[] groupNames) throws BaseException {
338       String JavaDoc[] s;
339       UserTransaction t = null;
340       try {
341          t = SharkUtilities.createUserTransaction();
342          s = getAllSubgroups(t, groupNames);
343          //SharkUtilities.commitUserTransaction(t);
344
return s;
345       } catch (RootException e) {
346          //SharkUtilities.rollbackUserTransaction(t);
347
if (e instanceof BaseException)
348             throw (BaseException)e;
349          else
350             throw new BaseException(e);
351       } finally {
352          SharkUtilities.releaseUserTransaction(t);
353       }
354    }
355
356    /**
357     * Returns all groups that belong to the given groups.
358     *
359     * @param t user transaction.
360     * @param groupNames names of the given groups.
361     * @return Array of all groups that belong to the given groups.
362     *
363     * @throws BaseException If something unexpected happens.
364     */

365    public String JavaDoc[] getAllSubgroups (UserTransaction t, String JavaDoc[] groupNames) throws BaseException {
366     if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
367       try {
368          List JavaDoc l=ugm.getAllSubgroups(t,Arrays.asList(groupNames));
369          String JavaDoc [] ret=new String JavaDoc[l.size()];
370          l.toArray(ret);
371          return ret;
372       } catch (Exception JavaDoc e) {
373          throw new BaseException(e);
374       }
375    }
376
377    /**
378      * Returns all groups that are immediate children of the given group
379     * (which are on the first level bellow the level of the given group).
380     *
381     * @param groupName name of the given group.
382     * @return Array of all groups that are immediate children of the given group.
383     *
384     * @throws BaseException If something unexpected happens.
385     */

386    public String JavaDoc[] getAllImmediateSubgroups (String JavaDoc groupName) throws BaseException {
387       String JavaDoc[] s;
388       UserTransaction t = null;
389       try {
390          t = SharkUtilities.createUserTransaction();
391          s = getAllImmediateSubgroups(t,groupName);
392          //SharkUtilities.commitUserTransaction(t);
393
return s;
394       } catch (RootException e) {
395          //SharkUtilities.rollbackUserTransaction(t);
396
if (e instanceof BaseException)
397             throw (BaseException)e;
398          else
399             throw new BaseException(e);
400       } finally {
401          SharkUtilities.releaseUserTransaction(t);
402       }
403     }
404
405    /**
406     * Returns all groups that are immediate children of the given group
407     * (which are on the first level bellow the level of the given group).
408     *
409     * @param t user transaction.
410     * @param groupName name of the given group.
411     * @return Array of all groups that are immediate children of the given group.
412     *
413     * @throws BaseException If something unexpected happens.
414     */

415     public String JavaDoc[] getAllImmediateSubgroups (UserTransaction t, String JavaDoc groupName) throws BaseException {
416      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
417       try {
418          List JavaDoc l=ugm.getAllImmediateSubgroups(t,groupName);
419          String JavaDoc [] ret=new String JavaDoc[l.size()];
420          l.toArray(ret);
421          return ret;
422       } catch (Exception JavaDoc e) {
423          throw new BaseException(e);
424       }
425     }
426
427    /**
428     * Creates a new user group.
429     *
430     * @param groupName name of the given group.
431     * @param description group description.
432     *
433     * @throws BaseException If something unexpected happens.
434     */

435    public void createGroup (String JavaDoc groupName,String JavaDoc description) throws BaseException {
436       UserTransaction t = null;
437       try {
438          t = SharkUtilities.createUserTransaction();
439          createGroup(t,groupName,description);
440          SharkUtilities.commitUserTransaction(t);
441       } catch (RootException e) {
442          SharkUtilities.rollbackUserTransaction(t,e);
443          if (e instanceof BaseException)
444             throw (BaseException)e;
445          else
446             throw new BaseException(e);
447       } finally {
448          SharkUtilities.releaseUserTransaction(t);
449       }
450    }
451
452    /**
453     * Creates a new user group.
454     *
455     * @param t user transaction.
456     * @param groupName name of the given group.
457     * @param description group description.
458     *
459     * @throws BaseException If something unexpected happens.
460     */

461    public void createGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc description) throws BaseException {
462       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
463       try {
464          ugm.createGroup(t,groupName,description);
465       } catch (Exception JavaDoc e) {
466          throw new BaseException(e);
467       }
468    }
469
470    /**
471     * Removes user group.
472     *
473     * @param groupName name of the given group.
474     *
475     * @throws BaseException If something unexpected happens.
476     */

477    public void removeGroup (String JavaDoc groupName) throws BaseException {
478       UserTransaction t = null;
479       try {
480          t = SharkUtilities.createUserTransaction();
481          removeGroup(t,groupName);
482          SharkUtilities.commitUserTransaction(t);
483       } catch (RootException e) {
484          SharkUtilities.rollbackUserTransaction(t,e);
485          if (e instanceof BaseException)
486             throw (BaseException)e;
487          else
488             throw new BaseException(e);
489       } finally {
490          SharkUtilities.releaseUserTransaction(t);
491       }
492    }
493
494    /**
495     * Removes user group.
496     *
497     * @param t user transaction.
498     * @param groupName name of the given group.
499     *
500     * @throws BaseException If something unexpected happens.
501     */

502    public void removeGroup (UserTransaction t, String JavaDoc groupName) throws BaseException {
503       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
504       try {
505          ugm.removeGroup(t,groupName);
506       } catch (Exception JavaDoc e) {
507          throw new BaseException(e);
508       }
509    }
510
511    /**
512     * Returns true if user group with given name exists.
513     *
514     * @param groupName name of the given group.
515     * @return true if user group exists, otherwise false.
516     *
517     * @throws BaseException If something unexpected happens.
518     */

519    public boolean doesGroupExist (String JavaDoc groupName) throws BaseException {
520       boolean ret = false;
521       UserTransaction t = null;
522       try {
523          t = SharkUtilities.createUserTransaction();
524          ret = doesGroupExist(t,groupName);
525          //SharkUtilities.commitUserTransaction(t);
526
return ret;
527       } catch (RootException e) {
528          //SharkUtilities.rollbackUserTransaction(t);
529
if (e instanceof BaseException)
530             throw (BaseException)e;
531          else
532             throw new BaseException(e);
533       } finally {
534          SharkUtilities.releaseUserTransaction(t);
535       }
536    }
537
538    /**
539     * Returns true if user group with given name exists.
540     *
541     * @param t user transaction.
542     * @param groupName name of the given group.
543     * @return true if user group exists, otherwise false.
544     *
545     * @throws BaseException If something unexpected happens.
546     */

547    public boolean doesGroupExist (UserTransaction t, String JavaDoc groupName) throws BaseException {
548       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
549       try {
550          boolean ret=ugm.doesGroupExist(t,groupName);
551          return ret;
552       } catch (Exception JavaDoc e) {
553          throw new BaseException(e);
554       }
555    }
556
557    /**
558     * Returns true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>.
559     *
560     * @param groupName name of the given group.
561     * @param subgroupName name of the given subgroup.
562     * @return true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>,
563     * otherwise false.
564     *
565     * @throws BaseException If something unexpected happens.
566     */

567    public boolean doesGroupBelongToGroup (String JavaDoc groupName, String JavaDoc subgroupName) throws BaseException {
568       boolean ret = false;
569       UserTransaction t = null;
570       try {
571          t = SharkUtilities.createUserTransaction();
572          ret = doesGroupBelongToGroup(t,groupName,subgroupName);
573          //SharkUtilities.commitUserTransaction(t);
574
return ret;
575       } catch (RootException e) {
576          //SharkUtilities.rollbackUserTransaction(t);
577
if (e instanceof BaseException)
578             throw (BaseException)e;
579          else
580             throw new BaseException(e);
581       } finally {
582          SharkUtilities.releaseUserTransaction(t);
583       }
584    }
585
586    /**
587     * Returns true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>.
588     *
589     * @param t user transaction.
590     * @param groupName name of the given group.
591     * @param subgroupName name of the given subgroup.
592     * @return true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>,
593     * otherwise false.
594     *
595     * @throws BaseException If something unexpected happens.
596     */

597    public boolean doesGroupBelongToGroup (UserTransaction t, String JavaDoc groupName, String JavaDoc subgroupName) throws BaseException {
598      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
599       try {
600          boolean ret=ugm.doesGroupBelongToGroup(t,groupName,subgroupName);
601          return ret;
602       } catch (Exception JavaDoc e) {
603          throw new BaseException(e);
604       }
605    }
606
607    /**
608     * Allows administrator to update data about group.
609     *
610     * @param groupName name of the given group.
611     * @param description group description.
612     *
613     * @throws BaseException If something unexpected happens.
614     */

615    public void updateGroup (String JavaDoc groupName,String JavaDoc description) throws BaseException {
616       UserTransaction t = null;
617       try {
618          t = SharkUtilities.createUserTransaction();
619          updateGroup(t,groupName,description);
620          SharkUtilities.commitUserTransaction(t);
621       } catch (RootException e) {
622          SharkUtilities.rollbackUserTransaction(t,e);
623          if (e instanceof BaseException)
624             throw (BaseException)e;
625          else
626             throw new BaseException(e);
627       } finally {
628          SharkUtilities.releaseUserTransaction(t);
629       }
630    }
631
632    /**
633     * Allows administrator to update data about group.
634     *
635     * @param t user transaction.
636     * @param groupName name of the given group.
637     * @param description group description.
638     *
639     * @throws BaseException If something unexpected happens.
640     */

641    public void updateGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc description) throws BaseException {
642       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
643       try {
644          ugm.updateGroup(t,groupName,description);
645       } catch (Exception JavaDoc e) {
646          throw new BaseException(e);
647       }
648    }
649
650    /**
651     * Adds an existing group <i>subgroupName</i> to the group <i>groupName</i>.
652     *
653     * @param groupName name of the given group.
654     * @param subgroupName name of the given subgroup to be added.
655     *
656     * @throws BaseException If something unexpected happens.
657     */

658    public void addGroupToGroup (String JavaDoc groupName,String JavaDoc subgroupName) throws BaseException {
659       UserTransaction t = null;
660       try {
661          t = SharkUtilities.createUserTransaction();
662          addGroupToGroup(t,groupName,subgroupName);
663          SharkUtilities.commitUserTransaction(t);
664       } catch (RootException e) {
665          SharkUtilities.rollbackUserTransaction(t,e);
666          if (e instanceof BaseException)
667             throw (BaseException)e;
668          else
669             throw new BaseException(e);
670       } finally {
671          SharkUtilities.releaseUserTransaction(t);
672       }
673    }
674
675    /**
676     * Adds an existing group <i>subgroupName</i> to the group <i>groupName</i>.
677     *
678     * @param t user transaction.
679     * @param groupName name of the given group.
680     * @param subgroupName name of the given subgroup to be added.
681     *
682     * @throws BaseException If something unexpected happens.
683     */

684    public void addGroupToGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc subgroupName) throws BaseException {
685     if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
686       try {
687          ugm.addGroupToGroup(t,groupName,subgroupName);
688       } catch (Exception JavaDoc e) {
689          throw new BaseException(e);
690       }
691    }
692
693    /**
694     * Removes group <i>subgroupName</i> from the group <i>groupName</i>.
695     *
696     * @param groupName name of the given group.
697     * @param subgroupName name of the given subgroup to be removed.
698     *
699     * @throws BaseException If something unexpected happens.
700     */

701    public void removeGroupFromGroup (String JavaDoc groupName,String JavaDoc subgroupName) throws BaseException {
702       UserTransaction t = null;
703       try {
704          t = SharkUtilities.createUserTransaction();
705          removeGroupFromGroup(t,groupName,subgroupName);
706          SharkUtilities.commitUserTransaction(t);
707       } catch (RootException e) {
708          SharkUtilities.rollbackUserTransaction(t,e);
709          if (e instanceof BaseException)
710             throw (BaseException)e;
711          else
712             throw new BaseException(e);
713       } finally {
714          SharkUtilities.releaseUserTransaction(t);
715       }
716    }
717
718    /**
719     * Removes group <i>subgroupName</i> from the group <i>groupName</i>.
720     *
721     * @param t user transaction.
722     * @param groupName name of the given group.
723     * @param subgroupName name of the given subgroup to be removed.
724     *
725     * @throws BaseException If something unexpected happens.
726     */

727    public void removeGroupFromGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc subgroupName) throws BaseException {
728     if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
729       try {
730          ugm.removeGroupFromGroup(t,groupName,subgroupName);
731       } catch (Exception JavaDoc e) {
732          throw new BaseException(e);
733       }
734    }
735
736    /**
737     * Deletes group <i>groupName</i> and all its child groups that don't belong
738     * to any other group except this one.
739     *
740     * @param groupName name of the given group.
741     *
742     * @throws BaseException If something unexpected happens.
743     */

744    public void removeGroupTree (String JavaDoc groupName) throws BaseException {
745       UserTransaction t = null;
746       try {
747          t = SharkUtilities.createUserTransaction();
748          removeGroupTree(t,groupName);
749          SharkUtilities.commitUserTransaction(t);
750       } catch (RootException e) {
751          SharkUtilities.rollbackUserTransaction(t,e);
752          if (e instanceof BaseException)
753             throw (BaseException)e;
754          else
755             throw new BaseException(e);
756       } finally {
757          SharkUtilities.releaseUserTransaction(t);
758       }
759    }
760
761    /**
762     * Deletes group <i>groupName</i> and all its child groups that don't belong
763     * to any other group except this one.
764     *
765     * @param t user transaction.
766     * @param groupName name of the given group.
767     *
768     * @throws BaseException If something unexpected happens.
769     */

770    public void removeGroupTree (UserTransaction t, String JavaDoc groupName) throws BaseException {
771     if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
772       try {
773          ugm.removeGroupTree(t,groupName);
774       } catch (Exception JavaDoc e) {
775          throw new BaseException(e);
776       }
777    }
778
779    /**
780     * Removes all users from group <i>group</i> that don't belong to any other
781     * group except this one.
782     *
783     * @param groupName name of the given group.
784     *
785     * @throws BaseException If something unexpected happens.
786     */

787    public void removeUsersFromGroupTree (String JavaDoc groupName) throws BaseException {
788       UserTransaction t = null;
789       try {
790          t = SharkUtilities.createUserTransaction();
791          removeUsersFromGroupTree(t,groupName);
792          SharkUtilities.commitUserTransaction(t);
793       } catch (RootException e) {
794          SharkUtilities.rollbackUserTransaction(t,e);
795          if (e instanceof BaseException)
796             throw (BaseException)e;
797          else
798             throw new BaseException(e);
799       } finally {
800          SharkUtilities.releaseUserTransaction(t);
801       }
802    }
803
804    /**
805     * Removes all users from group <i>group</i> that don't belong to any other
806     * group except this one.
807     *
808     * @param t user transaction.
809     * @param groupName name of the given group.
810     *
811     * @throws BaseException If something unexpected happens.
812     */

813    public void removeUsersFromGroupTree (UserTransaction t, String JavaDoc groupName) throws BaseException {
814     if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
815       try {
816          ugm.removeUsersFromGroupTree(t,groupName);
817       } catch (Exception JavaDoc e) {
818          throw new BaseException(e);
819       }
820    }
821
822    /**
823     * Moves group <i>subgroupName</i> from the group <i>currentParentGroup</i> to
824     * group <i>newParentGroup</i>.
825     *
826     * @param currentParentGroup current group that contains group subgroupName.
827     * @param newParentGroup new group where group subgroupName will be moved to.
828     * @param subgroupName subgroup that will be moved.
829     *
830     * @throws BaseException If something unexpected happens.
831     */

832    public void moveGroup (String JavaDoc currentParentGroup,String JavaDoc newParentGroup,String JavaDoc subgroupName) throws BaseException {
833       UserTransaction t = null;
834       try {
835          t = SharkUtilities.createUserTransaction();
836          moveGroup(t,currentParentGroup,newParentGroup,subgroupName);
837          SharkUtilities.commitUserTransaction(t);
838       } catch (RootException e) {
839          SharkUtilities.rollbackUserTransaction(t,e);
840          if (e instanceof BaseException)
841             throw (BaseException)e;
842          else
843             throw new BaseException(e);
844       } finally {
845          SharkUtilities.releaseUserTransaction(t);
846       }
847    }
848
849
850    /**
851     * Moves group <i>subgroupName</i> from the group <i>currentParentGroup</i> to
852     * group <i>newParentGroup</i>.
853     *
854     * @param t user transaction.
855     * @param currentParentGroup current group that contains group subgroupName.
856     * @param newParentGroup new group where group subgroupName will be moved to.
857     * @param subgroupName subgroup that will be moved.
858     *
859     * @throws BaseException If something unexpected happens.
860     */

861    public void moveGroup (UserTransaction t,String JavaDoc currentParentGroup,String JavaDoc newParentGroup,String JavaDoc subgroupName) throws BaseException {
862
863       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
864       try {
865          ugm.moveGroup(t,currentParentGroup,newParentGroup,subgroupName);
866       } catch (Exception JavaDoc e) {
867          throw new BaseException(e);
868       }
869    }
870
871    /**
872     * Returns a group description.
873     *
874     * @param groupName name of the given group.
875     * @return Group description.
876     *
877     * @throws BaseException If something unexpected happens.
878     */

879    public String JavaDoc getGroupDescription (String JavaDoc groupName) throws BaseException {
880       String JavaDoc s;
881       UserTransaction t = null;
882       try {
883          t = SharkUtilities.createUserTransaction();
884          s = getGroupDescription(t,groupName);
885          //SharkUtilities.commitUserTransaction(t);
886
return s;
887       } catch (RootException e) {
888          //SharkUtilities.rollbackUserTransaction(t);
889
if (e instanceof BaseException)
890             throw (BaseException)e;
891          else
892             throw new BaseException(e);
893       } finally {
894          SharkUtilities.releaseUserTransaction(t);
895       }
896    }
897
898    /**
899     * Returns a group description.
900     *
901     * @param t user transaction.
902     * @param groupName name of the given group.
903     * @return Group description.
904     *
905     * @throws BaseException If something unexpected happens.
906     */

907    public String JavaDoc getGroupDescription (UserTransaction t, String JavaDoc groupName) throws BaseException {
908       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
909       try {
910          String JavaDoc ret=ugm.getGroupDescription(t,groupName);
911          return ret;
912       } catch (Exception JavaDoc e) {
913          throw new BaseException(e);
914       }
915    }
916
917    /**
918     * Adds an existing user with a given username to the given group.
919     *
920     * @param groupName name of the given group.
921     * @param username username used to uniquely identify shark user.
922     *
923     * @throws BaseException If something unexpected happens.
924     */

925    public void addUserToGroup (String JavaDoc groupName,String JavaDoc username) throws BaseException {
926       UserTransaction t = null;
927       try {
928          t = SharkUtilities.createUserTransaction();
929          addUserToGroup(t,groupName,username);
930          SharkUtilities.commitUserTransaction(t);
931       } catch (RootException e) {
932          SharkUtilities.rollbackUserTransaction(t,e);
933          if (e instanceof BaseException)
934             throw (BaseException)e;
935          else
936             throw new BaseException(e);
937       } finally {
938          SharkUtilities.releaseUserTransaction(t);
939       }
940    }
941
942    /**
943     * Adds an existing user with a given username to the given group.
944     *
945     * @param t user transaction.
946     * @param groupName name of the given group.
947     * @param username username used to uniquely identify shark user.
948     *
949     * @throws BaseException If something unexpected happens.
950     */

951    public void addUserToGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc username) throws BaseException {
952       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
953       try {
954          ugm.addUserToGroup(t,groupName,username);
955       } catch (Exception JavaDoc e) {
956          throw new BaseException(e);
957       }
958    }
959
960    /**
961     * Removes the user from the group.
962     *
963     * @param groupName name of the given group.
964     * @param username username used to uniquely identify shark user.
965     *
966     * @throws BaseException If something unexpected happens.
967     */

968    public void removeUserFromGroup (String JavaDoc groupName,String JavaDoc username) throws BaseException {
969       UserTransaction t = null;
970       try {
971          t = SharkUtilities.createUserTransaction();
972          removeUserFromGroup(t,groupName,username);
973          SharkUtilities.commitUserTransaction(t);
974       } catch (RootException e) {
975          SharkUtilities.rollbackUserTransaction(t,e);
976          if (e instanceof BaseException)
977             throw (BaseException)e;
978          else
979             throw new BaseException(e);
980       } finally {
981          SharkUtilities.releaseUserTransaction(t);
982       }
983    }
984
985    /**
986     * Removes the user from the group.
987     *
988     * @param t user transaction.
989     * @param groupName name of the given group.
990     * @param username username used to uniquely identify shark user.
991     *
992     * @throws BaseException If something unexpected happens.
993     */

994    public void removeUserFromGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc username) throws BaseException {
995       if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
996       try {
997          ugm.removeUserFromGroup(t,groupName,username);
998       } catch (Exception JavaDoc e) {
999          throw new BaseException(e);
1000      }
1001   }
1002
1003   /**
1004    * Moves user <i>username</i> from the group <i>currentGroup</i> to group
1005    * <i>newGroup</i>.
1006    *
1007    * @param currentGroup current group that contains the user.
1008    * @param newGroup new group where the user will be moved to.
1009    * @param username the user that will be moved.
1010    *
1011    * @throws BaseException If something unexpected happens.
1012    */

1013   public void moveUser (String JavaDoc currentGroup,String JavaDoc newGroup,String JavaDoc username) throws BaseException {
1014      UserTransaction t = null;
1015      try {
1016         t = SharkUtilities.createUserTransaction();
1017         moveUser (t,currentGroup,newGroup,username);
1018         SharkUtilities.commitUserTransaction(t);
1019      } catch (RootException e) {
1020         SharkUtilities.rollbackUserTransaction(t,e);
1021         if (e instanceof BaseException)
1022            throw (BaseException)e;
1023         else
1024            throw new BaseException(e);
1025      } finally {
1026         SharkUtilities.releaseUserTransaction(t);
1027      }
1028   }
1029
1030   /**
1031    * Moves user <i>username</i> from the group <i>currentGroup</i> to group
1032    * <i>newGroup</i>.
1033    *
1034    * @param t user transaction.
1035    * @param currentGroup current group that contains the user.
1036    * @param newGroup new group where the user will be moved to.
1037    * @param username the user that will be moved.
1038    *
1039    * @throws BaseException If something unexpected happens.
1040    */

1041   public void moveUser (UserTransaction t,String JavaDoc currentGroup,String JavaDoc newGroup,String JavaDoc username) throws BaseException {
1042      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1043      try {
1044         ugm.moveUser(t,currentGroup,newGroup,username);
1045      } catch (Exception JavaDoc e) {
1046         throw new BaseException(e);
1047      }
1048   }
1049
1050   /**
1051    * Returns true if the given user belongs to the given group.
1052    *
1053    * @param groupName name of the given group.
1054    * @param username username used to uniquely identify shark user.
1055    * @return true if the given user belongs to the given group, otherwise
1056    * false.
1057    *
1058    * @throws BaseException If something unexpected happens.
1059    */

1060   public boolean doesUserBelongToGroup (String JavaDoc groupName,String JavaDoc username) throws BaseException {
1061      boolean ret = false;
1062      UserTransaction t = null;
1063      try {
1064         t = SharkUtilities.createUserTransaction();
1065         ret = doesUserBelongToGroup(t,groupName,username);
1066         //SharkUtilities.commitUserTransaction(t);
1067
return ret;
1068      } catch (RootException e) {
1069         //SharkUtilities.rollbackUserTransaction(t);
1070
if (e instanceof BaseException)
1071            throw (BaseException)e;
1072         else
1073            throw new BaseException(e);
1074      } finally {
1075         SharkUtilities.releaseUserTransaction(t);
1076      }
1077   }
1078
1079   /**
1080    * Returns true if the given user belongs to the given group.
1081    *
1082    * @param t user transaction.
1083    * @param groupName name of the given group.
1084    * @param username username used to uniquely identify shark user.
1085    * @return true if the given user belongs to the given group, otherwise
1086    * false.
1087    *
1088    * @throws BaseException If something unexpected happens.
1089    */

1090   public boolean doesUserBelongToGroup (UserTransaction t, String JavaDoc groupName,String JavaDoc username) throws BaseException {
1091      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1092      try {
1093         boolean ret=ugm.doesUserBelongToGroup(t,groupName,username);
1094         return ret;
1095      } catch (Exception JavaDoc e) {
1096         throw new BaseException(e);
1097      }
1098   }
1099
1100   /**
1101    * Allows administrator to create new user. After its creation, the client
1102    * application will always be able to log onto shark using username and
1103    * password defined for the user.
1104    *
1105    * @param groupName groupName used to uniquely identify group -
1106    * this parameter is mandatory.
1107    * @param username username used to uniquely identify user -
1108    * this parameter is mandatory.
1109    * @param password password used to authenticate -
1110    * this parameter is mandatory.
1111    * @param firstName the user's first name.
1112    * @param lastName the user's last name.
1113    * @param emailAddress email address of the user.
1114    *
1115    * @throws BaseException If something unexpected happens (i.e the user with
1116    * given username already exists).
1117    */

1118   public void createUser (String JavaDoc groupName,String JavaDoc username, String JavaDoc password, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc emailAddress) throws BaseException {
1119      UserTransaction t = null;
1120      try {
1121         t = SharkUtilities.createUserTransaction();
1122         createUser(t,groupName,username,password,firstName,lastName,emailAddress);
1123         SharkUtilities.commitUserTransaction(t);
1124      } catch (RootException e) {
1125         SharkUtilities.rollbackUserTransaction(t,e);
1126         if (e instanceof BaseException)
1127            throw (BaseException)e;
1128         else
1129            throw new BaseException(e);
1130      } finally {
1131         SharkUtilities.releaseUserTransaction(t);
1132      }
1133   }
1134
1135   /**
1136    * Allows administrator to create new user. After its creation, the client
1137    * application will always be able to log onto shark using username and
1138    * password defined for the user.
1139    *
1140    * @param t user transaction.
1141    * @param groupName groupName used to uniquely identify group -
1142    * this parameter is mandatory.
1143    * @param username username used to uniquely identify user -
1144    * this parameter is mandatory.
1145    * @param password password used to authenticate -
1146    * this parameter is mandatory.
1147    * @param firstName the user's first name.
1148    * @param lastName the user's last name.
1149    * @param emailAddress email address of the user.
1150    *
1151    * @throws BaseException If something unexpected happens (i.e the user with
1152    * given username already exists).
1153    */

1154   public void createUser (UserTransaction t, String JavaDoc groupName,String JavaDoc username, String JavaDoc password, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc emailAddress) throws BaseException {
1155      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1156      try {
1157         ugm.createUser(t,groupName,username,password,firstName,lastName,emailAddress);
1158      } catch (Exception JavaDoc e) {
1159         throw new BaseException(e);
1160      }
1161   }
1162
1163   /**
1164    * Allows administrator to remove the user.
1165    *
1166    * @param username username used to uniquely identify user.
1167    *
1168    * @throws BaseException If something unexpected happens (i.e the user with
1169    * given username does not exist, or this is a user that can't be removed).
1170    */

1171   public void removeUser (String JavaDoc username) throws BaseException {
1172      UserTransaction t = null;
1173      try {
1174         t = SharkUtilities.createUserTransaction();
1175         removeUser(t,username);
1176         SharkUtilities.commitUserTransaction(t);
1177      } catch (RootException e) {
1178         SharkUtilities.rollbackUserTransaction(t,e);
1179         if (e instanceof BaseException)
1180            throw (BaseException)e;
1181         else
1182            throw new BaseException(e);
1183      } finally {
1184         SharkUtilities.releaseUserTransaction(t);
1185      }
1186   }
1187
1188   /**
1189    * Allows administrator to remove the user.
1190    *
1191    * @param t user transaction.
1192    * @param username username used to uniquely identify user.
1193    *
1194    * @throws BaseException If something unexpected happens (i.e the user with
1195    * given username does not exist, or this is a user that can't be removed).
1196    */

1197   public void removeUser (UserTransaction t, String JavaDoc username) throws BaseException {
1198      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1199      try {
1200         ugm.removeUser(t,username);
1201      } catch (Exception JavaDoc e) {
1202         throw new BaseException(e);
1203      }
1204   }
1205
1206   /**
1207    * Allows administrator to update data about user.
1208    *
1209    * @param username username used to uniquely identify user -
1210    * this parameter is mandatory.
1211    * @param firstName the user's first name.
1212    * @param lastName the user's last name.
1213    * @param emailAddress email address of the user.
1214    *
1215    * @throws BaseException If something unexpected happens (i.e the user with
1216    * given username does not exist).
1217    */

1218   public void updateUser (String JavaDoc username,String JavaDoc firstName, String JavaDoc lastName, String JavaDoc emailAddress) throws BaseException {
1219      UserTransaction t = null;
1220      try {
1221         t = SharkUtilities.createUserTransaction();
1222         updateUser(t,username,firstName,lastName,emailAddress);
1223         SharkUtilities.commitUserTransaction(t);
1224      } catch (RootException e) {
1225         SharkUtilities.rollbackUserTransaction(t,e);
1226         if (e instanceof BaseException)
1227            throw (BaseException)e;
1228         else
1229            throw new BaseException(e);
1230      } finally {
1231         SharkUtilities.releaseUserTransaction(t);
1232      }
1233   }
1234
1235   /**
1236    * Allows administrator to update data about user.
1237    *
1238    * @param t user transaction.
1239    * @param username username used to uniquely identify user -
1240    * this parameter is mandatory.
1241    * @param firstName the user's first name.
1242    * @param lastName the user's last name.
1243    * @param emailAddress email address of the user.
1244    *
1245    * @throws BaseException If something unexpected happens (i.e the user with
1246    * given username does not exist).
1247    */

1248   public void updateUser (UserTransaction t, String JavaDoc username,String JavaDoc firstName, String JavaDoc lastName, String JavaDoc emailAddress) throws BaseException {
1249      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1250      try {
1251         ugm.updateUser(t,username,firstName,lastName,emailAddress);
1252      } catch (Exception JavaDoc e) {
1253         throw new BaseException(e);
1254      }
1255   }
1256
1257   /**
1258    * Sets user password.
1259    *
1260    * @param username username of the shark user.
1261    * @param password new password of the shark user.
1262    *
1263    * @throws BaseException If something unexpected happens.
1264    */

1265   public void setPassword (String JavaDoc username,String JavaDoc password) throws BaseException {
1266      UserTransaction t = null;
1267      try {
1268         t = SharkUtilities.createUserTransaction();
1269         setPassword(t,username,password);
1270         SharkUtilities.commitUserTransaction(t);
1271      } catch (RootException e) {
1272         SharkUtilities.rollbackUserTransaction(t,e);
1273         if (e instanceof BaseException)
1274            throw (BaseException)e;
1275         else
1276            throw new BaseException(e);
1277      } finally {
1278         SharkUtilities.releaseUserTransaction(t);
1279      }
1280   }
1281
1282   /**
1283    * Sets user password.
1284    *
1285    * @param t user transaction.
1286    * @param username username of the shark user.
1287    * @param password new password of the shark user.
1288    *
1289    * @throws BaseException If something unexpected happens.
1290    */

1291   public void setPassword (UserTransaction t, String JavaDoc username,String JavaDoc password) throws BaseException {
1292      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1293      try {
1294         ugm.setPassword(t,username,password);
1295      } catch (Exception JavaDoc e) {
1296         throw new BaseException(e);
1297      }
1298   }
1299
1300   /**
1301    * Returns true if user with given username exists.
1302    *
1303    * @param username username of the shark user.
1304    * @return true if the user with the given username exists, otherwise false.
1305    *
1306    * @throws BaseException If something unexpected happens.
1307    */

1308   public boolean doesUserExist (String JavaDoc username) throws BaseException {
1309      boolean ret = false;
1310      UserTransaction t = null;
1311      try {
1312         t = SharkUtilities.createUserTransaction();
1313         ret = doesUserExist(t,username);
1314         //SharkUtilities.commitUserTransaction(t);
1315
return ret;
1316      } catch (RootException e) {
1317         //SharkUtilities.rollbackUserTransaction(t);
1318
if (e instanceof BaseException)
1319            throw (BaseException)e;
1320         else
1321            throw new BaseException(e);
1322      } finally {
1323         SharkUtilities.releaseUserTransaction(t);
1324      }
1325   }
1326
1327   /**
1328    * Returns true if user with given username exists.
1329    *
1330    * @param t user transaction.
1331    * @param username username of the shark user.
1332    * @return true if the user with the given username exists, otherwise false.
1333    *
1334    * @throws BaseException If something unexpected happens.
1335    */

1336   public boolean doesUserExist (UserTransaction t, String JavaDoc username) throws BaseException {
1337      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1338      try {
1339         boolean ret=ugm.doesUserExist(t,username);
1340         return ret;
1341      } catch (Exception JavaDoc e) {
1342         throw new BaseException(e);
1343      }
1344   }
1345
1346   /**
1347    * Returns string representing the real name for the shark user with the
1348    * given username (first and last name).
1349    *
1350    * @param username username of the shark user.
1351    * @return Real name of the shark user.
1352    *
1353    * @throws BaseException If something unexpected happens.
1354    */

1355   public String JavaDoc getUserRealName (String JavaDoc username) throws BaseException {
1356      String JavaDoc s;
1357      UserTransaction t = null;
1358      try {
1359         t = SharkUtilities.createUserTransaction();
1360         s = getUserRealName(t,username);
1361         //SharkUtilities.commitUserTransaction(t);
1362
return s;
1363      } catch (RootException e) {
1364         //SharkUtilities.rollbackUserTransaction(t);
1365
if (e instanceof BaseException)
1366            throw (BaseException)e;
1367         else
1368            throw new BaseException(e);
1369      } finally {
1370         SharkUtilities.releaseUserTransaction(t);
1371      }
1372   }
1373
1374   /**
1375    * Returns string representing the real name for the shark user with the
1376    * given username (first and last name).
1377    *
1378    * @param t user transaction.
1379    * @param username username of the shark user.
1380    * @return Real name of the shark user.
1381    *
1382    * @throws BaseException If something unexpected happens.
1383    */

1384   public String JavaDoc getUserRealName (UserTransaction t, String JavaDoc username) throws BaseException {
1385      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1386      try {
1387         String JavaDoc ret=ugm.getUserRealName(t,username);
1388         return ret;
1389      } catch (Exception JavaDoc e) {
1390         throw new BaseException(e);
1391      }
1392   }
1393
1394   /**
1395    * Returns string representing user's first name.
1396    *
1397    * @param username username of the shark user.
1398    * @return First name of the shark user.
1399    *
1400    * @throws BaseException If something unexpected happens.
1401    */

1402   public String JavaDoc getUserFirstName (String JavaDoc username) throws BaseException {
1403      String JavaDoc s;
1404      UserTransaction t = null;
1405      try {
1406         t = SharkUtilities.createUserTransaction();
1407         s = getUserFirstName(t,username);
1408         //SharkUtilities.commitUserTransaction(t);
1409
return s;
1410      } catch (RootException e) {
1411         //SharkUtilities.rollbackUserTransaction(t);
1412
if (e instanceof BaseException)
1413            throw (BaseException)e;
1414         else
1415            throw new BaseException(e);
1416      } finally {
1417         SharkUtilities.releaseUserTransaction(t);
1418      }
1419   }
1420
1421   /**
1422    * Returns string representing user's first name.
1423    *
1424    * @param t user transaction.
1425    * @param username username of the shark user.
1426    * @return First name of the shark user.
1427    *
1428    * @throws BaseException If something unexpected happens.
1429    */

1430   public String JavaDoc getUserFirstName (UserTransaction t,String JavaDoc username) throws BaseException {
1431      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1432      try {
1433         String JavaDoc ret=ugm.getUserFirstName(t,username);
1434         return ret;
1435      } catch (Exception JavaDoc e) {
1436         throw new BaseException(e);
1437      }
1438   }
1439
1440   /**
1441    * Returns string representing user's last name.
1442    *
1443    * @param username username of the shark user.
1444    * @return Last name of the shark user.
1445    *
1446    * @throws BaseException If something unexpected happens.
1447    */

1448   public String JavaDoc getUserLastName (String JavaDoc username) throws BaseException {
1449      String JavaDoc s;
1450      UserTransaction t = null;
1451      try {
1452         t = SharkUtilities.createUserTransaction();
1453         s = getUserLastName(t,username);
1454         //SharkUtilities.commitUserTransaction(t);
1455
return s;
1456      } catch (RootException e) {
1457         //SharkUtilities.rollbackUserTransaction(t);
1458
if (e instanceof BaseException)
1459            throw (BaseException)e;
1460         else
1461            throw new BaseException(e);
1462      } finally {
1463         SharkUtilities.releaseUserTransaction(t);
1464      }
1465   }
1466
1467   /**
1468    * Returns string representing user's last name.
1469    *
1470    * @param t user transaction.
1471    * @param username username of the shark user.
1472    * @return Last name of the shark user.
1473    *
1474    * @throws BaseException If something unexpected happens.
1475    */

1476   public String JavaDoc getUserLastName (UserTransaction t,String JavaDoc username) throws BaseException {
1477      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1478      try {
1479         String JavaDoc ret=ugm.getUserLastName(t,username);
1480         return ret;
1481      } catch (Exception JavaDoc e) {
1482         throw new BaseException(e);
1483      }
1484   }
1485
1486   /**
1487    * Returns string representing email address for the user with the given
1488    * username.
1489    *
1490    * @param username username of the shark user.
1491    * @return Email of the shark user.
1492    *
1493    * @throws BaseException If something unexpected happens.
1494    */

1495   public String JavaDoc getUserEMailAddress (String JavaDoc username) throws BaseException {
1496      String JavaDoc s;
1497      UserTransaction t = null;
1498      try {
1499         t = SharkUtilities.createUserTransaction();
1500         s = getUserEMailAddress(t,username);
1501         //SharkUtilities.commitUserTransaction(t);
1502
return s;
1503      } catch (RootException e) {
1504         //SharkUtilities.rollbackUserTransaction(t);
1505
if (e instanceof BaseException)
1506            throw (BaseException)e;
1507         else
1508            throw new BaseException(e);
1509      } finally {
1510         SharkUtilities.releaseUserTransaction(t);
1511      }
1512   }
1513
1514   /**
1515    * Returns string representing email address for the user with the given
1516    * username.
1517    *
1518    * @param t user transaction.
1519    * @param username username of the shark user.
1520    * @return Email of the shark user.
1521    *
1522    * @throws BaseException If something unexpected happens.
1523    */

1524   public String JavaDoc getUserEMailAddress (UserTransaction t, String JavaDoc username) throws BaseException {
1525      if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!");
1526      try {
1527         String JavaDoc ret=ugm.getUserEMailAddress(t,username);
1528         return ret;
1529      } catch (Exception JavaDoc e) {
1530         throw new BaseException(e);
1531      }
1532   }
1533
1534}
1535
Popular Tags