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