Fields Summary |
---|
private static final Class | SERIALIZABLEConstant denoting Serializable class |
public static final String | RESTART_NEEDEDConstant denoting - restart of server required. |
public static final String | RUNTIME_EXCEPTIONConstant denoting - runtime exception while processing event |
public static final String | RUNTIME_ERRORConstant denoting - runtime error while processing event |
public static final String | TRANSMISSION_ERRORConstant denoting - event transmission error |
public static final String | LISTENER_ERRORConstant denoting - error while processing event in listener |
public static final String | CONFIG_SNAPSHOT_ERRORConstant denoting - error while creating snapshot of config context |
public static final String | MBEAN_NOT_FOUNDConstant denoting - MBean not found. |
public static final String | MBEAN_ATTR_NOT_FOUNDConstant denoting - MBean attribute not found. This is used to denote
invalid attribute name for Monitoring GET command. |
public static final String | SUCCESSConstant denoting - successful event processing |
public static final String | MIXED_RESULTConstant denoting - some events failed and some events passsed |
public static final String | ERRORConstant denoting - that event notification was not successful,
resultCodes needs to checked for individual status |
private static HashMap | resultList |
private long | eventId |
private String | resultCode |
private HashMap | resultCodes |
private HashMap | allMessages |
private HashMap | allExceptions |
private HashMap | allAttributes |
private AdminEventListenerException | firstAle |
private Throwable | firstThr |
private static com.sun.enterprise.util.i18n.StringManager | localStrings |
Methods Summary |
---|
void | addAttribute(java.lang.String target, java.lang.String name, java.lang.Object value)Add specified attribute. This method can be used to add any
Serializable object to event result. The method throws
IllegalArgumentException, if name is null or the value is not
Serializable.
attributeCheck(name, value);
synchronized (allAttributes) {
HashMap attributes = (HashMap) allAttributes.get(target);
if ( attributes == null ) {
attributes = new HashMap();
allAttributes.put(target, attributes);
}
attributes.put(name, value);
}
|
public void | addEventResult(java.lang.String target, com.sun.enterprise.admin.event.AdminEventResult eventResult)Merge another event result into the current EventResult
if ( eventResult == null )
return;
this.allMessages.put( target,
eventResult.getMessages().get(target));
this.allExceptions.put( target,
eventResult.getExceptions().get(target));
this.allAttributes.put(target,
(HashMap)eventResult.getAttributes(target));
if ( resultCodes == null ) {
resultCodes = new HashMap();
resultCodes.put(target, eventResult.getResultCode());
}
|
public void | addException(java.lang.String target, java.lang.Throwable tt)Add an exception to the result.
Collection excs = (Collection)allExceptions.get(target);
if (excs == null) {
excs = new ArrayList();
allExceptions.put(target, excs);
}
excs.add(tt);
if ((firstAle == null) && (tt instanceof AdminEventListenerException)) {
firstAle = (AdminEventListenerException)tt;
}
if (firstThr == null) {
firstThr = tt;
}
|
public void | addMessage(java.lang.String target, java.lang.String message)Add another message
Collection msgs = (Collection)allMessages.get(target);
if ( msgs == null) {
msgs = new ArrayList();
allMessages.put(target, msgs);
}
msgs.add(message);
|
void | attributeCheck(java.lang.String name, java.lang.Object value)
if (name == null) {
String msg = localStrings.getString( "admin.event.null_attribute_name" );
throw new IllegalArgumentException( msg );
}
if (value != null) {
if (!SERIALIZABLE.isInstance(value)) {
String msg = localStrings.getString( "admin.event.value_not_serializable" );
throw new IllegalArgumentException( msg );
}
}
|
static void | clearAdminEventResultFromCache(AdminEvent event)Remove specified event from cache
resultList.remove(event);
|
public static com.sun.enterprise.admin.event.AdminEventResult | getAdminEventResult(AdminEvent event)Get admin event result from the cache
AdminEventResult result = (AdminEventResult)resultList.get(event);
if (result == null) {
result = new AdminEventResult(event.getSequenceNumber());
resultList.put(event, result);
}
return result;
|
public java.lang.String | getAllMessagesAsString()Return all the messages as a String. Note that the Returned
String can be really big. Returns a non null empty string if there
are no messages. Never returns a null.
StringBuffer sb = new StringBuffer();
// Process messages array list
Set messageSet = allMessages.entrySet();
Iterator iter = messageSet.iterator();
while (( iter != null) && (iter.hasNext())) {
Entry nextMapEntry = (Entry) iter.next();
sb.append(localStrings.getString("admin.event.target_string"));
sb.append(nextMapEntry.getKey());
sb.append(" ");
Collection msgCol = (Collection) nextMapEntry.getValue();
Iterator msgs = null;
if ( msgCol != null) {
msgs = msgCol.iterator();
}
int msgCount = 0;
if (msgs != null) {
while (msgs.hasNext()) {
msgCount++;
sb.append(localStrings.getString(
"admin.event.msg_string", new Integer(msgCount).toString()));
String msg = (String) msgs.next();
sb.append(msg);
sb.append(" ");
}
}
}
// Process exceptions array list
Set exceptionSet = allExceptions.entrySet();
iter = exceptionSet.iterator();
while ( (iter != null) && (iter.hasNext())) {
Entry nextMapEntry = (Entry) iter.next();
Collection excsCol = (Collection) nextMapEntry.getValue();
Iterator excs = null;
if ( excsCol != null) {
excs = excsCol.iterator();
}
if (excs !=null) {
sb.append(localStrings.getString("admin.event.target_string"));
sb.append(nextMapEntry.getKey());
sb.append(" ");
int excCount = 0;
while ( excs.hasNext()) {
Throwable tt = (Throwable) excs.next();
excCount++;
if (tt != null) {
sb.append(localStrings.getString(
"admin.event.exp_string",
new Integer(excCount).toString()));
String nextStr = tt.getMessage();
sb.append(nextStr);
sb.append(System.getProperty("line.separator"));
StringWriter sw = new StringWriter();
tt.printStackTrace(new PrintWriter(sw));
sb.append(sw.toString());
sb.append(System.getProperty("line.separator"));
}
}
}
}
return (sb.toString());
|
public java.lang.String | getAllResultCodesAsString()Return all the result codes as a String. Note that the Returned
String can be really big. Returns a non null empty string if there
are no messages. Never returns a null.
StringBuffer sb = new StringBuffer();
// Process messages array list
Set resultCodeSet = resultCodes.entrySet();
Iterator iter = resultCodeSet.iterator();
while (( iter != null) && (iter.hasNext())) {
Entry nextMapEntry = (Entry) iter.next();
sb.append(localStrings.getString("admin.event.target_string"));
sb.append(nextMapEntry.getKey());
sb.append(" ");
sb.append(localStrings.getString("admin.event.result_code_string"));
sb.append(nextMapEntry.getValue());
sb.append(" ");
}
return (sb.toString());
|
public java.lang.Object | getAttribute(java.lang.String target, java.lang.String name)Get value of attribute with specified name.
if (name == null) {
String msg = localStrings.getString( "admin.event.null_attribute_name" );
throw new IllegalArgumentException( msg );
}
HashMap attributes = (HashMap) allAttributes.get(target);
if (attributes != null) {
return attributes.get(name);
} else {
return null;
}
|
public java.util.Set | getAttributeNames(java.lang.String target)Get names of all attributes for a target.The returned Set is empty if
there are no attributes associated to this event result,
otherwise it contains String objects representing names of all attributes.
HashMap h = (HashMap) allAttributes.get(target);
if ( h!=null) {
return h.keySet();
} else {
return null;
}
|
public java.util.HashMap | getAttributes(java.lang.String target)Returns all the attributes for a target as a map
return (HashMap) allAttributes.get(target);
|
public long | getEventId()Get event id
return eventId;
|
public java.util.HashMap | getExceptions()Get all event exceptions occured during the event delivery.
This method should be used in clustered environment
return allExceptions;
|
public java.util.Collection | getExceptions(java.lang.String target)Get all event exceptions occured during the event delivery.
This method should be used in clustered environment
return (Collection)allExceptions.get(target);
|
public AdminEventListenerException | getFirstAdminEventListenerException()This method returns the first exception added to AdminEventResult
on behalf of any target.
return firstAle;
|
public java.lang.Throwable | getFirstThrowable()This method returns the first throwbale added to AdminEventResult
on behalf of any target.
return firstThr;
|
public java.util.HashMap | getMessages()Get all event messages, used in clustered environment
return allMessages;
|
public java.util.Collection | getMessages(java.lang.String target)Get all event messages for an event sent to a target
return (Collection)allMessages.get(target);
|
public java.lang.String | getResultCode()Get result code
return resultCode;
|
public java.util.HashMap | getResultCodes()Get result codes, used in clustered environment
return resultCodes;
|
void | removeAttribute(java.lang.String target, java.lang.String name)Remove specified attribute. This method can be used to remove any
previously added attribute to event result. If name is null,
IllegalArgumentException is thrown.
if (name == null) {
String msg = localStrings.getString( "admin.event.null_attribute_name" );
throw new IllegalArgumentException( msg );
}
synchronized (allAttributes) {
HashMap attributes = (HashMap) allAttributes.get(target);
if ( attributes != null) {
attributes.remove(name);
}
}
|
public void | setResultCode(java.lang.String resultCode)/**
Set result code to specified value
WARNING: This should be used for setting indiviual instance
result code.
if (!RESTART_NEEDED.equals(this.resultCode)) {
this.resultCode = resultCode;
}
|