T - The type of UserSession to consider.U - The type of UserRequest to consider.public abstract class UserSessionBuilder<T extends UserSession<U>,U extends UserRequest> extends Object
UserSessionBuilder. This object encapsulates
methods to manage the building, filtering and dispatching the
UserSessions get from an InputStream. The filtering is done
using include and exclude UserRequestFilters and the processing is
delegated to UserSessionProcessors registered as listeners of this
builder object.| Constructor and Description |
|---|
UserSessionBuilder()
Creates a new user session builder.
|
| Modifier and Type | Method and Description |
|---|---|
UserSessionBuilder<T,U> |
addListener(UserSessionProcessor<T> listener)
Add a listener notified when a session is built (during buildSession
call).
|
abstract void |
buildSessions(InputStream input)
Build the session from the different request of the
InputStream. |
UserSessionBuilder<T,U> |
exclude(UserRequestFilter<U> filter)
Add an include filter to this builder.
|
UserSessionBuilder<T,U> |
include(UserRequestFilter<U> filter)
Add an include filter to this builder.
|
protected boolean |
isAcceptedRequest(U req)
Check if the request is accepted according to the include and exclude
filters.
|
protected void |
sessionCompleted(T session)
Notifies the listeners that the given session has been built.
|
public UserSessionBuilder()
public UserSessionBuilder<T,U> addListener(UserSessionProcessor<T> listener)
listener - The listener to add.protected void sessionCompleted(T session)
session - The session given to the listeners.public UserSessionBuilder<T,U> include(UserRequestFilter<U> filter)
filter - The filter to addpublic UserSessionBuilder<T,U> exclude(UserRequestFilter<U> filter)
filter - The filter to addprotected boolean isAcceptedRequest(U req)
req - The request to process.public abstract void buildSessions(InputStream input) throws SessionBuildException
InputStream.
Each time a session is build, the sessionCompleted(Session) method is
called to notify the listeners of the builder. All the requests in the
builded sessions have to satisfy isAcceptedRequest(Request).input - The InputStream to read.SessionBuildException - If an exception occurs during the building
of the sessions.Copyright © 2014–2018 University of Namur. All rights reserved.