1 23 24 package com.sun.enterprise.admin.event; 25 26 import com.sun.enterprise.admin.event.AdminEvent; 27 28 import com.sun.enterprise.util.i18n.StringManager; 30 31 39 public class UserMgmtEvent extends AdminEvent { 40 41 44 public static final int ACTION_USERADD = 1; 45 public static final int ACTION_USERUPDATE = 2; 46 public static final int ACTION_USERREMOVE = 3; 47 48 51 static final String eventType = UserMgmtEvent.class.getName(); 52 53 56 private int actionType; 57 private String realmName; 58 private String userName; 59 private String [] groupList; 60 61 private static StringManager localStrings = StringManager.getManager( UserMgmtEvent.class ); 63 64 74 public UserMgmtEvent(String instance, String realm, int action, String user, String [] groups) { 75 this(eventType, instance, realm, action, user, groups); 76 } 77 78 89 public UserMgmtEvent(String type, String instance, String realm, int action, String user, String [] groups) { 90 super(type, instance); 91 realmName = realm; 92 userName = user; 93 groupList = groups; 94 setAction(action); 95 } 96 97 100 public String getAuthRealmName() { 101 return realmName; 102 } 103 104 107 public String getUserName() { 108 return userName; 109 } 110 111 114 public String [] getGroupList() { 115 return groupList; 116 } 117 118 121 public int getActionType() { 122 return actionType; 123 } 124 125 130 private void setAction(int action) { 131 boolean valid = false; 132 if (action==ACTION_USERADD || 133 action==ACTION_USERUPDATE || 134 action==ACTION_USERREMOVE ) 135 valid = true; 136 if (!valid) { 137 String msg = localStrings.getString( "admin.event.invalid_action", ""+action ); 138 throw new IllegalArgumentException ( msg ); 139 } 140 this.actionType = action; 141 } 142 143 } 144 | Popular Tags |