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 2016/05/18 13:19:47 UTC
svn commit: r1744407 - in
/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model:
message/ name/ schema/ schema/syntaxCheckers/
Author: elecharny
Date: Wed May 18 13:19:47 2016
New Revision: 1744407
URL: http://svn.apache.org/viewvc?rev=1744407&view=rev
Log:
o Don't parse the DN anymore in the BindRequest.setName( String ) method (it will be done later anyway)
o Speedup for the Ava.equals() method : take a chance that the Ava Values are equal as String to avoid a costly normalization
o Added a shortcut in the AttributeType.equals() method : checking this against other at the beginning
o Some cleanup
Modified:
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/BindRequestImpl.java
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ObjectClass.java
directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/DnSyntaxChecker.java
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/BindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/BindRequestImpl.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/BindRequestImpl.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/BindRequestImpl.java Wed May 18 13:19:47 2016
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.mo
import java.util.Arrays;
import org.apache.directory.api.i18n.I18n;
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.util.Strings;
import org.slf4j.Logger;
@@ -208,17 +207,6 @@ public class BindRequestImpl extends Abs
{
this.name = name;
- try
- {
- this.dn = new Dn( name );
- }
- catch ( LdapInvalidDnException e )
- {
- // This might still be a valid DN (Windows AD binding for instance)
- LOG.debug( "Unable to convert the name to a DN." );
- this.dn = null;
- }
-
return this;
}
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java Wed May 18 13:19:47 2016
@@ -1501,6 +1501,11 @@ public class Ava implements Externalizab
{
if ( schemaManager != null )
{
+ if ( ( value.getValue() != null ) && value.getValue().equals( instance.value.getValue() ) )
+ {
+ return true;
+ }
+
MatchingRule equalityMatchingRule = attributeType.getEquality();
if ( equalityMatchingRule != null )
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java Wed May 18 13:19:47 2016
@@ -78,7 +78,7 @@ public abstract class AbstractSchemaObje
protected String oid;
/** The optional names for this SchemaObject */
- protected List<String> names;
+ protected transient List<String> names;
/** Whether or not this SchemaObject is enabled */
protected boolean isEnabled = true;
@@ -102,7 +102,7 @@ public abstract class AbstractSchemaObje
protected SchemaObjectType objectType;
/** A map containing the list of supported extensions */
- protected Map<String, List<String>> extensions;
+ protected transient Map<String, List<String>> extensions;
/** A locked to avoid modifications when set to true */
protected volatile boolean locked;
@@ -122,8 +122,8 @@ public abstract class AbstractSchemaObje
{
this.objectType = objectType;
this.oid = oid;
- extensions = new HashMap<String, List<String>>();
- names = new ArrayList<String>();
+ extensions = new HashMap<>();
+ names = new ArrayList<>();
}
@@ -136,8 +136,8 @@ public abstract class AbstractSchemaObje
protected AbstractSchemaObject( SchemaObjectType objectType )
{
this.objectType = objectType;
- extensions = new HashMap<String, List<String>>();
- names = new ArrayList<String>();
+ extensions = new HashMap<>();
+ names = new ArrayList<>();
}
@@ -151,6 +151,7 @@ public abstract class AbstractSchemaObje
* @return an OID for this SchemaObject or its MatchingRule if this
* SchemaObject is a MatchingRuleUse object
*/
+ @Override
public String getOid()
{
return oid;
@@ -162,6 +163,7 @@ public abstract class AbstractSchemaObje
* change it's OID
* @param oid The new OID
*/
+ @Override
public void setOid( String oid )
{
if ( locked )
@@ -179,6 +181,7 @@ public abstract class AbstractSchemaObje
*
* @return the names for this SchemaObject
*/
+ @Override
public List<String> getNames()
{
if ( names != null )
@@ -199,9 +202,10 @@ public abstract class AbstractSchemaObje
* @return the first of the names for this SchemaObject or the oid
* if one does not exist
*/
+ @Override
public String getName()
{
- if ( ( names != null ) && ( names.size() != 0 ) )
+ if ( ( names != null ) && !names.isEmpty() )
{
return names.get( 0 );
}
@@ -218,6 +222,7 @@ public abstract class AbstractSchemaObje
*
* @param namesToAdd The names to add
*/
+ @Override
public void addName( String... namesToAdd )
{
if ( locked )
@@ -228,7 +233,7 @@ public abstract class AbstractSchemaObje
if ( !isReadOnly )
{
// We must avoid duplicated names, as names are case insensitive
- Set<String> lowerNames = new HashSet<String>();
+ Set<String> lowerNames = new HashSet<>();
// Fills a set with all the existing names
for ( String name : this.names )
@@ -259,6 +264,7 @@ public abstract class AbstractSchemaObje
*
* @param names The list of names. Can be empty
*/
+ @Override
public void setNames( List<String> names )
{
if ( locked )
@@ -273,7 +279,7 @@ public abstract class AbstractSchemaObje
if ( !isReadOnly )
{
- this.names = new ArrayList<String>( names.size() );
+ this.names = new ArrayList<>( names.size() );
for ( String name : names )
{
@@ -324,6 +330,7 @@ public abstract class AbstractSchemaObje
*
* @return a short description about this SchemaObject
*/
+ @Override
public String getDescription()
{
return description;
@@ -335,6 +342,7 @@ public abstract class AbstractSchemaObje
*
* @param description The SchemaObject's description
*/
+ @Override
public void setDescription( String description )
{
if ( locked )
@@ -354,6 +362,7 @@ public abstract class AbstractSchemaObje
*
* @return the SchemaObject specification
*/
+ @Override
public String getSpecification()
{
return specification;
@@ -365,6 +374,7 @@ public abstract class AbstractSchemaObje
*
* @param specification The SchemaObject's specification
*/
+ @Override
public void setSpecification( String specification )
{
if ( locked )
@@ -385,6 +395,7 @@ public abstract class AbstractSchemaObje
* @return true if the SchemaObject is enabled, or if it depends on
* an enabled schema
*/
+ @Override
public boolean isEnabled()
{
return isEnabled;
@@ -396,6 +407,7 @@ public abstract class AbstractSchemaObje
*
* @return true if the SchemaObject is disabled
*/
+ @Override
public boolean isDisabled()
{
return !isEnabled;
@@ -407,6 +419,7 @@ public abstract class AbstractSchemaObje
*
* @param enabled The current SchemaObject state
*/
+ @Override
public void setEnabled( boolean enabled )
{
if ( !isReadOnly )
@@ -421,6 +434,7 @@ public abstract class AbstractSchemaObje
*
* @return true if the SchemaObject is not modifiable
*/
+ @Override
public boolean isReadOnly()
{
return isReadOnly;
@@ -432,6 +446,7 @@ public abstract class AbstractSchemaObje
*
* @param readOnly The current SchemaObject ReadOnly status
*/
+ @Override
public void setReadOnly( boolean readOnly )
{
if ( locked )
@@ -451,6 +466,7 @@ public abstract class AbstractSchemaObje
*
* @return true if inactive, false if active
*/
+ @Override
public boolean isObsolete()
{
return isObsolete;
@@ -462,6 +478,7 @@ public abstract class AbstractSchemaObje
*
* @param obsolete The Obsolete flag state
*/
+ @Override
public void setObsolete( boolean obsolete )
{
if ( locked )
@@ -479,6 +496,7 @@ public abstract class AbstractSchemaObje
/**
* {@inheritDoc}
*/
+ @Override
public Map<String, List<String>> getExtensions()
{
return extensions;
@@ -488,6 +506,7 @@ public abstract class AbstractSchemaObje
/**
* {@inheritDoc}
*/
+ @Override
public boolean hasExtension( String extension )
{
return extensions.containsKey( Strings.toUpperCaseAscii( extension ) );
@@ -497,6 +516,7 @@ public abstract class AbstractSchemaObje
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getExtension( String extension )
{
String name = Strings.toUpperCaseAscii( extension );
@@ -523,6 +543,7 @@ public abstract class AbstractSchemaObje
* @param key The extension key
* @param values The associated values
*/
+ @Override
public void addExtension( String key, String... values )
{
if ( locked )
@@ -532,7 +553,7 @@ public abstract class AbstractSchemaObje
if ( !isReadOnly )
{
- List<String> valueList = new ArrayList<String>();
+ List<String> valueList = new ArrayList<>();
for ( String value : values )
{
@@ -549,6 +570,7 @@ public abstract class AbstractSchemaObje
* @param key The extension key
* @param values The associated values
*/
+ @Override
public void addExtension( String key, List<String> values )
{
if ( locked )
@@ -568,6 +590,7 @@ public abstract class AbstractSchemaObje
*
* @param extensions The extensions map
*/
+ @Override
public void setExtensions( Map<String, List<String>> extensions )
{
if ( locked )
@@ -577,11 +600,11 @@ public abstract class AbstractSchemaObje
if ( !isReadOnly && ( extensions != null ) )
{
- this.extensions = new HashMap<String, List<String>>();
+ this.extensions = new HashMap<>();
for ( Map.Entry<String, List<String>> entry : extensions.entrySet() )
{
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
for ( String value : entry.getValue() )
{
@@ -613,6 +636,7 @@ public abstract class AbstractSchemaObje
*
* @return the SchemaObject type
*/
+ @Override
public SchemaObjectType getObjectType()
{
return objectType;
@@ -624,6 +648,7 @@ public abstract class AbstractSchemaObje
*
* @return the name of the schema associated with this schemaObject
*/
+ @Override
public String getSchemaName()
{
return schemaName;
@@ -635,6 +660,7 @@ public abstract class AbstractSchemaObje
*
* @param schemaName the new schema name
*/
+ @Override
public void setSchemaName( String schemaName )
{
if ( locked )
@@ -824,6 +850,7 @@ public abstract class AbstractSchemaObje
*
* @return The copied SchemaObject
*/
+ @Override
public abstract SchemaObject copy();
@@ -850,6 +877,7 @@ public abstract class AbstractSchemaObje
/**
* {@inheritDoc}
*/
+ @Override
public SchemaObject copy( SchemaObject original )
{
// copy the description
@@ -861,7 +889,7 @@ public abstract class AbstractSchemaObje
isReadOnly = original.isReadOnly();
// copy the names
- names = new ArrayList<String>();
+ names = new ArrayList<>();
for ( String name : original.getNames() )
{
@@ -869,13 +897,13 @@ public abstract class AbstractSchemaObje
}
// copy the extensions
- extensions = new HashMap<String, List<String>>();
+ extensions = new HashMap<>();
for ( String key : original.getExtensions().keySet() )
{
List<String> extensionValues = original.getExtension( key );
- List<String> cloneExtension = new ArrayList<String>();
+ List<String> cloneExtension = new ArrayList<>();
for ( String value : extensionValues )
{
@@ -899,6 +927,7 @@ public abstract class AbstractSchemaObje
* Clear the current SchemaObject : remove all the references to other objects,
* and all the Maps.
*/
+ @Override
public void clear()
{
// Clear the extensions
@@ -925,6 +954,7 @@ public abstract class AbstractSchemaObje
/**
* {@inheritDoc}
*/
+ @Override
public final void lock()
{
if ( locked )
@@ -941,7 +971,7 @@ public abstract class AbstractSchemaObje
h += h * 17 + objectType.getValue();
// The Names, if any
- if ( ( names != null ) && ( names.size() != 0 ) )
+ if ( ( names != null ) && !names.isEmpty() )
{
for ( String name : names )
{
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java Wed May 18 13:19:47 2016
@@ -624,6 +624,11 @@ public class AttributeType extends Abstr
*/
public boolean equals( Object o )
{
+ if ( this == o )
+ {
+ return true;
+ }
+
if ( !super.equals( o ) )
{
return false;
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ObjectClass.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ObjectClass.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ObjectClass.java Wed May 18 13:19:47 2016
@@ -76,22 +76,22 @@ public class ObjectClass extends Abstrac
protected ObjectClassTypeEnum objectClassType = ObjectClassTypeEnum.STRUCTURAL;
/** The ObjectClass superior OIDs */
- protected List<String> superiorOids;
+ protected transient List<String> superiorOids;
/** The ObjectClass superiors */
- protected List<ObjectClass> superiors;
+ protected transient List<ObjectClass> superiors;
/** The list of allowed AttributeType OIDs */
- protected List<String> mayAttributeTypeOids;
+ protected transient List<String> mayAttributeTypeOids;
/** The list of allowed AttributeTypes */
- protected List<AttributeType> mayAttributeTypes;
+ protected transient List<AttributeType> mayAttributeTypes;
/** The list of required AttributeType OIDs */
- protected List<String> mustAttributeTypeOids;
+ protected transient List<String> mustAttributeTypeOids;
/** The list of required AttributeTypes */
- protected List<AttributeType> mustAttributeTypes;
+ protected transient List<AttributeType> mustAttributeTypes;
/**
@@ -102,13 +102,13 @@ public class ObjectClass extends Abstrac
{
super( SchemaObjectType.OBJECT_CLASS, oid );
- mayAttributeTypeOids = new ArrayList<String>();
- mustAttributeTypeOids = new ArrayList<String>();
- superiorOids = new ArrayList<String>();
-
- mayAttributeTypes = new ArrayList<AttributeType>();
- mustAttributeTypes = new ArrayList<AttributeType>();
- superiors = new ArrayList<ObjectClass>();
+ mayAttributeTypeOids = new ArrayList<>();
+ mustAttributeTypeOids = new ArrayList<>();
+ superiorOids = new ArrayList<>();
+
+ mayAttributeTypes = new ArrayList<>();
+ mustAttributeTypes = new ArrayList<>();
+ superiors = new ArrayList<>();
objectClassType = ObjectClassTypeEnum.STRUCTURAL;
}
@@ -218,6 +218,7 @@ public class ObjectClass extends Abstrac
/**
* {@inheritDoc}
*/
+ @Override
public String toString()
{
return SchemaObjectRenderer.OPEN_LDAP_SCHEMA_RENDERER.render( this );
@@ -227,6 +228,7 @@ public class ObjectClass extends Abstrac
/**
* Copy an ObjectClass
*/
+ @Override
public ObjectClass copy()
{
ObjectClass copy = new ObjectClass( oid );
@@ -238,7 +240,7 @@ public class ObjectClass extends Abstrac
copy.objectClassType = objectClassType;
// Copy the Superiors ObjectClasses OIDs
- copy.superiorOids = new ArrayList<String>();
+ copy.superiorOids = new ArrayList<>();
for ( String oid : superiorOids )
{
@@ -246,10 +248,10 @@ public class ObjectClass extends Abstrac
}
// Copy the Superiors ObjectClasses ( will be empty )
- copy.superiors = new ArrayList<ObjectClass>();
+ copy.superiors = new ArrayList<>();
// Copy the MAY AttributeTypes OIDs
- copy.mayAttributeTypeOids = new ArrayList<String>();
+ copy.mayAttributeTypeOids = new ArrayList<>();
for ( String oid : mayAttributeTypeOids )
{
@@ -257,10 +259,10 @@ public class ObjectClass extends Abstrac
}
// Copy the MAY AttributeTypes ( will be empty )
- copy.mayAttributeTypes = new ArrayList<AttributeType>();
+ copy.mayAttributeTypes = new ArrayList<>();
// Copy the MUST AttributeTypes OIDs
- copy.mustAttributeTypeOids = new ArrayList<String>();
+ copy.mustAttributeTypeOids = new ArrayList<>();
for ( String oid : mustAttributeTypeOids )
{
@@ -268,7 +270,7 @@ public class ObjectClass extends Abstrac
}
// Copy the MUST AttributeTypes ( will be empty )
- copy.mustAttributeTypes = new ArrayList<AttributeType>();
+ copy.mustAttributeTypes = new ArrayList<>();
return copy;
}
Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/DnSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/DnSyntaxChecker.java?rev=1744407&r1=1744406&r2=1744407&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/DnSyntaxChecker.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/DnSyntaxChecker.java Wed May 18 13:19:47 2016
@@ -55,7 +55,7 @@ public class DnSyntaxChecker extends Syn
*/
public boolean isValidSyntax( Object value )
{
- String strValue = null;
+ String strValue;
if ( value == null )
{