be.unamur.inference.web.apache
Class ApacheUserSessionBuilder

java.lang.Object
  extended by be.unamur.inference.web.UserSessionBuilder<ApacheUserSession,ApacheUserRequest>
      extended by be.unamur.inference.web.apache.ApacheUserSessionBuilder

public class ApacheUserSessionBuilder
extends UserSessionBuilder<ApacheUserSession,ApacheUserRequest>

This class is used to process Apache user sessions from an Apache web log. The default usage of this class is:

 UserSessionProcessor<ApacheUserSession> listener;
 UserRequestFilter<ApacheUserRequest> includeFilter;
 UserRequestFilter<ApacheUserRequest> excludeFilter;
 // ... 
 newInstance().logFormat(ApacheLogFormatPatternBuilder.COMMON_LOG_FORMAT)
                .sessionTimeout(ApacheUserSessionBuilder.DEFAULT_TIMEOUT)
                .include(includeFilter)
                .exclude(excludeFilter)
                .addListener(listener)
                .buildSessions(new FileInputStream("apache-web.log"));
 

Author:
Xavier Devroey - xavier.devroey@unamur.be
See Also:
ApacheUserSession, ApacheLogFormatPatternBuilder

Field Summary
static long DEFAULT_TIMEOUT
          The default timeout for the sessions.
 
Method Summary
 void buildSessions(InputStream input)
          Build the session from the different request of the InputStream.
 ApacheUserSessionBuilder logFormat(String logFormat)
          Specify the log format to use.
static ApacheUserSessionBuilder newInstance()
          Returns a new instance of this class.
 ApacheUserSessionBuilder sessionTimeout(long timeout)
          Set the timeout to consider for the user sessions.
 
Methods inherited from class be.unamur.inference.web.UserSessionBuilder
addListener, exclude, include, isAcceptedRequest, sessionCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
The default timeout for the sessions.

See Also:
Constant Field Values
Method Detail

newInstance

public static ApacheUserSessionBuilder newInstance()
Returns a new instance of this class.


logFormat

public ApacheUserSessionBuilder logFormat(String logFormat)
Specify the log format to use. Default value is ApacheLogFormatPatternBuilder.COMMON_LOG_FORMAT.

Parameters:
logFormat - The new log format to use.
Returns:
This object.

sessionTimeout

public ApacheUserSessionBuilder sessionTimeout(long timeout)
Set the timeout to consider for the user sessions. Default is ApacheUserSessionBuilder.DEFAULT_TIMEOUT

Parameters:
timeout - The new timeout.
Returns:
This object.

buildSessions

public void buildSessions(InputStream input)
                   throws SessionBuildException
Description copied from class: UserSessionBuilder
Build the session from the different request of the 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).

Specified by:
buildSessions in class UserSessionBuilder<ApacheUserSession,ApacheUserRequest>
Parameters:
input - The InputStream to read.
Throws:
SessionBuildException - If an exception occurs during the building of the sessions.


Copyright © 2014 PReCISE, University of Namur. All rights reserved.