pt.digitalis.dif.controller.interfaces
Interface IChAL<RequestType,ResponseType>

Type Parameters:
RequestType - the type of request of the specific AbstractChAL
ResponseType - the type of response of the specific AbstractChAL
All Known Implementing Classes:
AbstractChAL

public interface IChAL<RequestType,ResponseType>

AbstractChAL stands for Channel Abstraction Layer and as the name implies it's purpose is to insulate the framework from the transport channel used by the original request. As can be implied from the statement above, AbstractChAL should be tailored to take care of a specific transport channel details. As such, AbstractChAL should be extended using inheritance and is the subclass that should be instantiated. To enforce the subclass instantiation AbstractChAL is declared abstract. AbstractChAL is responsible for translating the original request into a format that the framework can understand, then executing the appropriated Dispatcher and finally publish the results.

Author:
Pedro Viegas pviegas@digitalis.pt

Method Summary
 void publish(IDIFResponse difResponse, RequestType originalRequest, ResponseType finalResponse)
          This method is responsible for the response translation from the framework internal format into the channel's own format.
 IDIFResponse serve(RequestType originalRequest, ResponseType finalResponse, RESTAction action)
          This method will be called by the client via Listener.
 IDIFRequest translateRequest(RequestType originalRequest)
          This method should receive the request from the Listener and translate it to a format understandable by the framework.
 

Method Detail

publish

void publish(IDIFResponse difResponse,
             RequestType originalRequest,
             ResponseType finalResponse)
This method is responsible for the response translation from the framework internal format into the channel's own format. Each AbstractChAL should implement this method in a way adapted to the specific needs of the incoming request. The original request type is passed to the method because some technologies (such as Servlets) don't allow content writing on the response object.

Parameters:
difResponse - the framework's response
originalRequest - the original request
finalResponse - the response to send back to the Listener

serve

IDIFResponse serve(RequestType originalRequest,
                   ResponseType finalResponse,
                   RESTAction action)
This method will be called by the client via Listener.

Parameters:
originalRequest - the original request made by the client
finalResponse - the response object passed by the Listener and that will be sent back
action - the REST action if specified
Returns:
the DIFResponse containing the framework's response

translateRequest

IDIFRequest translateRequest(RequestType originalRequest)
                             throws ControllerException
This method should receive the request from the Listener and translate it to a format understandable by the framework. Each AbstractChAL should implement this method in a way adapted to the specific needs of the incoming request.

Parameters:
originalRequest - The request received from the Listener
Returns:
a BaseDIFRequest object that will be sent to the Dispatcher
Throws:
ControllerException - when any runtime exception is thrown


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.