org.apache.directory.server.ldap
Class LdapSession

java.lang.Object
  extended by org.apache.directory.server.ldap.LdapSession

public class LdapSession
extends java.lang.Object

An object representing an LdapSession. Any connection established with the LDAP server forms a session.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
LdapSession(org.apache.mina.common.IoSession ioSession)
          Creates a new instance of LdapSession associated with the underlying connection (MINA IoSession) to the server.
 
Method Summary
 void abandonAllOutstandingRequests()
          Abandons all outstanding requests associated with this session.
 org.apache.directory.shared.ldap.message.AbandonableRequest abandonOutstandingRequest(java.lang.Integer messageId)
          Abandons a specific request by messageId.
 void clearSaslProperties()
          Clear all the Sasl values stored into the Map
 org.apache.directory.shared.ldap.message.BindStatus getBindStatus()
           
 CoreSession getCoreSession()
          Gets the logical core DirectoryService session associated with this LdapSession.
 java.lang.String getCurrentMechanism()
          Get the mechanism selected by a user during a SASL Bind negotiation.
 org.apache.mina.common.IoSession getIoSession()
          Gets the MINA IoSession associated with this LdapSession.
 LdapService getLdapServer()
           
 java.util.Map<java.lang.Integer,org.apache.directory.shared.ldap.message.AbandonableRequest> getOutstandingRequests()
           
 java.lang.Object getSaslProperty(java.lang.String property)
          Get a Sasl property's value
 boolean isAnonymous()
          Check if the session is authenticated.
 boolean isAuthenticated()
          Check if the session is authenticated.
 boolean isAuthPending()
          Check if the session is in the middle of a SASL negotiation.
 void putSaslProperty(java.lang.String property, java.lang.Object value)
          Add a Sasl property and value
 void registerOutstandingRequest(org.apache.directory.shared.ldap.message.AbandonableRequest request)
          Registers an outstanding request which can be abandoned later.
 void removeSaslProperty(java.lang.String property)
          Remove a property from the SaslProperty map
 void setAnonymous()
          Set the current BindStatus to Anonymous
 void setAuthenticated()
          Set the current BindStatus to authenticated
 void setAuthPending()
          Set the current BindStatus to authentication pending
 void setCoreSession(CoreSession coreSession)
          Sets the logical core DirectoryService session.
 void setLdapServer(LdapService ldapService)
          Store a reference on the LdapService intance
 void unregisterOutstandingRequest(org.apache.directory.shared.ldap.message.AbandonableRequest request)
          Unregisters an outstanding request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapSession

public LdapSession(org.apache.mina.common.IoSession ioSession)
Creates a new instance of LdapSession associated with the underlying connection (MINA IoSession) to the server.

Parameters:
ioSession - the MINA session associated this LdapSession
Method Detail

isAuthenticated

public boolean isAuthenticated()
Check if the session is authenticated. There are two conditions for a session to be authenticated :
- the coreSession must not be null
- and the state should be Authenticated.

Returns:
true if the session is not anonymous

isAnonymous

public boolean isAnonymous()
Check if the session is authenticated. There are two conditions for a session to be authenticated :
- it has to exist
- and the session should not be anonymous.

Returns:
true if the session is not anonymous

isAuthPending

public boolean isAuthPending()
Check if the session is in the middle of a SASL negotiation.

Returns:
true if the session is in AuthPending state

getIoSession

public org.apache.mina.common.IoSession getIoSession()
Gets the MINA IoSession associated with this LdapSession.

Returns:
the MINA IoSession

getCoreSession

public CoreSession getCoreSession()
Gets the logical core DirectoryService session associated with this LdapSession.

Returns:
the logical core DirectoryService session

setCoreSession

public void setCoreSession(CoreSession coreSession)
Sets the logical core DirectoryService session.

Parameters:
coreSession - the logical core DirectoryService session

abandonAllOutstandingRequests

public void abandonAllOutstandingRequests()
Abandons all outstanding requests associated with this session.


abandonOutstandingRequest

public org.apache.directory.shared.ldap.message.AbandonableRequest abandonOutstandingRequest(java.lang.Integer messageId)
Abandons a specific request by messageId.


registerOutstandingRequest

public void registerOutstandingRequest(org.apache.directory.shared.ldap.message.AbandonableRequest request)
Registers an outstanding request which can be abandoned later.

Parameters:
request - an outstanding request that can be abandoned

unregisterOutstandingRequest

public void unregisterOutstandingRequest(org.apache.directory.shared.ldap.message.AbandonableRequest request)
Unregisters an outstanding request.

Parameters:
request - the request to unregister

getOutstandingRequests

public java.util.Map<java.lang.Integer,org.apache.directory.shared.ldap.message.AbandonableRequest> getOutstandingRequests()

getBindStatus

public org.apache.directory.shared.ldap.message.BindStatus getBindStatus()
Returns:
the current bind status for this session

setAuthPending

public void setAuthPending()
Set the current BindStatus to authentication pending


setAnonymous

public void setAnonymous()
Set the current BindStatus to Anonymous


setAuthenticated

public void setAuthenticated()
Set the current BindStatus to authenticated


getCurrentMechanism

public java.lang.String getCurrentMechanism()
Get the mechanism selected by a user during a SASL Bind negotiation.

Returns:
The used mechanism, if any

putSaslProperty

public void putSaslProperty(java.lang.String property,
                            java.lang.Object value)
Add a Sasl property and value

Parameters:
property - the property to add
value - the value for this property

getSaslProperty

public java.lang.Object getSaslProperty(java.lang.String property)
Get a Sasl property's value

Parameters:
property - the property to get
Returns:
the associated value, or null if we don't have such a property

clearSaslProperties

public void clearSaslProperties()
Clear all the Sasl values stored into the Map


removeSaslProperty

public void removeSaslProperty(java.lang.String property)
Remove a property from the SaslProperty map

Parameters:
property - the property to remove

getLdapServer

public LdapService getLdapServer()
Returns:
The LdapService reference

setLdapServer

public void setLdapServer(LdapService ldapService)
Store a reference on the LdapService intance

Parameters:
ldapService - the LdapService instance


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.