Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.nntp
Class SessionManager

java.lang.Object
  extended by com.jivesoftware.forum.nntp.SessionManager
All Implemented Interfaces:
JiveManager

public class SessionManager
extends java.lang.Object
implements JiveManager

Manages all NNTP sessions known to the server.


Field Summary
static int MODE_ALWAYS_REQUIRE_LOGIN
          Always require the user to login before posting.
static int MODE_NEVER_REQUIRE_LOGIN
          Ignore forum permissions and always permit users to post anonymously.
static int MODE_USE_PERMISSIONS
          Use standard forum permissions to determine whether the user must login before posting or not.
 
Method Summary
 Session createSession(Connection con)
          Creates a session for the given connection.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
static SessionManager getInstance()
          Returns a SessionManager instance.
 int getPostPermissionMode()
          Returns the post permission mode.
 Session getSession(Connection con)
          Obtain a session that corresponds to the given connection.
 long getSessionCheckPeriod()
          Obtains period between idle session checks in milliseconds.
 long getSessionTimeout()
          Returns the session timeout in milliseconds.
 void initialize()
          Initialize the manager.
 boolean isAnonymousReadAllowed()
          Flag indicating if logins are required to read content from the server.
 boolean isReadTrackingEnabled()
          Returns true if read tracking of NNTP sessions is enabled.
 boolean isSession(Connection conn)
          Indicates if the given connection has an associated session.
 void removeSession(Connection con)
          Removes the session associated with the connection.
 void setAnonymousReadAllowed(boolean allowed)
          Sets whether the server requires logins before any other commands are allowed.
 void setPostPermissionMode(int permissionMode)
          Sets the post permission mode.
 void setReadTrackingEnabled(boolean readTrackingEnabled)
          Enables or disables read tracking of NNTP sessions.
 void setSessionCheckPeriod(long period)
          Sets the new period between idle session checks in milliseconds.
 void setSessionTimeout(long timeout)
          Sets the new session timeout in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_ALWAYS_REQUIRE_LOGIN

public static final int MODE_ALWAYS_REQUIRE_LOGIN
Always require the user to login before posting. Once the user is logged in, they will still need to pass standard forum permissions before being able to post.

See Also:
Constant Field Values

MODE_USE_PERMISSIONS

public static final int MODE_USE_PERMISSIONS
Use standard forum permissions to determine whether the user must login before posting or not.

See Also:
Constant Field Values

MODE_NEVER_REQUIRE_LOGIN

public static final int MODE_NEVER_REQUIRE_LOGIN
Ignore forum permissions and always permit users to post anonymously. This mode enables an open NNTP server (to mirror standard Usenet setups) but to have a more restrictive web front-end.

See Also:
Constant Field Values
Method Detail

getInstance

public static SessionManager getInstance()
Returns a SessionManager instance.

Returns:
an instance.

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

isSession

public boolean isSession(Connection conn)

Indicates if the given connection has an associated session.

Parameters:
conn - the connection to check.
Returns:
true if a session is registerd with the session manager for the given connection.

getSession

public Session getSession(Connection con)
                   throws SessionNotFoundException

Obtain a session that corresponds to the given connection.

A session is created for the connection if one doesn't already exist.

Parameters:
con - the connection to locate a session for.
Returns:
the session corresponding to the given connection.
Throws:
SessionNotFoundException

createSession

public Session createSession(Connection con)
                      throws SessionAlreadyExistsException
Creates a session for the given connection.

Parameters:
con - the connection to create a session for
Returns:
the created session
Throws:
SessionAlreadyExistsException - if a session for the connection already exists

removeSession

public void removeSession(Connection con)

Removes the session associated with the connection.

Parameters:
con - the connection to locate a session for.

getSessionTimeout

public long getSessionTimeout()
Returns the session timeout in milliseconds. Sessions that are idle longer than the timeout time are automatically disconnected.

Returns:
the session idle timeout in milliseconds

setSessionTimeout

public void setSessionTimeout(long timeout)
Sets the new session timeout in milliseconds.

Parameters:
timeout - the session idle timeout in milliseconds

getSessionCheckPeriod

public long getSessionCheckPeriod()

Obtains period between idle session checks in milliseconds. The manager must inspect each session every period to look for expired sessions. High frequency checking results in more accurate timeouts of idle sessions. However, too frequent checking (esp. with large numbers of sessions) can consume large amounts of system resources.

Returns:
the idle session checking period in milliseconds

setSessionCheckPeriod

public void setSessionCheckPeriod(long period)

Sets the new period between idle session checks in milliseconds.

Parameters:
period - the idle session checking period in milliseconds

isReadTrackingEnabled

public boolean isReadTrackingEnabled()
Returns true if read tracking of NNTP sessions is enabled.

Returns:
true if read tracking is enabled.

setReadTrackingEnabled

public void setReadTrackingEnabled(boolean readTrackingEnabled)
Enables or disables read tracking of NNTP sessions.

Parameters:
readTrackingEnabled - true if read tracking should be enabled.

isAnonymousReadAllowed

public boolean isAnonymousReadAllowed()

Flag indicating if logins are required to read content from the server.

The setting is not the same as anonymous logins since all sessions start with anonymous login status. This setting determines if the server will allow any commands other than AUTHINFO before authenticating with a valid user account. If false, anonymous sessions can access forum data according to normal Forums permissions for anonymous users (read/list/post) without doing any authentication.

Returns:
true if logins are required to interact with the server.

setAnonymousReadAllowed

public void setAnonymousReadAllowed(boolean allowed)

Sets whether the server requires logins before any other commands are allowed.

Parameters:
allowed - true if logins are required to interact with the server.

getPostPermissionMode

public int getPostPermissionMode()
Returns the post permission mode. It can be one of three values:

Returns:
true if logins are required to post to the server server.

setPostPermissionMode

public void setPostPermissionMode(int permissionMode)
Sets the post permission mode. It can be one of three values:

Parameters:
permissionMode - the post permission mode.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.