All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gwtplatform.dispatch.rpc.server.actionhandler.ActionHandler Maven / Gradle / Ivy

There is a newer version: 1.6
Show newest version
/**
 * Copyright 2011 ArcBees Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.gwtplatform.dispatch.rpc.server.actionhandler;

import com.gwtplatform.dispatch.rpc.server.ExecutionContext;
import com.gwtplatform.dispatch.rpc.shared.Action;
import com.gwtplatform.dispatch.rpc.shared.Result;
import com.gwtplatform.dispatch.shared.ActionException;

/**
 * Instances of this interface will handle specific types of {@link Action} classes.
 * 

* Important! Your action handlers must be thread safe since they will be bound as singletons. For details, * see * http://code.google.com/p/google-guice/wiki/Scopes#Scopes_and_Concurrency. * * @param The type of the action extending {@link Action}. * @param The type of the result extending {@link Result}. */ public interface ActionHandler, R extends Result> { /** * Handles the specified action. If you want to build a compound action that can rollback automatically upon * failure, call {@link ExecutionContext#execute(Action)}. See * here for details. * * @param action The action. * @param context The {@link ExecutionContext}. * @return The {@link Result}. * @throws ActionException if there is a problem performing the specified action. */ R execute(A action, ExecutionContext context) throws ActionException; /** * @return The type of {@link Action} supported by this handler. */ Class getActionType(); /** * Undoes the specified action. If you want to build a compound action that can rollback automatically upon failure, * call {@link ExecutionContext#undo(Action, Result)}. See * here for details. * * @param action The action. * @param result The result of the action. * @param context The {@link ExecutionContext}. * @throws ActionException if there is a problem performing the specified action. */ void undo(A action, R result, ExecutionContext context) throws ActionException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy