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.listener.unlisten;
023
024import de.novanic.eventservice.client.event.domain.Domain;
025import de.novanic.eventservice.client.event.Event;
026
027import java.util.Set;
028
029/**
030 * An UnlistenEvent will be triggered when a timeout or a domain specific unlisten/deregistration occurs. The UnlistenEvent is created by
031 * {@link de.novanic.eventservice.client.event.service.EventService} when unlisten is called for a user. It will also be returned as an
032 * event (from the listen method) and will be added to the UnlistenDomain {@link de.novanic.eventservice.client.event.domain.DomainFactory#UNLISTEN_DOMAIN}.
033 * @see de.novanic.eventservice.client.event.service.EventService#unlisten()
034 * @see de.novanic.eventservice.client.event.service.EventService#unlisten(Domain)
035 * @see de.novanic.eventservice.client.event.service.EventService#unlisten(java.util.Set)
036 *
037 * @author sstrohschein
038 *         <br>Date: 16.08.2009
039 *         <br>Time: 01:01:09
040 */
041public interface UnlistenEvent extends Event
042{
043    /**
044     * A {@link de.novanic.eventservice.client.event.domain.Domain} can be set to the UnlistenEvent when the unlisten event
045     * is domain specific.
046     * @param aDomains unlistened domains
047     */
048    void setDomains(Set<Domain> aDomains);
049
050    /**
051     * Returns the domain for which isn't listening anymore. If the UnlistenEvent is global (for example a timeout),
052     * this method returns NULL.
053     * @return unlistened domains
054     */
055    Set<Domain> getDomains();
056
057    /**
058     * Sets the unlistened user id for the UnlistenEvent.
059     * @param aUserId unlistened user id
060     */
061    void setUserId(String aUserId);
062
063    /**
064     * Returns the unlistened user id for the UnlistenEvent.
065     * @return unlistened user id
066     */
067    String getUserId();
068
069    /**
070     * Returns true when the UnlistenEvent is a timeout, otherwise false (for example a domain specific UnlistenEvent).
071     * @return true when timeout, otherwise false (for example a domain specific UnlistenEvent)
072     */
073    boolean isTimeout();
074
075    /**
076     * Sets the timeout flag. It should be set true when the UnlistenEvent marks a timeout, otherwise false (for example a domain specific UnlistenEvent).
077     * @param aTimeout true when the UnlistenEvent marks a timeout, otherwise false (for example a domain specific UnlistenEvent)
078     */
079    void setTimeout(boolean aTimeout);
080
081    /**
082     * Returns true when the UnlistenEvent is triggered from the client side. That can for example occur on connection errors.
083     * @return true when triggered from client side, otherwise false
084     */
085    boolean isLocal();
086
087    /**
088     * Sets the local flag. It should be set true when the UnlistenEvent is triggered from the client side.  That can for example
089     * occur on connection errors.
090     * @param isLocal true when triggered from client side, otherwise false
091     */
092    void setLocal(boolean isLocal);
093}