1 package org.enhydra.shark.corba.poa; 2 3 import org.omg.WfBase.*; 4 import org.enhydra.shark.corba.WorkflowService.*; 5 import org.enhydra.shark.corba.poa.SharkCORBAServer; 6 7 8 9 13 public class UserGroupAdminCORBA extends UserGroupAdministrationPOA { 14 private SharkCORBAServer myServer; 15 16 private String userId; 17 private boolean connected=false; 18 19 org.enhydra.shark.api.client.wfservice.UserGroupAdministration myUGAdmin; 20 21 UserGroupAdminCORBA (SharkCORBAServer server,org.enhydra.shark.api.client.wfservice.UserGroupAdministration uga) { 22 this.myServer=server; 23 this.myUGAdmin=uga; 24 25 } 26 27 public void connect(String userId, String password, String engineName, String scope) throws BaseException, ConnectFailed { 28 this.userId=userId; 29 30 try { 31 if (!myServer.validateUser(userId,password)) { 32 throw new ConnectFailed("Connection failed, invalid username or password"); 33 } 34 connected=true; 35 myUGAdmin.connect(userId); 36 } catch (ConnectFailed cf) { 37 throw cf; 38 } catch (Exception ex) { 39 throw new BaseException(); 40 } 41 } 42 43 public void disconnect() throws BaseException, NotConnected { 44 if (!connected) { 45 throw new NotConnected("The connection is not established..."); 46 } 47 connected=false; 48 _this()._release(); 49 } 50 51 public String [] getAllGroupnames () throws BaseException, NotConnected { 52 if (!connected) { 53 throw new NotConnected("The connection is not established..."); 54 } 55 try { 56 return myUGAdmin.getAllGroupnames(); 57 } catch (Exception e) { 58 throw new BaseException(); 59 } 60 } 61 62 public String [] getAllUsers () throws BaseException, NotConnected { 63 if (!connected) { 64 throw new NotConnected("The connection is not established..."); 65 } 66 try { 67 return myUGAdmin.getAllUsers(); 68 } catch (Exception e) { 69 throw new BaseException(); 70 } 71 } 72 73 public String [] getAllImmediateUsers (String groupName) throws BaseException, NotConnected { 74 if (!connected) { 75 throw new NotConnected("The connection is not established..."); 76 } 77 try { 78 return myUGAdmin.getAllImmediateUsers(groupName); 79 } catch (Exception e) { 80 throw new BaseException(); 81 } 82 } 83 84 public String [] getAllUsersForGroup (String groupName) throws BaseException, NotConnected { 85 if (!connected) { 86 throw new NotConnected("The connection is not established..."); 87 } 88 try { 89 return myUGAdmin.getAllUsers(groupName); 90 } catch (Exception e) { 91 throw new BaseException(); 92 } 93 } 94 95 public String [] getAllUsersForGroups(String [] groupNames) throws BaseException, NotConnected { 96 if (!connected) { 97 throw new NotConnected("The connection is not established..."); 98 } 99 try { 100 return myUGAdmin.getAllUsers(groupNames); 101 } catch (Exception e) { 102 throw new BaseException(); 103 } 104 } 105 106 public String [] getAllSubgroups (String groupName) throws BaseException, NotConnected { 107 if (!connected) { 108 throw new NotConnected("The connection is not established..."); 109 } 110 try { 111 return myUGAdmin.getAllSubgroups(groupName); 112 } catch (Exception e) { 113 throw new BaseException(); 114 } 115 } 116 117 public String [] getAllSubgroupsForGroups(String [] groupNames) throws BaseException, NotConnected { 118 if (!connected) { 119 throw new NotConnected("The connection is not established..."); 120 } 121 try { 122 return myUGAdmin.getAllSubgroups(groupNames); 123 } catch (Exception e) { 124 throw new BaseException(); 125 } 126 } 127 128 public String [] getAllImmediateSubgroups (String groupName) throws BaseException, NotConnected { 129 if (!connected) { 130 throw new NotConnected("The connection is not established..."); 131 } 132 try { 133 return myUGAdmin.getAllImmediateSubgroups(groupName); 134 } catch (Exception e) { 135 throw new BaseException(); 136 } 137 } 138 139 public void createGroup (String groupName,String description) throws BaseException, NotConnected { 140 if (!connected) { 141 throw new NotConnected("The connection is not established..."); 142 } 143 try { 144 myUGAdmin.createGroup(groupName,description); 145 } catch (Exception e) { 146 throw new BaseException(); 147 } 148 } 149 150 public void removeGroup (String groupName) throws BaseException, NotConnected { 151 if (!connected) { 152 throw new NotConnected("The connection is not established..."); 153 } 154 try { 155 myUGAdmin.removeGroup(groupName); 156 } catch (Exception e) { 157 throw new BaseException(); 158 } 159 } 160 161 public boolean doesGroupExist (String groupName) throws BaseException, NotConnected { 162 if (!connected) { 163 throw new NotConnected("The connection is not established..."); 164 } 165 try { 166 return myUGAdmin.doesGroupExist(groupName); 167 } catch (Exception e) { 168 throw new BaseException(); 169 } 170 } 171 172 public boolean doesGroupBelongToGroup (String groupName, String subgroupName) throws BaseException, NotConnected { 173 if (!connected) { 174 throw new NotConnected("The connection is not established..."); 175 } 176 try { 177 return myUGAdmin.doesGroupBelongToGroup(groupName,subgroupName); 178 } catch (Exception e) { 179 throw new BaseException(); 180 } 181 } 182 183 public void updateGroup (String groupName,String description) throws BaseException, NotConnected { 184 if (!connected) { 185 throw new NotConnected("The connection is not established..."); 186 } 187 try { 188 myUGAdmin.updateGroup(groupName,description); 189 } catch (Exception e) { 190 throw new BaseException(); 191 } 192 } 193 194 public void addGroupToGroup (String groupName,String subgroupName) throws BaseException, NotConnected { 195 if (!connected) { 196 throw new NotConnected("The connection is not established..."); 197 } 198 try { 199 myUGAdmin.addGroupToGroup(groupName,subgroupName); 200 } catch (Exception e) { 201 throw new BaseException(); 202 } 203 } 204 205 public void removeGroupFromGroup (String groupName,String subgroupName) throws BaseException, NotConnected { 206 if (!connected) { 207 throw new NotConnected("The connection is not established..."); 208 } 209 try { 210 myUGAdmin.removeGroupFromGroup(groupName,subgroupName); 211 } catch (Exception e) { 212 throw new BaseException(); 213 } 214 } 215 216 public void removeGroupTree (String groupName) throws BaseException, NotConnected { 217 if (!connected) { 218 throw new NotConnected("The connection is not established..."); 219 } 220 try { 221 myUGAdmin.removeGroupTree(groupName); 222 } catch (Exception e) { 223 throw new BaseException(); 224 } 225 } 226 227 public void removeUsersFromGroupTree (String groupName) throws BaseException, NotConnected { 228 if (!connected) { 229 throw new NotConnected("The connection is not established..."); 230 } 231 try { 232 myUGAdmin.removeUsersFromGroupTree(groupName); 233 } catch (Exception e) { 234 throw new BaseException(); 235 } 236 } 237 238 public void moveGroup (String currentParentGroup, 239 String newParentGroup, 240 String subgroupName) throws BaseException, NotConnected { 241 if (!connected) { 242 throw new NotConnected("The connection is not established..."); 243 } 244 try { 245 myUGAdmin.moveGroup(currentParentGroup,newParentGroup,subgroupName); 246 } catch (Exception e) { 247 throw new BaseException(); 248 } 249 } 250 251 public String getGroupDescription (String groupName) throws BaseException, NotConnected { 252 if (!connected) { 253 throw new NotConnected("The connection is not established..."); 254 } 255 try { 256 return myUGAdmin.getGroupDescription(groupName); 257 } catch (Exception e) { 258 throw new BaseException(); 259 } 260 } 261 262 public void addUserToGroup (String groupName,String username) throws BaseException, NotConnected { 263 if (!connected) { 264 throw new NotConnected("The connection is not established..."); 265 } 266 try { 267 myUGAdmin.addUserToGroup(groupName,username); 268 } catch (Exception e) { 269 throw new BaseException(); 270 } 271 } 272 273 public void removeUserFromGroup (String groupName,String username) throws BaseException, NotConnected { 274 if (!connected) { 275 throw new NotConnected("The connection is not established..."); 276 } 277 try { 278 myUGAdmin.removeUserFromGroup(groupName,username); 279 } catch (Exception e) { 280 throw new BaseException(); 281 } 282 } 283 284 public void moveUser (String currentGroup, 285 String newGroup, 286 String username) throws BaseException, NotConnected { 287 if (!connected) { 288 throw new NotConnected("The connection is not established..."); 289 } 290 try { 291 myUGAdmin.moveUser(currentGroup,newGroup,username); 292 } catch (Exception e) { 293 throw new BaseException(); 294 } 295 } 296 297 public boolean doesUserBelongToGroup (String groupName,String username) throws BaseException, NotConnected { 298 if (!connected) { 299 throw new NotConnected("The connection is not established..."); 300 } 301 try { 302 return myUGAdmin.doesUserBelongToGroup(groupName,username); 303 } catch (Exception e) { 304 throw new BaseException(); 305 } 306 } 307 308 public void createUser (String groupName,String username, String password, String firstName, String lastName, String emailAddress) throws BaseException, NotConnected { 309 if (!connected) { 310 throw new NotConnected("The connection is not established..."); 311 } 312 try { 313 myUGAdmin.createUser(groupName,username,password,firstName,lastName,emailAddress); 314 } catch (Exception e) { 315 throw new BaseException(); 316 } 317 } 318 319 public void removeUser (String username) throws BaseException, NotConnected { 320 if (!connected) { 321 throw new NotConnected("The connection is not established..."); 322 } 323 try { 324 myUGAdmin.removeUser(username); 325 } catch (Exception e) { 326 throw new BaseException(); 327 } 328 } 329 330 public void updateUser (String username,String firstName, String lastName, String emailAddress) throws BaseException, NotConnected { 331 if (!connected) { 332 throw new NotConnected("The connection is not established..."); 333 } 334 try { 335 myUGAdmin.updateUser(username,firstName,lastName,emailAddress); 336 } catch (Exception e) { 337 throw new BaseException(); 338 } 339 } 340 341 public void setPassword (String username,String password) throws BaseException, NotConnected { 342 if (!connected) { 343 throw new NotConnected("The connection is not established..."); 344 } 345 try { 346 myUGAdmin.setPassword(username,password); 347 } catch (Exception e) { 348 throw new BaseException(); 349 } 350 } 351 352 public boolean doesUserExist (String username) throws BaseException, NotConnected { 353 if (!connected) { 354 throw new NotConnected("The connection is not established..."); 355 } 356 try { 357 return myUGAdmin.doesUserExist(username); 358 } catch (Exception e) { 359 throw new BaseException(); 360 } 361 } 362 363 public String getUserRealName (String username) throws BaseException, NotConnected { 364 if (!connected) { 365 throw new NotConnected("The connection is not established..."); 366 } 367 try { 368 return myUGAdmin.getUserRealName(username); 369 } catch (Exception e) { 370 throw new BaseException(); 371 } 372 } 373 374 public String getUserFirstName (String username) throws BaseException, NotConnected { 375 if (!connected) { 376 throw new NotConnected("The connection is not established..."); 377 } 378 try { 379 return myUGAdmin.getUserFirstName(username); 380 } catch (Exception e) { 381 throw new BaseException(); 382 } 383 } 384 385 public String getUserLastName (String username) throws BaseException, NotConnected { 386 if (!connected) { 387 throw new NotConnected("The connection is not established..."); 388 } 389 try { 390 return myUGAdmin.getUserLastName(username); 391 } catch (Exception e) { 392 throw new BaseException(); 393 } 394 } 395 396 public String getUserEMailAddress (String username) throws BaseException, NotConnected { 397 if (!connected) { 398 throw new NotConnected("The connection is not established..."); 399 } 400 try { 401 return myUGAdmin.getUserEMailAddress(username); 402 } catch (Exception e) { 403 throw new BaseException(); 404 } 405 } 406 407 } 408 | Popular Tags |