de.novanic.eventservice.client.event.listener.unlisten
Class DefaultUnlistenEvent

java.lang.Object
  extended by de.novanic.eventservice.client.event.listener.unlisten.DefaultUnlistenEvent
All Implemented Interfaces:
Event, UnlistenEvent, java.io.Serializable

public class DefaultUnlistenEvent
extends java.lang.Object
implements UnlistenEvent

An UnlistenEvent will be triggered when a timeout or a domain specific unlisten/deregistration occurs. The UnlistenEvent is created by EventService when unlisten is called for a user. It will also be returned as an event (from the listen method) and will be added to the UnlistenDomain DomainFactory.UNLISTEN_DOMAIN.

Author:
sstrohschein
Date: 05.06.2008
Time: 19:24:45
See Also:
EventService.unlisten(), EventService.unlisten(Domain), EventService.unlisten(java.util.Set), Serialized Form

Constructor Summary
DefaultUnlistenEvent()
          Creates an UnlistenEvent for all domains (global).
DefaultUnlistenEvent(java.util.Set<Domain> aDomains, java.lang.String aUserId, boolean isTimeout)
          Creates an UnlistenEvent for a specific domain.
DefaultUnlistenEvent(java.util.Set<Domain> aDomains, java.lang.String aUserId, boolean isTimeout, boolean isLocal)
          Creates an UnlistenEvent for a specific domain.
 
Method Summary
 boolean equals(java.lang.Object anObject)
           
 java.util.Set<Domain> getDomains()
          Returns the domain for which isn't listening anymore.
 java.lang.String getUserId()
          Returns the unlistened user id for the UnlistenEvent.
 int hashCode()
           
 boolean isLocal()
          Returns true when the UnlistenEvent is triggered from the client side.
 boolean isTimeout()
          Returns true when the UnlistenEvent is a timeout, otherwise false (for example a domain specific UnlistenEvent).
 void setDomains(java.util.Set<Domain> aDomains)
          A Domain can be set to the UnlistenEvent when the unlisten event is domain specific.
 void setLocal(boolean isLocal)
          Sets the local flag.
 void setTimeout(boolean aTimeout)
          Sets the timeout flag.
 void setUserId(java.lang.String aUserId)
          Sets the unlistened user id for the UnlistenEvent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultUnlistenEvent

public DefaultUnlistenEvent()
Creates an UnlistenEvent for all domains (global). This is useful if the user exits the browser/application and a timeout occurs.


DefaultUnlistenEvent

public DefaultUnlistenEvent(java.util.Set<Domain> aDomains,
                            java.lang.String aUserId,
                            boolean isTimeout)
Creates an UnlistenEvent for a specific domain. That will be created when a user will be deregistered from a domain.

Parameters:
aDomains - Domain which are unlistened (in combination with the user id)
aUserId - user id which is unlistened (in combination with the domain)
isTimeout - true when the creation of the UnlistenEvent is caused by a timeout

DefaultUnlistenEvent

public DefaultUnlistenEvent(java.util.Set<Domain> aDomains,
                            java.lang.String aUserId,
                            boolean isTimeout,
                            boolean isLocal)
Creates an UnlistenEvent for a specific domain. That will be created when a user will be deregistered from a domain or when the UnlistenEvent is triggered from the client side (see UnlistenEvent.isLocal()).

Parameters:
aDomains - Domain which are unlistened (in combination with the user id)
aUserId - user id which is unlistened (in combination with the domain)
isTimeout - true when the creation of the UnlistenEvent is caused by a timeout
isLocal - true when the UnlistenEvent was created from the client side (see UnlistenEvent.isLocal()).
Method Detail

setDomains

public void setDomains(java.util.Set<Domain> aDomains)
A Domain can be set to the UnlistenEvent when the unlisten event is domain specific.

Specified by:
setDomains in interface UnlistenEvent
Parameters:
aDomains - unlistened domains

getDomains

public java.util.Set<Domain> getDomains()
Returns the domain for which isn't listening anymore. If the UnlistenEvent is global (for example a timeout), this method returns NULL.

Specified by:
getDomains in interface UnlistenEvent
Returns:
unlistened domains

setUserId

public void setUserId(java.lang.String aUserId)
Sets the unlistened user id for the UnlistenEvent.

Specified by:
setUserId in interface UnlistenEvent
Parameters:
aUserId - unlistened user id

getUserId

public java.lang.String getUserId()
Returns the unlistened user id for the UnlistenEvent.

Specified by:
getUserId in interface UnlistenEvent
Returns:
unlistened user id

isTimeout

public boolean isTimeout()
Returns true when the UnlistenEvent is a timeout, otherwise false (for example a domain specific UnlistenEvent).

Specified by:
isTimeout in interface UnlistenEvent
Returns:
true when timeout, otherwise false (for example a domain specific UnlistenEvent)

setTimeout

public void setTimeout(boolean aTimeout)
Sets the timeout flag. It should be set true when the UnlistenEvent marks a timeout, otherwise false (for example a domain specific UnlistenEvent).

Specified by:
setTimeout in interface UnlistenEvent
Parameters:
aTimeout - true when the UnlistenEvent marks a timeout, otherwise false (for example a domain specific UnlistenEvent)

isLocal

public boolean isLocal()
Returns true when the UnlistenEvent is triggered from the client side. That can for example occur on connection errors.

Specified by:
isLocal in interface UnlistenEvent
Returns:
true when triggered from client side, otherwise false

setLocal

public void setLocal(boolean isLocal)
Sets the local flag. It should be set true when the UnlistenEvent is triggered from the client side. That can for example occur on connection errors.

Specified by:
setLocal in interface UnlistenEvent
Parameters:
isLocal - true when triggered from client side, otherwise false

equals

public boolean equals(java.lang.Object anObject)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object