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.event.listener.EventNotification; 025import de.novanic.eventservice.client.connection.strategy.connector.RemoteEventConnector; 026import de.novanic.eventservice.client.event.filter.EventFilter; 027import de.novanic.eventservice.client.event.domain.Domain; 028import com.google.gwt.user.client.rpc.AsyncCallback; 029 030/** 031 * Activates the listen cycle for event listening and registers the client/user for a domain (server side). 032 * 033 * @author sstrohschein 034 * <br>Date: 27.03.2009 035 * <br>Time: 23:31:34 036 */ 037public class ActivationCommand extends ServerCallCommand<Void> 038{ 039 private Domain myDomain; 040 private EventFilter myEventFilter; 041 private EventNotification myEventNotification; 042 043 /** 044 * Creates an ActivationCommand (activates the listen cycle for event listening) 045 * @param aRemoteEventConnector {@link de.novanic.eventservice.client.connection.strategy.connector.RemoteEventConnector} 046 * @param aDomain {@link de.novanic.eventservice.client.event.domain.Domain} domain/context for event listening 047 * @param anEventFilter {@link de.novanic.eventservice.client.event.filter.EventFilter} to filter events 048 * @param anEventNotification {@link de.novanic.eventservice.client.event.listener.EventNotification} to get informed about incoming events 049 * @param aCallback callback for the command 050 */ 051 public ActivationCommand(RemoteEventConnector aRemoteEventConnector, Domain aDomain, EventFilter anEventFilter, 052 EventNotification anEventNotification, AsyncCallback<Void> aCallback) { 053 super(aRemoteEventConnector, aCallback); 054 myDomain = aDomain; 055 myEventFilter = anEventFilter; 056 myEventNotification = anEventNotification; 057 } 058 059 /** 060 * Registers the client for event listening for a specified domain and starts the event listening cycle. 061 */ 062 public void execute() { 063 getRemoteEventConnector().activate(myDomain, myEventFilter, myEventNotification, getCommandCallback()); 064 } 065}