com.ibm.websphere.fabric.da
Class GuardResponse

java.lang.Object
  extended by com.ibm.websphere.fabric.da.GuardResponse
All Implemented Interfaces:
java.io.Serializable

public class GuardResponse
extends java.lang.Object
implements java.io.Serializable

Used by guards to indicate that a particular request should be allowed continue or be prevented from doing so. It is used in two ways. The continue reponse:

 ...
 return GuardResponse.getContinueResponse();
 
And the prevent response:
 ...
 String adminMsg = "Black listed subscription being used.";
 String userMsg = "Please check subscription and try again.";
 return GuardResponse.newPreventResponse(adminMsg, userMsg);
 

Version:
$Id: $
Author:
dilumr@us.ibm.com
See Also:
Serialized Form

Method Summary
 void addErrorCode(java.lang.String errorCode)
          Adds an error code to the response to provide yet another reason for this rejection.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAdminMessage()
          Exposes the internal reason for rejection.
static GuardResponse getContinueResponse()
          Gets the response indicating that the calling guard has no reservations about the request proceeding.
 java.util.Collection getErrorCodes()
          Retrieves all the error codes for this response.
 java.lang.String getUserMessage()
          Exposes the public reason for rejection.
 int hashCode()
           
static GuardResponse newErrorCodePreventResponse(java.lang.String errorCode)
          Gets the response indicating that the pending request should be prevented from continuing for a specific reason (or set of reasons).
static GuardResponse newPreventResponse(java.lang.String adminMessage, java.lang.String userMessage)
          Gets the response indicating that the pending request should be prevented from continuing for a specific reason.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContinueResponse

public static GuardResponse getContinueResponse()
Gets the response indicating that the calling guard has no reservations about the request proceeding.

Returns:
non-null response.

newPreventResponse

public static GuardResponse newPreventResponse(java.lang.String adminMessage,
                                               java.lang.String userMessage)
Gets the response indicating that the pending request should be prevented from continuing for a specific reason.

Parameters:
adminMessage - non-null text describing the reason for the system administrator. Typically, this message is externalized, and contains various internal hints.
userMessage - non-null error message that the requestor will be given. This message *should* be externalized, but not contain too many internal details. It is recommended that this message indicate whether a repreated request with the same content has any chance of success, or whether a different context or a policy set is needed for success.
Returns:
non-null response.

newErrorCodePreventResponse

public static GuardResponse newErrorCodePreventResponse(java.lang.String errorCode)
Gets the response indicating that the pending request should be prevented from continuing for a specific reason (or set of reasons).

Parameters:
errorCode - A non-null error code. Note that there may be others added.
Returns:
non-null response.

addErrorCode

public void addErrorCode(java.lang.String errorCode)
Adds an error code to the response to provide yet another reason for this rejection.

Parameters:
errorCode - The code to be added.

getErrorCodes

public java.util.Collection getErrorCodes()
Retrieves all the error codes for this response.

Returns:
A collection of error code strings that may be empty but will not be null.

getAdminMessage

public java.lang.String getAdminMessage()
Exposes the internal reason for rejection.

Returns:
non-null if this response represents a rejection; null if reponse is a CONTINUE.

getUserMessage

public java.lang.String getUserMessage()
Exposes the public reason for rejection.

Returns:
non-null if this response represents a rejection; null if reponse is a CONTINUE.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2002-2009 IBM. All Rights Reserved.