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 15:11:01 UTC
svn commit: r1235258 [2/8] - in /directory/apacheds/trunk:
core-annotations/src/main/java/org/apache/directory/server/core/annotations/
core-annotations/src/main/java/org/apache/directory/server/core/factory/
core-annotations/src/test/java/org/apache/d...
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java Tue Jan 24 14:10:56 2012
@@ -19,31 +19,34 @@
*/
package org.apache.directory.server.core.api;
+
/**
* The list of mandatory interceptors we use in the server.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public enum InterceptorEnum {
- NORMALIZATION_INTERCEPTOR( "normalizationInterceptor" ),
- AUTHENTICATION_INTERCEPTOR( "authenticationInterceptor" ),
- REFERRAL_INTERCEPTOR( "referralInterceptor" ),
- ACI_AUTHORIZATION_INTERCEPTOR( "aciAuthorizationInterceptor" ),
- DEFAULT_AUTHORIZATION_INTERCEPTOR( "defaultAuthorizationInterceptor" ),
- ADMINISTRATIVE_POINT_INTERCEPTOR( "administrativePointInterceptor" ),
- EXCEPTION_INTERCEPTOR( "exceptionInterceptor" ),
- OPERATIONAL_ATTRIBUTE_INTERCEPTOR( "operationalAttributeInterceptor" ),
- SCHEMA_INTERCEPTOR( "schemaInterceptor" ),
- SUBENTRY_INTERCEPTOR( "subentryInterceptor" ),
- EVENT_INTERCEPTOR( "eventInterceptor" ),
- TRIGGER_INTERCEPTOR( "triggerInterceptor" ),
- CHANGE_LOG_INTERCEPTOR( "changeLogInterceptor" ),
- COLLECTIVE_ATTRIBUTE_INTERCEPTOR( "collectiveAttributeInterceptor" ),
- JOURNAL_INTERCEPTOR( "journalInterceptor" );
-
+public enum InterceptorEnum
+{
+ NORMALIZATION_INTERCEPTOR("normalizationInterceptor"),
+ AUTHENTICATION_INTERCEPTOR("authenticationInterceptor"),
+ REFERRAL_INTERCEPTOR("referralInterceptor"),
+ ACI_AUTHORIZATION_INTERCEPTOR("aciAuthorizationInterceptor"),
+ DEFAULT_AUTHORIZATION_INTERCEPTOR("defaultAuthorizationInterceptor"),
+ ADMINISTRATIVE_POINT_INTERCEPTOR("administrativePointInterceptor"),
+ EXCEPTION_INTERCEPTOR("exceptionInterceptor"),
+ OPERATIONAL_ATTRIBUTE_INTERCEPTOR("operationalAttributeInterceptor"),
+ SCHEMA_INTERCEPTOR("schemaInterceptor"),
+ SUBENTRY_INTERCEPTOR("subentryInterceptor"),
+ EVENT_INTERCEPTOR("eventInterceptor"),
+ TRIGGER_INTERCEPTOR("triggerInterceptor"),
+ CHANGE_LOG_INTERCEPTOR("changeLogInterceptor"),
+ COLLECTIVE_ATTRIBUTE_INTERCEPTOR("collectiveAttributeInterceptor"),
+ JOURNAL_INTERCEPTOR("journalInterceptor");
+
/** The associated interceptor name */
private String name;
-
+
+
/**
* The private constructor
* @param methodName The associated interceptor name
@@ -52,8 +55,8 @@ public enum InterceptorEnum {
{
this.name = name;
}
-
-
+
+
/**
* @return The associated interceptor name
*/
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java Tue Jan 24 14:10:56 2012
@@ -138,7 +138,7 @@ public class LdapCoreSessionConnection i
messageId.incrementAndGet();
}
-
+
/**
* {@inheritDoc}
*/
@@ -228,7 +228,7 @@ public class LdapCoreSessionConnection i
addRequest.setEntryDn( entry.getDn() );
AddResponse addResponse = add( addRequest );
-
+
processResponse( addResponse );
}
@@ -666,13 +666,12 @@ public class LdapCoreSessionConnection i
modifyRequest.setName( entry.getDn() );
Iterator<Attribute> itr = entry.iterator();
-
+
while ( itr.hasNext() )
{
modifyRequest.addModification( new DefaultModification( modOp, itr.next() ) );
}
-
ModifyResponse modifyResponse = modify( modifyRequest );
processResponse( modifyResponse );
@@ -710,7 +709,7 @@ public class LdapCoreSessionConnection i
}
addResponseControls( modRequest, resp );
-
+
return resp;
}
@@ -1165,7 +1164,7 @@ public class LdapCoreSessionConnection i
public void bind() throws LdapException, IOException
{
throw new UnsupportedOperationException(
- "Bind operation using LdapConnectionConfig are not supported on CoreSession based connection" );
+ "Bind operation using LdapConnectionConfig are not supported on CoreSession based connection" );
}
@@ -1254,7 +1253,7 @@ public class LdapCoreSessionConnection i
*/
public void bind( Dn name, String credentials ) throws LdapException, IOException
{
- byte[] credBytes = ( credentials == null ? StringConstants.EMPTY_BYTES : Strings.getBytesUtf8(credentials) );
+ byte[] credBytes = ( credentials == null ? StringConstants.EMPTY_BYTES : Strings.getBytesUtf8( credentials ) );
BindRequest bindRequest = new BindRequestImpl();
bindRequest.setDn( name );
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipal.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipal.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipal.java Tue Jan 24 14:10:56 2012
@@ -45,15 +45,15 @@ public final class LdapPrincipal impleme
/** the authentication level for this principal */
private AuthenticationLevel authenticationLevel;
-
+
/** The userPassword
* @todo security risk remove this immediately
*/
private byte[] userPassword;
-
+
/** The SchemaManager */
private SchemaManager schemaManager;
-
+
private SocketAddress clientAddress;
private SocketAddress serverAddress;
@@ -70,16 +70,16 @@ public final class LdapPrincipal impleme
{
this.schemaManager = schemaManager;
this.dn = dn;
-
- if ( ! dn.isSchemaAware() )
+
+ if ( !dn.isSchemaAware() )
{
throw new IllegalStateException( I18n.err( I18n.ERR_436 ) );
}
-
+
this.authenticationLevel = authenticationLevel;
this.userPassword = null;
}
-
+
/**
* Creates a new LDAP/X500 principal without any group associations. Keep
@@ -90,14 +90,15 @@ public final class LdapPrincipal impleme
* @param authenticationLevel the authentication level for this principal
* @param userPassword The user password
*/
- public LdapPrincipal( SchemaManager schemaManager, Dn dn, AuthenticationLevel authenticationLevel, byte[] userPassword )
+ public LdapPrincipal( SchemaManager schemaManager, Dn dn, AuthenticationLevel authenticationLevel,
+ byte[] userPassword )
{
this.dn = dn;
this.authenticationLevel = authenticationLevel;
- this.userPassword = new byte[ userPassword.length ];
+ this.userPassword = new byte[userPassword.length];
System.arraycopy( userPassword, 0, this.userPassword, 0, userPassword.length );
this.schemaManager = schemaManager;
-}
+ }
/**
@@ -163,28 +164,28 @@ public final class LdapPrincipal impleme
public void setUserPassword( byte[] userPassword )
{
- this.userPassword = new byte[ userPassword.length ];
+ this.userPassword = new byte[userPassword.length];
System.arraycopy( userPassword, 0, this.userPassword, 0, userPassword.length );
}
-
-
+
+
/**
* Clone the object. This is done so that we don't store the
* password in a LdapPrincipal more than necessary.
*/
public Object clone() throws CloneNotSupportedException
{
- LdapPrincipal clone = (LdapPrincipal)super.clone();
-
+ LdapPrincipal clone = ( LdapPrincipal ) super.clone();
+
if ( userPassword != null )
{
clone.setUserPassword( userPassword );
}
-
+
return clone;
}
-
-
+
+
/**
* @return the schemaManager
*/
@@ -200,7 +201,7 @@ public final class LdapPrincipal impleme
public void setSchemaManager( SchemaManager schemaManager )
{
this.schemaManager = schemaManager;
-
+
try
{
dn.apply( schemaManager );
@@ -255,7 +256,7 @@ public final class LdapPrincipal impleme
public String toString()
{
StringBuilder sb = new StringBuilder();
-
+
if ( dn.isSchemaAware() )
{
sb.append( "(n)" );
@@ -264,21 +265,21 @@ public final class LdapPrincipal impleme
sb.append( "['" );
sb.append( dn.getName() );
sb.append( "'" );
-
+
if ( clientAddress != null )
{
sb.append( ", client@" );
sb.append( clientAddress );
}
-
+
if ( serverAddress != null )
{
sb.append( ", server@" );
sb.append( serverAddress );
}
-
+
sb.append( "]" );
-
+
return sb.toString();
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipalSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipalSerializer.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipalSerializer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapPrincipalSerializer.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api;
+
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -30,6 +31,7 @@ import org.apache.directory.shared.ldap.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
* A helper class which serialize and deserialize a LdapPrincipal.
*
@@ -40,6 +42,7 @@ public final class LdapPrincipalSerializ
/** The LoggerFactory used by this class */
protected static final Logger LOG = LoggerFactory.getLogger( LdapPrincipalSerializer.class );
+
/**
* Private constructor.
*/
@@ -47,7 +50,7 @@ public final class LdapPrincipalSerializ
{
}
-
+
/**
* Serializes a LdapPrincipal instance.
*
@@ -59,7 +62,7 @@ public final class LdapPrincipalSerializ
{
// The Authentication level
out.writeInt( principal.getAuthenticationLevel().getLevel() );
-
+
// The principal's DN
if ( principal.getDn() == null )
{
@@ -70,8 +73,8 @@ public final class LdapPrincipalSerializ
principal.getDn().writeExternal( out );
}
}
-
-
+
+
/**
* Deserializes a LdapPrincipal instance.
*
@@ -85,10 +88,10 @@ public final class LdapPrincipalSerializ
{
// Read the authenyication level
AuthenticationLevel authenticationLevel = AuthenticationLevel.getLevel( in.readInt() );
-
+
// Read the principal's DN
Dn dn = new Dn( schemaManager );
-
+
try
{
dn.readExternal( in );
@@ -99,9 +102,9 @@ public final class LdapPrincipalSerializ
ioe.initCause( cnfe );
throw ioe;
}
-
+
LdapPrincipal principal = new LdapPrincipal( schemaManager, dn, authenticationLevel );
-
+
return principal;
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java Tue Jan 24 14:10:56 2012
@@ -19,49 +19,52 @@
*/
package org.apache.directory.server.core.api;
+
/**
* The list of Operation we can process on the Interceptors.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public enum OperationEnum {
- ADD( "add" ),
- BIND( "bind" ),
- COMPARE( "compare" ),
- DELETE( "delete" ),
- GET_ROOT_DSE( "getRootDse" ),
- HAS_ENTRY( "hasEntry" ),
- LIST( "list" ),
- LOOKUP( "lookup" ),
- MODIFY( "modify" ),
- MOVE( "move" ),
- MOVE_AND_RENAME( "moveAndRename" ),
- RENAME( "rename" ),
- SEARCH( "search" ),
- UNBIND( "unbind" );
-
+public enum OperationEnum
+{
+ ADD("add"),
+ BIND("bind"),
+ COMPARE("compare"),
+ DELETE("delete"),
+ GET_ROOT_DSE("getRootDse"),
+ HAS_ENTRY("hasEntry"),
+ LIST("list"),
+ LOOKUP("lookup"),
+ MODIFY("modify"),
+ MOVE("move"),
+ MOVE_AND_RENAME("moveAndRename"),
+ RENAME("rename"),
+ SEARCH("search"),
+ UNBIND("unbind");
+
/** The associated method name */
private String methodName;
-
+
/** A list of all the operations */
private static OperationEnum[] operations = new OperationEnum[]
- {
- ADD,
- BIND,
- COMPARE,
- DELETE,
- GET_ROOT_DSE,
- HAS_ENTRY,
- LIST,
- LOOKUP,
- MODIFY,
- MOVE,
- MOVE_AND_RENAME,
- RENAME,
- SEARCH,
- UNBIND
- };
-
+ {
+ ADD,
+ BIND,
+ COMPARE,
+ DELETE,
+ GET_ROOT_DSE,
+ HAS_ENTRY,
+ LIST,
+ LOOKUP,
+ MODIFY,
+ MOVE,
+ MOVE_AND_RENAME,
+ RENAME,
+ SEARCH,
+ UNBIND
+ };
+
+
/**
* The private constructor
* @param methodName The associated method name
@@ -70,8 +73,8 @@ public enum OperationEnum {
{
this.methodName = methodName;
}
-
-
+
+
/**
* @return The associated method name
*/
@@ -79,8 +82,8 @@ public enum OperationEnum {
{
return methodName;
}
-
-
+
+
/**
* @return The list of all the operations
*/
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java Tue Jan 24 14:10:56 2012
@@ -54,8 +54,8 @@ public interface OperationManager
* @throws LdapException If the addition can't be processed successfully
*/
void add( AddOperationContext addContext ) throws LdapException;
-
-
+
+
/**
* Get the RooDse entry.
*
@@ -63,13 +63,13 @@ public interface OperationManager
* @return The rootDse if found
* @throws LdapException If we can't get back the rootDse entry
*/
- Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException;
+ Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException;
/**
* TODO document after determining if this method should be here.
*/
- boolean compare( CompareOperationContext compareContext) throws LdapException;
+ boolean compare( CompareOperationContext compareContext ) throws LdapException;
/**
@@ -125,13 +125,13 @@ public interface OperationManager
*/
void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException;
-
+
/**
* TODO document after determining if this method should be here.
*/
void bind( BindOperationContext bindContext ) throws LdapException;
-
+
/**
* TODO document after determining if this method should be here.
*/
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralHandlingMode.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralHandlingMode.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralHandlingMode.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralHandlingMode.java Tue Jan 24 14:10:56 2012
@@ -33,19 +33,19 @@ import org.apache.directory.shared.util.
*/
public enum ReferralHandlingMode
{
- THROW( "throw" ),
- FOLLOW( "follow" ),
- IGNORE( "ignore" ),
- THROW_FINDING_BASE( "throw-finding-base" );
-
+ THROW("throw"),
+ FOLLOW("follow"),
+ IGNORE("ignore"),
+ THROW_FINDING_BASE("throw-finding-base");
+
/**
* The JNDI Context.REFERRAL key's value.
*
* @see Context#REFERRAL
*/
private final String jndiValue;
-
-
+
+
/**
* Creates a new instance of ReferralHandlingMode.
*
@@ -56,8 +56,8 @@ public enum ReferralHandlingMode
{
this.jndiValue = jndiValue;
}
-
-
+
+
/**
* Gets the equivalent JNDI Context.REFERRAL key's value for this enumeration constant.
*
@@ -68,8 +68,8 @@ public enum ReferralHandlingMode
{
return jndiValue;
}
-
-
+
+
/**
* Gets the enumeration constant for the JNDI Context.REFERRAL key's value.
*
@@ -81,27 +81,27 @@ public enum ReferralHandlingMode
public static final ReferralHandlingMode getModeFromJndi( String jndiValue )
{
jndiValue = Strings.toLowerCase( Strings.trim( jndiValue ) );
-
+
if ( jndiValue.equals( "throw" ) )
{
return THROW;
}
-
+
if ( jndiValue.equals( "follow" ) )
{
return FOLLOW;
}
-
+
if ( jndiValue.equals( "ignore" ) )
{
return IGNORE;
}
-
+
if ( jndiValue.equals( "throw-finding-base" ) )
{
return THROW_FINDING_BASE;
}
-
+
throw new IllegalArgumentException( I18n.err( I18n.ERR_437, jndiValue ) );
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralManager.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralManager.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ReferralManager.java Tue Jan 24 14:10:56 2012
@@ -19,10 +19,12 @@
*/
package org.apache.directory.server.core.api;
+
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.name.Dn;
+
/**
* An interface for managing referrals in the server
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AdministrativePoint.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AdministrativePoint.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AdministrativePoint.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api.administrative;
+
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.subtree.AdministrativeRole;
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AutonomousAdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AutonomousAdministrativePoint.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AutonomousAdministrativePoint.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/administrative/AutonomousAdministrativePoint.java Tue Jan 24 14:10:56 2012
@@ -42,6 +42,7 @@ public class AutonomousAdministrativePoi
/** A pointer to the Subschema SAP */
private SubschemaAdministrativePoint subschemaSap;
+
/**
* Create an instance of AutonomousAdministrativePoint
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/EncryptionMethod.java Tue Jan 24 14:10:56 2012
@@ -51,7 +51,8 @@ public class EncryptionMethod
private LdapSecurityConstants algorithm;
- /** package protected */EncryptionMethod( LdapSecurityConstants algorithm, byte[] salt )
+ /** package protected */
+ EncryptionMethod( LdapSecurityConstants algorithm, byte[] salt )
{
this.algorithm = algorithm;
this.salt = salt;
@@ -70,14 +71,15 @@ public class EncryptionMethod
}
- /** package protected */ void setSalt( byte[] salt )
+ /** package protected */
+ void setSalt( byte[] salt )
{
// just to make this class immutable, though we have a setter
if ( this.salt != null )
{
throw new IllegalStateException( "salt will only be allowed to set once" );
}
-
+
this.salt = salt;
}
@@ -85,8 +87,8 @@ public class EncryptionMethod
@Override
public String toString()
{
- return "EncryptionMethod [algorithm=" + algorithm.getName().toUpperCase() + ", salt=" + Strings.dumpBytes(salt) + "]";
+ return "EncryptionMethod [algorithm=" + algorithm.getName().toUpperCase() + ", salt="
+ + Strings.dumpBytes( salt ) + "]";
}
-
-
+
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/PasswordUtil.java Tue Jan 24 14:10:56 2012
@@ -124,10 +124,10 @@ public class PasswordUtil
*/
public static byte[] createStoragePassword( String credentials, LdapSecurityConstants algorithm )
{
- return createStoragePassword( Strings.getBytesUtf8(credentials), algorithm );
+ return createStoragePassword( Strings.getBytesUtf8( credentials ), algorithm );
}
-
-
+
+
/**
* create a hashed password in a format that can be stored in the server.
* If the specified algorithm requires a salt then a random salt of 8 byte size is used
@@ -139,8 +139,8 @@ public class PasswordUtil
public static byte[] createStoragePassword( byte[] credentials, LdapSecurityConstants algorithm )
{
byte[] salt;
-
- switch( algorithm )
+
+ switch ( algorithm )
{
case HASH_METHOD_SSHA:
case HASH_METHOD_SSHA256:
@@ -150,21 +150,21 @@ public class PasswordUtil
salt = new byte[8]; // we use 8 byte salt always except for "crypt" which needs 2 byte salt
new SecureRandom().nextBytes( salt );
break;
-
+
case HASH_METHOD_CRYPT:
salt = new byte[2];
SecureRandom sr = new SecureRandom();
int i1 = sr.nextInt( 64 );
int i2 = sr.nextInt( 64 );
-
+
salt[0] = ( byte ) ( i1 < 12 ? ( i1 + '.' ) : i1 < 38 ? ( i1 + 'A' - 12 ) : ( i1 + 'a' - 38 ) );
salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
break;
-
+
default:
salt = null;
}
-
+
byte[] hashedPassword = encryptPassword( credentials, algorithm, salt );
StringBuffer sb = new StringBuffer();
@@ -174,8 +174,8 @@ public class PasswordUtil
if ( algorithm == LdapSecurityConstants.HASH_METHOD_CRYPT )
{
- sb.append( Strings.utf8ToString(salt) );
- sb.append( Strings.utf8ToString(hashedPassword) );
+ sb.append( Strings.utf8ToString( salt ) );
+ sb.append( Strings.utf8ToString( hashedPassword ) );
}
else if ( salt != null )
{
@@ -185,17 +185,17 @@ public class PasswordUtil
}
else
{
- sb.append( String.valueOf( Base64.encode(hashedPassword) ) );
+ sb.append( String.valueOf( Base64.encode( hashedPassword ) ) );
}
}
else
{
- sb.append( Strings.utf8ToString(hashedPassword) );
+ sb.append( Strings.utf8ToString( hashedPassword ) );
}
-
- return Strings.getBytesUtf8(sb.toString());
+
+ return Strings.getBytesUtf8( sb.toString() );
}
-
+
/**
*
@@ -242,22 +242,23 @@ public class PasswordUtil
public static boolean compareCredentials( byte[] receivedCredentials, byte[] storedCredentials )
{
LdapSecurityConstants algorithm = findAlgorithm( storedCredentials );
-
+
if ( algorithm != null )
{
EncryptionMethod encryptionMethod = new EncryptionMethod( algorithm, null );
-
+
// Let's get the encrypted part of the stored password
// We should just keep the password, excluding the algorithm
// and the salt, if any.
// But we should also get the algorithm and salt to
// be able to encrypt the submitted user password in the next step
byte[] encryptedStored = PasswordUtil.splitCredentials( storedCredentials, encryptionMethod );
-
+
// Reuse the saltedPassword informations to construct the encrypted
// password given by the user.
- byte[] userPassword = PasswordUtil.encryptPassword( receivedCredentials, encryptionMethod.getAlgorithm(), encryptionMethod.getSalt() );
-
+ byte[] userPassword = PasswordUtil.encryptPassword( receivedCredentials, encryptionMethod.getAlgorithm(),
+ encryptionMethod.getSalt() );
+
// Now, compare the two passwords.
return Arrays.equals( userPassword, encryptedStored );
}
@@ -266,7 +267,7 @@ public class PasswordUtil
return Arrays.equals( storedCredentials, receivedCredentials );
}
}
-
+
/**
* encrypts the given credentials based on the algorithm name and optional salt
@@ -301,11 +302,11 @@ public class PasswordUtil
return digest( LdapSecurityConstants.HASH_METHOD_MD5, credentials, salt );
case HASH_METHOD_CRYPT:
- String saltWithCrypted = UnixCrypt.crypt( Strings.utf8ToString(credentials), Strings
- .utf8ToString(salt) );
+ String saltWithCrypted = UnixCrypt.crypt( Strings.utf8ToString( credentials ), Strings
+ .utf8ToString( salt ) );
String crypted = saltWithCrypted.substring( 2 );
- return Strings.getBytesUtf8(crypted);
+ return Strings.getBytesUtf8( crypted );
default:
return credentials;
@@ -364,7 +365,7 @@ public class PasswordUtil
int algoLength = encryptionMethod.getAlgorithm().getName().length() + 2;
int hashLen = 0;
-
+
switch ( encryptionMethod.getAlgorithm() )
{
case HASH_METHOD_MD5:
@@ -408,28 +409,28 @@ public class PasswordUtil
case HASH_METHOD_SSHA:
hashLen = SHA1_LENGTH;
-
+
case HASH_METHOD_SHA256:
case HASH_METHOD_SSHA256:
if ( hashLen == 0 )
{
hashLen = SHA256_LENGTH;
}
-
+
case HASH_METHOD_SHA384:
case HASH_METHOD_SSHA384:
if ( hashLen == 0 )
{
hashLen = SHA384_LENGTH;
}
-
+
case HASH_METHOD_SHA512:
case HASH_METHOD_SSHA512:
if ( hashLen == 0 )
{
hashLen = SHA512_LENGTH;
}
-
+
try
{
// The password is associated with a salt. Decompose it
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyConfiguration.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyConfiguration.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyConfiguration.java Tue Jan 24 14:10:56 2012
@@ -155,6 +155,7 @@ public class PasswordPolicyConfiguration
//TODO to be injected from config
private PasswordValidator pwdValidator = DefaultPasswordValidator.INSTANCE;
+
public String getPwdAttribute()
{
return pwdAttribute;
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyException.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyException.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyException.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordPolicyException.java Tue Jan 24 14:10:56 2012
@@ -36,7 +36,9 @@ public class PasswordPolicyException ext
private int errorCode;
/** the array of valid error codes representing password policy errors */
- private static final int[] VALID_CODES = {0, 1, 2, 3, 4, 5, 6, 7, 8};
+ private static final int[] VALID_CODES =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
+
public PasswordPolicyException( Throwable cause )
{
@@ -69,8 +71,8 @@ public class PasswordPolicyException ext
{
return errorCode;
}
-
-
+
+
/**
* this method checks if the given error code is valid or not.
* This method was created cause using PasswordPolicyErrorEnum class creates some
@@ -87,7 +89,7 @@ public class PasswordPolicyException ext
return;
}
}
-
+
throw new IllegalArgumentException( "Unknown password policy response error code " + errorCode );
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordValidator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordValidator.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordValidator.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/authn/ppolicy/PasswordValidator.java Tue Jan 24 14:10:56 2012
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.api.authn.ppolicy;
+
/**
* An interface for implementing password quality verifiers.
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLog.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLog.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLog.java Tue Jan 24 14:10:56 2012
@@ -50,7 +50,7 @@ public interface ChangeLog
* @param enabled true to enable the service, flase to disable it
*/
void setEnabled( boolean enabled );
-
+
/**
* @return The underlying storage
@@ -196,12 +196,14 @@ public interface ChangeLog
*/
Tag tag() throws Exception;
+
/**
* @return The latest tag
* @throws Exception if there is a problem taking the latest tag
*/
Tag getLatest() throws LdapException;
+
/**
* Initialize the ChangeLog system.
*
@@ -210,44 +212,51 @@ public interface ChangeLog
*/
void init( DirectoryService service ) throws Exception;
+
/**
* Flush the changes to disk
* @throws Exception If the flush failed
*/
void sync() throws Exception;
+
/**
* Destroy the changeLog
* @throws Exception
*/
void destroy() throws Exception;
-
+
+
/**
* Exposes the contents of ChangeLog to clients if set to true. Default setting is false.
*
* @param exposed true to expose the contents, false to not expose.
*/
void setExposed( boolean exposed );
-
+
+
/**
* @return true if the changeLog system is visible by clients
*/
boolean isExposed();
-
+
+
/**
* The prefix of the partition. Default value is <i>ou=changelog</i>.
*
* @param suffix suffix value to be set for the changelog partition
*/
void setPartitionSuffix( String suffix );
-
+
+
/**
* The name of the revisions container under the partition. Default value is ou=revisions
*
* @param revContainerName the name of the revisions container
*/
void setRevisionsContainerName( String revContainerName );
-
+
+
/**
* The name of the tags container under the partition. Default value is ou=tags
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEvent.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEvent.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEvent.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEvent.java Tue Jan 24 14:10:56 2012
@@ -37,16 +37,16 @@ public class ChangeLogEvent
{
/** */
private String zuluTime;
-
+
/** The committer */
private LdapPrincipal committer;
-
+
/** The revision number for this event */
private long revision;
-
+
/** The modification */
private LdifEntry forwardLdif;
-
+
/** The revert changes. Can contain more than one single change */
private List<LdifEntry> reverseLdifs;
@@ -58,12 +58,12 @@ public class ChangeLogEvent
* @param zuluTime the timestamp for when the change occurred in generalizedTime format
*/
public ChangeLogEvent( long revision, String zuluTime, LdapPrincipal committer, LdifEntry forwardLdif,
- LdifEntry reverseLdif )
+ LdifEntry reverseLdif )
{
this.zuluTime = zuluTime;
this.revision = revision;
this.forwardLdif = forwardLdif;
- this.reverseLdifs = new ArrayList<LdifEntry>(1);
+ this.reverseLdifs = new ArrayList<LdifEntry>( 1 );
reverseLdifs.add( reverseLdif );
this.committer = committer;
}
@@ -79,7 +79,7 @@ public class ChangeLogEvent
* @param reverseLdifs the reverted operations
*/
public ChangeLogEvent( long revision, String zuluTime, LdapPrincipal committer, LdifEntry forwardLdif,
- List<LdifEntry> reverseLdifs )
+ List<LdifEntry> reverseLdifs )
{
this.zuluTime = zuluTime;
this.revision = revision;
@@ -149,35 +149,35 @@ public class ChangeLogEvent
{
StringBuilder sb = new StringBuilder();
sb.append( "ChangeLogEvent { " );
-
+
sb.append( "principal=" )
- .append( getCommitterPrincipal() )
- .append( ", " );
-
+ .append( getCommitterPrincipal() )
+ .append( ", " );
+
sb.append( "zuluTime=" )
- .append( getZuluTime() )
- .append( ", " );
-
+ .append( getZuluTime() )
+ .append( ", " );
+
sb.append( "revision=" )
- .append( getRevision() )
- .append( ", " );
-
+ .append( getRevision() )
+ .append( ", " );
+
sb.append( "\nforwardLdif=" )
- .append( getForwardLdif() )
- .append( ", " );
-
+ .append( getForwardLdif() )
+ .append( ", " );
+
if ( reverseLdifs != null )
{
sb.append( "\nreverseLdif number=" ).append( reverseLdifs.size() );
int i = 0;
-
- for ( LdifEntry reverseLdif:reverseLdifs )
+
+ for ( LdifEntry reverseLdif : reverseLdifs )
{
sb.append( "\nReverse[" ).append( i++ ).append( "] :\n" );
sb.append( reverseLdif );
}
}
-
+
sb.append( " }" );
return sb.toString();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEventSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEventSerializer.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEventSerializer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogEventSerializer.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api.changelog;
+
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -33,6 +34,7 @@ import org.apache.directory.shared.ldap.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
* A helper class which serialize and deserialize a ChangeLogEvent.
*
@@ -43,6 +45,7 @@ public final class ChangeLogEventSeriali
/** The LoggerFactory used by this class */
protected static final Logger LOG = LoggerFactory.getLogger( ChangeLogEventSerializer.class );
+
/**
* Private constructor.
*/
@@ -50,7 +53,7 @@ public final class ChangeLogEventSeriali
{
}
-
+
/**
* Serializes a ChangeLogEvent instance.
*
@@ -62,29 +65,29 @@ public final class ChangeLogEventSeriali
{
// The date the change has been created, "yyyyMMddHHmmss'Z'"
out.writeUTF( event.getZuluTime() );
-
+
// The committer's Principal
LdapPrincipalSerializer.serialize( event.getCommitterPrincipal(), out );
-
+
// The revision
out.writeLong( event.getRevision() );
-
+
// The forward LDIF
event.getForwardLdif().writeExternal( out );
-
+
// The reverse LDIFs number
int nbReverses = event.getReverseLdifs().size();
out.writeInt( nbReverses );
-
+
for ( LdifEntry reverseLdif : event.getReverseLdifs() )
{
reverseLdif.writeExternal( out );
}
-
+
out.flush();
}
-
-
+
+
/**
* Deserializes a ChangeLogEvent instance.
*
@@ -98,16 +101,16 @@ public final class ChangeLogEventSeriali
{
// The date the change has been created, "yyyyMMddHHmmss'Z'"
String zuluTime = in.readUTF();
-
+
// The committer's Principal
LdapPrincipal committerPrincipal = LdapPrincipalSerializer.deserialize( schemaManager, in );
-
+
// The revision
long revision = in.readLong();
-
+
// The forward LDIF
LdifEntry forwardEntry = new LdifEntry();
-
+
try
{
forwardEntry.readExternal( in );
@@ -118,12 +121,12 @@ public final class ChangeLogEventSeriali
ioe.initCause( cnfe );
throw ioe;
}
-
+
// The reverse LDIFs number
int nbReverses = in.readInt();
-
+
List<LdifEntry> reverses = new ArrayList<LdifEntry>( nbReverses );
-
+
for ( int i = 0; i < nbReverses; i++ )
{
LdifEntry reverseEntry = new LdifEntry();
@@ -138,11 +141,12 @@ public final class ChangeLogEventSeriali
ioe.initCause( cnfe );
throw ioe;
}
-
+
reverses.add( reverseEntry );
}
-
- ChangeLogEvent changeLogEvent = new ChangeLogEvent( revision, zuluTime, committerPrincipal, forwardEntry, reverses );
+
+ ChangeLogEvent changeLogEvent = new ChangeLogEvent( revision, zuluTime, committerPrincipal, forwardEntry,
+ reverses );
return changeLogEvent;
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogSearchEngine.java Tue Jan 24 14:10:56 2012
@@ -137,7 +137,7 @@ public interface ChangeLogSearchEngine
Cursor<ChangeLogEvent> find( long startRevision, long endRevision, RevisionOrder order )
throws Exception;
-
+
/**
* Finds all the ChangeLogEvents on an entry.
*
@@ -147,8 +147,8 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( Dn dn, RevisionOrder order ) throws Exception;
-
-
+
+
/**
* Finds all the ChangeLogEvents on an entry base and/or it's children/descendants.
*
@@ -159,7 +159,7 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( Dn base, Scope scope, RevisionOrder order ) throws Exception;
-
+
/**
* Finds all the ChangeLogEvents triggered by a principal in the system.
@@ -170,8 +170,8 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( LdapPrincipal principal, RevisionOrder order ) throws Exception;
-
-
+
+
/**
* Finds all the ChangeLogEvents of a particular change type.
*
@@ -181,8 +181,8 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( ChangeType changeType, RevisionOrder order ) throws Exception;
-
-
+
+
/**
* Finds all the ChangeLogEvents altering a particular attributeType.
*
@@ -192,7 +192,7 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( AttributeType attributeType, RevisionOrder order ) throws Exception;
-
+
/**
* Finds all the ChangeLogEvents altering a particular objectClass.
@@ -203,8 +203,8 @@ public interface ChangeLogSearchEngine
* @throws Exception if there are failures accessing the store
*/
Cursor<ChangeLogEvent> find( ObjectClass objectClass, RevisionOrder order ) throws Exception;
-
-
+
+
/**
* Finds all the ChangeLogEvents matched by the filter expression tree parameter.
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogStore.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogStore.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/ChangeLogStore.java Tue Jan 24 14:10:56 2012
@@ -35,7 +35,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface ChangeLogStore
+public interface ChangeLogStore
{
/**
* Initialize the store.
@@ -82,7 +82,7 @@ public interface ChangeLogStore
*/
ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception;
-
+
/**
* Records a change as a forward LDIF, some reverse changes to revert the change and
* the authorized principal triggering the revertable change event.
@@ -95,7 +95,7 @@ public interface ChangeLogStore
*/
ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry> reverses ) throws Exception;
-
+
/**
* Looks up the ChangeLogEvent for a revision.
*
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/LogChange.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/LogChange.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/LogChange.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/LogChange.java Tue Jan 24 14:10:56 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.api.changelog;
+
/**
*
* A structure telling the changeLog what to do with the incoming change
@@ -27,6 +28,6 @@ package org.apache.directory.server.core
*/
public enum LogChange
{
- TRUE, // The change must me stored
- FALSE // The change must not be stored
+ TRUE, // The change must me stored
+ FALSE // The change must not be stored
}
\ No newline at end of file
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/RevisionOrder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/RevisionOrder.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/RevisionOrder.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/RevisionOrder.java Tue Jan 24 14:10:56 2012
@@ -28,12 +28,11 @@ package org.apache.directory.server.core
*/
public enum RevisionOrder
{
- AscendingOrder( true ),
- DescendingOrder( false );
-
+ AscendingOrder(true),
+ DescendingOrder(false);
private final boolean ascending;
-
+
private RevisionOrder( boolean ascending )
{
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Scope.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Scope.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Scope.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Scope.java Tue Jan 24 14:10:56 2012
@@ -30,14 +30,13 @@ import javax.naming.directory.SearchCont
*/
public enum Scope
{
- Subtree( SearchControls.SUBTREE_SCOPE ),
- OneLevel( SearchControls.ONELEVEL_SCOPE ),
- Object( SearchControls.OBJECT_SCOPE );
-
-
+ Subtree(SearchControls.SUBTREE_SCOPE),
+ OneLevel(SearchControls.ONELEVEL_SCOPE),
+ Object(SearchControls.OBJECT_SCOPE);
+
private final int scope;
-
-
+
+
private Scope( int scope )
{
this.scope = scope;
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Tag.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Tag.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Tag.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/Tag.java Tue Jan 24 14:10:56 2012
@@ -58,14 +58,14 @@ public class Tag
this.revisionDate = revisionDate;
}
-
+
public Tag( long revision, String description, long tagTime, long revisionTime )
{
this.revision = revision;
this.description = description;
this.tagDate = new Date( tagTime );
- if( revisionTime > 0 )
+ if ( revisionTime > 0 )
{
this.revisionDate = new Date( revisionTime );
}
@@ -114,7 +114,7 @@ public class Tag
hash = hash * 17 + description.hashCode();
}
hash = hash * 17 + Long.valueOf( revision ).hashCode();
-
+
return hash;
}
@@ -148,22 +148,21 @@ public class Tag
{
StringBuilder sb = new StringBuilder();
sb.append( "Tag { " );
-
+
sb.append( "revision = " )
- .append( revision )
- .append( ", " );
-
+ .append( revision )
+ .append( ", " );
+
sb.append( " tagDate = " )
- .append( tagDate )
- .append( ", " );
-
+ .append( tagDate )
+ .append( ", " );
+
sb.append( " revisionDate = " )
- .append( revisionDate );
-
+ .append( revisionDate );
+
sb.append( " }" );
-
+
return sb.toString();
}
-
-
+
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TagSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TagSearchEngine.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TagSearchEngine.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TagSearchEngine.java Tue Jan 24 14:10:56 2012
@@ -59,7 +59,8 @@ public interface TagSearchEngine
* @throws Exception if there is a problem accessing the store
*/
Tag lookup( long revision ) throws Exception;
-
+
+
/**
* Checks to see if a snapshot exists for a specific revision.
*
@@ -74,7 +75,6 @@ public interface TagSearchEngine
// Tag Search Operations
// -----------------------------------------------------------------------
-
/**
* Finds all the snapshot tags taken since revision 0 until the current
* revision.
@@ -84,7 +84,8 @@ public interface TagSearchEngine
* @throws Exception if there is a problem accessing the store
*/
Cursor<Tag> find( RevisionOrder order ) throws Exception;
-
+
+
/**
* Finds all the snapshot tags taken before a specific revision. If a tag
* exists at the revision parameter it will be returned as well.
@@ -97,7 +98,8 @@ public interface TagSearchEngine
* or less than 0.
*/
Cursor<Tag> findBefore( long revision, RevisionOrder order ) throws Exception;
-
+
+
/**
* Finds all the snapshot tags taken after a specific revision. If a tag
* exists at the revision parameter it will be returned as well.
@@ -110,7 +112,8 @@ public interface TagSearchEngine
* or less than 0.
*/
Cursor<Tag> findAfter( long revision, RevisionOrder order ) throws Exception;
-
+
+
/**
* Enumerates over the tags of all snapshots taken between a specific revision
* range inclusive. The first revision parameter should be less than or equal
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableChangeLogStore.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableChangeLogStore.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableChangeLogStore.java Tue Jan 24 14:10:56 2012
@@ -19,8 +19,8 @@
*/
package org.apache.directory.server.core.api.changelog;
-import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
/**
@@ -42,6 +42,7 @@ public interface TaggableChangeLogStore
*/
Tag tag( long revision ) throws Exception;
+
/**
* Creates a snapshot of the server at the current revision.
*
@@ -50,6 +51,7 @@ public interface TaggableChangeLogStore
*/
Tag tag() throws Exception;
+
/**
* Creates a snapshot of the server at the current revision with a description
* of the snapshot tag.
@@ -69,8 +71,8 @@ public interface TaggableChangeLogStore
* @throws Exception on failures to access the tag store
*/
Tag getLatest() throws LdapException;
-
-
+
+
/**
* Removes a Tag created for a given revision.
*
@@ -79,7 +81,8 @@ public interface TaggableChangeLogStore
* @throws Exception on failures to access the tag store
*/
Tag removeTag( long revision ) throws Exception;
-
+
+
/**
* Creates a tag with the given description for a snapshot of the server
* in a specific state at a revision.
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableSearchableChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableSearchableChangeLogStore.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableSearchableChangeLogStore.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/changelog/TaggableSearchableChangeLogStore.java Tue Jan 24 14:10:56 2012
@@ -19,8 +19,8 @@
*/
package org.apache.directory.server.core.api.changelog;
-import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.api.partition.Partition;
/**
@@ -36,7 +36,8 @@ public interface TaggableSearchableChang
* @return the snapshot query engine for this store.
*/
TagSearchEngine getTagSearchEngine();
-
+
+
/**
*
* Gets the read only Partition backed by this ChangeLogStore.
@@ -53,12 +54,13 @@ public interface TaggableSearchableChang
* @param tagContainerName the container's name for holding the tags ex. ou=tags
*/
void createPartition( String partitionSuffix, String revContainerName, String tagContainerName );
-
+
+
/**
* Gets the partition associated with this store
*
* @return the partition associated with this store, null if not initialized
*/
Partition getPartition();
-
+
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java Tue Jan 24 14:10:56 2012
@@ -49,10 +49,11 @@ public class ClonedServerEntry implement
{
/** The original entry as returned by the backend */
protected Entry originalEntry;
-
+
/** The copied entry */
protected Entry clonedEntry;
+
/**
* Creates a new instance of ClonedServerEntry.
*/
@@ -60,7 +61,7 @@ public class ClonedServerEntry implement
{
}
-
+
/**
* Creates a new instance of ClonedServerEntry.
*
@@ -73,8 +74,8 @@ public class ClonedServerEntry implement
this.originalEntry = originalEntry;
this.clonedEntry = ( Entry ) originalEntry.clone();
}
-
-
+
+
/**
* @return the originalEntry
*/
@@ -317,7 +318,7 @@ public class ClonedServerEntry implement
return clonedEntry.hasObjectClass( objectClasses );
}
-
+
/**
* {@inheritDoc}
*/
@@ -325,7 +326,7 @@ public class ClonedServerEntry implement
{
return clonedEntry.isSchemaAware();
}
-
+
public Iterator<Attribute> iterator()
{
@@ -403,18 +404,18 @@ public class ClonedServerEntry implement
{
// Copy the Dn
Entry clientEntry = new DefaultEntry( clonedEntry.getDn() );
-
+
// Convert each attribute
- for ( Attribute clonedEntry:this )
+ for ( Attribute clonedEntry : this )
{
Attribute clientAttribute = clonedEntry.clone();
clientEntry.add( clientAttribute );
}
-
+
return clientEntry;
}
-
-
+
+
/**
* @see java.io.Externalizable#readExternal(ObjectInput)
*
@@ -424,8 +425,8 @@ public class ClonedServerEntry implement
{
throw new IllegalStateException( I18n.err( I18n.ERR_455 ) );
}
-
-
+
+
/**
* @see java.io.Externalizable#writeExternal(ObjectOutput)
*
@@ -435,14 +436,14 @@ public class ClonedServerEntry implement
{
throw new IllegalStateException( I18n.err( I18n.ERR_456 ) );
}
-
-
+
+
public Entry clone()
{
return ( Entry ) clonedEntry.clone();
}
-
-
+
+
/**
* {@inheritDoc}
*/
@@ -452,6 +453,7 @@ public class ClonedServerEntry implement
return 703;
}
+
/**
* @see Object#equals(Object);
*/
@@ -463,22 +465,22 @@ public class ClonedServerEntry implement
{
return true;
}
-
+
Entry other;
-
+
if ( obj instanceof ClonedServerEntry )
{
- other = ((ClonedServerEntry)obj).getClonedEntry();
+ other = ( ( ClonedServerEntry ) obj ).getClonedEntry();
}
else if ( obj instanceof Entry )
{
- other = (Entry)obj;
+ other = ( Entry ) obj;
}
- else
+ else
{
return false;
}
- if ( clonedEntry == null)
+ if ( clonedEntry == null )
{
return other == null;
}
@@ -487,8 +489,8 @@ public class ClonedServerEntry implement
return clonedEntry.equals( other );
}
}
-
-
+
+
public String toString()
{
return clonedEntry.toString();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryFactory.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryFactory.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryFactory.java Tue Jan 24 14:10:56 2012
@@ -38,7 +38,7 @@ public interface ServerEntryFactory
* May want to add more newEntry() overrides, some with variable arguments
* to create entries in one method call.
*/
-
+
/**
* Creates a new ServerEntry which has not yet been added to the
* directory.
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java?rev=1235258&r1=1235257&r2=1235258&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java Tue Jan 24 14:10:56 2012
@@ -18,6 +18,7 @@
*/
package org.apache.directory.server.core.api.entry;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -53,6 +54,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.util.EmptyEnumeration;
import org.apache.directory.shared.util.Strings;
+
/**
* A helper class used to manipulate Entries, Attributes and Values.
*
@@ -70,18 +72,18 @@ public class ServerEntryUtils
public static javax.naming.directory.Attribute toBasicAttribute( Attribute entryAttribute )
{
AttributeType attributeType = entryAttribute.getAttributeType();
-
+
javax.naming.directory.Attribute attribute = new BasicAttribute( attributeType.getName() );
-
- for ( Value<?> value: entryAttribute )
+
+ for ( Value<?> value : entryAttribute )
{
attribute.add( value.getValue() );
}
-
+
return attribute;
}
-
-
+
+
/**
* Convert a ServerEntry into a BasicAttributes. The Dn is lost
* during this conversion, as the Attributes object does not store
@@ -95,24 +97,24 @@ public class ServerEntryUtils
{
return null;
}
-
+
Attributes attributes = new BasicAttributes( true );
- for ( Attribute attribute:entry.getAttributes() )
+ for ( Attribute attribute : entry.getAttributes() )
{
AttributeType attributeType = attribute.getAttributeType();
Attribute attr = entry.get( attributeType );
-
+
// Deal with a special case : an entry without any ObjectClass
if ( attributeType.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) && attr.size() == 0 )
{
// We don't have any objectClass, just dismiss this element
continue;
}
-
+
attributes.put( toBasicAttribute( attr ) );
}
-
+
return attributes;
}
@@ -126,36 +128,37 @@ public class ServerEntryUtils
*
* @throws InvalidAttributeIdentifierException If we had an incorrect attribute
*/
- public static Attribute toServerAttribute( javax.naming.directory.Attribute attribute, AttributeType attributeType ) throws LdapException
+ public static Attribute toServerAttribute( javax.naming.directory.Attribute attribute, AttributeType attributeType )
+ throws LdapException
{
if ( attribute == null )
{
return null;
}
-
- try
+
+ try
{
Attribute serverAttribute = new DefaultAttribute( attributeType );
-
+
for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements(); )
{
Object value = values.nextElement();
int nbAdded = 0;
-
+
if ( value == null )
{
continue;
}
-
+
if ( serverAttribute.isHumanReadable() )
{
if ( value instanceof String )
{
- nbAdded = serverAttribute.add( (String)value );
+ nbAdded = serverAttribute.add( ( String ) value );
}
else if ( value instanceof byte[] )
{
- nbAdded = serverAttribute.add( Strings.utf8ToString((byte[]) value) );
+ nbAdded = serverAttribute.add( Strings.utf8ToString( ( byte[] ) value ) );
}
else
{
@@ -166,24 +169,24 @@ public class ServerEntryUtils
{
if ( value instanceof String )
{
- nbAdded = serverAttribute.add( Strings.getBytesUtf8((String) value) );
+ nbAdded = serverAttribute.add( Strings.getBytesUtf8( ( String ) value ) );
}
else if ( value instanceof byte[] )
{
- nbAdded = serverAttribute.add( (byte[])value );
+ nbAdded = serverAttribute.add( ( byte[] ) value );
}
else
{
throw new LdapInvalidAttributeTypeException();
}
}
-
+
if ( nbAdded == 0 )
{
throw new LdapInvalidAttributeTypeException();
}
}
-
+
return serverAttribute;
}
catch ( NamingException ne )
@@ -204,15 +207,16 @@ public class ServerEntryUtils
* @throws LdapInvalidAttributeTypeException If we get an invalid attribute
*/
public static Entry toServerEntry( Attributes attributes, Dn dn, SchemaManager schemaManager )
- throws LdapInvalidAttributeTypeException
+ throws LdapInvalidAttributeTypeException
{
if ( attributes instanceof BasicAttributes )
{
- try
+ try
{
Entry entry = new DefaultEntry( schemaManager, dn );
-
- for ( NamingEnumeration<? extends javax.naming.directory.Attribute> attrs = attributes.getAll(); attrs.hasMoreElements(); )
+
+ for ( NamingEnumeration<? extends javax.naming.directory.Attribute> attrs = attributes.getAll(); attrs
+ .hasMoreElements(); )
{
javax.naming.directory.Attribute attr = attrs.nextElement();
@@ -222,13 +226,13 @@ public class ServerEntryUtils
// TODO : handle options.
AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
Attribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
-
+
if ( serverAttribute != null )
{
entry.put( serverAttribute );
}
}
-
+
return entry;
}
catch ( LdapException ne )
@@ -252,20 +256,21 @@ public class ServerEntryUtils
* @return the resultant entry after the modification has taken place
* @throws LdapException if there are problems accessing attributes
*/
- public static Entry getTargetEntry( Modification mod, Entry entry, SchemaManager schemaManager ) throws LdapException
+ public static Entry getTargetEntry( Modification mod, Entry entry, SchemaManager schemaManager )
+ throws LdapException
{
Entry targetEntry = ( Entry ) entry.clone();
ModificationOperation modOp = mod.getOperation();
String id = mod.getAttribute().getUpId();
AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
-
+
switch ( modOp )
{
- case REPLACE_ATTRIBUTE :
+ case REPLACE_ATTRIBUTE:
targetEntry.put( mod.getAttribute() );
break;
-
- case REMOVE_ATTRIBUTE :
+
+ case REMOVE_ATTRIBUTE:
Attribute toBeRemoved = mod.getAttribute();
if ( toBeRemoved.size() == 0 )
@@ -278,35 +283,35 @@ public class ServerEntryUtils
if ( existing != null )
{
- for ( Value<?> value:toBeRemoved )
+ for ( Value<?> value : toBeRemoved )
{
existing.remove( value );
}
}
}
break;
-
- case ADD_ATTRIBUTE :
+
+ case ADD_ATTRIBUTE:
Attribute combined = new DefaultAttribute( id, attributeType );
Attribute toBeAdded = mod.getAttribute();
Attribute existing = entry.get( id );
if ( existing != null )
{
- for ( Value<?> value:existing )
+ for ( Value<?> value : existing )
{
combined.add( value );
}
}
- for ( Value<?> value:toBeAdded )
+ for ( Value<?> value : toBeAdded )
{
combined.add( value );
}
-
+
targetEntry.put( combined );
break;
-
+
default:
throw new IllegalStateException( I18n.err( I18n.ERR_464, modOp ) );
}
@@ -349,15 +354,15 @@ public class ServerEntryUtils
Attribute attr = attr0.clone();
- for ( Value<?> value:attr1 )
+ for ( Value<?> value : attr1 )
{
attr.add( value );
}
return attr;
}
-
-
+
+
/**
* Convert a ModificationItem to an instance of a ServerModification object
*
@@ -365,36 +370,37 @@ public class ServerEntryUtils
* @param attributeType the associated attributeType
* @return a instance of a ServerModification object
*/
- private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) throws LdapException
+ private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType )
+ throws LdapException
{
ModificationOperation operation;
-
+
switch ( modificationImpl.getModificationOp() )
{
- case DirContext.REMOVE_ATTRIBUTE :
+ case DirContext.REMOVE_ATTRIBUTE:
operation = ModificationOperation.REMOVE_ATTRIBUTE;
break;
-
- case DirContext.REPLACE_ATTRIBUTE :
+
+ case DirContext.REPLACE_ATTRIBUTE:
operation = ModificationOperation.REPLACE_ATTRIBUTE;
break;
- case DirContext.ADD_ATTRIBUTE :
- default :
+ case DirContext.ADD_ATTRIBUTE:
+ default:
operation = ModificationOperation.ADD_ATTRIBUTE;
break;
-
+
}
-
- Modification modification = new DefaultModification(
+
+ Modification modification = new DefaultModification(
operation,
- ServerEntryUtils.toServerAttribute( modificationImpl.getAttribute(), attributeType ) );
-
+ ServerEntryUtils.toServerAttribute( modificationImpl.getAttribute(), attributeType ) );
+
return modification;
-
+
}
-
+
/**
*
* Convert a list of ModificationItemImpl to a list of
@@ -404,19 +410,20 @@ public class ServerEntryUtils
* @return
* @throws LdapException
*/
- public static List<Modification> convertToServerModification( List<ModificationItem> modificationItems,
+ public static List<Modification> convertToServerModification( List<ModificationItem> modificationItems,
SchemaManager schemaManager ) throws LdapException
{
if ( modificationItems != null )
{
List<Modification> modifications = new ArrayList<Modification>( modificationItems.size() );
- for ( ModificationItem modificationItem: modificationItems )
+ for ( ModificationItem modificationItem : modificationItems )
{
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( modificationItem.getAttribute().getID() );
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( modificationItem
+ .getAttribute().getID() );
modifications.add( toServerModification( modificationItem, attributeType ) );
}
-
+
return modifications;
}
else
@@ -424,8 +431,8 @@ public class ServerEntryUtils
return null;
}
}
-
-
+
+
/**
* Convert a Modification to an instance of a ServerModification object.
*
@@ -436,23 +443,23 @@ public class ServerEntryUtils
private static Modification toServerModification( Modification modification, AttributeType attributeType )
throws LdapException
{
- Modification serverModification = new DefaultModification(
+ Modification serverModification = new DefaultModification(
modification.getOperation(),
- new DefaultAttribute( attributeType, modification.getAttribute() ) );
-
+ new DefaultAttribute( attributeType, modification.getAttribute() ) );
+
return serverModification;
-
+
}
-
- public static List<Modification> toServerModification( Modification[] modifications,
+
+ public static List<Modification> toServerModification( Modification[] modifications,
SchemaManager schemaManager ) throws LdapException
{
if ( modifications != null )
{
List<Modification> modificationsList = new ArrayList<Modification>();
-
- for ( Modification modification: modifications )
+
+ for ( Modification modification : modifications )
{
String attributeId = modification.getAttribute().getUpId();
String id = stripOptions( attributeId );
@@ -463,9 +470,9 @@ public class ServerEntryUtils
// DIRSERVER-646 Fix: Replacing an unknown attribute with no values
// (deletion) causes an error
// -------------------------------------------------------------------
- if ( ! schemaManager.getAttributeTypeRegistry().contains( id )
- && modification.getAttribute().size() == 0
- && modification.getOperation() == ModificationOperation.REPLACE_ATTRIBUTE )
+ if ( !schemaManager.getAttributeTypeRegistry().contains( id )
+ && modification.getAttribute().size() == 0
+ && modification.getOperation() == ModificationOperation.REPLACE_ATTRIBUTE )
{
// The attributeType does not exist in the schema.
// It's an error
@@ -479,7 +486,7 @@ public class ServerEntryUtils
modificationsList.add( toServerModification( modification, attributeType ) );
}
}
-
+
return modificationsList;
}
else
@@ -489,14 +496,14 @@ public class ServerEntryUtils
}
- public static List<Modification> toServerModification( ModificationItem[] modifications,
+ public static List<Modification> toServerModification( ModificationItem[] modifications,
SchemaManager schemaManager ) throws LdapException
{
if ( modifications != null )
{
List<Modification> modificationsList = new ArrayList<Modification>();
-
- for ( ModificationItem modification: modifications )
+
+ for ( ModificationItem modification : modifications )
{
String attributeId = modification.getAttribute().getID();
String id = stripOptions( attributeId );
@@ -506,13 +513,13 @@ public class ServerEntryUtils
// DIRSERVER-646 Fix: Replacing an unknown attribute with no values
// (deletion) causes an error
// -------------------------------------------------------------------
-
+
// TODO - after removing JNDI we need to make the server handle
// this in the codec
-
- if ( ! schemaManager.getAttributeTypeRegistry().contains( id )
- && modification.getAttribute().size() == 0
- && modification.getModificationOp() == DirContext.REPLACE_ATTRIBUTE )
+
+ if ( !schemaManager.getAttributeTypeRegistry().contains( id )
+ && modification.getAttribute().size() == 0
+ && modification.getModificationOp() == DirContext.REPLACE_ATTRIBUTE )
{
continue;
}
@@ -520,13 +527,12 @@ public class ServerEntryUtils
// -------------------------------------------------------------------
// END DIRSERVER-646 Fix
// -------------------------------------------------------------------
-
-
+
// TODO : handle options
AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
- modificationsList.add( toServerModification( (ModificationItem)modification, attributeType ) );
+ modificationsList.add( toServerModification( ( ModificationItem ) modification, attributeType ) );
}
-
+
return modificationsList;
}
else
@@ -545,20 +551,20 @@ public class ServerEntryUtils
*/
public static final Modification getModificationItem( List<Modification> mods, AttributeType type )
{
- for ( Modification modification:mods )
+ for ( Modification modification : mods )
{
Attribute attribute = modification.getAttribute();
-
+
if ( attribute.getAttributeType() == type )
{
return modification;
}
}
-
+
return null;
}
-
-
+
+
/**
* Utility method to extract an attribute from a list of modifications.
*
@@ -569,16 +575,16 @@ public class ServerEntryUtils
public static Attribute getAttribute( List<Modification> mods, AttributeType type )
{
Modification mod = getModificationItem( mods, type );
-
+
if ( mod != null )
{
return mod.getAttribute();
}
-
+
return null;
}
-
-
+
+
/**
* Encapsulate a ServerSearchResult enumeration into a SearchResult enumeration
* @param result The ServerSearchResult enumeration
@@ -590,8 +596,8 @@ public class ServerEntryUtils
{
return new EmptyEnumeration<SearchResult>();
}
-
- return new NamingEnumeration<SearchResult> ()
+
+ return new NamingEnumeration<SearchResult>()
{
public void close() throws NamingException
{
@@ -614,17 +620,17 @@ public class ServerEntryUtils
public SearchResult next() throws NamingException
{
ServerSearchResult rec = result.next();
-
- SearchResult searchResult = new SearchResult(
- rec.getDn().getName(),
- rec.getObject(),
- toBasicAttributes( rec.getServerEntry() ),
- rec.isRelative() );
-
+
+ SearchResult searchResult = new SearchResult(
+ rec.getDn().getName(),
+ rec.getObject(),
+ toBasicAttributes( rec.getServerEntry() ),
+ rec.isRelative() );
+
return searchResult;
}
-
-
+
+
/**
* @see java.util.Enumeration#hasMoreElements()
*/
@@ -642,18 +648,18 @@ public class ServerEntryUtils
try
{
ServerSearchResult rec = result.next();
-
- SearchResult searchResult = new SearchResult(
- rec.getDn().getName(),
- rec.getObject(),
- toBasicAttributes( rec.getServerEntry() ),
- rec.isRelative() );
-
+
+ SearchResult searchResult = new SearchResult(
+ rec.getDn().getName(),
+ rec.getObject(),
+ toBasicAttributes( rec.getServerEntry() ),
+ rec.isRelative() );
+
return searchResult;
}
catch ( NamingException ne )
{
- NoSuchElementException nsee =
+ NoSuchElementException nsee =
new NoSuchElementException( I18n.err( I18n.ERR_468 ) );
nsee.initCause( ne );
throw nsee;
@@ -661,8 +667,8 @@ public class ServerEntryUtils
}
};
}
-
-
+
+
/**
* Remove the options from the attributeType, and returns the ID.
*
@@ -674,8 +680,8 @@ public class ServerEntryUtils
*/
private static String stripOptions( String attributeId )
{
- int optionsPos = attributeId.indexOf( ";" );
-
+ int optionsPos = attributeId.indexOf( ";" );
+
if ( optionsPos != -1 )
{
return attributeId.substring( 0, optionsPos );
@@ -685,7 +691,7 @@ public class ServerEntryUtils
return attributeId;
}
}
-
+
/**
* Get the options from the attributeType.
@@ -697,22 +703,22 @@ public class ServerEntryUtils
*/
private static Set<String> getOptions( String attributeId )
{
- int optionsPos = attributeId.indexOf( ";" );
+ int optionsPos = attributeId.indexOf( ";" );
if ( optionsPos != -1 )
{
Set<String> options = new HashSet<String>();
-
+
String[] res = attributeId.substring( optionsPos + 1 ).split( ";" );
-
- for ( String option:res )
+
+ for ( String option : res )
{
- if ( !Strings.isEmpty(option) )
+ if ( !Strings.isEmpty( option ) )
{
options.add( option );
}
}
-
+
return options;
}
else