org.apache.directory.server.ldap
Class LdapProtocolUtils

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

public class LdapProtocolUtils
extends Object

Utility methods used by the LDAP protocol service.

Author:
Apache Directory Project

Field Summary
static String COOKIE_DELIM
          A delimiter for the replicaId
static String CSN_PREFIX
          the prefix for Csn value
static String REPLICA_ID_PREFIX
          the prefix for replicaId value
static int REPLICA_ID_PREFIX_LEN
           
 
Constructor Summary
LdapProtocolUtils()
           
 
Method Summary
static byte[] createCookie(int replicaId, String csn)
           
static String getCsn(String cookieString)
          returns the CSN present in cookie
static int getReplicaId(String cookieString)
          returns the replica id present in cookie
static boolean isValidCookie(String cookieString)
          Check the cookie syntax.
static void setRequestControls(org.apache.directory.server.core.api.interceptor.context.OperationContext opContext, org.apache.directory.api.ldap.model.message.Request request)
          Extracts request controls from a request to populate into an OperationContext.
static void setResponseControls(org.apache.directory.server.core.api.interceptor.context.OperationContext opContext, org.apache.directory.api.ldap.model.message.Response response)
          Extracts response controls from a an OperationContext to populate into a Response object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COOKIE_DELIM

public static final String COOKIE_DELIM
A delimiter for the replicaId

See Also:
Constant Field Values

REPLICA_ID_PREFIX

public static final String REPLICA_ID_PREFIX
the prefix for replicaId value

See Also:
Constant Field Values

REPLICA_ID_PREFIX_LEN

public static final int REPLICA_ID_PREFIX_LEN

CSN_PREFIX

public static final String CSN_PREFIX
the prefix for Csn value

See Also:
Constant Field Values
Constructor Detail

LdapProtocolUtils

public LdapProtocolUtils()
Method Detail

setRequestControls

public static void setRequestControls(org.apache.directory.server.core.api.interceptor.context.OperationContext opContext,
                                      org.apache.directory.api.ldap.model.message.Request request)
                               throws Exception
Extracts request controls from a request to populate into an OperationContext.

Parameters:
opContext - the context to populate with request controls
request - the request to extract controls from
Throws:
Exception

setResponseControls

public static void setResponseControls(org.apache.directory.server.core.api.interceptor.context.OperationContext opContext,
                                       org.apache.directory.api.ldap.model.message.Response response)
                                throws Exception
Extracts response controls from a an OperationContext to populate into a Response object.

Parameters:
opContext - the context to extract controls from
response - the response to populate with response controls
Throws:
Exception

createCookie

public static byte[] createCookie(int replicaId,
                                  String csn)

isValidCookie

public static boolean isValidCookie(String cookieString)
Check the cookie syntax. A cookie must have the following syntax : { rid={replicaId},csn={CSN} }


getCsn

public static String getCsn(String cookieString)
returns the CSN present in cookie

Parameters:
cookieString - the cookie
Returns:

getReplicaId

public static int getReplicaId(String cookieString)
returns the replica id present in cookie

Parameters:
cookieString - the cookie
Returns:


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.