View Javadoc
1   /*
2    * Copyright (C) 2012-2024 RRiBbit.org
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.rribbit.processing;
17  
18  import org.rribbit.Request;
19  import org.rribbit.Response;
20  import org.rribbit.dispatching.RequestDispatcher;
21  
22  /**
23   * The {@link RequestProcessor} is responsible for receiving {@link Request} objects from a {@link RequestDispatcher} and processing them. Implementations may expose themselves in
24   * a number of ways, such as plain java method calls, RMI connections or JMS connections. Implementations are responsible for decoding the {@link Request} object and encoding the
25   * {@link Response} object.
26   * <p />
27   * A single {@link RequestProcessor} is always supposed to communicate with only a single {@link RequestDispatcher}, for simplicity and ease of possible network configurations.
28   *
29   * @author G.J. Schouten
30   *
31   */
32  public interface RequestProcessor {
33  
34  	/**
35  	 * Processes a {@link Request} and returns the {@link Response}.
36  	 *
37  	 * @param request	The {@link Request} to process
38  	 * @return			The {@link Response}
39  	 */
40  	<T> Response<T> processRequest(Request request);
41  }