You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 17:15:29 UTC
svn commit: r1235326 [26/28] - in /directory/apacheds/trunk:
jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partitio...
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Tue Jan 24 16:15:05 2012
@@ -189,11 +189,11 @@ public class SearchHandler extends LdapR
LOG.warn( "This server does not allow replication" );
// Replication is not allowed on this server. generate a error message
LdapResult result = req.getResultResponse().getLdapResult();
-
+
result.setDiagnosticMessage( "Replicztion is not allowed on this server" );
result.setResultCode( ResultCodeEnum.OTHER );
session.getIoSession().write( req.getResultResponse() );
-
+
return;
}
}
@@ -518,10 +518,10 @@ public class SearchHandler extends LdapR
*/
private SearchResultDone abandonPagedSearch( LdapSession session, SearchRequest req ) throws Exception
{
- PagedResults pagedSearchControl = (PagedResults)req.getControls().get( PagedResults.OID );
+ PagedResults pagedSearchControl = ( PagedResults ) req.getControls().get( PagedResults.OID );
byte[] cookie = pagedSearchControl.getCookie();
- if ( !Strings.isEmpty(cookie) )
+ if ( !Strings.isEmpty( cookie ) )
{
// If the cookie is not null, we have to destroy the associated
// cursor stored into the session (if any)
@@ -615,7 +615,7 @@ public class SearchHandler extends LdapR
byte[] cookie = pagedSearchControl.getCookie();
LdapResult ldapResult = req.getResultResponse().getLdapResult();
- if ( Strings.isEmpty(cookie) )
+ if ( Strings.isEmpty( cookie ) )
{
// This is a new search. We have a special case when the paged size
// is above the server size limit : in this case, we default to a
@@ -863,7 +863,7 @@ public class SearchHandler extends LdapR
}
LdapUrl ldapUrl = null;
-
+
try
{
ldapUrl = new LdapUrl( url );
@@ -1033,7 +1033,7 @@ public class SearchHandler extends LdapR
// Handle psearch differently
// ===============================================================
- PersistentSearch psearch = (PersistentSearch)req.getControls().get( PersistentSearch.OID );
+ PersistentSearch psearch = ( PersistentSearch ) req.getControls().get( PersistentSearch.OID );
if ( psearch != null )
{
@@ -1070,7 +1070,7 @@ public class SearchHandler extends LdapR
*
* SO DON'T SEND BACK ANYTHING!!!!!
*/
- if ( e instanceof OperationAbandonedException)
+ if ( e instanceof OperationAbandonedException )
{
return;
}
@@ -1248,7 +1248,7 @@ public class SearchHandler extends LdapR
result.setDiagnosticMessage( "Encountered referral attempting to handle request." );
result.setMatchedDn( req.getBase() );
- Attribute refAttr = ((ClonedServerEntry)entry).getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ( ( ClonedServerEntry ) entry ).getOriginalEntry().get( SchemaConstants.REF_AT );
for ( Value<?> refval : refAttr )
{
@@ -1263,7 +1263,7 @@ public class SearchHandler extends LdapR
// parse the ref value and normalize the Dn
LdapUrl ldapUrl = null;
-
+
try
{
ldapUrl = new LdapUrl( refstr );
@@ -1309,7 +1309,7 @@ public class SearchHandler extends LdapR
if ( filter.isSchemaAware() )
{
- AttributeType attributeType = ( (PresenceNode) req.getFilter() ).getAttributeType();
+ AttributeType attributeType = ( ( PresenceNode ) req.getFilter() ).getAttributeType();
isRootDseFilter = attributeType.equals( OBJECT_CLASS_AT );
}
else
@@ -1375,7 +1375,7 @@ public class SearchHandler extends LdapR
{
LOG.debug( "Inside getReferralOnAncestor()" );
- Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ( ( ClonedServerEntry ) referralAncestor ).getOriginalEntry().get( SchemaConstants.REF_AT );
Referral referral = new ReferralImpl();
for ( Value<?> value : refAttr )
@@ -1393,7 +1393,7 @@ public class SearchHandler extends LdapR
// Parse the ref value
LdapUrl ldapUrl = null;
-
+
try
{
ldapUrl = new LdapUrl( ref );
@@ -1423,7 +1423,7 @@ public class SearchHandler extends LdapR
*/
Dn suffix = req.getBase().getDescendantOf( referralAncestor.getDn() );
Dn refDn = urlDn.add( suffix );
-
+
ldapUrl.setDn( refDn );
ldapUrl.setForceScopeRendering( true );
ldapUrl.setAttributes( req.getAttributes() );
@@ -1448,7 +1448,7 @@ public class SearchHandler extends LdapR
{
LOG.debug( "Inside getReferralOnAncestor()" );
- Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
+ Attribute refAttr = ( ( ClonedServerEntry ) referralAncestor ).getOriginalEntry().get( SchemaConstants.REF_AT );
Referral referral = new ReferralImpl();
for ( Value<?> value : refAttr )
@@ -1466,7 +1466,7 @@ public class SearchHandler extends LdapR
// parse the ref value and normalize the Dn
LdapUrl ldapUrl = null;
-
+
try
{
ldapUrl = new LdapUrl( ref );
@@ -1537,7 +1537,7 @@ public class SearchHandler extends LdapR
if ( e instanceof LdapOperationException )
{
- code = ( (LdapOperationException) e ).getResultCode();
+ code = ( ( LdapOperationException ) e ).getResultCode();
}
else
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java Tue Jan 24 16:15:05 2012
@@ -37,11 +37,11 @@ public class SearchTimeLimitingMonitor i
{
private final long startTime = System.currentTimeMillis();
private final long millisToLive;
-
+
private boolean closed;
private Exception cause;
-
-
+
+
/**
* Creates a new instance of SearchTimeLimitingMonitor.
*
@@ -67,7 +67,7 @@ public class SearchTimeLimitingMonitor i
}
}
-
+
/*
* (non-Javadoc)
* @see org.apache.directory.server.core.cursor.ClosureMonitor#checkNotClosed()
@@ -81,7 +81,7 @@ public class SearchTimeLimitingMonitor i
// state check needed to "try" not to overwrite exception (lack of
// synchronization may still allow overwriting but who cares that
// much
- if ( ! closed )
+ if ( !closed )
{
// not going to sync because who cares if it takes a little
// longer to stop but we need to set cause before toggling
@@ -90,21 +90,21 @@ public class SearchTimeLimitingMonitor i
closed = true;
}
}
-
+
if ( closed )
{
throw cause;
}
}
-
+
/*
* (non-Javadoc)
* @see org.apache.directory.server.core.cursor.ClosureMonitor#close()
*/
public void close()
{
- if ( ! closed )
+ if ( !closed )
{
// not going to sync because who cares if it takes a little longer
// to stop but we need to set cause before toggling closed state
@@ -114,14 +114,14 @@ public class SearchTimeLimitingMonitor i
}
}
-
+
/*
* (non-Javadoc)
* @see org.apache.directory.server.core.cursor.ClosureMonitor#close(java.lang.String)
*/
public void close( String cause )
{
- if ( ! closed )
+ if ( !closed )
{
// not going to sync because who cares if it takes a little longer
// to stop but we need to set cause before toggling closed state
@@ -138,7 +138,7 @@ public class SearchTimeLimitingMonitor i
*/
public void close( Exception cause )
{
- if ( ! closed )
+ if ( !closed )
{
// not going to sync because who cares if it takes a little longer
// to stop but we need to set cause before toggling closed state
@@ -148,7 +148,7 @@ public class SearchTimeLimitingMonitor i
}
}
-
+
/*
* (non-Javadoc)
* @see org.apache.directory.server.core.cursor.ClosureMonitor#getCause()
@@ -158,7 +158,7 @@ public class SearchTimeLimitingMonitor i
return cause;
}
-
+
/*
* (non-Javadoc)
* @see org.apache.directory.server.core.cursor.ClosureMonitor#isClosed()
@@ -171,9 +171,7 @@ public class SearchTimeLimitingMonitor i
cause = new LdapTimeLimitExceededException();
closed = true;
}
-
+
return closed;
}
}
-
-
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractMechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractMechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractMechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractMechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.ldap.handlers.bind;
+
import javax.security.sasl.SaslServer;
import org.apache.directory.server.ldap.LdapSession;
@@ -39,7 +40,7 @@ public abstract class AbstractMechanismH
/** A logger for this class **/
private static final Logger LOG = LoggerFactory.getLogger( AbstractMechanismHandler.class );
-
+
/**
* Inject a SaslFilter into the Filter chain, to deal with modified
* PDU sent when some mechanisms have been negotiated (DIGEST-MD5, GSSAPI,
@@ -51,16 +52,16 @@ public abstract class AbstractMechanismH
{
LOG.debug( "Inserting SaslFilter to engage negotiated security layer." );
IoSession ioSession = ldapSession.getIoSession();
-
+
// get the Io chain
IoFilterChain chain = ioSession.getFilterChain();
-
+
if ( !chain.contains( SaslConstants.SASL_FILTER ) )
{
SaslServer saslServer = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
chain.addBefore( "codec", SaslConstants.SASL_FILTER, new SaslFilter( saslServer ) );
}
-
+
/*
* We disable the SASL security layer once, to write the outbound SUCCESS
* message without SASL security layer processing.
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslCallbackHandler.java Tue Jan 24 16:15:05 2012
@@ -65,7 +65,7 @@ public abstract class AbstractSaslCallba
/** The logger instance */
private static final Logger LOG = LoggerFactory.getLogger( AbstractSaslCallbackHandler.class );
- /** An empty control array */
+ /** An empty control array */
private static final Control[] EMPTY = new Control[0];
private String username;
@@ -73,13 +73,13 @@ public abstract class AbstractSaslCallba
/** The reference on the user ldap session */
protected LdapSession ldapSession;
-
+
/** The admin core session */
protected CoreSession adminSession;
/** A reference on the DirectoryService instance */
protected final DirectoryService directoryService;
-
+
/** The associated BindRequest */
protected final BindRequest bindRequest;
@@ -117,6 +117,7 @@ public abstract class AbstractSaslCallba
return realm;
}
+
/**
* Implementors set the password based on a lookup, using the username and
* realm as keys.
@@ -184,8 +185,8 @@ public abstract class AbstractSaslCallba
{
// We assume that we have only one password available
byte[] password = userPassword.get().getBytes();
-
- String strPassword = Strings.utf8ToString(password);
+
+ String strPassword = Strings.utf8ToString( password );
passwordCB.setPassword( strPassword.toCharArray() );
}
}
@@ -240,7 +241,7 @@ public abstract class AbstractSaslCallba
{
Control[] connCtls = bindRequest.getControls().values().toArray( EMPTY );
env.put( DirectoryService.JNDI_KEY, directoryService );
- ctx = new InitialLdapContext( env, JndiUtils.toJndiControls( directoryService.getLdapCodecService(),
+ ctx = new InitialLdapContext( env, JndiUtils.toJndiControls( directoryService.getLdapCodecService(),
connCtls ) );
}
catch ( Exception e )
@@ -250,13 +251,13 @@ public abstract class AbstractSaslCallba
if ( e instanceof LdapOperationException )
{
- code = ( (LdapOperationException) e ).getResultCode();
+ code = ( ( LdapOperationException ) e ).getResultCode();
result.setResultCode( code );
dn = ( ( LdapOperationException ) e ).getResolvedDn();
}
else
{
- code = ResultCodeEnum.getBestEstimate(e, bindRequest.getType());
+ code = ResultCodeEnum.getBestEstimate( e, bindRequest.getType() );
result.setResultCode( code );
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslServer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/AbstractSaslServer.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.ldap.handlers.bind;
+
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
@@ -34,18 +35,18 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractSaslServer implements SaslServer
+public abstract class AbstractSaslServer implements SaslServer
{
/** The associated BindRequest */
private final BindRequest bindRequest;
-
+
/** The associated LdapSession instance */
private final LdapSession ldapSession;
-
- /** The admin session, used to authenticate users against the LDAP server */
+
+ /** The admin session, used to authenticate users against the LDAP server */
private CoreSession adminSession;
-
-
+
+
public AbstractSaslServer( LdapSession ldapSession, CoreSession adminSession, BindRequest bindRequest )
{
this.bindRequest = bindRequest;
@@ -53,7 +54,7 @@ public abstract class AbstractSaslServer
this.adminSession = adminSession;
}
-
+
/**
* {@inheritDoc}
*
@@ -75,7 +76,7 @@ public abstract class AbstractSaslServer
return new byte[0];
}
-
+
/**
* @return the associated BindRequest object
*/
@@ -84,7 +85,7 @@ public abstract class AbstractSaslServer
return bindRequest;
}
-
+
/**
* @return the associated ioSession
*/
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/MechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/MechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/MechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/MechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -44,16 +44,16 @@ public interface MechanismHandler
* @throws Exception
*/
public SaslServer handleMechanism( LdapSession session, BindRequest bindRequest ) throws Exception;
-
-
+
+
/**
* Initialize the saslProperties with some mechanism's specific data
*
* @param ldapSession the Ldapsession instance
*/
public void init( LdapSession ldapSession );
-
-
+
+
/**
* Clean the Sasl properties when the use has been authenticated
*
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslConstants.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslConstants.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SaslConstants.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
package org.apache.directory.server.ldap.handlers.bind;
+
/**
* SASL Constants used to store informations releated to the Challenge/response
* exchange during the SASL negociation.
@@ -32,66 +33,57 @@ public class SaslConstants
* A key constant for storing the SASL Server in the session.
*/
public static final String SASL_SERVER = "saslServer";
-
+
/**
* A key constant for storing the SASL host in the session
*/
public static final String SASL_HOST = "host";
-
+
/**
* A key constant used when creating a SaslServer
*/
public static final String LDAP_PROTOCOL = "ldap";
-
-
+
/**
* A key constant for storing the place where we are to search for user's pasword
*/
public static final String SASL_USER_BASE_DN = "userBaseDn";
-
-
+
/**
* A key constant for storing the current mechanism
*/
public static final String SASL_MECH = "saslMech";
-
-
+
/**
* A key constant for storing the authenticated user
*/
public static final String SASL_AUTHENT_USER = "saslAuthentUser";
-
-
+
/**
* A key constant for storing the evaluated credentials
*/
public static final String SASL_CREDS = "saslCreds";
-
/**
* A key constant for storing the Quality Of Protection
*/
public static final String SASL_QOP = "saslQop";
-
-
+
/**
* A key constant for storing the realm
*/
public static final String SASL_REALM = "saslRealm";
-
-
+
/**
* A key constant representing the SASL properties
*/
public static final String SASL_PROPS = "saslProps";
-
-
+
/**
* A key constant representing the SASL mechanism handler
*/
public static final String SASL_MECH_HANDLER = "saslmechHandler";
-
-
+
/**
* A key constant representing the SASL IoFilter
*/
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -51,36 +51,37 @@ public class SimpleMechanismHandler impl
/** The logger instance */
private static final Logger LOG = LoggerFactory.getLogger( SimpleMechanismHandler.class );
-
+
public SaslServer handleMechanism( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
// create a new Bind context, with a null session, as we don't have
// any context yet.
BindOperationContext bindContext = new BindOperationContext( null );
-
+
// Stores the Dn of the user to check, and its password
bindContext.setDn( bindRequest.getDn() );
bindContext.setCredentials( bindRequest.getCredentials() );
- bindContext.setInterceptors( ldapSession.getLdapServer().getDirectoryService().getInterceptors( OperationEnum.BIND ) );
+ bindContext.setInterceptors( ldapSession.getLdapServer().getDirectoryService()
+ .getInterceptors( OperationEnum.BIND ) );
// Stores the request controls into the operation context
LdapProtocolUtils.setRequestControls( bindContext, bindRequest );
-
+
try
{
CoreSession adminSession = ldapSession.getLdapServer().getDirectoryService().getAdminSession();
// And call the OperationManager bind operation.
adminSession.getDirectoryService().getOperationManager().bind( bindContext );
-
+
// As a result, store the created session in the Core Session
ldapSession.setCoreSession( bindContext.getSession() );
-
+
// Return the successful response
BindResponse response = ( BindResponse ) bindRequest.getResultResponse();
response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
LdapProtocolUtils.setResponseControls( bindContext, response );
-
+
// Write it back to the client
ldapSession.getIoSession().write( response );
LOG.debug( "Returned SUCCESS message: {}.", response );
@@ -93,7 +94,7 @@ public class SimpleMechanismHandler impl
if ( e instanceof LdapOperationException )
{
- code = ( (LdapOperationException) e ).getResultCode();
+ code = ( ( LdapOperationException ) e ).getResultCode();
result.setResultCode( code );
}
else
@@ -111,12 +112,12 @@ public class SimpleMechanismHandler impl
}
Dn name = null;
-
- if ( e instanceof LdapAuthenticationException)
+
+ if ( e instanceof LdapAuthenticationException )
{
- name = ((LdapAuthenticationException)e).getResolvedDn();
+ name = ( ( LdapAuthenticationException ) e ).getResolvedDn();
}
-
+
if ( ( name != null )
&& ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM )
|| ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM ) ) )
@@ -127,11 +128,11 @@ public class SimpleMechanismHandler impl
result.setDiagnosticMessage( msg );
ldapSession.getIoSession().write( bindRequest.getResultResponse() );
}
-
+
return null;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java Tue Jan 24 16:15:05 2012
@@ -57,7 +57,7 @@ public class CramMd5CallbackHandler exte
private static final Logger LOG = LoggerFactory.getLogger( CramMd5CallbackHandler.class );
private String bindDn;
-
+
/** A SchemaManager instance */
private SchemaManager schemaManager;
@@ -84,30 +84,31 @@ public class CramMd5CallbackHandler exte
{
ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
-
- AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
- returningAttributes.add( new AttributeTypeOptions( passwordAT) );
- bindDn = (String)ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
-
+
+ AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager()
+ .lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
+ returningAttributes.add( new AttributeTypeOptions( passwordAT ) );
+ bindDn = ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
+
Dn baseDn = new Dn( bindDn );
- EntryFilteringCursor cursor = adminSession.search(
- baseDn,
+ EntryFilteringCursor cursor = adminSession.search(
+ baseDn,
SearchScope.SUBTREE,
- filter,
- AliasDerefMode.DEREF_ALWAYS,
+ filter,
+ AliasDerefMode.DEREF_ALWAYS,
returningAttributes );
-
+
cursor.beforeFirst();
-
+
Entry entry = null;
-
+
while ( cursor.next() )
{
entry = cursor.get();
- LdapPrincipal ldapPrincipal = new LdapPrincipal(
- schemaManager,
- entry.getDn(),
+ LdapPrincipal ldapPrincipal = new LdapPrincipal(
+ schemaManager,
+ entry.getDn(),
AuthenticationLevel.STRONG,
entry.get( SchemaConstants.USER_PASSWORD_AT ).getBytes() );
ldapSession.putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5MechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5MechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5MechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5MechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -44,7 +44,7 @@ public class CramMd5MechanismHandler ext
{
public SaslServer handleMechanism( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
- SaslServer ss = (SaslServer)ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
+ SaslServer ss = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
// TODO - don't use session properties anymore
if ( ss == null )
@@ -54,18 +54,19 @@ public class CramMd5MechanismHandler ext
ldapSession.putSaslProperty( SaslConstants.SASL_HOST, saslHost );
ldapSession.putSaslProperty( SaslConstants.SASL_USER_BASE_DN, userBaseDn );
Map<String, String> saslProps = new HashMap<String, String>();
-
+
CoreSession adminSession = ldapSession.getLdapServer().getDirectoryService().getAdminSession();
CallbackHandler callbackHandler = new CramMd5CallbackHandler( ldapSession, adminSession, bindRequest );
- ss = Sasl.createSaslServer( SupportedSaslMechanisms.CRAM_MD5, SaslConstants.LDAP_PROTOCOL, saslHost, saslProps, callbackHandler );
+ ss = Sasl.createSaslServer( SupportedSaslMechanisms.CRAM_MD5, SaslConstants.LDAP_PROTOCOL, saslHost,
+ saslProps, callbackHandler );
ldapSession.putSaslProperty( SaslConstants.SASL_SERVER, ss );
}
return ss;
}
-
+
/**
* {@inheritDoc}
@@ -76,7 +77,7 @@ public class CramMd5MechanismHandler ext
String saslHost = ldapSession.getLdapServer().getSaslHost();
ldapSession.putSaslProperty( SaslConstants.SASL_HOST, saslHost );
}
-
+
/**
* Remove the SaslServer and Mechanism property.
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java Tue Jan 24 16:15:05 2012
@@ -57,12 +57,11 @@ public class DigestMd5CallbackHandler ex
private static final Logger LOG = LoggerFactory.getLogger( DigestMd5CallbackHandler.class );
private String bindDn;
-
+
/** A SchemaManager instance */
private SchemaManager schemaManager;
-
/**
* Creates a new instance of DigestMd5CallbackHandler.
*
@@ -86,30 +85,31 @@ public class DigestMd5CallbackHandler ex
{
ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
-
- AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
- returningAttributes.add( new AttributeTypeOptions( passwordAT) );
- bindDn = (String)ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
-
+
+ AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager()
+ .lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
+ returningAttributes.add( new AttributeTypeOptions( passwordAT ) );
+ bindDn = ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
+
Dn baseDn = new Dn( bindDn );
- EntryFilteringCursor cursor = adminSession.search(
- baseDn,
+ EntryFilteringCursor cursor = adminSession.search(
+ baseDn,
SearchScope.SUBTREE,
- filter,
+ filter,
AliasDerefMode.DEREF_ALWAYS,
returningAttributes );
-
+
cursor.beforeFirst();
-
+
Entry entry = null;
-
+
while ( cursor.next() )
{
entry = cursor.get();
- LdapPrincipal ldapPrincipal = new LdapPrincipal(
- schemaManager,
- entry.getDn(),
+ LdapPrincipal ldapPrincipal = new LdapPrincipal(
+ schemaManager,
+ entry.getDn(),
AuthenticationLevel.STRONG,
entry.get( SchemaConstants.USER_PASSWORD_AT ).getBytes() );
ldapSession.putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5MechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5MechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5MechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5MechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -54,7 +54,7 @@ public class DigestMd5MechanismHandler e
StringBuilder realms = new StringBuilder();
boolean isFirst = true;
- for ( String realm:ldapServer.getSaslRealms() )
+ for ( String realm : ldapServer.getSaslRealms() )
{
if ( isFirst )
{
@@ -64,7 +64,7 @@ public class DigestMd5MechanismHandler e
{
realms.append( ' ' );
}
-
+
realms.append( realm );
}
@@ -72,10 +72,9 @@ public class DigestMd5MechanismHandler e
}
-
public SaslServer handleMechanism( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
- SaslServer ss = (SaslServer)ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
+ SaslServer ss = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
if ( ss == null )
{
@@ -83,11 +82,11 @@ public class DigestMd5MechanismHandler e
CallbackHandler callbackHandler = new DigestMd5CallbackHandler( ldapSession, adminSession, bindRequest );
- ss = Sasl.createSaslServer(
+ ss = Sasl.createSaslServer(
SupportedSaslMechanisms.DIGEST_MD5,
- SaslConstants.LDAP_PROTOCOL,
- (String)ldapSession.getSaslProperty( SaslConstants.SASL_HOST ),
- (Map<String, String>)ldapSession.getSaslProperty( SaslConstants.SASL_PROPS ),
+ SaslConstants.LDAP_PROTOCOL,
+ ( String ) ldapSession.getSaslProperty( SaslConstants.SASL_HOST ),
+ ( Map<String, String> ) ldapSession.getSaslProperty( SaslConstants.SASL_PROPS ),
callbackHandler );
ldapSession.putSaslProperty( SaslConstants.SASL_SERVER, ss );
}
@@ -95,7 +94,7 @@ public class DigestMd5MechanismHandler e
return ss;
}
-
+
/**
* {@inheritDoc}
*/
@@ -105,7 +104,6 @@ public class DigestMd5MechanismHandler e
String saslHost = ldapSession.getLdapServer().getSaslHost();
String userBaseDn = ldapSession.getLdapServer().getSearchBaseDn();
-
ldapSession.putSaslProperty( SaslConstants.SASL_HOST, saslHost );
ldapSession.putSaslProperty( SaslConstants.SASL_USER_BASE_DN, userBaseDn );
@@ -114,8 +112,8 @@ public class DigestMd5MechanismHandler e
saslProps.put( "com.sun.security.sasl.digest.realm", getActiveRealms( ldapSession.getLdapServer() ) );
ldapSession.putSaslProperty( SaslConstants.SASL_PROPS, saslProps );
}
-
-
+
+
/**
* Remove the Host, UserBaseDn, props and Mechanism property.
*
@@ -125,7 +123,7 @@ public class DigestMd5MechanismHandler e
{
// Inject the Sasl Filter
insertSaslFilter( ldapSession );
-
+
// and cleanup the useless informations
ldapSession.removeSaslProperty( SaslConstants.SASL_HOST );
ldapSession.removeSaslProperty( SaslConstants.SASL_USER_BASE_DN );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiCallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiCallbackHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiCallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/gssapi/GssapiCallbackHandler.java Tue Jan 24 16:15:05 2012
@@ -84,7 +84,7 @@ public class GssapiCallbackHandler exten
LOG.debug( "Converted username {} to Dn {}.", username, bindDn );
- LdapPrincipal ldapPrincipal = new LdapPrincipal( adminSession.getDirectoryService().getSchemaManager(),
+ LdapPrincipal ldapPrincipal = new LdapPrincipal( adminSession.getDirectoryService().getSchemaManager(),
new Dn( entry.getDistinguishedName() ),
AuthenticationLevel.STRONG, StringConstants.EMPTY_BYTES );
ldapSession.putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmMechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmMechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmMechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmMechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -63,8 +63,9 @@ public class NtlmMechanismHandler extend
{
initProvider();
}
-
- ss = new NtlmSaslServer( provider, bindRequest, ldapSession, ldapSession.getLdapServer().getDirectoryService().getAdminSession() );
+
+ ss = new NtlmSaslServer( provider, bindRequest, ldapSession, ldapSession.getLdapServer()
+ .getDirectoryService().getAdminSession() );
ldapSession.putSaslProperty( SaslConstants.SASL_SERVER, ss );
}
@@ -76,8 +77,8 @@ public class NtlmMechanismHandler extend
{
provider = ( NtlmProvider ) Class.forName( providerFqcn ).newInstance();
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.ldap.handlers.bind.ntlm;
+
import org.apache.mina.core.session.IoSession;
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java Tue Jan 24 16:15:05 2012
@@ -48,14 +48,18 @@ import org.apache.directory.shared.util.
public class NtlmSaslServer extends AbstractSaslServer
{
/** The different states during a NTLM negotiation */
- enum NegotiationState { INITIALIZED, TYPE_1_RECEIVED, TYPE_2_SENT, TYPE_3_RECEIVED, COMPLETED }
+ enum NegotiationState
+ {
+ INITIALIZED, TYPE_1_RECEIVED, TYPE_2_SENT, TYPE_3_RECEIVED, COMPLETED
+ }
/** The current state */
private NegotiationState state = NegotiationState.INITIALIZED;
private final NtlmProvider provider;
- public NtlmSaslServer( NtlmProvider provider, BindRequest bindRequest, LdapSession ldapSession, CoreSession adminSession )
+ public NtlmSaslServer( NtlmProvider provider, BindRequest bindRequest, LdapSession ldapSession,
+ CoreSession adminSession )
{
super( ldapSession, adminSession, bindRequest );
this.provider = provider;
@@ -158,17 +162,19 @@ public class NtlmSaslServer extends Abst
result = provider.authenticate( getLdapSession().getIoSession(), response );
Dn dn = getBindRequest().getDn();
dn.apply( getLdapSession().getLdapServer().getDirectoryService().getSchemaManager() );
- LdapPrincipal ldapPrincipal = new LdapPrincipal( getAdminSession().getDirectoryService().getSchemaManager(),
+ LdapPrincipal ldapPrincipal = new LdapPrincipal( getAdminSession().getDirectoryService()
+ .getSchemaManager(),
dn, AuthenticationLevel.STRONG );
getLdapSession().putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
- getLdapSession().putSaslProperty( Context.SECURITY_PRINCIPAL, getBindRequest().getName().toString() );
+ getLdapSession()
+ .putSaslProperty( Context.SECURITY_PRINCIPAL, getBindRequest().getName().toString() );
}
catch ( Exception e )
{
throw new SaslException( I18n.err( I18n.ERR_669 ), e );
}
- if ( ! result )
+ if ( !result )
{
throw new SaslException( I18n.err( I18n.ERR_670 ) );
}
@@ -188,7 +194,7 @@ public class NtlmSaslServer extends Abst
{
BindOperationContext bindContext = new BindOperationContext( getLdapSession().getCoreSession() );
bindContext.setDn( new Dn( user ) );
- bindContext.setCredentials( Strings.getBytesUtf8(password) );
+ bindContext.setCredentials( Strings.getBytesUtf8( password ) );
getAdminSession().getDirectoryService().getOperationManager().bind( bindContext );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/package-info.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/package-info.java Tue Jan 24 16:15:05 2012
@@ -25,3 +25,5 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
package org.apache.directory.server.ldap.handlers.bind;
+
+
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainMechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainMechanismHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainMechanismHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainMechanismHandler.java Tue Jan 24 16:15:05 2012
@@ -36,14 +36,14 @@ import org.apache.directory.shared.ldap.
*/
public class PlainMechanismHandler extends AbstractMechanismHandler
{
-
+
/**
* {@inheritDoc}
*/
public SaslServer handleMechanism( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
SaslServer ss = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
-
+
if ( ss == null )
{
CoreSession adminSession = ldapSession.getLdapServer().getDirectoryService().getAdminSession();
@@ -64,7 +64,7 @@ public class PlainMechanismHandler exten
// Do nothing
}
-
+
/**
* Remove the SaslServer and Mechanism property.
*
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainSaslServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainSaslServer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainSaslServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/plain/PlainSaslServer.java Tue Jan 24 16:15:05 2012
@@ -49,39 +49,37 @@ public class PlainSaslServer extends Abs
{
/** The authzid property stored into the LdapSession instance */
public static final String SASL_PLAIN_AUTHZID = "authzid";
-
+
/** The authcid property stored into the LdapSession instance */
public static final String SASL_PLAIN_AUTHCID = "authcid";
/** The password property stored into the LdapSession instance */
public static final String SASL_PLAIN_PASSWORD = "password";
-
-
+
/**
* The possible states for the negotiation of a PLAIN mechanism.
*/
- private enum NegotiationState
+ private enum NegotiationState
{
- INITIALIZED, // Negotiation has just started
- MECH_RECEIVED, // We have received the PLAIN mechanism
- COMPLETED // The user/password have been received
+ INITIALIZED, // Negotiation has just started
+ MECH_RECEIVED, // We have received the PLAIN mechanism
+ COMPLETED // The user/password have been received
}
-
-
+
/**
* The different state used by the iInitialResponse decoding
*/
private enum InitialResponse
{
- AUTHZID_EXPECTED, // We are expecting a authzid element
- AUTHCID_EXPECTED, // We are expecting a authcid element
- PASSWORD_EXPECTED // We are expecting a password element
+ AUTHZID_EXPECTED, // We are expecting a authzid element
+ AUTHCID_EXPECTED, // We are expecting a authcid element
+ PASSWORD_EXPECTED // We are expecting a password element
}
/** The current negotiation state */
private NegotiationState state;
-
-
+
+
/**
*
* Creates a new instance of PlainSaslServer.
@@ -93,7 +91,7 @@ public class PlainSaslServer extends Abs
{
super( ldapSession, adminSession, bindRequest );
state = NegotiationState.INITIALIZED;
-
+
// Reinitialize the SASL properties
getLdapSession().removeSaslProperty( SASL_PLAIN_AUTHZID );
getLdapSession().removeSaslProperty( SASL_PLAIN_AUTHCID );
@@ -115,7 +113,7 @@ public class PlainSaslServer extends Abs
*/
public byte[] evaluateResponse( byte[] initialResponse ) throws SaslException
{
- if ( Strings.isEmpty(initialResponse) )
+ if ( Strings.isEmpty( initialResponse ) )
{
state = NegotiationState.MECH_RECEIVED;
return null;
@@ -135,13 +133,13 @@ public class PlainSaslServer extends Abs
String authzId = null;
String authcId = null;
String password = null;
-
+
int start = 0;
int end = 0;
-
+
try
{
- for ( byte b:initialResponse )
+ for ( byte b : initialResponse )
{
if ( b == '\0' )
{
@@ -165,25 +163,25 @@ public class PlainSaslServer extends Abs
{
start++;
String value = new String( initialResponse, start, end - start + 1, "UTF-8" );
-
+
switch ( element )
{
- case AUTHZID_EXPECTED :
+ case AUTHZID_EXPECTED:
element = InitialResponse.AUTHCID_EXPECTED;
authzId = PrepareString.normalize( value, PrepareString.StringType.CASE_EXACT_IA5 );
end++;
start = end;
break;
-
- case AUTHCID_EXPECTED :
+
+ case AUTHCID_EXPECTED:
element = InitialResponse.PASSWORD_EXPECTED;
- authcId = PrepareString.normalize( value, PrepareString.StringType.DIRECTORY_STRING );
+ authcId = PrepareString
+ .normalize( value, PrepareString.StringType.DIRECTORY_STRING );
end++;
start = end;
break;
-
-
- default :
+
+ default:
// This is an error !
throw new IllegalArgumentException( I18n.err( I18n.ERR_672 ) );
}
@@ -194,27 +192,27 @@ public class PlainSaslServer extends Abs
end++;
}
}
-
+
if ( start == end )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_671 ) );
}
-
+
start++;
- String value = Strings.utf8ToString(initialResponse, start, end - start + 1);
-
+ String value = Strings.utf8ToString( initialResponse, start, end - start + 1 );
+
password = PrepareString.normalize( value, PrepareString.StringType.CASE_EXACT_IA5 );
-
+
if ( ( authcId == null ) || ( password == null ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_671 ) );
}
-
+
// Now that we have the authcid and password, try to authenticate.
CoreSession userSession = authenticate( authcId, password );
-
+
getLdapSession().setCoreSession( userSession );
-
+
state = NegotiationState.COMPLETED;
}
catch ( IOException ioe )
@@ -239,8 +237,8 @@ public class PlainSaslServer extends Abs
{
return state == NegotiationState.COMPLETED;
}
-
-
+
+
/**
* Try to authenticate the usr against the underlying LDAP server.
*/
@@ -248,10 +246,10 @@ public class PlainSaslServer extends Abs
{
BindOperationContext bindContext = new BindOperationContext( getLdapSession().getCoreSession() );
bindContext.setDn( new Dn( user ) );
- bindContext.setCredentials( Strings.getBytesUtf8(password) );
-
+ bindContext.setCredentials( Strings.getBytesUtf8( password ) );
+
getAdminSession().getDirectoryService().getOperationManager().bind( bindContext );
-
+
return bindContext.getSession();
}
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.ldap.handlers.controls;
+
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -33,6 +34,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.util.Strings;
+
/**
* The structure which stores the informations relative to the pagedSearch control.
* They are associated to a cookie, stored into the session and associated to an
@@ -57,6 +59,7 @@ public class PagedSearchContext
/** The associated cursor for the current search request */
private EntryFilteringCursor cursor;
+
/**
* Creates a new instance of this class, storing the SearchRequest into it.
*/
@@ -116,7 +119,7 @@ public class PagedSearchContext
Set<String> requestSet = new HashSet<String>();
// Build the set of attributeType from the attributes
- for ( String attribute:request.getAttributes() )
+ for ( String attribute : request.getAttributes() )
{
try
{
@@ -127,8 +130,8 @@ public class PagedSearchContext
{
// Deal with special attributes : '*', '+' and '1.1'
if ( attribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) ||
- attribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
- attribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
+ attribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
+ attribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
{
requestSet.add( attribute );
}
@@ -140,6 +143,7 @@ public class PagedSearchContext
return requestSet;
}
+
/**
* Compare the previous search request and the new one, and return
* true if they are equal. We compare every field but the MessageID.
@@ -215,7 +219,7 @@ public class PagedSearchContext
return false;
}
- for ( String attribute:requestSet )
+ for ( String attribute : requestSet )
{
previousRequestSet.remove( attribute );
}
@@ -315,7 +319,7 @@ public class PagedSearchContext
StringBuilder sb = new StringBuilder();
sb.append( "PagedSearch context : <" );
- sb.append( Strings.dumpBytes(cookie) );
+ sb.append( Strings.dumpBytes( cookie ) );
sb.append( ", " );
sb.append( currentPosition );
sb.append( ">" );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java Tue Jan 24 16:15:05 2012
@@ -20,7 +20,7 @@
package org.apache.directory.server.ldap.handlers.extended;
-import java.util.Collections;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -40,7 +40,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class CertGenerationRequestHandler
+public class CertGenerationRequestHandler
implements ExtendedOperationHandler<CertGenerationRequest, CertGenerationResponse>
{
private static final Set<String> EXTENSION_OIDS;
@@ -81,10 +81,10 @@ public class CertGenerationRequestHandle
if ( entry != null )
{
- TlsKeyGenerator.addKeyPair(
- ( ( ClonedServerEntry ) entry ).getOriginalEntry(),
+ TlsKeyGenerator.addKeyPair(
+ ( ( ClonedServerEntry ) entry ).getOriginalEntry(),
req.getIssuerDN(),
- req.getSubjectDN(),
+ req.getSubjectDN(),
req.getKeyAlgorithm() );
}
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java Tue Jan 24 16:15:05 2012
@@ -49,7 +49,8 @@ import org.slf4j.LoggerFactory;
* @todo : missing Javadoc
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class GracefulShutdownHandler implements ExtendedOperationHandler<GracefulShutdownRequest, GracefulShutdownResponse>
+public class GracefulShutdownHandler implements
+ ExtendedOperationHandler<GracefulShutdownRequest, GracefulShutdownResponse>
{
private static final Logger LOG = LoggerFactory.getLogger( GracefulShutdownHandler.class );
public static final Set<String> EXTENSION_OIDS;
@@ -74,7 +75,7 @@ public class GracefulShutdownHandler imp
{
// make sue only the administrator can issue this shutdown request if
// not we respond to the requestor with with insufficientAccessRights(50)
- if ( ! requestor.getCoreSession().isAnAdministrator() )
+ if ( !requestor.getCoreSession().isAnAdministrator() )
{
if ( LOG.isInfoEnabled() )
{
@@ -82,7 +83,7 @@ public class GracefulShutdownHandler imp
+ requestor.getCoreSession().getEffectivePrincipal().getName() );
}
- requestor.getIoSession().write( new GracefulShutdownResponseImpl(
+ requestor.getIoSession().write( new GracefulShutdownResponseImpl(
req.getMessageId(), ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
return;
}
@@ -93,7 +94,7 @@ public class GracefulShutdownHandler imp
IoAcceptor acceptor = ( IoAcceptor ) requestor.getIoSession().getService();
List<IoSession> sessions = new ArrayList<IoSession>(
- acceptor.getManagedSessions().values() );
+ acceptor.getManagedSessions().values() );
// build the graceful disconnect message with replicationContexts
GracefulDisconnectResponse notice = getGracefulDisconnect( req.getTimeOffline(), req.getDelay() );
@@ -167,7 +168,8 @@ public class GracefulShutdownHandler imp
* @param requestor the session of the graceful shutdown requestor
* @param sessions the IoSessions to send disconnect message to
*/
- public static void sendGracefulDisconnect( List<IoSession> sessions, GracefulDisconnectResponse msg, IoSession requestor )
+ public static void sendGracefulDisconnect( List<IoSession> sessions, GracefulDisconnectResponse msg,
+ IoSession requestor )
{
List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
@@ -249,7 +251,7 @@ public class GracefulShutdownHandler imp
// And close the connections when the NoDs are sent.
Iterator<IoSession> sessionIt = sessions.iterator();
-
+
for ( WriteFuture future : writeFutures )
{
try
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java Tue Jan 24 16:15:05 2012
@@ -94,7 +94,7 @@ public class StartTlsHandler implements
sslFilter.startSsl( session.getIoSession() );
}
- ExtendedResponseDecorator<ExtendedResponse> res = new ExtendedResponseDecorator<ExtendedResponse>(
+ ExtendedResponseDecorator<ExtendedResponse> res = new ExtendedResponseDecorator<ExtendedResponse>(
LdapApiServiceFactory.getSingleton(), new ExtendedResponseImpl( req.getMessageId() ) );
LdapResult result = res.getLdapResult();
result.setResultCode( ResultCodeEnum.SUCCESS );
@@ -145,9 +145,8 @@ public class StartTlsHandler implements
LOG.debug( "Setting LDAP Service" );
Provider provider = Security.getProvider( "SUN" );
LOG.debug( "provider = {}", provider );
-
+
KeyStore keyStore = null;
-
try
{
@@ -157,7 +156,7 @@ public class StartTlsHandler implements
keyStore = new KeyStore( coreKeyStoreSpi, provider, "JKS" )
{
};
-
+
keyStore.load( null, null );
}
else
@@ -184,12 +183,12 @@ public class StartTlsHandler implements
try
{
char[] password = null;
-
+
if ( ldapServer.getKeystoreFile() != null )
{
password = ldapServer.getCertificatePassword().toCharArray();
}
-
+
keyManagerFactory.init( keyStore, password );
}
catch ( Exception e )
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java Tue Jan 24 16:15:05 2012
@@ -47,7 +47,8 @@ import org.apache.directory.shared.ldap.
* @todo : Missing Javadoc
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoredProcedureExtendedOperationHandler implements ExtendedOperationHandler<StoredProcedureRequest, StoredProcedureResponse>
+public class StoredProcedureExtendedOperationHandler implements
+ ExtendedOperationHandler<StoredProcedureRequest, StoredProcedureResponse>
{
private StoredProcExecutionManager manager;
private static final Object[] EMPTY_CLASS_ARRAY = new Object[0];
@@ -73,12 +74,12 @@ public class StoredProcedureExtendedOper
StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
List<Object> valueList = new ArrayList<Object>( req.size() );
-
+
for ( int ii = 0; ii < req.size(); ii++ )
{
byte[] serializedValue = ( byte[] ) req.getParameterValue( ii );
Object value = SerializationUtils.deserialize( serializedValue );
-
+
if ( value.getClass().equals( LdapContextParameter.class ) )
{
String paramCtx = ( ( LdapContextParameter ) value ).getValue();
@@ -87,16 +88,16 @@ public class StoredProcedureExtendedOper
valueList.add( value );
}
-
+
Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values );
byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response );
- StoredProcedureResponse resp =
+ StoredProcedureResponse resp =
LdapApiServiceFactory.getSingleton().newExtendedResponse( req, serializedResponse );
session.getIoSession().write( resp );
}
-
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/package-info.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/package-info.java Tue Jan 24 16:15:05 2012
@@ -25,3 +25,5 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
package org.apache.directory.server.ldap.handlers.extended;
+
+
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/package-info.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/package-info.java Tue Jan 24 16:15:05 2012
@@ -25,3 +25,5 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
package org.apache.directory.server.ldap.handlers;
+
+
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/LdapsInitializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/LdapsInitializer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/LdapsInitializer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/LdapsInitializer.java Tue Jan 24 16:15:05 2012
@@ -57,10 +57,10 @@ public class LdapsInitializer
{
algorithm = KeyManagerFactory.getDefaultAlgorithm();
}
-
+
KeyManagerFactory kmf = KeyManagerFactory.getInstance( algorithm );
-
- if ( Strings.isEmpty(certificatePassord) )
+
+ if ( Strings.isEmpty( certificatePassord ) )
{
kmf.init( ks, null );
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/package-info.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ssl/package-info.java Tue Jan 24 16:15:05 2012
@@ -24,3 +24,5 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
package org.apache.directory.server.ldap.handlers.ssl;
+
+
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/package-info.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/package-info.java Tue Jan 24 16:15:05 2012
@@ -25,3 +25,5 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
package org.apache.directory.server.ldap;
+
+
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java Tue Jan 24 16:15:05 2012
@@ -35,10 +35,11 @@ public class ReplicaEventMessage
{
/** The message change type */
private ChangeType changeType;
-
+
/** The entry */
private Entry entry;
+
/**
* Create a new ReplicaEvent instance for a Add/Delete+Modify operation
* @param changeType The change type
@@ -79,9 +80,9 @@ public class ReplicaEventMessage
public boolean isEventOlderThan( String csn ) throws Exception
{
String entryCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
-
+
int i = entryCsn.compareTo( csn );
-
+
return ( i < 0 );
}
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessageSerializer.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.ldap.replication;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+
/**
* A Modification serializer/deserializer.
* A modification is serialized following this format : <br/>
@@ -59,7 +61,8 @@ public class ReplicaEventMessageSerializ
private transient LdapApiService codec = LdapApiServiceFactory.getSingleton();
private transient SchemaManager schemaManager;
-
+
+
/**
* Creates a new instance of ReplicaEventMessageSerializer.
*
@@ -77,35 +80,35 @@ public class ReplicaEventMessageSerializ
*/
public byte[] serialize( Object object ) throws IOException
{
- ReplicaEventMessage replicaEventMessage = (ReplicaEventMessage)object;
-
+ ReplicaEventMessage replicaEventMessage = ( ReplicaEventMessage ) object;
+
Entry entry = replicaEventMessage.getEntry();
ChangeType changeType = replicaEventMessage.getChangeType();
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream( baos );
// The entry DN
entry.getDn().writeExternal( out );
-
+
// The entry
byte[] data = entrySerializer.serialize( entry );
// Entry's length
out.writeInt( data.length );
-
+
// Entry's data
out.write( data );
// The change type
out.writeByte( changeType.getValue() );
-
+
out.flush();
return baos.toByteArray();
}
-
+
/**
* Deserialize a ReplicaEventMessage.
*
@@ -129,7 +132,7 @@ public class ReplicaEventMessageSerializ
int length = in.readInt();
byte[] data = new byte[length];
-
+
// The entry itself
in.readFully( data );
@@ -147,7 +150,7 @@ public class ReplicaEventMessageSerializ
{
// there is nothing we can do here...
}
-
+
return replicaEventMessage;
}
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicationConsumerConfig.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicationConsumerConfig.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicationConsumerConfig.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicationConsumerConfig.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
package org.apache.directory.server.ldap.replication;
+
/**
* A marker interface for the configuration used in implementations of ReplicationConsumer.
*