001/* 002 * GWTEventService 003 * Copyright (c) 2011 and beyond, strawbill UG (haftungsbeschr?nkt) 004 * 005 * This is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Lesser General Public License as 007 * published by the Free Software Foundation; either version 3 of 008 * the License, or (at your option) any later version. 009 * Other licensing for GWTEventService may also be possible on request. 010 * Please view the license.txt of the project for more information. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022package de.novanic.eventservice.client.command; 023 024import com.google.gwt.user.client.rpc.AsyncCallback; 025import de.novanic.eventservice.client.event.service.EventServiceAsync; 026 027/** 028 * A RemoteCommand can be used to execute a call from client to the server side. The possibility to queue RemoteCommands 029 * is one of the advantages. 030 * 031 * @author sstrohschein 032 * <br>Date: 06.06.2008 033 * <br>Time: 22:38:48 034 */ 035public interface RemoteCommand<T> 036{ 037 /** 038 * Initializes the RemoteCommand with a callback, which can also be used in the execute method 039 * {@link de.novanic.eventservice.client.command.RemoteCommand#execute(de.novanic.eventservice.client.event.service.EventServiceAsync)} 040 * @param aCallback callback 041 */ 042 void init(AsyncCallback<T> aCallback); 043 044 /** 045 * Checks if the RemoteCommand is initialized with a callback. 046 * @return true when the init method ({@link de.novanic.eventservice.client.command.RemoteCommand#init(com.google.gwt.user.client.rpc.AsyncCallback)}) 047 * was called with a callback, false when the RemoteCommand wasn't initialized with a callback. 048 */ 049 boolean isInitialized(); 050 051 /** 052 * This method executes the RemoteCommand. This method has access to {@link de.novanic.eventservice.client.event.service.EventService} 053 * and to the initialized callback ({@link de.novanic.eventservice.client.command.RemoteCommand#getCallback()}). 054 * @param anEventService {@link de.novanic.eventservice.client.event.service.EventService} 055 */ 056 void execute(EventServiceAsync anEventService); 057 058 /** 059 * Returns the callback, which can be set with the link method 060 * ({@link de.novanic.eventservice.client.command.RemoteCommand#init(com.google.gwt.user.client.rpc.AsyncCallback)}) 061 * @return callback 062 */ 063 AsyncCallback<T> getCallback(); 064}