Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


oracle.adf.view.rich.remote
Class RemoteApplicationResponseGenerator

java.lang.Object
  extended by oracle.adf.view.rich.remote.RemoteApplicationResponseGenerator


public final class RemoteApplicationResponseGenerator
extends java.lang.Object

Generates various types of RemoteApplicationResponses. Sometimes when using the RemoteApplicationFramework, it might be advantagous to pass around the RemoteApplicationResponse object to indicate the result of a particular connection. If things go wrong on the consumer side during this request, however, it would be advantagous to be able to generate a RemoteApplicationResponse indicating the failure. <p/> Additionally, extensions to the Scotty framework on the producer side may generate responses of thier own. This utility will help in the generation of RemoteApplicationResponse objects such that they are implemented consistantly across the framework. <p/>


Constructor Summary
RemoteApplicationResponseGenerator()
           

 

Method Summary
static RemoteApplicationResponse getErrorResponse(ErrorResult.Source source, RemoteApplicationInstance instance, java.lang.String message, java.lang.Throwable cause)
          Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT.
static RemoteApplicationResponse getErrorResponse(RemoteApplicationInstance instance, java.lang.String message, java.lang.Throwable cause)
          Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT.
static RemoteApplicationResponse getErrorResponse(RemoteApplicationInstance instance, java.lang.Throwable cause)
          Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT.
static RemoteApplicationResponse getErrorResponse(java.lang.String message, java.lang.Throwable cause)
          Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT.
static RemoteApplicationResponse getErrorResponse(java.lang.Throwable cause)
          Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

RemoteApplicationResponseGenerator

public RemoteApplicationResponseGenerator()

Method Detail

getErrorResponse

public static RemoteApplicationResponse getErrorResponse(java.lang.Throwable cause)
Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT. This response will return a result of type ErrorResult with the supplied cause and a message which is the result of the localized message on the throwable and then from the normal exception message if any are provided. <p/> The source of the ErrorResult is automatically determined using the result of RemoteApplicationUtils.isRemote(), but because no RemoteApplicationInstance is able to be provided on this method, an IllegalStateException will be thrown if this method is called from the producer. As such, this method will always return a Response where the object is ErrorResult.Source#CONSUMER.
Parameters:
cause - the cause of the error. This property must not be null
Returns:
the appropriate RemoteApplicationResponse
Throws:
java.lang.IllegalArgumentException - if the cause attribute is null
java.lang.IllegalStateException - if this method is called on the producer

getErrorResponse

public static RemoteApplicationResponse getErrorResponse(java.lang.String message,
                                                         java.lang.Throwable cause)
Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT. This response will return a result of type ErrorResult with the supplied cause and a message which is the result of the localized message on the throwable and then from the normal exception message if any are provided. <p/> If the message is null, the result of ErrorResult.getMessage() will be taken first from the localized message on the throwable and then from the normal exception message if any are provided. <p/> The source of the ErrorResult is automatically determined using the result of RemoteApplicationUtils.isRemote(), but because no RemoteApplicationInstance is able to be provided on this method, an IllegalStateException will be thrown if this method is called from the producer. As such, this method will always return a Response where the object is ErrorResult.Source#CONSUMER.
Parameters:
message - a special message to include with the error response
cause - the cause of the error. This property must not be null
Returns:
the appropriate RemoteApplicationResponse
Throws:
java.lang.IllegalArgumentException - if the cause attribute is null
java.lang.IllegalStateException - if this method is called on the producer

getErrorResponse

public static RemoteApplicationResponse getErrorResponse(RemoteApplicationInstance instance,
                                                         java.lang.Throwable cause)
Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT. This response will return a result of type ErrorResult with the supplied cause and a message which is the result of the localized message on the throwable and then from the normal exception message if any are provided. The source of the ErrorResult is automatically determined using the result of RemoteApplicationUtils.isRemote(). <p/> If the source is determined to be on the producer, then a RemoteApplicationInstance must be provided or else an IllegalArgumentException will be thrown.
Parameters:
instance - the current RemoteApplicationInstance if there is one
cause - the cause of the error. This property must not be null
Returns:
the appropriate RemoteApplicationResponse
Throws:
java.lang.IllegalArgumentException - if the cause attribute is null or if we are currently on the producer and the instance is null

getErrorResponse

public static RemoteApplicationResponse getErrorResponse(RemoteApplicationInstance instance,
                                                         java.lang.String message,
                                                         java.lang.Throwable cause)
Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT. This response will return a result of type ErrorResult with the supplied message and cause. The source of the ErrorResult is automatically determined using the result of RemoteApplicationUtils.isRemote(). <p/> If the message is null, the result of ErrorResult.getMessage() will be taken first from the localized message on the throwable and then from the normal exception message if any are provided. <p/> If the source is determined to be on the producer, then a RemoteApplicationInstance must be provided or else an IllegalArgumentException will be thrown.
Parameters:
instance - the current RemoteApplicationInstance if there is one
message - a special message to include with the error response
cause - the cause of the error. This property must not be null
Returns:
the appropriate RemoteApplicationResponse
Throws:
java.lang.IllegalArgumentException - if the cause attribute is null or if we are currently on the producer and the instance is null

getErrorResponse

public static RemoteApplicationResponse getErrorResponse(ErrorResult.Source source,
                                                         RemoteApplicationInstance instance,
                                                         java.lang.String message,
                                                         java.lang.Throwable cause)
Returns a RemoteApplicationResponse of RemoteApplicationResponse.Status.ERROR and RemoteApplicationResponse.Type.OBJECT. This response will return a result of type ErrorResult with the supplied source, message and cause. <p/> If the message is null, the result of ErrorResult.getMessage() will be taken first from the localized message on the throwable and then from the normal exception message if any are provided. <p/> If the source of the response is set to ErrorResult.Source#PRODUCER then a RemoteApplicationInstance must be provided or else an IllegalArgumentException will be thrown.
Parameters:
source - the source of this error response. This property must not be null
instance - the current RemoteApplicationInstance if there is one
message - a special message to include with the error response
cause - the cause of the error. This property must not be null
Returns:
the appropriate RemoteApplicationResponse
Throws:
java.lang.IllegalArgumentException - if either source or cause attributes are null OR if the source is set to PRODUCER and the RemoteApplicationInstance is null

Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.