1 package org.enhydra.shark; 2 3 4 import java.util.Arrays ; 5 import java.util.List ; 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 18 public class UserGroupAdmin implements UserGroupAdministration { 19 20 UserGroupManager ugm; 21 22 private CallbackUtilities cus; 23 private String userId="Unknown"; 24 25 28 protected UserGroupAdmin () { 29 this.cus=SharkEngineManager.getInstance().getCallbackUtilities(); 30 ugm=SharkEngineManager.getInstance().getUserGroupManager(); 31 } 32 33 39 public void connect (String userId) { 40 this.userId=userId; 41 } 42 43 50 public String [] getAllGroupnames () throws BaseException { 51 String [] s; 52 UserTransaction t = null; 53 try { 54 t = SharkUtilities.createUserTransaction(); 55 s = getAllGroupnames(t); 56 return s; 58 } catch (RootException e) { 59 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 77 public String [] 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 l=ugm.getAllGroupnames(t); 81 String [] ret=new String [l.size()]; 82 l.toArray(ret); 83 return ret; 84 } catch (Exception e) { 85 throw new BaseException(e); 86 } 87 } 88 89 96 public String [] getAllUsers () throws BaseException { 97 String [] s; 98 UserTransaction t = null; 99 try { 100 t = SharkUtilities.createUserTransaction(); 101 s = getAllUsers(t); 102 return s; 104 } catch (RootException e) { 105 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 123 public String [] 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 l=ugm.getAllUsers(t); 127 String [] ret=new String [l.size()]; 128 l.toArray(ret); 129 return ret; 130 } catch (Exception e) { 131 throw new BaseException(e); 132 } 133 } 134 135 143 public String [] getAllUsers (String groupName) throws BaseException { 144 String [] s; 145 UserTransaction t = null; 146 try { 147 t = SharkUtilities.createUserTransaction(); 148 s = getAllUsers(t,groupName); 149 return s; 151 } catch (RootException e) { 152 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 171 public String [] getAllUsers (UserTransaction t, String groupName) throws BaseException { 172 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 173 try { 174 List l=ugm.getAllUsers(t,groupName); 175 String [] ret=new String [l.size()]; 176 l.toArray(ret); 177 return ret; 178 } catch (Exception e) { 179 throw new BaseException(e); 180 } 181 } 182 183 191 public String [] getAllUsers (String [] groupNames) throws BaseException { 192 String [] s; 193 UserTransaction t = null; 194 try { 195 t = SharkUtilities.createUserTransaction(); 196 s = getAllUsers(t, groupNames); 197 return s; 199 } catch (RootException e) { 200 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 219 public String [] getAllUsers (UserTransaction t, String [] groupNames) throws BaseException { 220 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 221 try { 222 List l=ugm.getAllUsers(t,Arrays.asList(groupNames)); 223 String [] ret=new String [l.size()]; 224 l.toArray(ret); 225 return ret; 226 } catch (Exception e) { 227 throw new BaseException(e); 228 } 229 } 230 231 240 public String [] getAllImmediateUsers (String groupName) throws BaseException { 241 String [] s; 242 UserTransaction t = null; 243 try { 244 t = SharkUtilities.createUserTransaction(); 245 s = getAllImmediateUsers(t,groupName); 246 return s; 248 } catch (RootException e) { 249 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 269 public String [] getAllImmediateUsers (UserTransaction t, String groupName) throws BaseException { 270 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 271 try { 272 List l=ugm.getAllImmediateUsers(t,groupName); 273 String [] ret=new String [l.size()]; 274 l.toArray(ret); 275 return ret; 276 } catch (Exception e) { 277 throw new BaseException(e); 278 } 279 } 280 281 289 public String [] getAllSubgroups (String groupName) throws BaseException { 290 String [] s; 291 UserTransaction t = null; 292 try { 293 t = SharkUtilities.createUserTransaction(); 294 s = getAllSubgroups(t,groupName); 295 return s; 297 } catch (RootException e) { 298 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 317 public String [] getAllSubgroups (UserTransaction t, String groupName) throws BaseException { 318 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 319 try { 320 List l=ugm.getAllSubgroups(t,groupName); 321 String [] ret=new String [l.size()]; 322 l.toArray(ret); 323 return ret; 324 } catch (Exception e) { 325 throw new BaseException(e); 326 } 327 } 328 329 337 public String [] getAllSubgroups (String [] groupNames) throws BaseException { 338 String [] s; 339 UserTransaction t = null; 340 try { 341 t = SharkUtilities.createUserTransaction(); 342 s = getAllSubgroups(t, groupNames); 343 return s; 345 } catch (RootException e) { 346 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 365 public String [] getAllSubgroups (UserTransaction t, String [] groupNames) throws BaseException { 366 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 367 try { 368 List l=ugm.getAllSubgroups(t,Arrays.asList(groupNames)); 369 String [] ret=new String [l.size()]; 370 l.toArray(ret); 371 return ret; 372 } catch (Exception e) { 373 throw new BaseException(e); 374 } 375 } 376 377 386 public String [] getAllImmediateSubgroups (String groupName) throws BaseException { 387 String [] s; 388 UserTransaction t = null; 389 try { 390 t = SharkUtilities.createUserTransaction(); 391 s = getAllImmediateSubgroups(t,groupName); 392 return s; 394 } catch (RootException e) { 395 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 415 public String [] getAllImmediateSubgroups (UserTransaction t, String groupName) throws BaseException { 416 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 417 try { 418 List l=ugm.getAllImmediateSubgroups(t,groupName); 419 String [] ret=new String [l.size()]; 420 l.toArray(ret); 421 return ret; 422 } catch (Exception e) { 423 throw new BaseException(e); 424 } 425 } 426 427 435 public void createGroup (String groupName,String 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 461 public void createGroup (UserTransaction t, String groupName,String 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 e) { 466 throw new BaseException(e); 467 } 468 } 469 470 477 public void removeGroup (String 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 502 public void removeGroup (UserTransaction t, String 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 e) { 507 throw new BaseException(e); 508 } 509 } 510 511 519 public boolean doesGroupExist (String groupName) throws BaseException { 520 boolean ret = false; 521 UserTransaction t = null; 522 try { 523 t = SharkUtilities.createUserTransaction(); 524 ret = doesGroupExist(t,groupName); 525 return ret; 527 } catch (RootException e) { 528 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 547 public boolean doesGroupExist (UserTransaction t, String 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 e) { 553 throw new BaseException(e); 554 } 555 } 556 557 567 public boolean doesGroupBelongToGroup (String groupName, String subgroupName) throws BaseException { 568 boolean ret = false; 569 UserTransaction t = null; 570 try { 571 t = SharkUtilities.createUserTransaction(); 572 ret = doesGroupBelongToGroup(t,groupName,subgroupName); 573 return ret; 575 } catch (RootException e) { 576 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 597 public boolean doesGroupBelongToGroup (UserTransaction t, String groupName, String 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 e) { 603 throw new BaseException(e); 604 } 605 } 606 607 615 public void updateGroup (String groupName,String 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 641 public void updateGroup (UserTransaction t, String groupName,String 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 e) { 646 throw new BaseException(e); 647 } 648 } 649 650 658 public void addGroupToGroup (String groupName,String 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 684 public void addGroupToGroup (UserTransaction t, String groupName,String 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 e) { 689 throw new BaseException(e); 690 } 691 } 692 693 701 public void removeGroupFromGroup (String groupName,String 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 727 public void removeGroupFromGroup (UserTransaction t, String groupName,String 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 e) { 732 throw new BaseException(e); 733 } 734 } 735 736 744 public void removeGroupTree (String 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 770 public void removeGroupTree (UserTransaction t, String 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 e) { 775 throw new BaseException(e); 776 } 777 } 778 779 787 public void removeUsersFromGroupTree (String 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 813 public void removeUsersFromGroupTree (UserTransaction t, String 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 e) { 818 throw new BaseException(e); 819 } 820 } 821 822 832 public void moveGroup (String currentParentGroup,String newParentGroup,String 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 861 public void moveGroup (UserTransaction t,String currentParentGroup,String newParentGroup,String 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 e) { 867 throw new BaseException(e); 868 } 869 } 870 871 879 public String getGroupDescription (String groupName) throws BaseException { 880 String s; 881 UserTransaction t = null; 882 try { 883 t = SharkUtilities.createUserTransaction(); 884 s = getGroupDescription(t,groupName); 885 return s; 887 } catch (RootException e) { 888 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 907 public String getGroupDescription (UserTransaction t, String groupName) throws BaseException { 908 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 909 try { 910 String ret=ugm.getGroupDescription(t,groupName); 911 return ret; 912 } catch (Exception e) { 913 throw new BaseException(e); 914 } 915 } 916 917 925 public void addUserToGroup (String groupName,String 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 951 public void addUserToGroup (UserTransaction t, String groupName,String 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 e) { 956 throw new BaseException(e); 957 } 958 } 959 960 968 public void removeUserFromGroup (String groupName,String 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 994 public void removeUserFromGroup (UserTransaction t, String groupName,String 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 e) { 999 throw new BaseException(e); 1000 } 1001 } 1002 1003 1013 public void moveUser (String currentGroup,String newGroup,String 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 1041 public void moveUser (UserTransaction t,String currentGroup,String newGroup,String 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 e) { 1046 throw new BaseException(e); 1047 } 1048 } 1049 1050 1060 public boolean doesUserBelongToGroup (String groupName,String username) throws BaseException { 1061 boolean ret = false; 1062 UserTransaction t = null; 1063 try { 1064 t = SharkUtilities.createUserTransaction(); 1065 ret = doesUserBelongToGroup(t,groupName,username); 1066 return ret; 1068 } catch (RootException e) { 1069 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 1090 public boolean doesUserBelongToGroup (UserTransaction t, String groupName,String 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 e) { 1096 throw new BaseException(e); 1097 } 1098 } 1099 1100 1118 public void createUser (String groupName,String username, String password, String firstName, String lastName, String 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 1154 public void createUser (UserTransaction t, String groupName,String username, String password, String firstName, String lastName, String 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 e) { 1159 throw new BaseException(e); 1160 } 1161 } 1162 1163 1171 public void removeUser (String 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 1197 public void removeUser (UserTransaction t, String 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 e) { 1202 throw new BaseException(e); 1203 } 1204 } 1205 1206 1218 public void updateUser (String username,String firstName, String lastName, String 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 1248 public void updateUser (UserTransaction t, String username,String firstName, String lastName, String 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 e) { 1253 throw new BaseException(e); 1254 } 1255 } 1256 1257 1265 public void setPassword (String username,String 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 1291 public void setPassword (UserTransaction t, String username,String 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 e) { 1296 throw new BaseException(e); 1297 } 1298 } 1299 1300 1308 public boolean doesUserExist (String username) throws BaseException { 1309 boolean ret = false; 1310 UserTransaction t = null; 1311 try { 1312 t = SharkUtilities.createUserTransaction(); 1313 ret = doesUserExist(t,username); 1314 return ret; 1316 } catch (RootException e) { 1317 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 1336 public boolean doesUserExist (UserTransaction t, String 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 e) { 1342 throw new BaseException(e); 1343 } 1344 } 1345 1346 1355 public String getUserRealName (String username) throws BaseException { 1356 String s; 1357 UserTransaction t = null; 1358 try { 1359 t = SharkUtilities.createUserTransaction(); 1360 s = getUserRealName(t,username); 1361 return s; 1363 } catch (RootException e) { 1364 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 1384 public String getUserRealName (UserTransaction t, String username) throws BaseException { 1385 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 1386 try { 1387 String ret=ugm.getUserRealName(t,username); 1388 return ret; 1389 } catch (Exception e) { 1390 throw new BaseException(e); 1391 } 1392 } 1393 1394 1402 public String getUserFirstName (String username) throws BaseException { 1403 String s; 1404 UserTransaction t = null; 1405 try { 1406 t = SharkUtilities.createUserTransaction(); 1407 s = getUserFirstName(t,username); 1408 return s; 1410 } catch (RootException e) { 1411 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 1430 public String getUserFirstName (UserTransaction t,String username) throws BaseException { 1431 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 1432 try { 1433 String ret=ugm.getUserFirstName(t,username); 1434 return ret; 1435 } catch (Exception e) { 1436 throw new BaseException(e); 1437 } 1438 } 1439 1440 1448 public String getUserLastName (String username) throws BaseException { 1449 String s; 1450 UserTransaction t = null; 1451 try { 1452 t = SharkUtilities.createUserTransaction(); 1453 s = getUserLastName(t,username); 1454 return s; 1456 } catch (RootException e) { 1457 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 1476 public String getUserLastName (UserTransaction t,String username) throws BaseException { 1477 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 1478 try { 1479 String ret=ugm.getUserLastName(t,username); 1480 return ret; 1481 } catch (Exception e) { 1482 throw new BaseException(e); 1483 } 1484 } 1485 1486 1495 public String getUserEMailAddress (String username) throws BaseException { 1496 String s; 1497 UserTransaction t = null; 1498 try { 1499 t = SharkUtilities.createUserTransaction(); 1500 s = getUserEMailAddress(t,username); 1501 return s; 1503 } catch (RootException e) { 1504 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 1524 public String getUserEMailAddress (UserTransaction t, String username) throws BaseException { 1525 if (ugm==null) throw new BaseException("Shark is configured to work without internal UserGroup API implementation!"); 1526 try { 1527 String ret=ugm.getUserEMailAddress(t,username); 1528 return ret; 1529 } catch (Exception e) { 1530 throw new BaseException(e); 1531 } 1532 } 1533 1534} 1535 | Popular Tags |