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.event.command; 023 024import de.novanic.eventservice.client.connection.strategy.connector.RemoteEventConnector; 025import de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent; 026import de.novanic.eventservice.client.event.listener.unlisten.UnlistenEventListener; 027import de.novanic.eventservice.client.logger.ClientLogger; 028import de.novanic.eventservice.client.logger.ClientLoggerFactory; 029import com.google.gwt.user.client.rpc.AsyncCallback; 030 031/** 032 * Registers an {@link de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent} which will be transferred to 033 * other clients/users when that user/client gets a timeout or deregisters a {@link de.novanic.eventservice.client.event.listener.RemoteEventListener}. 034 * 035 * @author sstrohschein 036 * <br>Date: 07.07.2009 037 * <br>Time: 23:22:43 038 */ 039public class RegistrationUnlistenEventCommand extends ServerCallCommand<Void> 040{ 041 private static final ClientLogger LOG = ClientLoggerFactory.getClientLogger(); 042 043 private UnlistenEventListener.Scope myUnlistenScope; 044 private UnlistenEvent myUnlistenEvent; 045 046 /** 047 * Creates an ServerCallCommand to execute and handle server calls. 048 * @param anUnlistenScope scope of the unlisten events to receive 049 * @param aRemoteEventConnector {@link de.novanic.eventservice.client.connection.strategy.connector.RemoteEventConnector} 050 * @param anUnlistenEvent {@link de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent} will be transferred to other clients/users when 051 * that user/client gets a timeout or deregisters a {@link de.novanic.eventservice.client.event.listener.RemoteEventListener}. 052 * @param aVoidAsyncCallback callback of the command 053 */ 054 public RegistrationUnlistenEventCommand(UnlistenEventListener.Scope anUnlistenScope, RemoteEventConnector aRemoteEventConnector, UnlistenEvent anUnlistenEvent, AsyncCallback<Void> aVoidAsyncCallback) { 055 super(aRemoteEventConnector, aVoidAsyncCallback); 056 myUnlistenScope = anUnlistenScope; 057 myUnlistenEvent = anUnlistenEvent; 058 } 059 060 /** 061 * Registers an {@link de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent}. 062 */ 063 public void execute() { 064 LOG.log("Unlisten-Listener registered."); 065 getRemoteEventConnector().registerUnlistenEvent(myUnlistenScope, myUnlistenEvent, getCommandCallback()); 066 } 067}